Commit c823f04e authored by Konstantin Podsvirov's avatar Konstantin Podsvirov Committed by Brad King

CMake: New option CMake_INSTALL_COMPONENTS

By default is OFF.
Now it's used with CPack IFW himself installer.
parent 7383e4d7
......@@ -66,34 +66,40 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
endif()
# Components
set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack)
list(APPEND _CPACK_IFW_COMPONENTS_ALL data)
if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME
${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
else()
set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified)
endif()
list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME})
string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}"
_CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME)
if(BUILD_CursesDialog)
list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake)
endif()
if(BUILD_QtDialog)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui)
endif()
if(SPHINX_MAN)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man)
endif()
if(SPHINX_HTML)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html)
endif()
if(SPHINX_SINGLEHTML)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml)
endif()
if(SPHINX_QTHELP)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp)
if(CMake_INSTALL_COMPONENTS)
set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack)
if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME
${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
else()
set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified)
endif()
list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME})
string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}"
_CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME)
if(BUILD_CursesDialog)
list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake)
endif()
if(BUILD_QtDialog)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui)
endif()
if(SPHINX_MAN)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man)
endif()
if(SPHINX_HTML)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html)
endif()
if(SPHINX_SINGLEHTML)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml)
endif()
if(SPHINX_QTHELP)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp)
endif()
set(_CPACK_IFW_COMPONENTS_CONFIGURATION "
# Components
set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\")
set(CPACK_COMPONENTS_GROUPING IGNORE)
")
endif()
# Components scripts configuration
......@@ -107,9 +113,23 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
set(_CPACK_IFW_PACKAGE_ICON
"set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")")
if(BUILD_QtDialog)
set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n")
endif()
if(SPHINX_HTML)
set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n")
endif()
configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in"
"${CMake_BINARY_DIR}/installscript.qs" @ONLY
)
install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html"
DESTINATION "${CMAKE_DOC_DIR}"
)
if(CMake_INSTALL_COMPONENTS)
set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/CMake.qs")
else()
set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/installscript.qs")
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
......
......@@ -32,6 +32,7 @@ endif()
include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL)
if(CPACK_GENERATOR MATCHES "IFW")
# Installer configuration
set(CPACK_IFW_PACKAGE_TITLE "CMake Build Tool")
set(CPACK_IFW_PRODUCT_URL "http://www.cmake.org")
......@@ -40,17 +41,20 @@ if(CPACK_GENERATOR MATCHES "IFW")
"@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png")
set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT
"@CMake_SOURCE_DIR@/Source/QtIFW/controlscript.qs")
# Uninstaller configuration
set(CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "cmake-maintenance")
# Package configuration group
set(CPACK_IFW_PACKAGE_GROUP CMake)
# Components
set(CPACK_COMPONENTS_ALL "@_CPACK_IFW_COMPONENTS_ALL@")
set(CPACK_COMPONENTS_GROUPING IGNORE)
@_CPACK_IFW_COMPONENTS_CONFIGURATION@
# Unspecified
set(CPACK_IFW_COMPONENT_@_CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME@_VERSION
"@_CPACK_IFW_PACKAGE_VERSION@")
# Package configuration group
set(CPACK_IFW_PACKAGE_GROUP CMake)
# Group configuration
# CMake
set(CPACK_COMPONENT_GROUP_CMAKE_DISPLAY_NAME
"@CPACK_PACKAGE_NAME@")
set(CPACK_COMPONENT_GROUP_CMAKE_DESCRIPTION
......@@ -59,32 +63,48 @@ if(CPACK_GENERATOR MATCHES "IFW")
"@_CPACK_IFW_PACKAGE_VERSION@")
set(CPACK_IFW_COMPONENT_GROUP_CMAKE_LICENSES
"@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@")
set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT "@CMake_BINARY_DIR@/CMake.qs")
set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT "@_CPACK_IFW_PACKAGE_SCRIPT@")
set(CPACK_IFW_COMPONENT_GROUP_CMAKE_PRIORITY 100)
# Tools
set(CPACK_COMPONENT_GROUP_TOOLS_DISPLAY_NAME "Command-Line Tools")
set(CPACK_COMPONENT_GROUP_TOOLS_DESCRIPTION
"Command-Line Tools: cmake, ctest and cpack")
set(CPACK_COMPONENT_GROUP_TOOLS_PARENT_GROUP CMake)
set(CPACK_IFW_COMPONENT_GROUP_TOOLS_PRIORITY 90)
set(CPACK_IFW_COMPONENT_GROUP_TOOLS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
set(CPACK_COMPONENT_CMAKE_DISPLAY_NAME "cmake")
set(CPACK_COMPONENT_CMAKE_DESCRIPTION
"The \"cmake\" executable is the CMake command-line interface")
set(CPACK_COMPONENT_CMAKE_REQUIRED TRUE)
set(CPACK_COMPONENT_CMAKE_GROUP Tools)
set(CPACK_IFW_COMPONENT_CMAKE_NAME "CMake")
set(CPACK_IFW_COMPONENT_CMAKE_PRIORITY 89)
set(CPACK_IFW_COMPONENT_CMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
set(CPACK_COMPONENT_CTEST_DISPLAY_NAME "ctest")
set(CPACK_COMPONENT_CTEST_DESCRIPTION
"The \"ctest\" executable is the CMake test driver program")
set(CPACK_COMPONENT_CTEST_REQUIRED TRUE)
set(CPACK_COMPONENT_CTEST_GROUP Tools)
set(CPACK_IFW_COMPONENT_CTEST_NAME "CTest")
set(CPACK_IFW_COMPONENT_CTEST_PRIORITY 88)
set(CPACK_IFW_COMPONENT_CTEST_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
set(CPACK_COMPONENT_CPACK_DISPLAY_NAME "cpack")
set(CPACK_COMPONENT_CPACK_DESCRIPTION
"The \"cpack\" executable is the CMake packaging program")
set(CPACK_COMPONENT_CPACK_REQUIRED TRUE)
set(CPACK_COMPONENT_CPACK_GROUP Tools)
set(CPACK_IFW_COMPONENT_CPACK_NAME "CPack")
set(CPACK_IFW_COMPONENT_CPACK_PRIORITY 87)
set(CPACK_IFW_COMPONENT_CPACK_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
# Dialogs
set(CPACK_COMPONENT_GROUP_DIALOGS_DISPLAY_NAME "Interactive Dialogs")
set(CPACK_COMPONENT_GROUP_DIALOGS_DESCRIPTION
"Interactive Dialogs with Console and GUI interfaces")
set(CPACK_COMPONENT_GROUP_DIALOGS_PARENT_GROUP CMake)
set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_PRIORITY 80)
set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
......@@ -101,17 +121,10 @@ if(CPACK_GENERATOR MATCHES "IFW")
set(CPACK_IFW_COMPONENT_CCMAKE_NAME "CursesGUI")
set(CPACK_IFW_COMPONENT_CCMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
# Data
set(CPACK_COMPONENT_DATA_DISPLAY_NAME "Data")
set(CPACK_COMPONENT_DATA_DESCRIPTION
"CMake data files (help, modules and templates)")
set(CPACK_COMPONENT_DATA_GROUP CMake)
set(CPACK_IFW_COMPONENT_DATA_PRIORITY 70)
set(CPACK_IFW_COMPONENT_DATA_NAME "Data")
set(CPACK_IFW_COMPONENT_DATA_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
# Documentation
set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DISPLAY_NAME "Documentation")
set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
"CMake Documentation in different formats (html, man, qch)")
set(CPACK_COMPONENT_GROUP_DOCUMENTATION_PARENT_GROUP CMake)
set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_PRIORITY 60)
set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_VERSION
......@@ -119,6 +132,7 @@ if(CPACK_GENERATOR MATCHES "IFW")
set(CPACK_COMPONENT_SPHINX-MAN_DISPLAY_NAME "man")
set(CPACK_COMPONENT_SPHINX-MAN_GROUP Documentation)
set(CPACK_COMPONENT_SPHINX-MAN_DISABLED TRUE)
set(CPACK_IFW_COMPONENT_SPHINX-MAN_NAME "SphinxMan")
set(CPACK_IFW_COMPONENT_SPHINX-MAN_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
......@@ -131,12 +145,14 @@ if(CPACK_GENERATOR MATCHES "IFW")
set(CPACK_COMPONENT_SPHINX-SINGLEHTML_DISPLAY_NAME "Single HTML")
set(CPACK_COMPONENT_SPHINX-SINGLEHTML_GROUP Documentation)
set(CPACK_COMPONENT_SPHINX-SINGLEHTML_DISABLED TRUE)
set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_NAME "SphinxSingleHTML")
set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_VERSION
"@_CPACK_IFW_PACKAGE_VERSION@")
set(CPACK_COMPONENT_SPHINX-QTHELP_DISPLAY_NAME "Qt Compressed Help")
set(CPACK_COMPONENT_SPHINX-QTHELP_GROUP Documentation)
set(CPACK_COMPONENT_SPHINX-QTHELP_DISABLED TRUE)
set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_NAME "SphinxQtHelp")
set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
......
......@@ -59,6 +59,17 @@ if(CMAKE_ENCODING_UTF8)
set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8)
endif()
# option to use COMPONENT with install command
option(CMake_INSTALL_COMPONENTS "Using components when installing" OFF)
mark_as_advanced(CMake_INSTALL_COMPONENTS)
macro(CMake_OPTIONAL_COMPONENT NAME)
if(CMake_INSTALL_COMPONENTS)
set(COMPONENT COMPONENT ${NAME})
else()
set(COMPONENT)
endif()
endmacro()
#-----------------------------------------------------------------------
# a macro to deal with system libraries, implemented as a macro
# simply to improve readability of the main script
......@@ -652,7 +663,6 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
COMPONENT data
PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
......
......@@ -743,7 +743,8 @@ if(APPLE)
endif()
foreach(_tool ${_tools})
install(TARGETS ${_tool} DESTINATION bin COMPONENT ${_tool})
CMake_OPTIONAL_COMPONENT(${_tool})
install(TARGETS ${_tool} DESTINATION bin ${COMPONENT})
endforeach()
install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include)
......@@ -47,4 +47,5 @@ else()
target_link_libraries(ccmake cmForm)
endif()
install(TARGETS ccmake DESTINATION bin COMPONENT ccmake)
CMake_OPTIONAL_COMPONENT(ccmake)
install(TARGETS ccmake DESTINATION bin ${COMPONENT})
......@@ -14,6 +14,7 @@ project(QtDialog)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) # Drop when CMake >= 2.8.11 required
endif()
CMake_OPTIONAL_COMPONENT(cmake-gui)
find_package(Qt5Widgets QUIET)
if (Qt5Widgets_FOUND)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
......@@ -48,7 +49,7 @@ if (Qt5Widgets_FOUND)
set(_qt_plugin_dest "PlugIns/${_qt_plugin_type}")
install(FILES "${_qt_plugin_path}"
DESTINATION "${_qt_plugin_dest}"
COMPONENT cmake-gui)
${COMPONENT})
set(${_qt_plugins_var}
"${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}")
else()
......@@ -60,7 +61,7 @@ if (Qt5Widgets_FOUND)
"[Paths]\nPlugins = PlugIns\n")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources"
COMPONENT cmake-gui)
${COMPONENT})
endif()
if(WIN32 AND TARGET Qt5::Core)
......@@ -133,7 +134,7 @@ endif()
if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL)
install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt
DESTINATION ${CMAKE_DATA_DIR}/Licenses
COMPONENT cmake-gui)
${COMPONENT})
set_property(SOURCE CMakeSetupDialog.cxx
PROPERTY COMPILE_DEFINITIONS CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL)
endif()
......@@ -166,10 +167,10 @@ if(APPLE)
)
endif()
set(CMAKE_INSTALL_DESTINATION_ARGS
BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT cmake-gui)
BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" ${COMPONENT})
install(TARGETS cmake-gui
RUNTIME DESTINATION bin COMPONENT cmake-gui
RUNTIME DESTINATION bin ${COMPONENT}
${CMAKE_INSTALL_DESTINATION_ARGS})
if(UNIX AND NOT APPLE)
......@@ -177,7 +178,7 @@ if(UNIX AND NOT APPLE)
install(
FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png"
DESTINATION "share/icons/hicolor/${size}x${size}/apps"
COMPONENT cmake-gui
${COMPONENT}
RENAME "CMakeSetup.png")
endforeach ()
......@@ -185,17 +186,17 @@ if(UNIX AND NOT APPLE)
# with an icon
install(FILES CMake.desktop
DESTINATION share/applications
COMPONENT cmake-gui)
${COMPONENT})
install(FILES cmakecache.xml
DESTINATION share/mime/packages
COMPONENT cmake-gui)
${COMPONENT})
endif()
if(APPLE)
install(CODE "
execute_process(COMMAND ln -s \"../MacOS/CMake\" cmake-gui
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)
" COMPONENT cmake-gui)
" ${COMPONENT})
endif()
if(APPLE OR WIN32)
......@@ -209,7 +210,7 @@ if(APPLE OR WIN32)
include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\")
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\")
" COMPONENT cmake-gui)
" ${COMPONENT})
endif()
set(CMAKE_PACKAGE_QTGUI TRUE)
......
function Component()
{
// default constructor
}
Component.prototype.createOperations = function()
{
// call default implementation to actually install applications!
component.createOperations();
// Create shortcut
if (installer.value("os") === "win") {
@_CPACK_IFW_SHORTCUT_OPTIONAL@
component.addOperation("CreateShortcut",
installer.value("TargetDir") + "/cmake.org.html",
installer.value("StartMenuDir") + "/CMake Web Site.lnk");
component.addOperation("CreateShortcut",
installer.value("TargetDir") + "/cmake-maintenance.exe",
installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk");
}
}
......@@ -153,31 +153,35 @@ if(SPHINX_MAN)
if("x${m}" MATCHES "^x(.+)\\.([1-9])\\.rst$")
set(name "${CMAKE_MATCH_1}")
set(sec "${CMAKE_MATCH_2}")
CMake_OPTIONAL_COMPONENT(sphinx-man)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${name}.${sec}
DESTINATION ${CMAKE_MAN_DIR}/man${sec}
COMPONENT sphinx-man)
${COMPONENT})
endif()
endforeach()
endif()
if(SPHINX_HTML)
CMake_OPTIONAL_COMPONENT(sphinx-html)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
DESTINATION ${CMAKE_DOC_DIR}
COMPONENT sphinx-html
${COMPONENT}
PATTERN .buildinfo EXCLUDE
)
endif()
if(SPHINX_SINGLEHTML)
CMake_OPTIONAL_COMPONENT(sphinx-singlehtml)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/singlehtml
DESTINATION ${CMAKE_DOC_DIR}
COMPONENT sphinx-singlehtml
${COMPONENT}
PATTERN .buildinfo EXCLUDE
)
endif()
if(SPHINX_QTHELP)
CMake_OPTIONAL_COMPONENT(sphinx-qthelp)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake-${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}.qch
DESTINATION ${CMAKE_DOC_DIR} COMPONENT sphinx-qthelp
DESTINATION ${CMAKE_DOC_DIR} ${COMPONENT}
)
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment