summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/try_compile/TargetTypeExe.cmake
blob: 9b6e7272f93930e22906b07edbf6f9e0475e9a52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
enable_language(C)
set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
  SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
  OUTPUT_VARIABLE out
  COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy
  COPY_FILE_ERROR copy_err
  )
if(NOT result)
  message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
if(copy_err)
  message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}")
endif()