2011-07-29 18:04:36 +04:00
|
|
|
cmake_minimum_required(VERSION 2.8.4)
|
2011-01-26 16:26:31 +03:00
|
|
|
project(VSResource)
|
2011-01-26 02:54:36 +03:00
|
|
|
|
2010-12-22 23:40:53 +03:00
|
|
|
string(REPLACE "/INCREMENTAL:YES" ""
|
|
|
|
CMAKE_EXE_LINKER_FLAGS_DEBUG
|
|
|
|
"${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
2011-01-26 02:54:36 +03:00
|
|
|
|
2011-01-27 23:45:25 +03:00
|
|
|
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")
|
2011-01-26 16:26:31 +03:00
|
|
|
add_definitions(/DCMAKE_RCDEFINE="test.txt")
|
|
|
|
else()
|
2011-01-27 23:45:25 +03:00
|
|
|
# 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")
|
2011-01-26 16:26:31 +03:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test.txt
|
2011-01-27 23:45:25 +03:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/test with spaces.txt" @ONLY)
|
2011-01-26 16:26:31 +03:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
add_definitions(/DCMAKE_RCDEFINE="test with spaces.txt")
|
|
|
|
endif()
|
2011-01-26 02:54:36 +03:00
|
|
|
|
2010-12-21 17:17:21 +03:00
|
|
|
add_executable(VSResource main.cpp test.rc)
|
2011-07-29 18:04:36 +04:00
|
|
|
|
|
|
|
set_property(TARGET VSResource
|
|
|
|
PROPERTY VS_GLOBAL_CMakeTestVsGlobalVariable "test val")
|