Tests: Provide Apple inspection results to CMakeOnly and RunCMake tests

Re-order logic to make `CMake_TEST_XCODE_VERSION` and friends available
to the `Tests/CMakeOnly` and `Tests/RunCMake` directories.
This commit is contained in:
Brad King
2022-10-21 10:31:04 -04:00
parent 7629a1182c
commit f78ad6223a

View File

@@ -271,14 +271,6 @@ if(BUILD_TESTING)
find_package(Qt5Widgets QUIET NO_MODULE)
endif()
if(NOT CMake_TEST_EXTERNAL_CMAKE)
add_subdirectory(CMakeLib)
endif()
add_subdirectory(CMakeOnly)
add_subdirectory(RunCMake)
add_subdirectory(FindPackageModeMakefileTest)
# Collect a list of all test build directories.
set(TEST_BUILD_DIRS)
@@ -342,6 +334,16 @@ if(BUILD_TESTING)
endif()
endif()
if(CMake_TEST_XCODE_VERSION AND CMAKE_OSX_SDKVERSION AND CMAKE_OSX_SDKPRODUCT)
if((NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1) AND
((NOT CMAKE_OSX_SDKPRODUCT STREQUAL "Mac OS X") OR
(NOT CMAKE_OSX_SDKVERSION VERSION_LESS 10.10)))
if(CMAKE_GENERATOR STREQUAL "Xcode")
set(CMake_TEST_XCODE_SWIFT 1)
endif()
endif()
endif()
# Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value,
# whichever is greater.
set(CMAKE_LONG_TEST_TIMEOUT 1500)
@@ -352,6 +354,14 @@ if(BUILD_TESTING)
set(CMAKE_LONG_TEST_TIMEOUT 1500)
endif()
if(NOT CMake_TEST_EXTERNAL_CMAKE)
add_subdirectory(CMakeLib)
endif()
add_subdirectory(CMakeOnly)
add_subdirectory(RunCMake)
add_subdirectory(FindPackageModeMakefileTest)
add_test(NAME CMake.Copyright
COMMAND ${CMAKE_CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCopyright.cmake)
@@ -380,15 +390,6 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(MissingSourceFile MissingSourceFile)
set_tests_properties(MissingSourceFile PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c")
if(CMake_TEST_XCODE_VERSION AND CMAKE_OSX_SDKVERSION AND CMAKE_OSX_SDKPRODUCT)
if((NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1) AND
((NOT CMAKE_OSX_SDKPRODUCT STREQUAL "Mac OS X") OR
(NOT CMAKE_OSX_SDKVERSION VERSION_LESS 10.10)))
if(CMAKE_GENERATOR STREQUAL "Xcode")
set(CMake_TEST_XCODE_SWIFT 1)
endif()
endif()
endif()
if(CMAKE_Swift_COMPILER OR CMake_TEST_XCODE_SWIFT)
ADD_TEST_MACRO(SwiftOnly SwiftOnly)
if(CMake_TEST_XCODE_SWIFT)