mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 01:29:43 +01:00
Use add_custom_command over add_custom_target
This fixes an issue where the CentOS CI kept failing because it couldn't find the generated InterimVersion output file. It seems like using the BYPRODUCTS statement in add_custom_target didn't work because BYPRODUCTS was only added in CMake 3.2, so then add_custom_target never ran, which is obviously a problem. The solution is to use add_custom_command instead, and to solve the problem that the interim version needs to be regenerated every time no matter what (which is what BYPRODUCTS was supposed to do) we just add a dummy output instead.
This commit is contained in:
parent
e3876feb3b
commit
c636713a43
1 changed files with 3 additions and 6 deletions
|
@ -217,10 +217,9 @@ if(NOT OFFICIAL_BUILD)
|
|||
set(VERSION_INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.in.c)
|
||||
set(VERSION_OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.out.c)
|
||||
|
||||
add_custom_target(
|
||||
GenerateVersion ALL
|
||||
# This BYPRODUCTS line is required for this to be ran every time
|
||||
BYPRODUCTS ${VERSION_OUTPUT_FILE}
|
||||
add_custom_command(
|
||||
# This OUTPUT line is required for this to be ran every time
|
||||
OUTPUT ${VERSION_OUTPUT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/src/_dummy.c
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
# These args have to be passed through, otherwise the script can't see them
|
||||
# Also, these args have to come BEFORE `-P`! (Otherwise it fails with an unclear error)
|
||||
|
@ -229,8 +228,6 @@ if(NOT OFFICIAL_BUILD)
|
|||
-P ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake
|
||||
)
|
||||
|
||||
add_dependencies(VVVVVV GenerateVersion)
|
||||
|
||||
target_compile_definitions(VVVVVV PRIVATE -DINTERIM_VERSION_EXISTS)
|
||||
|
||||
add_library(InterimVersion STATIC src/InterimVersion.out.c)
|
||||
|
|
Loading…
Reference in a new issue