diff options
author | Brad King <brad.king@kitware.com> | 2010-01-25 13:47:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-01-25 13:47:32 (GMT) |
commit | 2b3eee46468fca17d69a5b905f0ef8876cbf2c16 (patch) | |
tree | 29f89b761d9bbd9d263cf8afbcccadeba1a3a675 /Tests | |
parent | 4d1351e8d3d97b78baa67d24e72f0baa3bb8ada5 (diff) | |
download | CMake-2b3eee46468fca17d69a5b905f0ef8876cbf2c16.zip CMake-2b3eee46468fca17d69a5b905f0ef8876cbf2c16.tar.gz CMake-2b3eee46468fca17d69a5b905f0ef8876cbf2c16.tar.bz2 |
Avoid PathScale cmd-line bug in TryCompile test
The PathScale compiler silently accepts unknown options that start in
more than one '-':
$ touch foo.c
$ pathcc -c foo.c --junk
$ echo $?
0
$ pathcc -c foo.c ---junk
$ echo $?
0
$ pathcc -c foo.c -junk
pathcc ERROR parsing -junk: unknown flag
$ echo $?
2
We teach the TryCompile to pass a bogus flag with only one '-' instead
of three '-'s for this compiler.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/TryCompile/CMakeLists.txt | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 62bed87..a57498f 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -211,12 +211,18 @@ TEST_ASSERT(CXX_BUILD_SHOULD_WORK "CHECK_CXX_SOURCE_COMPILES() failed") TEST_FAIL(CXX_RUN_SHOULD_FAIL "CHECK_CXX_SOURCE_RUNS() succeeded, but should have failed") TEST_ASSERT(CXX_RUN_SHOULD_WORK "CHECK_CXX_SOURCE_RUNS() failed") +FOREACH(lang C CXX) + IF(NOT "${CMAKE_${lang}_COMPILER_ID}" MATCHES "^(PathScale)$") + SET(${lang}_DD --) + ENDIF() +ENDFOREACH() + UNSET(C_BOGUS_FLAG CACHE) INCLUDE(CheckCCompilerFlag) -CHECK_C_COMPILER_FLAG(---_this_is_not_a_flag_ C_BOGUS_FLAG) +CHECK_C_COMPILER_FLAG(${C_DD}-_this_is_not_a_flag_ C_BOGUS_FLAG) TEST_FAIL(C_BOGUS_FLAG "CHECK_C_COMPILER_FLAG() succeeded, but should have failed") UNSET(CXX_BOGUS_FLAG CACHE) INCLUDE(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG(---_this_is_not_a_flag_ CXX_BOGUS_FLAG) +CHECK_CXX_COMPILER_FLAG(${CXX_DD}-_this_is_not_a_flag_ CXX_BOGUS_FLAG) TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed") |