Skip to content

Commit

Permalink
cmake: Fix version determination: run git from sources directory
Browse files Browse the repository at this point in the history
If build directory is outside of the sources directory then
the version of product will be determined.
  • Loading branch information
dmitryash committed Jun 24, 2014
1 parent fdb7fb0 commit 1fab41d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ endif()
if(NOT SOURCE_PACKAGE)
message("-- Determining version")
EXECUTE_PROCESS(COMMAND git describe --tags HEAD #OUTPUT_VARIABLE PROJECT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND sed "s,^release-,,;s,-,+,;s,-,~,;" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE PROJECT_VERSION)
COMMAND sed "s,^release-,,;s,-,+,;s,-,~,;" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE PROJECT_VERSION
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cmake.cmake" "${CMAKE_CURRENT_BINARY_DIR}/version.cmake" @ONLY)
else(NOT SOURCE_PACKAGE)
include(cmake/version.cmake)
Expand Down

0 comments on commit 1fab41d

Please sign in to comment.