diff options
author | Brad King <brad.king@kitware.com> | 2019-07-23 12:50:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-07-24 11:40:30 (GMT) |
commit | d50b31be35ed113a41f3944179f8e4a362018f86 (patch) | |
tree | 93abab5e9a413b0691b056ba23c33f7399d221ac /Tests/Plugin | |
parent | 79bcf4e1655ffa38e8f4740b19ec3a14ac567eec (diff) | |
download | CMake-d50b31be35ed113a41f3944179f8e4a362018f86.zip CMake-d50b31be35ed113a41f3944179f8e4a362018f86.tar.gz CMake-d50b31be35ed113a41f3944179f8e4a362018f86.tar.bz2 |
Clang: For MSVC ABI do not use modes older than C++14
Since commit d44c0db0b2 (clang: setup correct configuration in gnu mode,
2019-02-20, v3.15.0-rc1~41^2~5) we support the GNU-like Clang that
targets the MSVC ABI. However, Clang cannot compile with the MSVC
standard library unless it runs in a mode aware of C++14 (since MSVC
itself does not even have a lower mode). When `CMAKE_CXX_STANDARD` is
set to 98 or 11, use C++14 anyway.
Since Clang's default mode is aware of C++14, another option is to not
add any flags for 98 or 11. However, if a future Clang version ever
defaults to a higher C++ standard, setting the standard to 98 or 11
should at least not use a mode higher than 14.
Also revert test updates from commit 4819ff9647 (Tests: fix failures
with gnu mode clang on windows, 2019-03-21, v3.15.0-rc1~41^2~3) that
were meant to work around the standard selection problem.
Fixes: #19496
Diffstat (limited to 'Tests/Plugin')
-rw-r--r-- | Tests/Plugin/CMakeLists.txt | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt index c4540db..8e8fa07 100644 --- a/Tests/Plugin/CMakeLists.txt +++ b/Tests/Plugin/CMakeLists.txt @@ -5,17 +5,6 @@ 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) @@ -40,6 +29,12 @@ 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 |