summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-10-20 16:07:59 (GMT)
committerBrad King <brad.king@kitware.com>2021-10-20 17:00:25 (GMT)
commit42418b02f769858d68ce21a58dab3025d30f31a2 (patch)
tree30d20049be4391600dc9d4b7ec22780456f450be /Modules
parent44a86d0b3890848e2df702dc87d625a19216641e (diff)
downloadCMake-42418b02f769858d68ce21a58dab3025d30f31a2.zip
CMake-42418b02f769858d68ce21a58dab3025d30f31a2.tar.gz
CMake-42418b02f769858d68ce21a58dab3025d30f31a2.tar.bz2
Android: Refactor sysroot detection under Visual Studio
Since commit 6051a49c78 (Visual Studio: Add Android support, 2020-06-12, v3.19.0-rc1~619^2) we run MSBuild to build a sample project to detect the sysroot. Previously we relied on `CMAKE_VS_MSBUILD_COMMAND` being available. That required commit d5b5c19278 (cmGlobalGenerator: FindMakeProgram() before CMakeDetermineSystem, 2020-06-15, v3.19.0-rc1~619^2~3) to make it available early enough. However, that ordering broke `CMAKE_GENERATOR_INSTANCE` so we need to prepare to revert it. Use `cmake_host_system_information` to get the location of MSBuild under a VS generator instead.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Platform/Android-Determine.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
index 7b67f83..a4e9574 100644
--- a/Modules/Platform/Android-Determine.cmake
+++ b/Modules/Platform/Android-Determine.cmake
@@ -52,14 +52,16 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio")
endif()
configure_file(${CMAKE_ROOT}/Modules/Platform/Android/VCXProjInspect.vcxproj.in
${CMAKE_PLATFORM_INFO_DIR}/VCXProjInspect.vcxproj @ONLY)
+ cmake_host_system_information(RESULT _msbuild QUERY VS_MSBUILD_COMMAND) # undocumented query
execute_process(
- COMMAND "${CMAKE_VS_MSBUILD_COMMAND}" "VCXProjInspect.vcxproj"
+ COMMAND "${_msbuild}" "VCXProjInspect.vcxproj"
"/p:Configuration=Debug" "/p:Platform=${vcx_platform}"
WORKING_DIRECTORY ${CMAKE_PLATFORM_INFO_DIR}
OUTPUT_VARIABLE VCXPROJ_INSPECT_OUTPUT
ERROR_VARIABLE VCXPROJ_INSPECT_OUTPUT
RESULT_VARIABLE VCXPROJ_INSPECT_RESULT
)
+ unset(_msbuild)
if(NOT CMAKE_SYSROOT AND VCXPROJ_INSPECT_OUTPUT MATCHES "CMAKE_SYSROOT=([^%\r\n]+)[\r\n]")
# Strip VS diagnostic output from the end of the line.
string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _sysroot "${CMAKE_MATCH_1}")