From 87853ed828e8c013ca9ac860c1bbb46198c6d78b Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 1 May 2007 14:12:56 -0400 Subject: ENH: Added test to make sure custom commands are not built more than once in a single build. This tests for a bug introduced by one fix and fixed by another fix for bug#4377. --- Tests/CustomCommand/CMakeLists.txt | 7 +++++++ Tests/CustomCommand/check_mark.cmake | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 Tests/CustomCommand/check_mark.cmake diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 602f69b..83d2de2 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -230,6 +230,8 @@ ADD_EXECUTABLE(check_command_line ${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/command_line_check + COMMAND ${CMAKE_COMMAND} -DMARK_FILE=${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt + -P ${CMAKE_CURRENT_SOURCE_DIR}/check_mark.cmake COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check_command_line ${CHECK_ARGS} VERBATIM @@ -246,3 +248,8 @@ ADD_CUSTOM_TARGET(do_check_command_line ALL COMMENT "Checking custom target command line escapes ($dollar-signs$)" ) ADD_DEPENDENCIES(do_check_command_line check_command_line) + +ADD_CUSTOM_TARGET(pre_check_command_line + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt + ) +ADD_DEPENDENCIES(do_check_command_line pre_check_command_line) diff --git a/Tests/CustomCommand/check_mark.cmake b/Tests/CustomCommand/check_mark.cmake new file mode 100644 index 0000000..8b0551f --- /dev/null +++ b/Tests/CustomCommand/check_mark.cmake @@ -0,0 +1,5 @@ +IF(EXISTS "${MARK_FILE}") + MESSAGE(FATAL_ERROR "Custom command run more than once!") +ELSE(EXISTS "${MARK_FILE}") + FILE(WRITE "${MARK_FILE}" "check for running custom command twice\n") +ENDIF(EXISTS "${MARK_FILE}") -- cgit v0.12