Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extraction of version number if sources are inside another Git repository #1362

Merged
merged 4 commits into from
Dec 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions cmake/NestVersionInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,29 @@


macro(get_version_info)
execute_process(
COMMAND "git" "rev-parse" "--short" "HEAD"
OUTPUT_VARIABLE NEST_VERSION_GITHASH
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)

execute_process(
COMMAND "git" "rev-parse" "--abbrev-ref" "HEAD"
OUTPUT_VARIABLE NEST_VERSION_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
execute_process(
COMMAND "git" "rev-parse" "--short" "HEAD"
OUTPUT_VARIABLE NEST_VERSION_GITHASH
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)

if (NEST_VERSION_SUFFIX)
set(versionsuffix "-${NEST_VERSION_SUFFIX}")
endif()
execute_process(
COMMAND "git" "rev-parse" "--abbrev-ref" "HEAD"
OUTPUT_VARIABLE NEST_VERSION_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)

if (NEST_VERSION_SUFFIX)
set(versionsuffix "-${NEST_VERSION_SUFFIX}")
endif()

if (NEST_VERSION_GITHASH)
set(githash "@${NEST_VERSION_GITHASH}")
if (NEST_VERSION_GITHASH)
set(githash "@${NEST_VERSION_GITHASH}")
endif()
endif()

if (NOT NEST_VERSION_BRANCH)
Expand Down