From: ThorstenB Date: Wed, 30 Nov 2011 18:56:44 +0000 (+0100) Subject: Set correct installation folder for documentation X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f35685471242981cbd8a2b6a867f723102bdd626;p=flightgear.git Set correct installation folder for documentation Also fix build when ".gitignore" is absent (i.e. building a cleaned tar-ball). --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 725d8134c..bb023c0e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,16 @@ include (CheckCSourceCompiles) include (CheckCXXSourceCompiles) include (CheckIncludeFile) - project(FlightGear) +if(${CMAKE_VERSION} VERSION_GREATER 2.8.4) + # use official include provided by latest CMake + include(GNUInstallDirs) +else(${CMAKE_VERSION} VERSION_GREATER 2.8.4) + # backward compatibility: use our own module for older cmake versions + include(OldGNUInstallDirs) +endif(${CMAKE_VERSION} VERSION_GREATER 2.8.4) + set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows") set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") @@ -18,9 +25,15 @@ file(READ version versionFile) string(STRIP ${versionFile} FLIGHTGEAR_VERSION) #packaging +if(EXISTS ${PROJECT_SOURCE_DIR}/.gitignore) + file(READ .gitignore CPACK_SOURCE_IGNORE_FILES) +else() + # clean tar-balls do not contain SCM (.git/.gitignore/...) files. + set(CPACK_SOURCE_IGNORE_FILES + "^${PROJECT_SOURCE_DIR}/.git;\\\\.gitignore;Makefile.am;~$;${CPACK_SOURCE_IGNORE_FILES}") +endif() # split version string into components, note CMAKE_MATCH_0 is the entire regexp match -file(READ .gitignore CPACK_SOURCE_IGNORE_FILES) string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" CPACK_PACKAGE_VERSION ${FLIGHTGEAR_VERSION} ) set(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1}) set(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2}) @@ -30,8 +43,6 @@ SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README") set(CPACK_SOURCE_GENERATOR TBZ2 ZIP) set(CPACK_SOURCE_PACKAGE_FILE_NAME "flightgear-${FLIGHTGEAR_VERSION}" CACHE INTERNAL "tarball basename") -#set(CPACK_SOURCE_IGNORE_FILES -# "^${PROJECT_SOURCE_DIR}/.git;\\\\.gitignore;Makefile.am;~$;${CPACK_SOURCE_IGNORE_FILES}") include (CPack) @@ -304,7 +315,7 @@ set (INSTALL_DOCS README.OSG README.SimGear) -INSTALL(FILES ${INSTALL_DOCS} DESTINATION doc OPTIONAL) +INSTALL(FILES ${INSTALL_DOCS} DESTINATION ${CMAKE_INSTALL_DOCDIR} OPTIONAL) #----------------------------------------------------------------------------- ### uninstall target