summaryrefslogtreecommitdiff
path: root/Modules/FindBISON.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-10-09 08:25:16 -0400
committerBrad King <brad.king@kitware.com>2018-10-09 08:55:54 -0400
commitc64797fa94de29ef3f5f9c940273036c9ebf64ee (patch)
tree8d87ddb1739d2adb3fbcd0a179ce577bfabf5edc /Modules/FindBISON.cmake
parentfd02538974dd952a8639d371c2c0067d30d5469a (diff)
downloadcmake-c64797fa94de29ef3f5f9c940273036c9ebf64ee.tar.gz
FindBISON: Fix "multiple rules generate" error on VERBOSE output
When `BISON_TARGET` is called with both VERBOSE <extra-file> REPORT_FILE <file> we add a custom command to copy `<file>` to `<extra-file>`. The change in commit v3.7.1~10^2 (FindBISON: Do not rebuild every time when not VERBOSE, 2016-11-14) incorrectly listed the extra file as an output of the main bison invocation custom command, but it is actually produced by the separate copy command. Fix the logic to always generate `<file>` as an output of the bison command and `<extra-file>` as an output of the copy command. Fixes: #18433
Diffstat (limited to 'Modules/FindBISON.cmake')
-rw-r--r--Modules/FindBISON.cmake21
1 files changed, 14 insertions, 7 deletions
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index d684ccd86b..2000f7ff6f 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -149,17 +149,25 @@ if(BISON_EXECUTABLE)
set(BISON_TARGET_verbose_file "${ReportFile}")
list(APPEND BISON_TARGET_cmdopt "--report-file=${BISON_TARGET_verbose_file}")
endif()
+ if(NOT IS_ABSOLUTE "${BISON_TARGET_verbose_file}")
+ set(BISON_TARGET_verbose_file "${CMAKE_CURRENT_SOURCE_DIR}/${BISON_TARGET_verbose_file}")
+ endif()
endmacro()
# internal macro
# adds a custom command and sets
- # BISON_TARGET_cmdopt, BISON_TARGET_verbose_file, BISON_TARGET_extraoutputs
+ # BISON_TARGET_cmdopt, BISON_TARGET_extraoutputs
macro(BISON_TARGET_option_verbose Name BisonOutput filename)
list(APPEND BISON_TARGET_cmdopt "--verbose")
- list(APPEND BISON_TARGET_extraoutputs
+ list(APPEND BISON_TARGET_outputs
"${BISON_TARGET_verbose_file}")
if (NOT "${filename}" STREQUAL "")
- add_custom_command(OUTPUT ${filename}
+ if(IS_ABSOLUTE "${filename}")
+ set(BISON_TARGET_verbose_extra_file "${filename}")
+ else()
+ set(BISON_TARGET_verbose_extra_file "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
+ endif()
+ add_custom_command(OUTPUT ${BISON_TARGET_verbose_extra_file}
COMMAND ${CMAKE_COMMAND} -E copy
"${BISON_TARGET_verbose_file}"
"${filename}"
@@ -167,10 +175,10 @@ if(BISON_EXECUTABLE)
DEPENDS
"${BISON_TARGET_verbose_file}"
COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}"
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
- set(BISON_${Name}_VERBOSE_FILE ${filename})
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
list(APPEND BISON_TARGET_extraoutputs
- "${filename}")
+ "${BISON_TARGET_verbose_extra_file}")
+ unset(BISON_TARGET_verbose_extra_file)
endif()
endmacro()
@@ -226,7 +234,6 @@ if(BISON_EXECUTABLE)
list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}")
add_custom_command(OUTPUT ${BISON_TARGET_outputs}
- ${BISON_TARGET_extraoutputs}
COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput}
VERBATIM
DEPENDS ${BisonInput}