diff options
-rw-r--r-- | Tests/AliasTarget/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/COnly/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/Complex/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/ComplexOneConfig/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/EnforceConfig.cmake.in | 7 | ||||
-rw-r--r-- | Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/Plugin/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/RunCMake/GenerateExportHeader/GEH.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/greeting.c | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/greeting2.c | 1 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/LinkOptions.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/try_run/LinkOptions.cmake | 4 |
12 files changed, 45 insertions, 12 deletions
diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index fc70135..6271988 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD 98) # Clang/C2 in C++98 mode cannot properly handle some of MSVC headers if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") - set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD 14) endif() add_library(foo SHARED empty.cpp) diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt index b3cc438..3037f13 100644 --- a/Tests/COnly/CMakeLists.txt +++ b/Tests/COnly/CMakeLists.txt @@ -7,7 +7,7 @@ add_library(testc1 STATIC libc1.c) add_library(testc2 SHARED libc2.c) add_executable (COnly conly.c foo.c foo.h) target_link_libraries(COnly testc1 testc2) -if(MSVC_VERSION) +if(MSVC_VERSION AND NOT CMAKE_C_COMPILER_ID STREQUAL Clang OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") set_target_properties(COnly PROPERTIES LINK_FLAGS " /NODEFAULTLIB:\"libcdg.lib\" /NODEFAULTLIB:\"libcmtg.lib\" /NODEFAULTLIB:\"foomsvcrt.lib\" /NODEFAULTLIB:\"libbar.lib\" /NODEFAULTLIB:\"libfooba.lib\"") endif() diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 2e41754..fef83f6 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -446,6 +446,11 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND set(CMAKE_CXX_STANDARD 11) endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") + set(CMAKE_CXX_STANDARD 14) +endif() + # # Create the libs and the main exe # diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index 628cd4e..77baa4c 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -403,6 +403,11 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND set(CMAKE_CXX_STANDARD 11) endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") + set(CMAKE_CXX_STANDARD 14) +endif() + # # Create the libs and the main exe # diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in index 8c0817c..b8a6860 100644 --- a/Tests/EnforceConfig.cmake.in +++ b/Tests/EnforceConfig.cmake.in @@ -18,7 +18,12 @@ if(NOT CTEST_CONFIGURATION_TYPE) endif() endforeach() if(NOT CTEST_CONFIGURATION_TYPE) - set(CTEST_CONFIGURATION_TYPE NoConfig) + if("@CMAKE_C_COMPILER_ID@;@CMAKE_C_SIMULATE_ID@;@CMAKE_C_COMPILER_FRONTEND_VARIANT@" STREQUAL "Clang;MSVC;GNU") + # A valid configuration is required for this compiler in tests that do not set CMP0091 to NEW. + set(CTEST_CONFIGURATION_TYPE Debug) + else() + set(CTEST_CONFIGURATION_TYPE NoConfig) + endif() endif() message("Guessing configuration ${CTEST_CONFIGURATION_TYPE}") endif() diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index cffef5a..b30928d 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -133,7 +133,9 @@ endif() # for msvc the compiler version determines which c++11 features are available. if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" - OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")) + OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" + AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" + AND "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" )) if(";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;") list(APPEND true_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS) list(APPEND true_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES) diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt index 8e8fa07..c4540db 100644 --- a/Tests/Plugin/CMakeLists.txt +++ b/Tests/Plugin/CMakeLists.txt @@ -5,6 +5,17 @@ project(Plugin) # We need proper C++98 support from the compiler set(CMAKE_CXX_STANDARD 98) +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") + set(CMAKE_CXX_STANDARD 14) +endif() + # Test per-target output directory properties. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/plugin) @@ -29,12 +40,6 @@ include_directories( ${Plugin_SOURCE_DIR}/include ) -# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers -if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND - CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") - set(CMAKE_CXX_STANDARD 11) -endif() - # Create an executable that exports an API for use by plugins. add_executable(example_exe src/example_exe.cxx) set_target_properties(example_exe PROPERTIES diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake index ae9a84c..b3f1c7f 100644 --- a/Tests/RunCMake/GenerateExportHeader/GEH.cmake +++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake @@ -51,6 +51,11 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND set(CMAKE_CXX_STANDARD 11) endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") + set(CMAKE_CXX_STANDARD 14) +endif() + add_subdirectory(lib_shared_and_static) if(CMAKE_SYSTEM_NAME MATCHES "AIX" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" diff --git a/Tests/RunCMake/Ninja/greeting.c b/Tests/RunCMake/Ninja/greeting.c index ba3e55b..1124d14 100644 --- a/Tests/RunCMake/Ninja/greeting.c +++ b/Tests/RunCMake/Ninja/greeting.c @@ -6,4 +6,5 @@ __declspec(dllexport) void greeting(void) { printf("Hello world!\n"); + fflush(stdout); } diff --git a/Tests/RunCMake/Ninja/greeting2.c b/Tests/RunCMake/Ninja/greeting2.c index c6ed87d..cc8409c 100644 --- a/Tests/RunCMake/Ninja/greeting2.c +++ b/Tests/RunCMake/Ninja/greeting2.c @@ -3,4 +3,5 @@ void greeting2(void) { printf("Hello world 2!\n"); + fflush(stdout); } diff --git a/Tests/RunCMake/try_compile/LinkOptions.cmake b/Tests/RunCMake/try_compile/LinkOptions.cmake index 488cab1..7fae35c 100644 --- a/Tests/RunCMake/try_compile/LinkOptions.cmake +++ b/Tests/RunCMake/try_compile/LinkOptions.cmake @@ -5,7 +5,9 @@ cmake_policy(SET CMP0054 NEW) set (lib_name "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}lib${CMAKE_STATIC_LIBRARY_SUFFIX}") if (CMAKE_SYSTEM_NAME STREQUAL "Windows") - if (RunCMake_C_COMPILER_ID STREQUAL "MSVC" OR "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") + if (RunCMake_C_COMPILER_ID STREQUAL "MSVC" + OR ("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" AND + NOT CMAKE_C_COMPILER_ID STREQUAL "Clang" OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")) if (CMAKE_SIZEOF_VOID_P EQUAL 4) set (undef_flag /INCLUDE:_func) else() diff --git a/Tests/RunCMake/try_run/LinkOptions.cmake b/Tests/RunCMake/try_run/LinkOptions.cmake index 9939a42..b9a87f3 100644 --- a/Tests/RunCMake/try_run/LinkOptions.cmake +++ b/Tests/RunCMake/try_run/LinkOptions.cmake @@ -5,7 +5,9 @@ cmake_policy(SET CMP0054 NEW) set (lib_name "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}lib${CMAKE_STATIC_LIBRARY_SUFFIX}") if (CMAKE_SYSTEM_NAME STREQUAL "Windows") - if (RunCMake_C_COMPILER_ID STREQUAL "MSVC" OR "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") + if (RunCMake_C_COMPILER_ID STREQUAL "MSVC" + OR ("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" AND + NOT CMAKE_C_COMPILER_ID STREQUAL "Clang" OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")) if (CMAKE_SIZEOF_VOID_P EQUAL 4) set (undef_flag /INCLUDE:_func) else() |