Skip to content

Commit 0e0324b

Browse files
committed
cmake: Add TEST_SUITE_EXTRA_*_FLAGS variable
Introduce TEST_SUITE_EXTRA_C_FLAGS, TEST_SUITE_EXTRA_CXX_FLAGS and TEST_SUITE_EXTRA_EXE_LINKER_FLAGS. They simply get appended at the end of CMAKE_* flags. They are mostly intended for cache files that want settings to take effect even when the user manually overrides CMAKE_* flags. llvm-svn: 344155
1 parent 6e54860 commit 0e0324b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,20 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TEST_SUITE_DIAGNOSE_FLAGS}")
131131
set(CMAKE_EXE_LINKER_FLAGS
132132
"${CMAKE_EXE_LINKER_FLAGS} ${TEST_SUITE_DIAGNOSE_LINKER_FLAGS}")
133133

134+
# Append extra flags. These extra flags are mainly meant for cache files that
135+
# want to apply flags that get not override even when the user manually
136+
# specifies CMAKE_C_FLAGS and similar.
137+
set(TEST_SUITE_EXTRA_C_FLAGS CACHE STRING "Extra flags for CMAKE_C_FLAGS")
138+
set(TEST_SUITE_EXTRA_CXX_FLAGS CACHE STRING "Extra flags for CMAKE_CXX_FLAGS")
139+
set(TEST_SUITE_EXTRA_EXE_LINKER_FLAGS CACHE STRING
140+
"Extra flags for CMAKE_EXE_LINKER_FLAGS")
141+
mark_as_advanced(TEST_SUITE_EXTRA_C_FLAGS, TEST_SUITE_EXTRA_CXX_FLAGS,
142+
TEST_SUITE_EXTRA_EXE_LINKER_FLAGS)
143+
set(CMAKE_C_CFLAGS "${CMAKE_C_CFLAGS} ${TEST_SUITE_EXTRA_C_FLAGS}")
144+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TEST_SUITE_EXTRA_CXX_FLAGS}")
145+
set(CMAKE_EXE_LINKER_FLAGS
146+
"${CMAKE_EXE_LINKER_FLAGS} ${TEST_SUITE_EXTRA_EXE_LINKER_FLAGS}")
147+
134148
include(TestSuite)
135149
include(SingleMultiSource)
136150
find_package(TCL)

0 commit comments

Comments
 (0)