From 18e2eb1ad59db93f575bf9199d9f361c05161e70 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 23 Oct 2013 19:48:06 +0200 Subject: integrate Git version in the titlebar Signed-off-by: Stanislaw Halik --- CMakeLists.txt | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index d374f0ae..7a1cb8b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,12 @@ project(opentrack) cmake_minimum_required(VERSION 2.8) set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake/") +include(GetGitRevisionDescription) +find_package(Git QUIET) +if(GIT_FOUND) + git_describe(OPENTRACK__COMMIT --tags --always) +endif() + SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) SET(CMAKE_SKIP_INSTALL_RPATH FALSE) @@ -25,11 +31,11 @@ if(CMAKE_COMPILER_IS_GNUCXX) add_definitions(-std=c++11) endif() -if(WIN32 AND MSVC) +if(WIN32) set(SDK_GOOGLE_BREAKPAD "" CACHE PATH "google-breakpad for crash reporting") endif() -if(SDK_GOOGLE_BREAKPAD AND MSVC) +if(SDK_GOOGLE_BREAKPAD AND WIN32) add_definitions(-DOPENTRACK_BREAKPAD) include_directories("${SDK_GOOGLE_BREAKPAD}/src/client/windows/handler") include_directories("${SDK_GOOGLE_BREAKPAD}/src/") @@ -566,6 +572,7 @@ endif() target_link_libraries(opentrack-qxt-mini ${MY_QT_LIBS}) endif() add_executable(opentrack ${opentrack-win32-executable} ${opentrack-bin-c} ${opentrack-bin-moc} ${opentrack-bin-uih} ${opentrack-bin-rcc}) + set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") if(UNIX) target_link_libraries(opentrack opentrack-qxt-mini) endif() @@ -589,10 +596,15 @@ endif() if(NOT WIN32) target_link_libraries(opentrack dl) endif() - if(SDK_GOOGLE_BREAKPAD AND MSVC) - target_link_libraries(opentrack "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/crash_generation_client.lib" - "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/exception_handler.lib" - "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/common.lib") + if(SDK_GOOGLE_BREAKPAD) + if(MSVC) + target_link_libraries(opentrack "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/crash_generation_client.lib" + "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/exception_handler.lib" + "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/common.lib") + else() + target_link_libraries(opentrack "${SDK_GOOGLE_BREAKPAD}/lib/libbreakpad_client.a" + "${SDK_GOOGLE_BREAKPAD}/lib/libbreakpad.a") + endif() endif() set_target_properties(opentrack PROPERTIES COMPILE_FLAGS -DOPENTRACK_MAIN) endif() -- cgit v1.2.3