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 (55 lines) | stat: -rw-r--r-- 1,179 bytes parent folder | download
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cmake_minimum_required(VERSION 2.6)
project(Unset C)

# Local variable
set(x 42)
if(NOT x EQUAL 42)
  message(FATAL_ERROR "x!=42")
endif()

if(NOT DEFINED x)
  message(FATAL_ERROR "x should be defined!")
endif()

unset(x)
if(DEFINED x)
  message(FATAL_ERROR "x should be undefined now!")
endif()

# Local variable test unset via set()
set(x 43)
if(NOT x EQUAL 43)
  message(FATAL_ERROR "x!=43")
endif()
set(x)
if(DEFINED x)
  message(FATAL_ERROR "x should be undefined now!")
endif()

# Cache variable
set(BAR "test" CACHE STRING "documentation")
if(NOT DEFINED BAR)
  message(FATAL_ERROR "BAR not defined")
endif()

# Test interaction of cache entries with variables.
set(BAR "test-var")
if(NOT "$CACHE{BAR}" STREQUAL "test")
  message(FATAL_ERROR "\$CACHE{BAR} changed by variable BAR")
endif()
if(NOT "${BAR}" STREQUAL "test-var")
  message(FATAL_ERROR "\${BAR} not separate from \$CACHE{BAR}")
endif()
unset(BAR)
if(NOT "${BAR}" STREQUAL "test")
  message(FATAL_ERROR "\${BAR} does not fall through to \$CACHE{BAR}")
endif()

# Test unsetting of CACHE entry.
unset(BAR CACHE)
if(DEFINED BAR)
  message(FATAL_ERROR "BAR still defined")
endif()


add_executable(Unset unset.c)