1 2enable_language (CXX) 3include(CheckSourceRuns) 4 5set(CXX 1) # test that this is tolerated 6 7check_source_runs(CXX "int main() {return 2;}" SHOULD_FAIL) 8if(SHOULD_FAIL) 9 message(SEND_ERROR "CXX check_source_runs succeeded, but should have failed.") 10endif() 11 12check_source_runs(CXX 13[=[ 14 #include <vector> 15 int main() { 16 return 0; 17 } 18]=] 19 SHOULD_RUN) 20if(NOT SHOULD_RUN) 21 message(SEND_ERROR "CXX check_source_runs failed for valid C executable.") 22endif() 23