summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-31 16:43:48 (GMT)
committerBrad King <brad.king@kitware.com>2022-10-31 16:43:48 (GMT)
commitb641a80d55ccde59d8e5c25c63b44df5ee0d999c (patch)
tree58fc0f683367ac491fe148199c31225e247c1a9c /Tests
parent46c1693602fa7ae8d1cd332228dad10ea98a6877 (diff)
downloadCMake-b641a80d55ccde59d8e5c25c63b44df5ee0d999c.zip
CMake-b641a80d55ccde59d8e5c25c63b44df5ee0d999c.tar.gz
CMake-b641a80d55ccde59d8e5c25c63b44df5ee0d999c.tar.bz2
Tests: Factor out a CMake_TEST_OBJC variable for OBJC/OBJCXX test conditions
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt14
-rw-r--r--Tests/RunCMake/CMakeLists.txt12
2 files changed, 17 insertions, 9 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 850e743..112455b 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -349,6 +349,12 @@ if(BUILD_TESTING)
endif()
endif()
+ if(NOT DEFINED CMake_TEST_OBJC)
+ if(APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
+ set(CMake_TEST_OBJC 1)
+ endif()
+ endif()
+
# Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value,
# whichever is greater.
set(CMAKE_LONG_TEST_TIMEOUT 1500)
@@ -438,6 +444,11 @@ if(BUILD_TESTING)
endif()
endif()
+ if(CMake_TEST_OBJC)
+ add_subdirectory(ObjC)
+ add_subdirectory(ObjCXX)
+ endif()
+
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
ADD_TEST_MACRO(CSharpOnly CSharpOnly)
if(NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
@@ -2506,9 +2517,6 @@ if(BUILD_TESTING)
-Dgen=${CMAKE_GENERATOR}
-P ${CMake_SOURCE_DIR}/Tests/CFBundleTest/VerifyResult.cmake)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CFBundleTest")
-
- add_subdirectory(ObjC)
- add_subdirectory(ObjCXX)
endif()
endif()
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 280a21a..88dbe25 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -299,8 +299,8 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
add_RunCMake_test(CompilerChange)
endif()
add_RunCMake_test(CompilerNotFound)
-if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
- list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=1)
+if(DEFINED CMake_TEST_OBJC)
+ list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=${CMake_TEST_OBJC})
endif()
if(CMAKE_Fortran_COMPILER)
list(APPEND CompilerTest_ARGS -DCMake_TEST_Fortran=1)
@@ -897,13 +897,13 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
if(DEFINED CMake_TEST_ISPC)
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_ISPC=${CMake_TEST_ISPC})
endif()
+ if(DEFINED CMake_TEST_OBJC)
+ list(APPEND CompilerLauncher_ARGS -DCMake_TEST_OBJC=${CMake_TEST_OBJC})
+ list(APPEND LinkerLauncher_ARGS -DCMake_TEST_OBJC=${CMake_TEST_OBJC})
+ endif()
if(CMAKE_Fortran_COMPILER)
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1)
endif()
- if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
- list(APPEND CompilerLauncher_ARGS -DCMake_TEST_OBJC=1)
- list(APPEND LinkerLauncher_ARGS -DCMake_TEST_OBJC=1)
- endif()
add_RunCMake_test(CompilerLauncher)
set_property(TEST RunCMake.CompilerLauncher APPEND
PROPERTY LABELS "CUDA;HIP;ISPC")