File: EnvConfig.cmake

package info (click to toggle)
cmake 4.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 152,344 kB
  • sloc: ansic: 403,894; cpp: 303,807; sh: 4,097; python: 3,582; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 108; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (20 lines) | stat: -rw-r--r-- 688 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})

enable_language(C)

set(ENV{CMAKE_BUILD_TYPE} "Bad")
set(ENV{CMAKE_CONFIGURATION_TYPES} "Bad;Debug")

add_library(tc_defs INTERFACE IMPORTED)
target_compile_definitions(tc_defs INTERFACE "TC_CONFIG_$<UPPER_CASE:$<CONFIG>>")

try_compile(ENV_CONFIG_RESULT "${try_compile_bindir_or_SOURCES}"
  ${try_compile_redundant_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/EnvConfig.c"
  COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/EnvConfig.bin"
  OUTPUT_VARIABLE tc_output
  LINK_LIBRARIES tc_defs
  )
if(NOT ENV_CONFIG_RESULT)
  string(REPLACE "\n" "\n  " tc_output "  ${tc_output}")
  message(FATAL_ERROR "try_compile failed:\n${tc_output}")
endif()