diff options
author | David Cole <david.cole@kitware.com> | 2011-01-27 20:45:25 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2011-01-27 23:28:36 (GMT) |
commit | 008d116b1767cb93c043e399ab607bcc8db5c175 (patch) | |
tree | bdce62f475073f365cfdc5fe291dcd2c2fc9c9de /Tests/VSResource/CMakeLists.txt | |
parent | 8f9919d93cad64de58775e4a7609b0ffb37d061e (diff) | |
download | CMake-008d116b1767cb93c043e399ab607bcc8db5c175.zip CMake-008d116b1767cb93c043e399ab607bcc8db5c175.tar.gz CMake-008d116b1767cb93c043e399ab607bcc8db5c175.tar.bz2 |
VSResource: Avoid windres /D with quoted spaces (#11695)
Improve test: print out what's happening along the way.
Diffstat (limited to 'Tests/VSResource/CMakeLists.txt')
-rw-r--r-- | Tests/VSResource/CMakeLists.txt | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt index 5fbd572..5d7d14e 100644 --- a/Tests/VSResource/CMakeLists.txt +++ b/Tests/VSResource/CMakeLists.txt @@ -5,12 +5,31 @@ string(REPLACE "/INCREMENTAL:YES" "" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}") -if(MSVC60 OR CYGWIN) - # VS6 and Cygwin rc compilers do not deal well with spaces in a "/D" value +message(STATUS "CMAKE_RC_COMPILER='${CMAKE_RC_COMPILER}'") + +# Because of the following avoidance techniques required for windres and VS6, +# we recommend using a configured header file, and defining preprocessor +# symbols via #define code and including that header in the rc file. Using +# add_definitions is fine for simple definitions (with no spaces and no +# quoting), but requires avoidance or work-arounds beyond that... + +if(CMAKE_RC_COMPILER MATCHES windres) + # windres rc compiler does not properly define quoted /D values as strings + message(STATUS "CMAKE_RC_COMPILER MATCHES windres") + add_definitions(/DCMAKE_RCDEFINE=test.txt) + add_definitions(/DCMAKE_RCDEFINE_NO_QUOTED_STRINGS) +elseif(MSVC60) + # VS6 rc compiler does not deal well with spaces in a "/D" value, but it can + # handle the quoting + message(STATUS "MSVC60") add_definitions(/DCMAKE_RCDEFINE="test.txt") else() + # expected case -- rc compiler is "capable enough" + message(STATUS + "rc compiler handles quoted strings with spaces in values via /D") + set(TEXTFILE_FROM_SOURCE_DIR "textfile, spaces in name, from binary dir") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test.txt - "${CMAKE_CURRENT_BINARY_DIR}/test with spaces.txt" COPYONLY) + "${CMAKE_CURRENT_BINARY_DIR}/test with spaces.txt" @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_definitions(/DCMAKE_RCDEFINE="test with spaces.txt") endif() |