summaryrefslogtreecommitdiffstats
path: root/Tests/VSResource/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-01-28 19:17:54 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-01-28 19:17:54 (GMT)
commitecfe0f7ca8e017ac78015616e957d709d08e424e (patch)
tree2fe25c739214af3b262cdbc2a94c752b3b8dd5ae /Tests/VSResource/CMakeLists.txt
parentba718fb8275e98c8404c6362f8ac675165bbfef1 (diff)
parent008d116b1767cb93c043e399ab607bcc8db5c175 (diff)
downloadCMake-ecfe0f7ca8e017ac78015616e957d709d08e424e.zip
CMake-ecfe0f7ca8e017ac78015616e957d709d08e424e.tar.gz
CMake-ecfe0f7ca8e017ac78015616e957d709d08e424e.tar.bz2
Merge topic 'fix-11695-spaces-in-vs10-rc-defs'
008d116 VSResource: Avoid windres /D with quoted spaces (#11695) 8f9919d Avoid space in rc /D values for VS6 and Cygwin (#11695) 78fe97f Fix line too long KWStyle issue (#11695) 6627560 VS10: Escape double quote chars in defines for rc files (#11695)
Diffstat (limited to 'Tests/VSResource/CMakeLists.txt')
-rw-r--r--Tests/VSResource/CMakeLists.txt36
1 files changed, 33 insertions, 3 deletions
diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt
index e842955..5d7d14e 100644
--- a/Tests/VSResource/CMakeLists.txt
+++ b/Tests/VSResource/CMakeLists.txt
@@ -1,7 +1,37 @@
-cmake_minimum_required (VERSION 2.6)
-project (VSResource)
-add_definitions(/DCMAKE_RCDEFINE="test.txt")
+cmake_minimum_required(VERSION 2.8.3.20110118)
+project(VSResource)
+
string(REPLACE "/INCREMENTAL:YES" ""
CMAKE_EXE_LINKER_FLAGS_DEBUG
"${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
+
+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" @ONLY)
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
+ add_definitions(/DCMAKE_RCDEFINE="test with spaces.txt")
+endif()
+
add_executable(VSResource main.cpp test.rc)