summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/try_compile/Verbose.cmake
blob: 3f2a7ddd784798dfb579f2ec93f5630532206ba8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
enable_language(C)

try_compile(COMPILE_RESULT
  SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Verbose.c
  COMPILE_DEFINITIONS -DEXAMPLE_DEFINITION
  OUTPUT_VARIABLE out
  )
string(REPLACE "\n" "\n  " out "  ${out}")
if(NOT COMPILE_RESULT)
  message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
if(NOT out MATCHES "EXAMPLE_DEFINITION"
    AND NOT CMAKE_GENERATOR MATCHES "NMake|Borland")
  message(FATAL_ERROR "try_compile output does not contain EXAMPLE_DEFINITION:\n${out}")
endif()