Skip to content

Commit a062ed0

Browse files
committed
Use PROJECT_SOURCE_DIR across CMakeLists
1 parent 4e70095 commit a062ed0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ option(USE_USER_BUS "Uses user bus" OFF)
1616
find_package(Git)
1717

1818
# Set version number and update submodules
19-
if(EXISTS ${CMAKE_SOURCE_DIR}/.git AND GIT_FOUND)
19+
if(EXISTS ${PROJECT_SOURCE_DIR}/.git AND GIT_FOUND)
2020
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags
2121
OUTPUT_VARIABLE LOGIOPS_VERSION
2222
RESULT_VARIABLE LOGIOPS_VERSION_RET
23+
WORKING_DIRECTORY PROJECT_SOURCE_DIR
2324
ERROR_QUIET)
2425
if(NOT LOGIOPS_VERSION_RET EQUAL "0")
2526
execute_process(COMMAND ${GIT_EXECUTABLE}
@@ -29,10 +30,11 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.git AND GIT_FOUND)
2930
endif()
3031

3132
execute_process(COMMAND ${GIT_EXECUTABLE}
32-
submodule update --init --recursive)
33+
submodule update --init --recursive
34+
WORKING_DIRECTORY PROJECT_SOURCE_DIR)
3335

3436
string(REGEX REPLACE "\n$" "" LOGIOPS_VERSION ${LOGIOPS_VERSION})
35-
elseif(EXISTS ${CMAKE_SOURCE_DIR}/version.txt)
37+
elseif(EXISTS ${PROJECT_SOURCE_DIR}/version.txt)
3638
file(READ version.txt LOGIOPS_VERSION)
3739
string(REGEX REPLACE "\n$" "" LOGIOPS_VERSION ${LOGIOPS_VERSION})
3840

0 commit comments

Comments
 (0)