summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-04-26 14:28:29 +0000
committerKitware Robot <kwrobot@kitware.com>2023-04-26 10:28:38 -0400
commitd5d06ec444db38e535c7da303b36af6204fd734f (patch)
treec4f0770d2c6fa1eee40a004572b4acb68cb12543
parentaf53934df746ee4e88f2ff2de0d4773cd8b27945 (diff)
parent16d8b65bc0efda22be8d9466cff2486cf5eada2a (diff)
downloadcmake-d5d06ec444db38e535c7da303b36af6204fd734f.tar.gz
Merge topic 'vs2022-android'
16d8b65bc0 VS/Android: Use safe API level when detecting the NDK directory f7af10100c VS/Android: Detect full NDK root instead of sysroot 850ee280e0 VS/Android: Set API level explicitly during compiler identification 5d5b6c741d VS/Android: Do not specify Windows Runtime library type during compiler id e78abf94e3 VS/Android: Use ApplicationTypeRevision 3.0 in VS2022 Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8426
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake4
-rw-r--r--Modules/CompilerId/VS-10.vcxproj.in3
-rw-r--r--Modules/Platform/Android-Determine.cmake23
-rw-r--r--Modules/Platform/Android/VCXProjInspect.vcxproj.in3
4 files changed, 16 insertions, 17 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 67044fb3b2..403766e561 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -345,6 +345,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_platform ${CMAKE_VS_PLATFORM_NAME})
set(id_lang "${lang}")
set(id_PostBuildEvent_Command "")
+ set(id_api_level "")
if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Ll][Ll][Vv][Mm](_v[0-9]+(_xp)?)?$")
set(id_cl_var "ClangClExecutable")
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Cc][Ll][Aa][Nn][Gg]([Cc][Ll]$|_[0-9])")
@@ -430,9 +431,10 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_system "")
endif()
if(id_keyword STREQUAL "Android")
+ set(id_api_level "<AndroidAPILevel>android-${CMAKE_SYSTEM_VERSION}</AndroidAPILevel>")
if(CMAKE_GENERATOR MATCHES "Visual Studio 14")
set(id_system_version "<ApplicationTypeRevision>2.0</ApplicationTypeRevision>")
- elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[56]")
+ elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[567]")
set(id_system_version "<ApplicationTypeRevision>3.0</ApplicationTypeRevision>")
else()
set(id_system_version "")
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 3598fc7e20..fa324d8214 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -26,6 +26,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
<ConfigurationType>@id_config_type@</ConfigurationType>
@id_toolset@
+ @id_api_level@
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -44,7 +45,7 @@
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <RuntimeLibrary Condition="'$(ApplicationType)'!='Android'">MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
index 715f68bb4e..bc60222476 100644
--- a/Modules/Platform/Android-Determine.cmake
+++ b/Modules/Platform/Android-Determine.cmake
@@ -34,18 +34,13 @@ cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
# If using Android tools for Visual Studio, compile a sample project to get the
-# sysroot.
+# NDK path
if(CMAKE_GENERATOR MATCHES "Visual Studio")
- if(NOT CMAKE_SYSROOT)
+ if(NOT CMAKE_ANDROID_NDK)
set(vcx_platform ${CMAKE_GENERATOR_PLATFORM})
- if(CMAKE_GENERATOR MATCHES "Visual Studio 1[45]")
- set(vcx_sysroot_var "Sysroot")
- else()
- set(vcx_sysroot_var "SysrootLink")
- endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio 14")
set(vcx_revision "2.0")
- elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[56]")
+ elseif(CMAKE_GENERATOR MATCHES "Visual Studio 1[567]")
set(vcx_revision "3.0")
else()
set(vcx_revision "")
@@ -62,16 +57,16 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio")
RESULT_VARIABLE VCXPROJ_INSPECT_RESULT
)
unset(_msbuild)
- if(NOT CMAKE_SYSROOT AND VCXPROJ_INSPECT_OUTPUT MATCHES "CMAKE_SYSROOT=([^%\r\n]+)[\r\n]")
+ if(VCXPROJ_INSPECT_OUTPUT MATCHES "CMAKE_ANDROID_NDK=([^%\r\n]+)[\r\n]")
# Strip VS diagnostic output from the end of the line.
- string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _sysroot "${CMAKE_MATCH_1}")
- if(EXISTS "${_sysroot}")
- file(TO_CMAKE_PATH "${_sysroot}" CMAKE_SYSROOT)
+ string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _ndk "${CMAKE_MATCH_1}")
+ if(EXISTS "${_ndk}")
+ file(TO_CMAKE_PATH "${_ndk}" CMAKE_ANDROID_NDK)
endif()
endif()
if(VCXPROJ_INSPECT_RESULT)
message(CONFIGURE_LOG
- "Determining the sysroot for the Android NDK failed.
+ "Determining the Android NDK failed from msbuild failed.
The output was:
${VCXPROJ_INSPECT_RESULT}
${VCXPROJ_INSPECT_OUTPUT}
@@ -79,7 +74,7 @@ ${VCXPROJ_INSPECT_OUTPUT}
")
else()
message(CONFIGURE_LOG
- "Determining the sysroot for the Android NDK succeeded.
+ "Determining the Android NDK succeeded.
The output was:
${VCXPROJ_INSPECT_RESULT}
${VCXPROJ_INSPECT_OUTPUT}
diff --git a/Modules/Platform/Android/VCXProjInspect.vcxproj.in b/Modules/Platform/Android/VCXProjInspect.vcxproj.in
index 6919d2cd85..f87d59bca2 100644
--- a/Modules/Platform/Android/VCXProjInspect.vcxproj.in
+++ b/Modules/Platform/Android/VCXProjInspect.vcxproj.in
@@ -19,6 +19,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@vcx_platform@'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
+ <AndroidAPILevel>android-21</AndroidAPILevel>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -29,7 +30,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@vcx_platform@'">
<PostBuildEvent>
- <Command>%40echo CMAKE_SYSROOT=$(@vcx_sysroot_var@)</Command>
+ <Command>%40echo CMAKE_ANDROID_NDK=$(VS_NdkRoot)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />