Skip to content

Commit

Permalink
ensure correct cmake script argument (#169)
Browse files Browse the repository at this point in the history
When running a build in a scenario with multiple paths in
CMAKE_MODULE_PATH, we aren't actually running the git-version script.
This happens because we are APPENDing our own module path to the
existing setting.

Instead of relying on the contents of CMAKE_MODULE_PATH, create a
variable that is dedicated to our own location, and use that to specify
the git-version script.

Signed-off-by: Frans Klaver <[email protected]>
Co-authored-by: Frans Klaver <[email protected]>
  • Loading branch information
fransklaver and Frans Klaver authored Nov 20, 2024
1 parent 5987dfa commit 1f94717
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ project (lpac
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(LPAC_CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH ${LPAC_CMAKE_MODULE_PATH})

# add_compile_options(-Wall -Wextra -Wpedantic)

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ add_custom_target(version
-D SRC=${CMAKE_CURRENT_SOURCE_DIR}/version.h.in
-D DST=${CMAKE_CURRENT_SOURCE_DIR}/version.h
-D GIT_EXECUTABLE=${GIT_EXECUTABLE}
-P ${CMAKE_MODULE_PATH}/git-version.cmake
-P ${LPAC_CMAKE_MODULE_PATH}/git-version.cmake
)
add_dependencies(lpac version)
set_target_properties(lpac PROPERTIES
Expand Down

0 comments on commit 1f94717

Please sign in to comment.