Skip to content

Commit

Permalink
Use application version from version.txt if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Oct 9, 2016
1 parent 13d52b5 commit 9ce04f6
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions CMakeLists.txt
Expand Up @@ -71,22 +71,33 @@ if(WITH_TESTS)
endif()
endif()

find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND
"${GIT_EXECUTABLE}" describe
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE copyq_git_describe_result
OUTPUT_VARIABLE copyq_git_describe_output
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(copyq_git_describe_result EQUAL 0)
message(STATUS "Building CopyQ version ${copyq_git_describe_output}.")
add_definitions( -DCOPYQ_VERSION="${copyq_git_describe_output}" )
# Get application version.
if (EXISTS "version.txt")
file(STRINGS "version.txt" copyq_version)
endif()

if (NOT copyq_version)
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND
"${GIT_EXECUTABLE}" describe
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE copyq_git_describe_result
OUTPUT_VARIABLE copyq_git_describe_output
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(copyq_git_describe_result EQUAL 0)
set(copyq_version "${copyq_git_describe_output}")
endif()
endif()
endif()

if (copyq_version)
message(STATUS "Building CopyQ version ${copyq_version}.")
add_definitions( -DCOPYQ_VERSION="${copyq_version}" )
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(FILES ${copyq_ICON_NORMAL} DESTINATION ${ICON_INSTALL_PREFIX} RENAME copyq-normal.svg)
install(FILES ${copyq_ICON_BUSY} DESTINATION ${ICON_INSTALL_PREFIX} RENAME copyq-busy.svg)
Expand Down

0 comments on commit 9ce04f6

Please sign in to comment.