diff options
author | Brad King <brad.king@kitware.com> | 2023-03-16 20:40:17 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-03-20 17:13:08 (GMT) |
commit | ffd8537acf4ff938ec87b134f3b72e1a22d1b1d3 (patch) | |
tree | 71c0ea989cebe90fe0366748ac129d269e000117 /Modules | |
parent | 60132272302f106c996aa15a0c42cb3de9789a24 (diff) | |
download | CMake-ffd8537acf4ff938ec87b134f3b72e1a22d1b1d3.zip CMake-ffd8537acf4ff938ec87b134f3b72e1a22d1b1d3.tar.gz CMake-ffd8537acf4ff938ec87b134f3b72e1a22d1b1d3.tar.bz2 |
Clang: Record Clang 16.0 C++ modules flags only for GNU-like front-end
The settings added by commit 3fe8e33f27 (Clang: Record Clang 16.0 flags
for our experimental C++ modules support, 2023-03-03, v3.26.0-rc6~6^2)
work only for the GNU-like `clang++` front-end, and not for the
MSVC-like `clang-cl` on Windows.
Also quote the path to `clang-scan-deps` to support spaces in its path.
Issue: #24611
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Compiler/Clang-CXX.cmake | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 33154fd..a74e90b 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -30,16 +30,18 @@ if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") endif() endif() -if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0) - string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE - "${CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS}" - " -format=p1689" - " --" - " <CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS>" - " -x c++ <SOURCE> -c -o <OBJECT>" - " -MT <DYNDEP_FILE>" - " -MD -MF <DEP_FILE>" - " > <DYNDEP_FILE>") - set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "clang") - set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>") -endif () +if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0) + if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE + "\"${CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS}\"" + " -format=p1689" + " --" + " <CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS>" + " -x c++ <SOURCE> -c -o <OBJECT>" + " -MT <DYNDEP_FILE>" + " -MD -MF <DEP_FILE>" + " > <DYNDEP_FILE>") + set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "clang") + set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>") + endif() +endif() |