diff options
author | Brad King <brad.king@kitware.com> | 2014-08-12 17:26:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-08-12 17:56:21 (GMT) |
commit | fbf7a9297571b7e26739009d7026fbe21c3ccbc7 (patch) | |
tree | bf5da358ee2d7a1dd387944c5982a608d7b2de67 /Tests/CompileOptions | |
parent | 1f8cfc3b5f4bd87216e48c6bf909b59f10b9065e (diff) | |
download | CMake-fbf7a9297571b7e26739009d7026fbe21c3ccbc7.zip CMake-fbf7a9297571b7e26739009d7026fbe21c3ccbc7.tar.gz CMake-fbf7a9297571b7e26739009d7026fbe21c3ccbc7.tar.bz2 |
Makefile: Handle '#' in COMPILE_OPTIONS (#15070)
Teach the Makefile generators to escape '#' characters on the right hand
side of variable assignments in flags.make. This is needed for flags
like '-Wno-error=#warnings'. Otherwise the make tool treats them as
comments and leaves them out of the _FLAGS variable value.
Add a case to the CompileOptions test covering '#' in a COMPILE_OPTIONS
value, at least on compilers where it is known to be supported.
Diffstat (limited to 'Tests/CompileOptions')
-rw-r--r-- | Tests/CompileOptions/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/CompileOptions/main.cpp | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 9b6c9c2..05a5f82 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -22,6 +22,12 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS ${cxx_tests} ) +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland") + set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS + "-DTEST_OCTOTHORPE=\"#\"" + ) +endif() + target_link_libraries(CompileOptions testlib) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp index 42f4cca..f3c1355 100644 --- a/Tests/CompileOptions/main.cpp +++ b/Tests/CompileOptions/main.cpp @@ -17,6 +17,9 @@ int main() { return (strcmp(NEEDS_ESCAPE, "E$CAPE") == 0 +#ifdef TEST_OCTOTHORPE + && strcmp(TEST_OCTOTHORPE, "#") == 0 +#endif && strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0 && strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == 0 && TEST_C_COMPILER_VERSION_EQUALITY == 1 |