diff options
author | Brad King <brad.king@kitware.com> | 2021-04-07 17:36:23 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-04-07 17:53:22 (GMT) |
commit | 3953dfcb315f6d85966703f01c7fbb0ac262e928 (patch) | |
tree | bedb763e0afdccbcc64fa5c6ae186eb83ff80fee /Modules/CMakeDetermineCompilerId.cmake | |
parent | f8af94a2124d61e33f71f67b4ae282475314da25 (diff) | |
download | CMake-3953dfcb315f6d85966703f01c7fbb0ac262e928.zip CMake-3953dfcb315f6d85966703f01c7fbb0ac262e928.tar.gz CMake-3953dfcb315f6d85966703f01c7fbb0ac262e928.tar.bz2 |
Restore support for backslashes in initial language-wide flags
Refactoring in commit bdc40742bd (CMakeDetermineCompilerId: Test without
COMPILER_ID_FLAGS if REQUIRE_SUCCESS, 2021-02-27, v3.20.0-rc3~6^2) added
an extra macro layer through which flag strings are passed. That caused
an extra level of argument re-parsing, and broke flags with backslashes.
Pass flags to the helper macro through variable names instead.
Fixes: #22041
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 1595cfd..ad9503c 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -1,9 +1,9 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -macro(__determine_compiler_id_test testflags_in userflags) - separate_arguments(testflags UNIX_COMMAND "${testflags_in}") - CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${testflags}" "${userflags}" "${src}") +macro(__determine_compiler_id_test testflags_var userflags_var) + separate_arguments(testflags UNIX_COMMAND "${${testflags_var}}") + CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${testflags}" "${${userflags_var}}" "${src}") CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}") if(NOT CMAKE_${lang}_COMPILER_ID) @@ -44,7 +44,8 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) endif() foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "") - __determine_compiler_id_test("${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}" "${userflags}") + set(testflags "${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}") + __determine_compiler_id_test(testflags userflags) if(CMAKE_${lang}_COMPILER_ID) break() endif() @@ -55,7 +56,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) # of helper flags. Stop when the compiler is identified. foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "") foreach(testflags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST} "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) - __determine_compiler_id_test("${testflags}" "${userflags}") + __determine_compiler_id_test(testflags userflags) if(CMAKE_${lang}_COMPILER_ID) break() endif() |