Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Tests / RunCMake / CheckSourceRuns / CheckCSourceRuns.cmake
1
2 enable_language (C)
3 include(CheckCSourceRuns)
4
5 set(C 1) # test that this is tolerated
6
7 check_c_source_runs("int main() {return 2;}" SHOULD_FAIL)
8 if(SHOULD_FAIL)
9   message(SEND_ERROR "check_c_source_runs succeeded, but should have failed.")
10 endif()
11
12 check_c_source_runs("int main() {return 0;}" SHOULD_RUN)
13 if(NOT SHOULD_RUN)
14   message(SEND_ERROR "check_c_source_runs failed for valid C executable.")
15 endif()