summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/try_compile
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-31 17:02:55 (GMT)
committerBrad King <brad.king@kitware.com>2022-10-31 17:04:28 (GMT)
commitbb2370842f5d3919db1b755f94288dfffe28d39f (patch)
treee0b60a6254cef8dcc560d6dccfccb5be4118d75c /Tests/RunCMake/try_compile
parent1abcb094a7172bfadd5fde90b4c6c19f5527a818 (diff)
downloadCMake-bb2370842f5d3919db1b755f94288dfffe28d39f.zip
CMake-bb2370842f5d3919db1b755f94288dfffe28d39f.tar.gz
CMake-bb2370842f5d3919db1b755f94288dfffe28d39f.tar.bz2
Tests: Simplify RunCMake.try_compile compiler inspection
Detect the compiler id, version, and default standard level in the test's inspection step rather than passing it all in from the host CMake build's results. This avoids repeating details not known to older versions of CMake, and shortens the code.
Diffstat (limited to 'Tests/RunCMake/try_compile')
-rw-r--r--Tests/RunCMake/try_compile/Inspect.cmake7
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake6
2 files changed, 13 insertions, 0 deletions
diff --git a/Tests/RunCMake/try_compile/Inspect.cmake b/Tests/RunCMake/try_compile/Inspect.cmake
index bfca882..2977d02 100644
--- a/Tests/RunCMake/try_compile/Inspect.cmake
+++ b/Tests/RunCMake/try_compile/Inspect.cmake
@@ -1,3 +1,4 @@
+enable_language(C)
enable_language(CXX)
if(CMake_TEST_OBJC)
enable_language(OBJC)
@@ -6,6 +7,12 @@ endif()
set(info "")
foreach(var
+ CMAKE_C_COMPILER_ID
+ CMAKE_C_COMPILER_VERSION
+ CMAKE_C_STANDARD_DEFAULT
+ CMAKE_CXX_COMPILER_ID
+ CMAKE_CXX_COMPILER_VERSION
+ CMAKE_CXX_STANDARD_DEFAULT
CMAKE_CXX_EXTENSIONS_DEFAULT
CMAKE_OBJC_STANDARD_DEFAULT
CMAKE_OBJCXX_STANDARD_DEFAULT
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index d02a391..ad1cc29 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -1,6 +1,12 @@
include(RunCMake)
# Detect information from the toolchain:
+# - CMAKE_C_COMPILER_ID
+# - CMAKE_C_COMPILER_VERSION
+# - CMAKE_C_STANDARD_DEFAULT
+# - CMAKE_CXX_COMPILER_ID
+# - CMAKE_CXX_COMPILER_VERSION
+# - CMAKE_CXX_STANDARD_DEFAULT
# - CMAKE_CXX_EXTENSIONS_DEFAULT
# - CMAKE_OBJC_STANDARD_DEFAULT
# - CMAKE_OBJCXX_STANDARD_DEFAULT