summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-04-08 11:47:00 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-04-08 11:47:09 (GMT)
commitf39ea2e292079707feceeb256b242d8f41b71ee9 (patch)
tree6e21a7d7f47bf594214fea759393f885994c35ab /Tests
parent34f05129a37be61158a139a29bfbc23d353630fa (diff)
parent3953dfcb315f6d85966703f01c7fbb0ac262e928 (diff)
downloadCMake-f39ea2e292079707feceeb256b242d8f41b71ee9.zip
CMake-f39ea2e292079707feceeb256b242d8f41b71ee9.tar.gz
CMake-f39ea2e292079707feceeb256b242d8f41b71ee9.tar.bz2
Merge topic 'flags-with-backslash'
3953dfcb31 Restore support for backslashes in initial language-wide flags Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5995
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/InitialFlags/C-stdout.txt1
-rw-r--r--Tests/RunCMake/InitialFlags/C.cmake3
-rw-r--r--Tests/RunCMake/InitialFlags/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/InitialFlags/CXX-stdout.txt1
-rw-r--r--Tests/RunCMake/InitialFlags/CXX.cmake3
-rw-r--r--Tests/RunCMake/InitialFlags/RunCMakeTest.cmake7
7 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index b1bf835..5f23c05 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -248,6 +248,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()
diff --git a/Tests/RunCMake/InitialFlags/C-stdout.txt b/Tests/RunCMake/InitialFlags/C-stdout.txt
new file mode 100644
index 0000000..9a7341d
--- /dev/null
+++ b/Tests/RunCMake/InitialFlags/C-stdout.txt
@@ -0,0 +1 @@
+CMAKE_C_FLAGS='[^']*-Denv="a\\b"[^']+-Dvar="b\\c"[^']*'
diff --git a/Tests/RunCMake/InitialFlags/C.cmake b/Tests/RunCMake/InitialFlags/C.cmake
new file mode 100644
index 0000000..5afc395
--- /dev/null
+++ b/Tests/RunCMake/InitialFlags/C.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_C_FLAGS_INIT [[-Dvar="b\c"]])
+enable_language(C)
+message(STATUS "CMAKE_C_FLAGS='${CMAKE_C_FLAGS}'")
diff --git a/Tests/RunCMake/InitialFlags/CMakeLists.txt b/Tests/RunCMake/InitialFlags/CMakeLists.txt
new file mode 100644
index 0000000..7cabeb6
--- /dev/null
+++ b/Tests/RunCMake/InitialFlags/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.20)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/InitialFlags/CXX-stdout.txt b/Tests/RunCMake/InitialFlags/CXX-stdout.txt
new file mode 100644
index 0000000..623b74a
--- /dev/null
+++ b/Tests/RunCMake/InitialFlags/CXX-stdout.txt
@@ -0,0 +1 @@
+CMAKE_CXX_FLAGS='[^']*-Denv="a\\b"[^']+-Dvar="b\\c"[^']*'
diff --git a/Tests/RunCMake/InitialFlags/CXX.cmake b/Tests/RunCMake/InitialFlags/CXX.cmake
new file mode 100644
index 0000000..1d7a53c
--- /dev/null
+++ b/Tests/RunCMake/InitialFlags/CXX.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_CXX_FLAGS_INIT [[-Dvar="b\c"]])
+enable_language(CXX)
+message(STATUS "CMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'")
diff --git a/Tests/RunCMake/InitialFlags/RunCMakeTest.cmake b/Tests/RunCMake/InitialFlags/RunCMakeTest.cmake
new file mode 100644
index 0000000..d13019e
--- /dev/null
+++ b/Tests/RunCMake/InitialFlags/RunCMakeTest.cmake
@@ -0,0 +1,7 @@
+include(RunCMake)
+
+set(ENV{CFLAGS} "$ENV{CFLAGS} -Denv=\"a\\b\"")
+run_cmake(C)
+
+set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Denv=\"a\\b\"")
+run_cmake(CXX)