Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Tests / RunCMake / try_compile / TargetTypeExe.cmake
1 include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
2
3 enable_language(C)
4
5 set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
6
7 try_compile(result ${try_compile_bindir_or_SOURCES}
8   ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
9   OUTPUT_VARIABLE out
10   COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy
11   COPY_FILE_ERROR copy_err
12   )
13
14 if(NOT result)
15   message(FATAL_ERROR "try_compile failed:\n${out}")
16 endif()
17
18 if(copy_err)
19   message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}")
20 endif()