diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 48 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/Inspect.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/RunCMakeTest.cmake | 6 |
3 files changed, 13 insertions, 48 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 58c1bc8..6bf8f3f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -502,58 +502,10 @@ if(APPLE) endif() function(add_RunCMake_test_try_compile) - if(CMAKE_VERSION VERSION_LESS 3.9.20170907 AND "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") - # Older CMake versions do not know about MSVC language standards. - # Approximate our logic from MSVC-CXX.cmake. - if ((NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.24215.1 AND - CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) OR - NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10.25017) - set(CMAKE_CXX_STANDARD_DEFAULT 14) - elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0) - set(CMAKE_CXX_STANDARD_DEFAULT "") - else() - unset(CMAKE_CXX_STANDARD_DEFAULT) - endif() - endif() - if(CMAKE_VERSION VERSION_LESS 3.18.20200813 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC") - # Older CMake versions do not know about MSVC language standards. - # Approximate our logic from MSVC-C.cmake. - if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.27) - set(CMAKE_C_STANDARD_DEFAULT 99) - else() - set(CMAKE_C_STANDARD_DEFAULT "") - endif() - endif() - if(CMAKE_VERSION VERSION_LESS 3.20.20210225 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang") - # Older CMake versions do not know about Clang MSVC compatibility mode - # standards. Approximate the logic from Clang-C.cmake. - if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0) - set(CMAKE_C_STANDARD_DEFAULT 17) - elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.5.2) - set(CMAKE_C_STANDARD_DEFAULT 11) - endif() - endif() - if(CMAKE_VERSION VERSION_LESS 3.20.6 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xIntelLLVM" AND "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") - # Older CMake versions accidentally set the default standards to empty when - # IntelLLVM targets the MSVC ABI, thus not activating standard selection. - # Approximate the logic from IntelLLVM-{C,CXX}.cmake. - if(DEFINED CMAKE_C_STANDARD_DEFAULT AND "${CMAKE_C_STANDARD_DEFAULT}" STREQUAL "") - set(CMAKE_C_STANDARD_DEFAULT 17) - endif() - if(DEFINED CMAKE_CXX_STANDARD_DEFAULT AND "${CMAKE_CXX_STANDARD_DEFAULT}" STREQUAL "") - set(CMAKE_CXX_STANDARD_DEFAULT 14) - endif() - endif() foreach( var IN ITEMS CMAKE_SYSTEM_NAME - 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_TEST_CUDA CMake_TEST_ISPC CMake_TEST_HIP 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 |