Skip to content

Instantly share code, notes, and snippets.

@ycnakajsph
Created March 29, 2024 14:27
Show Gist options
  • Save ycnakajsph/59032bc012bcc6afd1f7d46ad70413cb to your computer and use it in GitHub Desktop.
Save ycnakajsph/59032bc012bcc6afd1f7d46ad70413cb to your computer and use it in GitHub Desktop.
Defining main-target
...
add_custom_target(generate_version_header
COMMAND ${CMAKE_COMMAND}
-DVERSION_TEMPLATE:STRING=version.hpp.in
-DVERSION_FILE:STRING=version.hpp
-DSOURCE_DIR:STRING=${CMAKE_SOURCE_DIR}
-P ${CMAKE_SOURCE_DIR}/generate_version_header.cmake
COMMENT "Generating version header"
)
add_dependencies(main-target generate_version_header)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment