CMake: fix parallel build by not copying ws.css repeatedly

A race condition exists with msbuild where building some targets
(generate_{developer,user}-guide.xml, {developer,user}_guide_pdf) will
result in parallel, repeated execution of the commands to copy 'ws.css'.
Synchronize those executions using a single target to avoid this.

Change-Id: Ie93d07e504bc18fa4e4e8aac5b611fba329ff188
Reviewed-on: https://code.wireshark.org/review/30553
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2018-11-09 12:08:01 +01:00 committed by Anders Broman
parent 9b1daa3629
commit 34d3afa3e4
1 changed files with 7 additions and 3 deletions

View File

@ -288,6 +288,7 @@ set(WSUG_SOURCE
${WSUG_GRAPHICS}
)
# Ensure ws.css is available when the user tries to open generated .html files.
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
add_custom_command(
OUTPUT ws.css
@ -297,9 +298,12 @@ if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/ws.css
)
add_custom_target(copy_ws.css DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ws.css)
else()
add_custom_target(copy_ws.css)
endif()
set( WSUG_BUILT_DEPS ws.css)
set( WSUG_BUILT_DEPS copy_ws.css)
set(WSDG_SOURCE
${WSDG_FILES}
@ -351,7 +355,7 @@ ADD_CUSTOM_COMMAND(
${WSLUA_MODULES}
)
set( WSDG_BUILT_DEPS ws.css wsluarm )
set( WSDG_BUILT_DEPS copy_ws.css wsluarm )
set( ASCIIDOC_CONF_FILES
attributes.asciidoc
@ -525,7 +529,7 @@ add_custom_target(
set_docbook_target_properties(news)
if( ASCIIDOCTOR_FOUND )
ASCIIDOCTOR2HTML( release-notes.asciidoc ws.css )
ASCIIDOCTOR2HTML( release-notes.asciidoc copy_ws.css )
ASCIIDOCTOR2TXT( release-notes.asciidoc )
endif()