diff --git a/CMakeLists.txt b/CMakeLists.txt index 2da2eca0b..44ff8ffa3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,12 +42,17 @@ set(CPACK_PACKAGE_CONTACT "Icinga Development Team") set(CPACK_PACKAGE_VERSION ${ICINGA2_VERSION}) set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt") set(CPACK_WIX_UPGRADE_GUID "68C75073-7CEF-4FC9-8DA5-581758729696") +set(CPACK_SOURCE_IGNORE_FILES "/.git/") include(CPack) include(GetGitRevisionDescription) -set(GIT_VERSION ${CPACK_PACKAGE_VERSION}) git_describe(GIT_VERSION --tags) -configure_file(icinga-version.h.cmake icinga-version.h) +if(GIT_VERSION MATCHES "-NOTFOUND$") + configure_file(icinga-version.h.fallback ${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h COPYONLY) +else() + configure_file(icinga-version.h.cmake icinga-version.h) + configure_file(${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h ${CMAKE_CURRENT_SOURCE_DIR}/icinga-version.h.fallback COPYONLY) +endif() if(WIN32) set(Boost_USE_STATIC_LIBS ON)