Tests: Compute Xcode version for any generator on OS X
Store the version in CMake_TEST_XCODE_VERSION for use by tests that work with any generator on OS X but may depend on the Xcode version providing the tools.
This commit is contained in:
parent
380db3de00
commit
54a5cdbb4c
|
@ -172,6 +172,7 @@ if(BUILD_TESTING)
|
|||
ON)
|
||||
mark_as_advanced(CTEST_TEST_CPACK)
|
||||
set(CTEST_TEST_OSX_ARCH 0)
|
||||
set(CMake_TEST_XCODE_VERSION 0)
|
||||
if(APPLE)
|
||||
execute_process(
|
||||
COMMAND sw_vers -productVersion
|
||||
|
@ -185,6 +186,17 @@ if(BUILD_TESTING)
|
|||
else()
|
||||
set(CTEST_TEST_OSX_ARCH 1)
|
||||
endif()
|
||||
if(XCODE_VERSION)
|
||||
set(CMake_TEST_XCODE_VERSION "${XCODE_VERSION}")
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND xcodebuild -version
|
||||
OUTPUT_VARIABLE _version ERROR_VARIABLE _version
|
||||
)
|
||||
if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)")
|
||||
set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value,
|
||||
|
|
Loading…
Reference in New Issue