Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate Version.h if the git hash changes #16881

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/Build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 10,17 @@ if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)
${CMAKE_CURRENT_BINARY_DIR}/Version.h.in)

add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Version.h
OUTPUT version_file
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Version.h
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/SubWCRev.py
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/Version.h.out
${CMAKE_CURRENT_BINARY_DIR}/Version.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS version_check)

add_custom_command(
OUTPUT version_check
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/SubWCRev.py
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Version.h.in)
set_source_files_properties(version_file PROPERTIES SYMBOLIC true)

ADD_CUSTOM_TARGET(fc_version DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Version.h)
ADD_CUSTOM_TARGET(fc_version DEPENDS version_file ${CMAKE_CURRENT_BINARY_DIR}/Version.h)

else (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)

Expand Down
Loading