diff options
author | Michael Karcher <kitware@mkarcher.dialup.fu-berlin.de> | 2023-04-21 16:00:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-04-25 17:47:17 (GMT) |
commit | 850ee280e0bb726771ea14f247ba1524b0c3dd64 (patch) | |
tree | 997e8cdf32d78c28dcd897ef5b727df372c0f2e8 | |
parent | 5d5b6c741da414d7d62ac9681604cc95a1275c51 (diff) | |
download | CMake-850ee280e0bb726771ea14f247ba1524b0c3dd64.zip CMake-850ee280e0bb726771ea14f247ba1524b0c3dd64.tar.gz CMake-850ee280e0bb726771ea14f247ba1524b0c3dd64.tar.bz2 |
VS/Android: Set API level explicitly during compiler identification
VS2022 defaults to API 31 in 64-bit builds. This breaks if you combine
VS2022 with an older Android NDK.
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 2 | ||||
-rw-r--r-- | Modules/CompilerId/VS-10.vcxproj.in | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index c724008..403766e 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,6 +431,7 @@ 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[567]") diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in index 9bd618c..fa324d8 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" /> |