File: CMakeLists.txt

package info (click to toggle)
cmake 2.8.11.1-1~bpo70+1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 37,056 kB
  • sloc: cpp: 157,219; ansic: 137,155; yacc: 3,254; sh: 2,745; xml: 2,483; lex: 1,028; lisp: 215; python: 199; objc: 134; f90: 105; perl: 99; fortran: 93; makefile: 65; tcl: 55; asm: 28; php: 25; ruby: 22; java: 20
file content (40 lines) | stat: -rw-r--r-- 1,643 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
cmake_minimum_required(VERSION 2.8.4)
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)

set_property(TARGET VSResource
  PROPERTY VS_GLOBAL_CMakeTestVsGlobalVariable "test val")