summaryrefslogtreecommitdiffstats
path: root/Tests/CompileDefinitions/CMakeLists.txt
blob: 13d1b011f91da060b463aa2ef5d25b068d445216 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
cmake_minimum_required(VERSION 2.8)
project(CompileDefinitions)

if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 6")
    add_definitions(-DNO_SPACES_IN_DEFINE_VALUES)
    set(NO_SPACES_IN_DEFINE_VALUES 1)
endif()

# Use compile flags to tell executables which config is built
# without depending on the compile definitions functionality.
foreach(c DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
  set(CMAKE_C_FLAGS_${c} "${CMAKE_C_FLAGS_${c}} -DTEST_CONFIG_${c}")
  set(CMAKE_CXX_FLAGS_${c} "${CMAKE_CXX_FLAGS_${c}} -DTEST_CONFIG_${c}")
endforeach()

set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
  "BUILD_CONFIG_NAME=\"$<CONFIGURATION>\""
  )

add_subdirectory(add_def_cmd)
add_subdirectory(target_prop)
add_subdirectory(add_def_cmd_tprop)

add_executable(CompileDefinitions runtest.c)