diff options
Diffstat (limited to 'Tests/CMakeOnly')
-rw-r--r-- | Tests/CMakeOnly/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/CMakeOnly/CheckOBJCCompilerFlag/CMakeLists.txt | 18 | ||||
-rw-r--r-- | Tests/CMakeOnly/CheckOBJCXXCompilerFlag/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake | 9 |
5 files changed, 28 insertions, 31 deletions
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 03babd2..361cf5f 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -31,12 +31,9 @@ add_CMakeOnly_test(CheckStructHasMember) add_CMakeOnly_test(CompilerIdC) add_CMakeOnly_test(CompilerIdCXX) -if(CMAKE_OBJC_COMPILER) +if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") add_CMakeOnly_test(CompilerIdOBJC) add_CMakeOnly_test(CheckOBJCCompilerFlag) -endif() - -if(CMAKE_OBJCXX_COMPILER) add_CMakeOnly_test(CompilerIdOBJCXX) add_CMakeOnly_test(CheckOBJCXXCompilerFlag) endif() @@ -75,6 +72,12 @@ add_test(CMakeOnly.ProjectIncludeAny ${CMAKE_CMAKE_COMMAND} add_test(CMakeOnly.ProjectIncludeBefore ${CMAKE_CMAKE_COMMAND} -DTEST=ProjectIncludeBefore + -DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE_BEFORE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectIncludeBefore/include.cmake + -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake + ) + +add_test(CMakeOnly.ProjectIncludeBeforeAny ${CMAKE_CMAKE_COMMAND} + -DTEST=ProjectIncludeBeforeAny -DCMAKE_ARGS=-DCMAKE_PROJECT_INCLUDE_BEFORE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectIncludeBefore/include.cmake -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake ) diff --git a/Tests/CMakeOnly/CheckOBJCCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckOBJCCompilerFlag/CMakeLists.txt index a9a96ee..a714b73 100644 --- a/Tests/CMakeOnly/CheckOBJCCompilerFlag/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckOBJCCompilerFlag/CMakeLists.txt @@ -1,17 +1,7 @@ -cmake_minimum_required(VERSION 2.8.12) - -project(CheckOBJCCompilerFlag) - +cmake_minimum_required(VERSION 3.16) +project(CheckOBJCCompilerFlag OBJC) include(CheckOBJCCompilerFlag) - -if(CMAKE_COMPILER_IS_GNUOBJC) - set(COMPILER_FLAG -fobjc-direct-dispatch) -else() - set(COMPILER_FLAG -fobjc-gc) -endif() - -CHECK_OBJC_COMPILER_FLAGS(${COMPILER_FLAG} HAS_COMPILER_FLAG) - +check_objc_compiler_flag(-DFOO HAS_COMPILER_FLAG) if(NOT HAS_COMPILER_FLAG) message(SEND_ERROR "Test fail: HAS_COMPILER_FLAG: ${COMPILER_FLAG}") -endif +endif() diff --git a/Tests/CMakeOnly/CheckOBJCXXCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckOBJCXXCompilerFlag/CMakeLists.txt index f83b738..d09f0b9 100644 --- a/Tests/CMakeOnly/CheckOBJCXXCompilerFlag/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckOBJCXXCompilerFlag/CMakeLists.txt @@ -1,17 +1,7 @@ -cmake_minimum_required(VERSION 2.8.12) - -project(CheckOBJCXXCompilerFlag) - +cmake_minimum_required(VERSION 3.16) +project(CheckOBJCXXCompilerFlag OBJCXX) include(CheckOBJCXXCompilerFlag) - -if(CMAKE_COMPILER_IS_GNUOBJCXX) - set(COMPILER_FLAG -fobjc-direct-dispatch) -else() - set(COMPILER_FLAG -fobjc-gc) -endif() - -CHECK_OBJCXX_COMPILER_FLAGS(${COMPILER_FLAG} HAS_COMPILER_FLAG) - +check_objcxx_compiler_flag(-DFOO HAS_COMPILER_FLAG) if(NOT HAS_COMPILER_FLAG) message(SEND_ERROR "Test fail: HAS_COMPILER_FLAG: ${COMPILER_FLAG}") endif() diff --git a/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt b/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt new file mode 100644 index 0000000..5cd9cba --- /dev/null +++ b/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt @@ -0,0 +1,5 @@ +set(FOO TRUE) +project(ProjectInclude LANGUAGES NONE) +if(NOT AUTO_INCLUDE) + message(FATAL_ERROR "include file not found") +endif() diff --git a/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake b/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake new file mode 100644 index 0000000..0a4799d --- /dev/null +++ b/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake @@ -0,0 +1,9 @@ +if(NOT FOO) + message(FATAL_ERROR "FOO is not set") +endif() + +if(NOT "${PROJECT_NAME}" STREQUAL "") + message(FATAL_ERROR "PROJECT_NAME should be empty") +endif() + +set(AUTO_INCLUDE TRUE) |