Commit 9be8441c authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'flags-with-backslash' into release-3.20

3953dfcb

 Restore support for backslashes in initial language-wide flags
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !5995
parents 6d27dd3d 3953dfcb
# 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()
......
......@@ -243,6 +243,7 @@ add_RunCMake_test(FileAPI -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
add_RunCMake_test(FindBoost)
add_RunCMake_test(FindLua)
add_RunCMake_test(FindOpenGL)
add_RunCMake_test(InitialFlags)
if(CMake_TEST_FindOpenSSL)
add_RunCMake_test(FindOpenSSL)
endif()
......
CMAKE_C_FLAGS='[^']*-Denv="a\\b"[^']+-Dvar="b\\c"[^']*'
set(CMAKE_C_FLAGS_INIT [[-Dvar="b\c"]])
enable_language(C)
message(STATUS "CMAKE_C_FLAGS='${CMAKE_C_FLAGS}'")
cmake_minimum_required(VERSION 3.20)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
CMAKE_CXX_FLAGS='[^']*-Denv="a\\b"[^']+-Dvar="b\\c"[^']*'
set(CMAKE_CXX_FLAGS_INIT [[-Dvar="b\c"]])
enable_language(CXX)
message(STATUS "CMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'")
include(RunCMake)
set(ENV{CFLAGS} "$ENV{CFLAGS} -Denv=\"a\\b\"")
run_cmake(C)
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Denv=\"a\\b\"")
run_cmake(CXX)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment