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