2006-01-04 23:14:09 +03:00
|
|
|
# Pick a configuration file
|
|
|
|
SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
|
|
|
|
IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
|
|
|
|
SET(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
|
|
|
|
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
|
|
|
|
|
|
|
|
# Macro for setting values if a user did not overwrite them
|
|
|
|
MACRO(cpack_set_if_not_set name value)
|
2006-01-09 19:26:31 +03:00
|
|
|
IF(NOT DEFINED "${name}")
|
2006-01-04 23:14:09 +03:00
|
|
|
SET(${name} "${value}")
|
2006-01-09 19:26:31 +03:00
|
|
|
ENDIF(NOT DEFINED "${name}")
|
2006-01-04 23:14:09 +03:00
|
|
|
ENDMACRO(cpack_set_if_not_set)
|
|
|
|
|
|
|
|
# Set the package name
|
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
|
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MINOR "1")
|
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_VERSION_PATCH "1")
|
2006-02-23 17:38:40 +03:00
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_VERSION
|
|
|
|
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
2006-01-04 23:14:09 +03:00
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_VENDOR "Humanity")
|
2006-01-10 02:20:02 +03:00
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
|
|
|
"${PROJECT_NAME} built using CMake")
|
2006-02-28 22:18:13 +03:00
|
|
|
|
2006-01-10 02:20:02 +03:00
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE
|
|
|
|
"${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
|
2006-02-28 22:18:13 +03:00
|
|
|
cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE
|
|
|
|
"${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
|
|
|
|
cpack_set_if_not_set(CPACK_RESOURCE_FILE_README
|
|
|
|
"${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
|
|
|
|
cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
|
|
|
|
"${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")
|
2006-01-04 23:14:09 +03:00
|
|
|
|
|
|
|
# <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
|
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
|
2006-01-10 02:20:02 +03:00
|
|
|
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}")
|
2006-02-23 17:38:40 +03:00
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY
|
|
|
|
"${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
|
|
|
|
cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
|
|
|
|
"${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
|
2006-01-04 23:14:09 +03:00
|
|
|
|
2006-02-28 22:18:13 +03:00
|
|
|
MACRO(cpack_check_file_exists file description)
|
|
|
|
IF(NOT EXISTS "${file}")
|
|
|
|
MESSAGE(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.")
|
|
|
|
ENDIF(NOT EXISTS "${file}")
|
|
|
|
ENDMACRO(cpack_check_file_exists)
|
|
|
|
cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description")
|
|
|
|
cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}" "license resource")
|
|
|
|
cpack_check_file_exists("${CPACK_RESOURCE_FILE_README}" "readme resource")
|
|
|
|
cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}" "welcome resource")
|
2006-01-04 23:14:09 +03:00
|
|
|
|
|
|
|
# Pick a generator
|
|
|
|
IF(NOT CPACK_GENERATOR)
|
|
|
|
IF(UNIX)
|
|
|
|
IF(APPLE)
|
|
|
|
SET(CPACK_GENERATOR "PackageMaker")
|
|
|
|
ELSE(APPLE)
|
2006-02-23 17:38:40 +03:00
|
|
|
SET(CPACK_GENERATOR "STGZ")
|
2006-01-04 23:14:09 +03:00
|
|
|
ENDIF(APPLE)
|
|
|
|
ELSE(UNIX)
|
|
|
|
SET(CPACK_GENERATOR "NSIS")
|
|
|
|
ENDIF(UNIX)
|
|
|
|
ENDIF(NOT CPACK_GENERATOR)
|
|
|
|
|
|
|
|
# Set some other variables
|
|
|
|
SET(CPACK_BINARY_DIR "${CMAKE_BINARY_DIR}")
|
|
|
|
|
2006-01-11 19:08:15 +03:00
|
|
|
# Hack for Visual Studio support
|
|
|
|
# Search for system runtime libraries based on the platform. This is
|
|
|
|
# not complete because it is used only for the release process by the
|
|
|
|
# developers.
|
2006-02-23 17:38:40 +03:00
|
|
|
IF(NOT CPACK_DISABLE_EXTRA_MSVC_LIBRARIES)
|
|
|
|
IF(MSVC)
|
|
|
|
STRING(REGEX REPLACE "\\\\" "/" SYSTEMROOT "$ENV{SYSTEMROOT}")
|
|
|
|
FOREACH(lib
|
|
|
|
"${SYSTEMROOT}/system32/mfc71.dll"
|
|
|
|
"${SYSTEMROOT}/system32/msvcp71.dll"
|
|
|
|
"${SYSTEMROOT}/system32/msvcr71.dll"
|
|
|
|
)
|
|
|
|
IF(EXISTS ${lib})
|
|
|
|
SET(CMake_INSTALL_SYSTEM_RUNTIME_LIBS
|
|
|
|
${CMake_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
|
|
|
|
ENDIF(EXISTS ${lib})
|
|
|
|
ENDFOREACH(lib)
|
|
|
|
ENDIF(MSVC)
|
|
|
|
ENDIF(NOT CPACK_DISABLE_EXTRA_MSVC_LIBRARIES)
|
2006-01-11 19:08:15 +03:00
|
|
|
|
|
|
|
# Include system runtime libraries in the installation if any are
|
|
|
|
# specified by CMake_INSTALL_SYSTEM_RUNTIME_LIBS.
|
|
|
|
IF(CMake_INSTALL_SYSTEM_RUNTIME_LIBS)
|
|
|
|
IF(WIN32)
|
|
|
|
INSTALL_PROGRAMS(/bin ${CMake_INSTALL_SYSTEM_RUNTIME_LIBS})
|
|
|
|
ELSE(WIN32)
|
|
|
|
INSTALL_PROGRAMS(/lib ${CMake_INSTALL_SYSTEM_RUNTIME_LIBS})
|
|
|
|
ENDIF(WIN32)
|
|
|
|
ENDIF(CMake_INSTALL_SYSTEM_RUNTIME_LIBS)
|
|
|
|
|
2006-02-27 18:58:20 +03:00
|
|
|
SET(_CPACK_UNUSED_VARIABLES_)
|
|
|
|
GET_CMAKE_PROPERTY(res VARIABLES)
|
|
|
|
FOREACH(var ${res})
|
|
|
|
IF("xxx${var}" MATCHES "xxxCPACK")
|
|
|
|
SET(_CPACK_OTHER_VARIABLES_
|
|
|
|
"${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
|
|
|
|
ENDIF("xxx${var}" MATCHES "xxxCPACK")
|
|
|
|
ENDFOREACH(var ${res})
|
|
|
|
|
2006-01-04 23:14:09 +03:00
|
|
|
CONFIGURE_FILE("${cpack_input_file}" "${CMAKE_BINARY_DIR}/CPackConfig.cmake" @ONLY IMMEDIATE)
|