summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CompilerTest
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2022-09-27 18:58:15 (GMT)
committerBrad King <brad.king@kitware.com>2022-09-28 14:27:31 (GMT)
commitf891a75d5cb61909f46fe9b253b1d7b589e7d138 (patch)
tree87ec7dea83b366c1176f23ff253d524bea9974db /Tests/RunCMake/CompilerTest
parent164a156c7c26aaf4f30e73ae0cdb6d2e8a10e0a4 (diff)
downloadCMake-f891a75d5cb61909f46fe9b253b1d7b589e7d138.zip
CMake-f891a75d5cb61909f46fe9b253b1d7b589e7d138.tar.gz
CMake-f891a75d5cb61909f46fe9b253b1d7b589e7d138.tar.bz2
Tests: Test CMakeTest*Compiler.cmake fallbacks
Add tests that explicitly test the fallback tests of the modules which test for a functional [Obj]C[xx] compiler, bypassing the ABI tests. Due to the ABI test short-circuiting added by commit 1d21dd0f7c (enable_language: Assume compiler works if ABI detection compiles, 2020-05-25, v3.18.0-rc1~93^2), this logic is likely not getting tested otherwise.
Diffstat (limited to 'Tests/RunCMake/CompilerTest')
-rw-r--r--Tests/RunCMake/CompilerTest/C-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/C.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CompilerTest/CXX-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/CXX.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/OBJC-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/OBJC.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/OBJCXX-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/OBJCXX.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/RunCMakeTest.cmake9
10 files changed, 32 insertions, 0 deletions
diff --git a/Tests/RunCMake/CompilerTest/C-stdout.txt b/Tests/RunCMake/CompilerTest/C-stdout.txt
new file mode 100644
index 0000000..ce5d80e
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/C-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working C compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/C.cmake b/Tests/RunCMake/CompilerTest/C.cmake
new file mode 100644
index 0000000..8e9d70c
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/C.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_C_ABI_COMPILED FALSE)
+enable_language(C)
diff --git a/Tests/RunCMake/CompilerTest/CMakeLists.txt b/Tests/RunCMake/CompilerTest/CMakeLists.txt
new file mode 100644
index 0000000..aba1016
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.24)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CompilerTest/CXX-stdout.txt b/Tests/RunCMake/CompilerTest/CXX-stdout.txt
new file mode 100644
index 0000000..513fd85
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/CXX-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working CXX compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/CXX.cmake b/Tests/RunCMake/CompilerTest/CXX.cmake
new file mode 100644
index 0000000..e17cc9d
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/CXX.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_CXX_ABI_COMPILED FALSE)
+enable_language(CXX)
diff --git a/Tests/RunCMake/CompilerTest/OBJC-stdout.txt b/Tests/RunCMake/CompilerTest/OBJC-stdout.txt
new file mode 100644
index 0000000..23f5120
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/OBJC-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working OBJC compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/OBJC.cmake b/Tests/RunCMake/CompilerTest/OBJC.cmake
new file mode 100644
index 0000000..5ec842c
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/OBJC.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_OBJC_ABI_COMPILED FALSE)
+enable_language(OBJC)
diff --git a/Tests/RunCMake/CompilerTest/OBJCXX-stdout.txt b/Tests/RunCMake/CompilerTest/OBJCXX-stdout.txt
new file mode 100644
index 0000000..8291904
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/OBJCXX-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working OBJCXX compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/OBJCXX.cmake b/Tests/RunCMake/CompilerTest/OBJCXX.cmake
new file mode 100644
index 0000000..49df0aa
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/OBJCXX.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_OBJCXX_ABI_COMPILED FALSE)
+enable_language(OBJCXX)
diff --git a/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake
new file mode 100644
index 0000000..995296a
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+run_cmake(C)
+run_cmake(CXX)
+
+if(CMake_TEST_OBJC)
+ run_cmake(OBJC)
+ run_cmake(OBJCXX)
+endif()