Skip to content

Commit

Permalink
Use PROJECT_SOURCE_DIR across CMakeLists
Browse files Browse the repository at this point in the history
  • Loading branch information
PixlOne committed May 4, 2023
1 parent 4e70095 commit a77b328
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ option(USE_USER_BUS "Uses user bus" OFF)
find_package(Git)

# Set version number and update submodules
if(EXISTS ${CMAKE_SOURCE_DIR}/.git AND GIT_FOUND)
if(EXISTS ${PROJECT_SOURCE_DIR}/.git AND GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags
OUTPUT_VARIABLE LOGIOPS_VERSION
RESULT_VARIABLE LOGIOPS_VERSION_RET
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
ERROR_QUIET)
if(NOT LOGIOPS_VERSION_RET EQUAL "0")
execute_process(COMMAND ${GIT_EXECUTABLE}
Expand All @@ -29,10 +30,11 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.git AND GIT_FOUND)
endif()

execute_process(COMMAND ${GIT_EXECUTABLE}
submodule update --init --recursive)
submodule update --init --recursive
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})

string(REGEX REPLACE "\n$" "" LOGIOPS_VERSION ${LOGIOPS_VERSION})
elseif(EXISTS ${CMAKE_SOURCE_DIR}/version.txt)
elseif(EXISTS ${PROJECT_SOURCE_DIR}/version.txt)
file(READ version.txt LOGIOPS_VERSION)
string(REGEX REPLACE "\n$" "" LOGIOPS_VERSION ${LOGIOPS_VERSION})

Expand Down

0 comments on commit a77b328

Please sign in to comment.