2013-01-02 20:10:04 +04:00
|
|
|
include(RunCMake)
|
|
|
|
|
|
|
|
run_cmake(CommandConflict)
|
2014-07-17 17:31:53 +04:00
|
|
|
if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2)
|
|
|
|
run_cmake(OutputConflict)
|
2013-01-02 20:10:04 +04:00
|
|
|
endif()
|
|
|
|
run_cmake(EmptyCondition1)
|
|
|
|
run_cmake(EmptyCondition2)
|
|
|
|
run_cmake(BadCondition)
|
|
|
|
run_cmake(DebugEvaluate)
|
2014-11-05 01:24:54 +03:00
|
|
|
run_cmake(GenerateSource)
|
|
|
|
run_cmake(OutputNameMatchesSources)
|
|
|
|
run_cmake(OutputNameMatchesObjects)
|
|
|
|
run_cmake(OutputNameMatchesOtherSources)
|
|
|
|
file(READ "${RunCMake_BINARY_DIR}/OutputNameMatchesOtherSources-build/1somefile.cpp" file_contents)
|
|
|
|
if (NOT file_contents MATCHES "generated.cpp.rule")
|
|
|
|
message(SEND_ERROR "Rule file not in target sources! ${file_contents}")
|
|
|
|
endif()
|
2014-04-25 22:11:05 +04:00
|
|
|
|
|
|
|
set(timeformat "%Y%j%H%M%S")
|
|
|
|
|
|
|
|
file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt")
|
2014-06-30 22:32:51 +04:00
|
|
|
set(RunCMake_TEST_OPTIONS "-DTEST_FILE=WriteIfDifferent.cmake")
|
2014-04-25 22:11:05 +04:00
|
|
|
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/WriteIfDifferent-build")
|
|
|
|
run_cmake(WriteIfDifferent-prepare)
|
2014-06-30 22:32:51 +04:00
|
|
|
unset(RunCMake_TEST_OPTIONS)
|
2014-04-25 22:11:05 +04:00
|
|
|
unset(RunCMake_TEST_BINARY_DIR)
|
|
|
|
file(TIMESTAMP "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt" timestamp ${timeformat})
|
|
|
|
if(NOT timestamp)
|
|
|
|
message(SEND_ERROR "Could not get timestamp for \"${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt\"")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1)
|
|
|
|
|
|
|
|
set(RunCMake_TEST_NO_CLEAN ON)
|
|
|
|
run_cmake(WriteIfDifferent)
|
|
|
|
file(TIMESTAMP "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt" timestamp_after ${timeformat})
|
|
|
|
if(NOT timestamp_after)
|
|
|
|
message(SEND_ERROR "Could not get timestamp for \"${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt\"")
|
|
|
|
endif()
|
|
|
|
unset(RunCMake_TEST_NO_CLEAN)
|
|
|
|
|
|
|
|
if (NOT timestamp_after STREQUAL timestamp)
|
|
|
|
message(SEND_ERROR "WriteIfDifferent changed output file.")
|
|
|
|
endif()
|
2014-07-22 17:10:57 +04:00
|
|
|
|
|
|
|
if (UNIX AND EXISTS /bin/sh)
|
|
|
|
set(RunCMake_TEST_NO_CLEAN ON)
|
|
|
|
run_cmake(CarryPermissions)
|
|
|
|
execute_process(
|
|
|
|
COMMAND "${RunCMake_BINARY_DIR}/CarryPermissions-build/output_script.sh"
|
|
|
|
OUTPUT_VARIABLE script_output
|
|
|
|
RESULT_VARIABLE script_result
|
|
|
|
ERROR_VARIABLE script_error
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
if (script_result)
|
|
|
|
message(SEND_ERROR "Generated script did not execute correctly: [${script_result}]\n${script_output}\n====\n${script_error}")
|
|
|
|
endif()
|
|
|
|
if (NOT script_output STREQUAL SUCCESS)
|
|
|
|
message(SEND_ERROR "Generated script did not execute correctly:\n${script_output}\n====\n${script_error}")
|
|
|
|
endif()
|
|
|
|
endif()
|