Skip to content

Commit

Permalink
fix: main.cpp generation fails when multiple build configs are running
Browse files Browse the repository at this point in the history
Generate the file in the build directory so that multiple build configure operation can
run simultaneously without conflicting with each other due to the generated file being
in the source tree.
  • Loading branch information
abdes committed Oct 22, 2024
1 parent a06b9a1 commit e7eb314
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/version-info/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ asap_declare_module(
# Code generation
# ------------------------------------------------------------------------------

# Generate version-header
configure_file(src/main.cpp.in ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
# Generate the main.cpp file
set(generated_main ${CMAKE_CURRENT_BINARY_DIR}/src/main.cpp)
configure_file(src/main.cpp.in ${generated_main})

# ------------------------------------------------------------------------------
# Main module target
# ------------------------------------------------------------------------------

set(MODULE_TARGET_NAME "${META_PROJECT_NAME}-${META_MODULE_NAME}")

asap_add_executable(${MODULE_TARGET_NAME} WARNING SOURCES "src/main.cpp")
asap_add_executable(${MODULE_TARGET_NAME} WARNING SOURCES ${generated_main})

target_compile_features(${MODULE_TARGET_NAME} PUBLIC cxx_constexpr)

Expand Down

0 comments on commit e7eb314

Please sign in to comment.