CrucibleEnablePlatformPreprocessorSymbols.cmake
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
include_guard(GLOBAL) function(crucible_enable_platform_preprocessor_symbols TARGET_NAME) get_target_property(TARGET_TYPE "${TARGET_NAME}" TYPE) file(TO_NATIVE_PATH "${PROJECT_SOURCE_DIR}" NATIVE_ROOT_PATH) string(REPLACE "\\" "\\\\" NATIVE_ROOT_PATH_ESCAPED "${NATIVE_ROOT_PATH}") list(APPEND PLATFORM_DEFINITIONS "CRUCIBLE_ROOT=\"${NATIVE_ROOT_PATH_ESCAPED}\"") if(UNIX) list(APPEND PLATFORM_DEFINITIONS CRUCIBLE_UNIX) endif() if(WIN32) list(APPEND PLATFORM_DEFINITIONS CRUCIBLE_WINDOWS) endif() if(TARGET_TYPE STREQUAL INTERFACE_LIBRARY) set(SCOPE INTERFACE) else() set(SCOPE PUBLIC) endif() target_compile_definitions("${TARGET_NAME}" "${SCOPE}" ${PLATFORM_DEFINITIONS}) endfunction()