1
0
Fork 0

Set correct installation folder for documentation

Also fix build when ".gitignore" is absent (i.e. building a
cleaned tar-ball).
This commit is contained in:
ThorstenB 2011-11-30 19:56:44 +01:00
parent f054f15693
commit f356854712

View file

@ -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