diff options
73 files changed, 2160 insertions, 1218 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c40bc26..93822ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -325,6 +325,7 @@ MACRO (CMAKE_BUILD_UTILITIES) IF(NOT LibArchive_FOUND) MESSAGE(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!") ENDIF() + SET(CMAKE_TAR_INCLUDES ${LibArchive_INCLUDE_DIRS}) SET(CMAKE_TAR_LIBRARIES ${LibArchive_LIBRARIES}) ELSE(CMAKE_USE_SYSTEM_LIBARCHIVE) SET(HAVE_LIBZ 1) diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index fbcdc98..a756e64 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -32,14 +32,20 @@ MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines SET(${_resultIncludeDirs}) SET(_gccOutput) FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n" ) - EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -v -E -x ${_lang} -dD dummy + + IF (${_lang} STREQUAL "c++") + SET(_compilerExecutable "${CMAKE_CXX_COMPILER}") + ELSE (${_lang} STREQUAL "c++") + SET(_compilerExecutable "${CMAKE_C_COMPILER}") + ENDIF (${_lang} STREQUAL "c++") + EXECUTE_PROCESS(COMMAND ${_compilerExecutable} -v -E -x ${_lang} -dD dummy WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles ERROR_VARIABLE _gccOutput OUTPUT_VARIABLE _gccStdout ) FILE(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy") # First find the system include dirs: - IF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" ) + IF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+ *\n) *End of (search) list" ) # split the output into lines and then remove leading and trailing spaces from each of them: STRING(REGEX MATCHALL "[^\n]+\n" _includeLines "${CMAKE_MATCH_1}") @@ -48,7 +54,7 @@ MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines LIST(APPEND ${_resultIncludeDirs} "${_includePath}") ENDFOREACH(nextLine) - ENDIF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" ) + ENDIF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+ *\n) *End of (search) list" ) # now find the builtin macros: diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 797ee57..bf52b25 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -11,13 +11,7 @@ # For certain kinds of binary installers (including the graphical # installers on Mac OS X and Windows), CPack generates installers that # allow users to select individual application components to -# install. The contents of each of the components are identified by -# the COMPONENT argument of CMake's INSTALL command. These components -# can be annotated with user-friendly names and descriptions, -# inter-component dependencies, etc., and grouped in various ways to -# customize the resulting installer. See the cpack_add_* commands, -# described below, for more information about component-specific -# installations. +# install. See CPackComponent module for that. # # The CPACK_GENERATOR variable has different meanings in different # contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a @@ -183,93 +177,6 @@ # automatically detected command (or specify its location if the # auto-detection fails to find it.) # -# Installers built on Mac OS X using the Bundle generator use the -# aforementioned DragNDrop variables, plus the following Bundle-specific -# parameters: -# -# CPACK_BUNDLE_NAME - The name of the generated bundle. This -# appears in the OSX finder as the bundle name. Required. -# -# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used -# as the Info.plist for the generated bundle. This assumes that -# the caller has generated or specified their own Info.plist file. -# Required. -# -# CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as -# the icon for the generated bundle. This is the icon that appears -# in the OSX finder for the bundle, and in the OSX dock when the -# bundle is opened. Required. -# -# CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that -# will be run whenever an end-user double-clicks the generated bundle -# in the OSX Finder. Optional. -# -# The following variables are specific to the graphical installers built -# on Windows using the Nullsoft Installation System. -# -# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when -# installing this project. -# -# CPACK_NSIS_INSTALL_ROOT - The default installation directory presented -# to the end user by the NSIS installer is under this root dir. The full -# directory presented to the end user is: -# ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY} -# -# CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated -# install program. -# -# CPACK_NSIS_MUI_UNIICON - The icon file (.ico) for the generated -# uninstall program. -# -# CPACK_PACKAGE_ICON - A branding image that will be displayed inside -# the installer. -# -# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that will -# be added to the install Section. -# -# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra NSIS commands that will -# be added to the uninstall Section. -# -# CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the -# NSIS SetCompressor command. -# -# CPACK_NSIS_MODIFY_PATH - If this is set to "ON", then an extra page -# will appear in the installer that will allow the user to choose -# whether the program directory should be added to the system PATH -# variable. -# -# CPACK_NSIS_DISPLAY_NAME - The display name string that appears in -# the Windows Add/Remove Program control panel -# -# CPACK_NSIS_PACKAGE_NAME - The title displayed at the top of the -# installer. -# -# CPACK_NSIS_INSTALLED_ICON_NAME - A path to the executable that -# contains the installer icon. -# -# CPACK_NSIS_HELP_LINK - URL to a web site providing assistance in -# installing your application. -# -# CPACK_NSIS_URL_INFO_ABOUT - URL to a web site providing more -# information about your application. -# -# CPACK_NSIS_CONTACT - Contact information for questions and comments -# about the installation process. -# -# CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for -# creating start menu shortcuts. -# -# CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to -# uninstall start menu shortcuts. -# -# CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links -# assumes that they are in 'bin' unless this variable is set. -# For example, you would set this to 'exec' if your executables are -# in an exec directory. -# -# CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option -# to run on the finish page of the NSIS installer. -# # The following variable is specific to installers build on Mac OS X # using PackageMaker: # @@ -310,194 +217,6 @@ # # CPACK_INSTALL_DIRECTORIES - Extra directories to install. # -# Component-specific installation allows users to select specific sets -# of components to install during the install process. Installation -# components are identified by the COMPONENT argument of CMake's -# INSTALL commands, and should be further described by the following -# CPack commands: -# -# cpack_add_component - Describes a CPack installation component -# named by the COMPONENT argument to a CMake INSTALL command. -# -# cpack_add_component(compname -# [DISPLAY_NAME name] -# [DESCRIPTION description] -# [HIDDEN | REQUIRED | DISABLED ] -# [GROUP group] -# [DEPENDS comp1 comp2 ... ] -# [INSTALL_TYPES type1 type2 ... ] -# [DOWNLOADED] -# [ARCHIVE_FILE filename]) -# -# The cmake_add_component command describes an installation -# component, which the user can opt to install or remove as part of -# the graphical installation process. compname is the name of the -# component, as provided to the COMPONENT argument of one or more -# CMake INSTALL commands. -# -# DISPLAY_NAME is the displayed name of the component, used in -# graphical installers to display the component name. This value can -# be any string. -# -# DESCRIPTION is an extended description of the component, used in -# graphical installers to give the user additional information about -# the component. Descriptions can span multiple lines using "\n" as -# the line separator. Typically, these descriptions should be no -# more than a few lines long. -# -# HIDDEN indicates that this component will be hidden in the -# graphical installer, so that the user cannot directly change -# whether it is installed or not. -# -# REQUIRED indicates that this component is required, and therefore -# will always be installed. It will be visible in the graphical -# installer, but it cannot be unselected. (Typically, required -# components are shown greyed out). -# -# DISABLED indicates that this component should be disabled -# (unselected) by default. The user is free to select this component -# for installation, unless it is also HIDDEN. -# -# DEPENDS lists the components on which this component depends. If -# this component is selected, then each of the components listed -# must also be selected. The dependency information is encoded -# within the installer itself, so that users cannot install -# inconsitent sets of components. -# -# GROUP names the component group of which this component is a -# part. If not provided, the component will be a standalone -# component, not part of any component group. Component groups are -# described with the cpack_add_component_group command, detailed -# below. -# -# INSTALL_TYPES lists the installation types of which this component -# is a part. When one of these installations types is selected, this -# component will automatically be selected. Installation types are -# described with the cpack_add_install_type command, detailed below. -# -# DOWNLOADED indicates that this component should be downloaded -# on-the-fly by the installer, rather than packaged in with the -# installer itself. For more information, see the cpack_configure_downloads -# command. -# -# ARCHIVE_FILE provides a name for the archive file created by CPack -# to be used for downloaded components. If not supplied, CPack will -# create a file with some name based on CPACK_PACKAGE_FILE_NAME and -# the name of the component. See cpack_configure_downloads for more -# information. -# -# cpack_add_component_group - Describes a group of related CPack -# installation components. -# -# cpack_add_component_group(groupname -# [DISPLAY_NAME name] -# [DESCRIPTION description] -# [PARENT_GROUP parent] -# [EXPANDED] -# [BOLD_TITLE]) -# -# The cpack_add_component_group describes a group of installation -# components, which will be placed together within the listing of -# options. Typically, component groups allow the user to -# select/deselect all of the components within a single group via a -# single group-level option. Use component groups to reduce the -# complexity of installers with many options. groupname is an -# arbitrary name used to identify the group in the GROUP argument of -# the cpack_add_component command, which is used to place a -# component in a group. The name of the group must not conflict with -# the name of any component. -# -# DISPLAY_NAME is the displayed name of the component group, used in -# graphical installers to display the component group name. This -# value can be any string. -# -# DESCRIPTION is an extended description of the component group, -# used in graphical installers to give the user additional -# information about the components within that group. Descriptions -# can span multiple lines using "\n" as the line -# separator. Typically, these descriptions should be no more than a -# few lines long. -# -# PARENT_GROUP, if supplied, names the parent group of this group. -# Parent groups are used to establish a hierarchy of groups, -# providing an arbitrary hierarchy of groups. -# -# EXPANDED indicates that, by default, the group should show up as -# "expanded", so that the user immediately sees all of the -# components within the group. Otherwise, the group will initially -# show up as a single entry. -# -# BOLD_TITLE indicates that the group title should appear in bold, -# to call the user's attention to the group. -# -# cpack_add_install_type - Add a new installation type containing a -# set of predefined component selections to the graphical installer. -# -# cpack_add_install_type(typename -# [DISPLAY_NAME name]) -# -# The cpack_add_install_type command identifies a set of preselected -# components that represents a common use case for an -# application. For example, a "Developer" install type might include -# an application along with its header and library files, while an -# "End user" install type might just include the application's -# executable. Each component identifies itself with one or more -# install types via the INSTALL_TYPES argument to -# cpack_add_component. -# -# DISPLAY_NAME is the displayed name of the install type, which will -# typically show up in a drop-down box within a graphical -# installer. This value can be any string. -# -# cpack_configure_downloads - Configure CPack to download selected -# components on-the-fly as part of the installation process. -# -# cpack_configure_downloads(site -# [UPLOAD_DIRECTORY dirname] -# [ALL] -# [ADD_REMOVE|NO_ADD_REMOVE]) -# -# The cpack_configure_downloads command configures installation-time -# downloads of selected components. For each downloadable component, -# CPack will create an archive containing the contents of that -# component, which should be uploaded to the given site. When the -# user selects that component for installation, the installer will -# download and extract the component in place. This feature is -# useful for creating small installers that only download the -# requested components, saving bandwidth. Additionally, the -# installers are small enough that they will be installed as part of -# the normal installation process, and the "Change" button in -# Windows Add/Remove Programs control panel will allow one to add or -# remove parts of the application after the original -# installation. On Windows, the downloaded-components functionality -# requires the ZipDLL plug-in for NSIS, available at: -# -# http://nsis.sourceforge.net/ZipDLL_plug-in -# -# On Mac OS X, installers that download components on-the-fly can -# only be built and installed on system using Mac OS X 10.5 or -# later. -# -# The site argument is a URL where the archives for downloadable -# components will reside, e.g., http://www.cmake.org/files/2.6.1/installer/ -# All of the archives produced by CPack should be uploaded to that location. -# -# UPLOAD_DIRECTORY is the local directory where CPack will create the -# various archives for each of the components. The contents of this -# directory should be uploaded to a location accessible by the URL given -# in the site argument. If omitted, CPack will use the directory -# CPackUploads inside the CMake binary directory to store the generated -# archives. -# -# The ALL flag indicates that all components be downloaded. Otherwise, only -# those components explicitly marked as DOWNLOADED or that have a specified -# ARCHIVE_FILE will be downloaded. Additionally, the ALL option implies -# ADD_REMOVE (unless NO_ADD_REMOVE is specified). -# -# ADD_REMOVE indicates that CPack should install a copy of the installer -# that can be called from Windows' Add/Remove Programs dialog (via the -# "Modify" button) to change the set of installed components. NO_ADD_REMOVE -# turns off this behavior. This option is ignored on Mac OS X. #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -512,6 +231,13 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +# Define this var in order to avoid (or warn) concerning multiple inclusion +IF(CPack_CMake_INCLUDED) + MESSAGE(WARNING "CPack.cmake has already been included!!") +ELSE(CPack_CMake_INCLUDED) + SET(CPack_CMake_INCLUDED 1) +ENDIF(CPack_CMake_INCLUDED) + # Pick a configuration file SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in") IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") @@ -522,214 +248,9 @@ IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") SET(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") -# Argument-parsing macro from http://www.cmake.org/Wiki/CMakeMacroParseArguments -MACRO(cpack_parse_arguments prefix arg_names option_names) - SET(${prefix}_DEFAULT_ARGS) - FOREACH(arg_name ${arg_names}) - SET(${prefix}_${arg_name}) - ENDFOREACH(arg_name) - FOREACH(option ${option_names}) - SET(${prefix}_${option} FALSE) - ENDFOREACH(option) - - SET(current_arg_name DEFAULT_ARGS) - SET(current_arg_list) - FOREACH(arg ${ARGN}) - SET(larg_names ${arg_names}) - LIST(FIND larg_names "${arg}" is_arg_name) - IF (is_arg_name GREATER -1) - SET(${prefix}_${current_arg_name} ${current_arg_list}) - SET(current_arg_name ${arg}) - SET(current_arg_list) - ELSE (is_arg_name GREATER -1) - SET(loption_names ${option_names}) - LIST(FIND loption_names "${arg}" is_option) - IF (is_option GREATER -1) - SET(${prefix}_${arg} TRUE) - ELSE (is_option GREATER -1) - SET(current_arg_list ${current_arg_list} ${arg}) - ENDIF (is_option GREATER -1) - ENDIF (is_arg_name GREATER -1) - ENDFOREACH(arg) - SET(${prefix}_${current_arg_name} ${current_arg_list}) -ENDMACRO(cpack_parse_arguments) - -# Macro that appends a SET command for the given variable name (var) -# to the macro named strvar, but only if the variable named "var" -# has been defined. The string will eventually be appended to a CPack -# configuration file. -MACRO(cpack_append_variable_set_command var strvar) - IF (DEFINED ${var}) - SET(${strvar} "${${strvar}}SET(${var}") - FOREACH(APPENDVAL ${${var}}) - SET(${strvar} "${${strvar}} ${APPENDVAL}") - ENDFOREACH(APPENDVAL) - SET(${strvar} "${${strvar}})\n") - ENDIF (DEFINED ${var}) -ENDMACRO(cpack_append_variable_set_command) - -# Macro that appends a SET command for the given variable name (var) -# to the macro named strvar, but only if the variable named "var" -# has been defined and is a string. The string will eventually be -# appended to a CPack configuration file. -MACRO(cpack_append_string_variable_set_command var strvar) - IF (DEFINED ${var}) - LIST(LENGTH ${var} CPACK_APP_VALUE_LEN) - IF(${CPACK_APP_VALUE_LEN} EQUAL 1) - SET(${strvar} "${${strvar}}SET(${var} \"${${var}}\")\n") - ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1) - ENDIF (DEFINED ${var}) -ENDMACRO(cpack_append_string_variable_set_command) - -# Macro that appends a SET command for the given variable name (var) -# to the macro named strvar, but only if the variable named "var" -# has been set to true. The string will eventually be -# appended to a CPack configuration file. -MACRO(cpack_append_option_set_command var strvar) - IF (${var}) - LIST(LENGTH ${var} CPACK_APP_VALUE_LEN) - IF(${CPACK_APP_VALUE_LEN} EQUAL 1) - SET(${strvar} "${${strvar}}SET(${var} TRUE)\n") - ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1) - ENDIF (${var}) -ENDMACRO(cpack_append_option_set_command) - -# Macro that adds a component to the CPack installer -MACRO(cpack_add_component compname) - STRING(TOUPPER ${compname} CPACK_ADDCOMP_UNAME) - cpack_parse_arguments(CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME} - "DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE" - "HIDDEN;REQUIRED;DISABLED;DOWNLOADED" - ${ARGN} - ) - - if (CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED) - SET(CPACK_ADDCOMP_STR "\n# Configuration for downloaded component \"${compname}\"\n") - else () - SET(CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n") - endif () - - IF(NOT CPACK_MONOLITHIC_INSTALL) - # If the user didn't set CPACK_COMPONENTS_ALL explicitly, update the - # value of CPACK_COMPONENTS_ALL in the configuration file. This will - # take care of any components that have been added after the CPack - # moduled was included. - IF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER) - GET_CMAKE_PROPERTY(CPACK_ADDCOMP_COMPONENTS COMPONENTS) - SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL") - FOREACH(COMP ${CPACK_ADDCOMP_COMPONENTS}) - SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR} ${COMP}") - ENDFOREACH(COMP) - SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR})\n") - ENDIF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER) - ENDIF(NOT CPACK_MONOLITHIC_INSTALL) - - cpack_append_string_variable_set_command( - CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISPLAY_NAME - CPACK_ADDCOMP_STR) - cpack_append_string_variable_set_command( - CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DESCRIPTION - CPACK_ADDCOMP_STR) - cpack_append_variable_set_command( - CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_GROUP - CPACK_ADDCOMP_STR) - cpack_append_variable_set_command( - CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DEPENDS - CPACK_ADDCOMP_STR) - cpack_append_variable_set_command( - CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_INSTALL_TYPES - CPACK_ADDCOMP_STR) - cpack_append_string_variable_set_command( - CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_ARCHIVE_FILE - CPACK_ADDCOMP_STR) - cpack_append_option_set_command( - CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_HIDDEN - CPACK_ADDCOMP_STR) - cpack_append_option_set_command( - CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_REQUIRED - CPACK_ADDCOMP_STR) - cpack_append_option_set_command( - CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISABLED - CPACK_ADDCOMP_STR) - cpack_append_option_set_command( - CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED - CPACK_ADDCOMP_STR) - FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDCOMP_STR}") -ENDMACRO(cpack_add_component) - -# Macro that adds a component group to the CPack installer -MACRO(cpack_add_component_group grpname) - STRING(TOUPPER ${grpname} CPACK_ADDGRP_UNAME) - cpack_parse_arguments(CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME} - "DISPLAY_NAME;DESCRIPTION" - "EXPANDED;BOLD_TITLE" - ${ARGN} - ) - - SET(CPACK_ADDGRP_STR "\n# Configuration for component group \"${grpname}\"\n") - cpack_append_string_variable_set_command( - CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DISPLAY_NAME - CPACK_ADDGRP_STR) - cpack_append_string_variable_set_command( - CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION - CPACK_ADDGRP_STR) - cpack_append_option_set_command( - CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED - CPACK_ADDGRP_STR) - cpack_append_option_set_command( - CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_BOLD_TITLE - CPACK_ADDGRP_STR) - FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDGRP_STR}") -ENDMACRO(cpack_add_component_group) - -# Macro that adds an installation type to the CPack installer -MACRO(cpack_add_install_type insttype) - STRING(TOUPPER ${insttype} CPACK_INSTTYPE_UNAME) - cpack_parse_arguments(CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME} - "DISPLAY_NAME" - "" - ${ARGN} - ) - - SET(CPACK_INSTTYPE_STR - "\n# Configuration for installation type \"${insttype}\"\n") - SET(CPACK_INSTTYPE_STR - "${CPACK_INSTTYPE_STR}LIST(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n") - cpack_append_string_variable_set_command( - CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}_DISPLAY_NAME - CPACK_INSTTYPE_STR) - FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_INSTTYPE_STR}") -ENDMACRO(cpack_add_install_type) - -MACRO(cpack_configure_downloads site) - cpack_parse_arguments(CPACK_DOWNLOAD - "UPLOAD_DIRECTORY" - "ALL;ADD_REMOVE;NO_ADD_REMOVE" - ${ARGN} - ) - - SET(CPACK_CONFIG_DL_STR - "\n# Downloaded components configuration\n") - SET(CPACK_UPLOAD_DIRECTORY ${CPACK_DOWNLOAD_UPLOAD_DIRECTORY}) - SET(CPACK_DOWNLOAD_SITE ${site}) - cpack_append_string_variable_set_command( - CPACK_DOWNLOAD_SITE - CPACK_CONFIG_DL_STR) - cpack_append_string_variable_set_command( - CPACK_UPLOAD_DIRECTORY - CPACK_CONFIG_DL_STR) - cpack_append_option_set_command( - CPACK_DOWNLOAD_ALL - CPACK_CONFIG_DL_STR) - IF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE}) - SET(CPACK_DOWNLOAD_ADD_REMOVE ON) - ENDIF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE}) - SET(CPACK_ADD_REMOVE ${CPACK_DOWNLOAD_ADD_REMOVE}) - cpack_append_option_set_command( - CPACK_ADD_REMOVE - CPACK_CONFIG_DL_STR) - FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_CONFIG_DL_STR}") -ENDMACRO(cpack_configure_downloads) +# Backward compatibility +# Include CPackComponent macros if it has not already been included before. +include(CPackComponent) # Macro for setting values if a user did not overwrite them MACRO(cpack_set_if_not_set name value) @@ -739,7 +260,7 @@ MACRO(cpack_set_if_not_set name value) ENDMACRO(cpack_set_if_not_set) # Macro to encode variables for the configuration file -# find any varable that stars with CPACK and create a variable +# find any variable that starts with CPACK and create a variable # _CPACK_OTHER_VARIABLES_ that contains SET commands for # each cpack variable. _CPACK_OTHER_VARIABLES_ is then # used as an @ replacment in configure_file for the CPackConfig. diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake new file mode 100644 index 0000000..3ac4ea8 --- /dev/null +++ b/Modules/CPackBundle.cmake @@ -0,0 +1,37 @@ +# - CPack Bundle generator (Mac OS X) specific options +# +# Installers built on Mac OS X using the Bundle generator use the +# aforementioned DragNDrop variables, plus the following Bundle-specific +# parameters: +# +# CPACK_BUNDLE_NAME - The name of the generated bundle. This +# appears in the OSX finder as the bundle name. Required. +# +# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used +# as the Info.plist for the generated bundle. This assumes that +# the caller has generated or specified their own Info.plist file. +# Required. +# +# CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as +# the icon for the generated bundle. This is the icon that appears +# in the OSX finder for the bundle, and in the OSX dock when the +# bundle is opened. Required. +# +# CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that +# will be run whenever an end-user double-clicks the generated bundle +# in the OSX Finder. Optional. + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +#Bundle Generator specific code should be put here diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake new file mode 100644 index 0000000..1c10372 --- /dev/null +++ b/Modules/CPackComponent.cmake @@ -0,0 +1,456 @@ +# - Build binary and source package installers +# +# The CPackComponent module is the module which handles +# the component part of CPack. See CPack module for +# general information about CPack. +# +# For certain kinds of binary installers (including the graphical +# installers on Mac OS X and Windows), CPack generates installers that +# allow users to select individual application components to +# install. The contents of each of the components are identified by +# the COMPONENT argument of CMake's INSTALL command. These components +# can be annotated with user-friendly names and descriptions, +# inter-component dependencies, etc., and grouped in various ways to +# customize the resulting installer. See the cpack_add_* commands, +# described below, for more information about component-specific +# installations. +# +# Component-specific installation allows users to select specific sets +# of components to install during the install process. Installation +# components are identified by the COMPONENT argument of CMake's +# INSTALL commands, and should be further described by the following +# CPack commands: +# +# cpack_add_component - Describes a CPack installation component +# named by the COMPONENT argument to a CMake INSTALL command. +# +# cpack_add_component(compname +# [DISPLAY_NAME name] +# [DESCRIPTION description] +# [HIDDEN | REQUIRED | DISABLED ] +# [GROUP group] +# [DEPENDS comp1 comp2 ... ] +# [INSTALL_TYPES type1 type2 ... ] +# [DOWNLOADED] +# [ARCHIVE_FILE filename]) +# +# The cmake_add_component command describes an installation +# component, which the user can opt to install or remove as part of +# the graphical installation process. compname is the name of the +# component, as provided to the COMPONENT argument of one or more +# CMake INSTALL commands. +# +# DISPLAY_NAME is the displayed name of the component, used in +# graphical installers to display the component name. This value can +# be any string. +# +# DESCRIPTION is an extended description of the component, used in +# graphical installers to give the user additional information about +# the component. Descriptions can span multiple lines using "\n" as +# the line separator. Typically, these descriptions should be no +# more than a few lines long. +# +# HIDDEN indicates that this component will be hidden in the +# graphical installer, so that the user cannot directly change +# whether it is installed or not. +# +# REQUIRED indicates that this component is required, and therefore +# will always be installed. It will be visible in the graphical +# installer, but it cannot be unselected. (Typically, required +# components are shown greyed out). +# +# DISABLED indicates that this component should be disabled +# (unselected) by default. The user is free to select this component +# for installation, unless it is also HIDDEN. +# +# DEPENDS lists the components on which this component depends. If +# this component is selected, then each of the components listed +# must also be selected. The dependency information is encoded +# within the installer itself, so that users cannot install +# inconsitent sets of components. +# +# GROUP names the component group of which this component is a +# part. If not provided, the component will be a standalone +# component, not part of any component group. Component groups are +# described with the cpack_add_component_group command, detailed +# below. +# +# INSTALL_TYPES lists the installation types of which this component +# is a part. When one of these installations types is selected, this +# component will automatically be selected. Installation types are +# described with the cpack_add_install_type command, detailed below. +# +# DOWNLOADED indicates that this component should be downloaded +# on-the-fly by the installer, rather than packaged in with the +# installer itself. For more information, see the cpack_configure_downloads +# command. +# +# ARCHIVE_FILE provides a name for the archive file created by CPack +# to be used for downloaded components. If not supplied, CPack will +# create a file with some name based on CPACK_PACKAGE_FILE_NAME and +# the name of the component. See cpack_configure_downloads for more +# information. +# +# cpack_add_component_group - Describes a group of related CPack +# installation components. +# +# cpack_add_component_group(groupname +# [DISPLAY_NAME name] +# [DESCRIPTION description] +# [PARENT_GROUP parent] +# [EXPANDED] +# [BOLD_TITLE]) +# +# The cpack_add_component_group describes a group of installation +# components, which will be placed together within the listing of +# options. Typically, component groups allow the user to +# select/deselect all of the components within a single group via a +# single group-level option. Use component groups to reduce the +# complexity of installers with many options. groupname is an +# arbitrary name used to identify the group in the GROUP argument of +# the cpack_add_component command, which is used to place a +# component in a group. The name of the group must not conflict with +# the name of any component. +# +# DISPLAY_NAME is the displayed name of the component group, used in +# graphical installers to display the component group name. This +# value can be any string. +# +# DESCRIPTION is an extended description of the component group, +# used in graphical installers to give the user additional +# information about the components within that group. Descriptions +# can span multiple lines using "\n" as the line +# separator. Typically, these descriptions should be no more than a +# few lines long. +# +# PARENT_GROUP, if supplied, names the parent group of this group. +# Parent groups are used to establish a hierarchy of groups, +# providing an arbitrary hierarchy of groups. +# +# EXPANDED indicates that, by default, the group should show up as +# "expanded", so that the user immediately sees all of the +# components within the group. Otherwise, the group will initially +# show up as a single entry. +# +# BOLD_TITLE indicates that the group title should appear in bold, +# to call the user's attention to the group. +# +# cpack_add_install_type - Add a new installation type containing a +# set of predefined component selections to the graphical installer. +# +# cpack_add_install_type(typename +# [DISPLAY_NAME name]) +# +# The cpack_add_install_type command identifies a set of preselected +# components that represents a common use case for an +# application. For example, a "Developer" install type might include +# an application along with its header and library files, while an +# "End user" install type might just include the application's +# executable. Each component identifies itself with one or more +# install types via the INSTALL_TYPES argument to +# cpack_add_component. +# +# DISPLAY_NAME is the displayed name of the install type, which will +# typically show up in a drop-down box within a graphical +# installer. This value can be any string. +# +# cpack_configure_downloads - Configure CPack to download selected +# components on-the-fly as part of the installation process. +# +# cpack_configure_downloads(site +# [UPLOAD_DIRECTORY dirname] +# [ALL] +# [ADD_REMOVE|NO_ADD_REMOVE]) +# +# The cpack_configure_downloads command configures installation-time +# downloads of selected components. For each downloadable component, +# CPack will create an archive containing the contents of that +# component, which should be uploaded to the given site. When the +# user selects that component for installation, the installer will +# download and extract the component in place. This feature is +# useful for creating small installers that only download the +# requested components, saving bandwidth. Additionally, the +# installers are small enough that they will be installed as part of +# the normal installation process, and the "Change" button in +# Windows Add/Remove Programs control panel will allow one to add or +# remove parts of the application after the original +# installation. On Windows, the downloaded-components functionality +# requires the ZipDLL plug-in for NSIS, available at: +# +# http://nsis.sourceforge.net/ZipDLL_plug-in +# +# On Mac OS X, installers that download components on-the-fly can +# only be built and installed on system using Mac OS X 10.5 or +# later. +# +# The site argument is a URL where the archives for downloadable +# components will reside, e.g., http://www.cmake.org/files/2.6.1/installer/ +# All of the archives produced by CPack should be uploaded to that location. +# +# UPLOAD_DIRECTORY is the local directory where CPack will create the +# various archives for each of the components. The contents of this +# directory should be uploaded to a location accessible by the URL given +# in the site argument. If omitted, CPack will use the directory +# CPackUploads inside the CMake binary directory to store the generated +# archives. +# +# The ALL flag indicates that all components be downloaded. Otherwise, only +# those components explicitly marked as DOWNLOADED or that have a specified +# ARCHIVE_FILE will be downloaded. Additionally, the ALL option implies +# ADD_REMOVE (unless NO_ADD_REMOVE is specified). +# +# ADD_REMOVE indicates that CPack should install a copy of the installer +# that can be called from Windows' Add/Remove Programs dialog (via the +# "Modify" button) to change the set of installed components. NO_ADD_REMOVE +# turns off this behavior. This option is ignored on Mac OS X. + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Define var in order to avoid multiple inclusion +IF(NOT CPackComponent_CMake_INCLUDED) +SET(CPackComponent_CMake_INCLUDED 1) + +# Argument-parsing macro from http://www.cmake.org/Wiki/CMakeMacroParseArguments +MACRO(cpack_parse_arguments prefix arg_names option_names) + SET(${prefix}_DEFAULT_ARGS) + FOREACH(arg_name ${arg_names}) + SET(${prefix}_${arg_name}) + ENDFOREACH(arg_name) + FOREACH(option ${option_names}) + SET(${prefix}_${option} FALSE) + ENDFOREACH(option) + + SET(current_arg_name DEFAULT_ARGS) + SET(current_arg_list) + FOREACH(arg ${ARGN}) + SET(larg_names ${arg_names}) + LIST(FIND larg_names "${arg}" is_arg_name) + IF (is_arg_name GREATER -1) + SET(${prefix}_${current_arg_name} ${current_arg_list}) + SET(current_arg_name ${arg}) + SET(current_arg_list) + ELSE (is_arg_name GREATER -1) + SET(loption_names ${option_names}) + LIST(FIND loption_names "${arg}" is_option) + IF (is_option GREATER -1) + SET(${prefix}_${arg} TRUE) + ELSE (is_option GREATER -1) + SET(current_arg_list ${current_arg_list} ${arg}) + ENDIF (is_option GREATER -1) + ENDIF (is_arg_name GREATER -1) + ENDFOREACH(arg) + SET(${prefix}_${current_arg_name} ${current_arg_list}) +ENDMACRO(cpack_parse_arguments) + +# Macro that appends a SET command for the given variable name (var) +# to the macro named strvar, but only if the variable named "var" +# has been defined. The string will eventually be appended to a CPack +# configuration file. +MACRO(cpack_append_variable_set_command var strvar) + IF (DEFINED ${var}) + SET(${strvar} "${${strvar}}SET(${var}") + FOREACH(APPENDVAL ${${var}}) + SET(${strvar} "${${strvar}} ${APPENDVAL}") + ENDFOREACH(APPENDVAL) + SET(${strvar} "${${strvar}})\n") + ENDIF (DEFINED ${var}) +ENDMACRO(cpack_append_variable_set_command) + +# Macro that appends a SET command for the given variable name (var) +# to the macro named strvar, but only if the variable named "var" +# has been defined and is a string. The string will eventually be +# appended to a CPack configuration file. +MACRO(cpack_append_string_variable_set_command var strvar) + IF (DEFINED ${var}) + LIST(LENGTH ${var} CPACK_APP_VALUE_LEN) + IF(${CPACK_APP_VALUE_LEN} EQUAL 1) + SET(${strvar} "${${strvar}}SET(${var} \"${${var}}\")\n") + ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1) + ENDIF (DEFINED ${var}) +ENDMACRO(cpack_append_string_variable_set_command) + +# Macro that appends a SET command for the given variable name (var) +# to the macro named strvar, but only if the variable named "var" +# has been set to true. The string will eventually be +# appended to a CPack configuration file. +MACRO(cpack_append_option_set_command var strvar) + IF (${var}) + LIST(LENGTH ${var} CPACK_APP_VALUE_LEN) + IF(${CPACK_APP_VALUE_LEN} EQUAL 1) + SET(${strvar} "${${strvar}}SET(${var} TRUE)\n") + ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1) + ENDIF (${var}) +ENDMACRO(cpack_append_option_set_command) + +# Macro that adds a component to the CPack installer +MACRO(cpack_add_component compname) + STRING(TOUPPER ${compname} CPACK_ADDCOMP_UNAME) + cpack_parse_arguments(CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME} + "DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE" + "HIDDEN;REQUIRED;DISABLED;DOWNLOADED" + ${ARGN} + ) + + if (CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED) + SET(CPACK_ADDCOMP_STR "\n# Configuration for downloaded component \"${compname}\"\n") + else () + SET(CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n") + endif () + + IF(NOT CPACK_MONOLITHIC_INSTALL) + # If the user didn't set CPACK_COMPONENTS_ALL explicitly, update the + # value of CPACK_COMPONENTS_ALL in the configuration file. This will + # take care of any components that have been added after the CPack + # moduled was included. + IF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER) + GET_CMAKE_PROPERTY(CPACK_ADDCOMP_COMPONENTS COMPONENTS) + SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL") + FOREACH(COMP ${CPACK_ADDCOMP_COMPONENTS}) + SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR} ${COMP}") + ENDFOREACH(COMP) + SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR})\n") + ENDIF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER) + ENDIF(NOT CPACK_MONOLITHIC_INSTALL) + + cpack_append_string_variable_set_command( + CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISPLAY_NAME + CPACK_ADDCOMP_STR) + cpack_append_string_variable_set_command( + CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DESCRIPTION + CPACK_ADDCOMP_STR) + cpack_append_variable_set_command( + CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_GROUP + CPACK_ADDCOMP_STR) + cpack_append_variable_set_command( + CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DEPENDS + CPACK_ADDCOMP_STR) + cpack_append_variable_set_command( + CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_INSTALL_TYPES + CPACK_ADDCOMP_STR) + cpack_append_string_variable_set_command( + CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_ARCHIVE_FILE + CPACK_ADDCOMP_STR) + cpack_append_option_set_command( + CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_HIDDEN + CPACK_ADDCOMP_STR) + cpack_append_option_set_command( + CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_REQUIRED + CPACK_ADDCOMP_STR) + cpack_append_option_set_command( + CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISABLED + CPACK_ADDCOMP_STR) + cpack_append_option_set_command( + CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED + CPACK_ADDCOMP_STR) + # Backward compatibility issue. + # Write to config iff the macros is used after CPack.cmake has been + # included, other it's not necessary because the variables + # will be encoded by cpack_encode_variables. + IF(CPack_CMake_INCLUDED) + FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDCOMP_STR}") + ENDIF(CPack_CMake_INCLUDED) +ENDMACRO(cpack_add_component) + +# Macro that adds a component group to the CPack installer +MACRO(cpack_add_component_group grpname) + STRING(TOUPPER ${grpname} CPACK_ADDGRP_UNAME) + cpack_parse_arguments(CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME} + "DISPLAY_NAME;DESCRIPTION" + "EXPANDED;BOLD_TITLE" + ${ARGN} + ) + + SET(CPACK_ADDGRP_STR "\n# Configuration for component group \"${grpname}\"\n") + cpack_append_string_variable_set_command( + CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DISPLAY_NAME + CPACK_ADDGRP_STR) + cpack_append_string_variable_set_command( + CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION + CPACK_ADDGRP_STR) + cpack_append_option_set_command( + CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED + CPACK_ADDGRP_STR) + cpack_append_option_set_command( + CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_BOLD_TITLE + CPACK_ADDGRP_STR) + # Backward compatibility issue. + # Write to config iff the macros is used after CPack.cmake has been + # included, other it's not necessary because the variables + # will be encoded by cpack_encode_variables. + IF(CPack_CMake_INCLUDED) + FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDGRP_STR}") + ENDIF(CPack_CMake_INCLUDED) +ENDMACRO(cpack_add_component_group) + +# Macro that adds an installation type to the CPack installer +MACRO(cpack_add_install_type insttype) + STRING(TOUPPER ${insttype} CPACK_INSTTYPE_UNAME) + cpack_parse_arguments(CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME} + "DISPLAY_NAME" + "" + ${ARGN} + ) + + SET(CPACK_INSTTYPE_STR + "\n# Configuration for installation type \"${insttype}\"\n") + SET(CPACK_INSTTYPE_STR + "${CPACK_INSTTYPE_STR}LIST(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n") + cpack_append_string_variable_set_command( + CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}_DISPLAY_NAME + CPACK_INSTTYPE_STR) + # Backward compatibility issue. + # Write to config iff the macros is used after CPack.cmake has been + # included, other it's not necessary because the variables + # will be encoded by cpack_encode_variables. + IF(CPack_CMake_INCLUDED) + FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_INSTTYPE_STR}") + ENDIF(CPack_CMake_INCLUDED) +ENDMACRO(cpack_add_install_type) + +MACRO(cpack_configure_downloads site) + cpack_parse_arguments(CPACK_DOWNLOAD + "UPLOAD_DIRECTORY" + "ALL;ADD_REMOVE;NO_ADD_REMOVE" + ${ARGN} + ) + + SET(CPACK_CONFIG_DL_STR + "\n# Downloaded components configuration\n") + SET(CPACK_UPLOAD_DIRECTORY ${CPACK_DOWNLOAD_UPLOAD_DIRECTORY}) + SET(CPACK_DOWNLOAD_SITE ${site}) + cpack_append_string_variable_set_command( + CPACK_DOWNLOAD_SITE + CPACK_CONFIG_DL_STR) + cpack_append_string_variable_set_command( + CPACK_UPLOAD_DIRECTORY + CPACK_CONFIG_DL_STR) + cpack_append_option_set_command( + CPACK_DOWNLOAD_ALL + CPACK_CONFIG_DL_STR) + IF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE}) + SET(CPACK_DOWNLOAD_ADD_REMOVE ON) + ENDIF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE}) + SET(CPACK_ADD_REMOVE ${CPACK_DOWNLOAD_ADD_REMOVE}) + cpack_append_option_set_command( + CPACK_ADD_REMOVE + CPACK_CONFIG_DL_STR) + # Backward compatibility issue. + # Write to config iff the macros is used after CPack.cmake has been + # included, other it's not necessary because the variables + # will be encoded by cpack_encode_variables. + IF(CPack_CMake_INCLUDED) + FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_CONFIG_DL_STR}") + ENDIF(CPack_CMake_INCLUDED) +ENDMACRO(cpack_configure_downloads) +ENDIF(NOT CPackComponent_CMake_INCLUDED) diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 469f08f..90c80a4 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -316,6 +316,7 @@ IF(CPACK_DEB_PACKAGE_COMPONENT) SET(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") SET(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "/${CPACK_DEB_PACKAGE_COMPONENT}") SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_DEB_PACKAGE_COMPONENT}") + STRING(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME) ELSE(CPACK_DEB_PACKAGE_COMPONENT) SET(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "") SET(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "") diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake new file mode 100644 index 0000000..d9dab53 --- /dev/null +++ b/Modules/CPackNSIS.cmake @@ -0,0 +1,83 @@ +# - CPack NSIS generator specific options +# +# The following variables are specific to the graphical installers built +# on Windows using the Nullsoft Installation System. +# +# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when +# installing this project. +# +# CPACK_NSIS_INSTALL_ROOT - The default installation directory presented +# to the end user by the NSIS installer is under this root dir. The full +# directory presented to the end user is: +# ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY} +# +# CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated +# install program. +# +# CPACK_NSIS_MUI_UNIICON - The icon file (.ico) for the generated +# uninstall program. +# +# CPACK_PACKAGE_ICON - A branding image that will be displayed inside +# the installer. +# +# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that will +# be added to the install Section. +# +# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra NSIS commands that will +# be added to the uninstall Section. +# +# CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the +# NSIS SetCompressor command. +# +# CPACK_NSIS_MODIFY_PATH - If this is set to "ON", then an extra page +# will appear in the installer that will allow the user to choose +# whether the program directory should be added to the system PATH +# variable. +# +# CPACK_NSIS_DISPLAY_NAME - The display name string that appears in +# the Windows Add/Remove Program control panel +# +# CPACK_NSIS_PACKAGE_NAME - The title displayed at the top of the +# installer. +# +# CPACK_NSIS_INSTALLED_ICON_NAME - A path to the executable that +# contains the installer icon. +# +# CPACK_NSIS_HELP_LINK - URL to a web site providing assistance in +# installing your application. +# +# CPACK_NSIS_URL_INFO_ABOUT - URL to a web site providing more +# information about your application. +# +# CPACK_NSIS_CONTACT - Contact information for questions and comments +# about the installation process. +# +# CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for +# creating start menu shortcuts. +# +# CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to +# uninstall start menu shortcuts. +# +# CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links +# assumes that they are in 'bin' unless this variable is set. +# For example, you would set this to 'exec' if your executables are +# in an exec directory. +# +# CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option +# to run on the finish page of the NSIS installer. + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +#FIXME we should put NSIS specific code here +#FIXME but I'm not doing it because I'm not able to test it... diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index 8f66557..ae869e3 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -1,14 +1,9 @@ -SET(CMAKE_C_VERBOSE_FLAG "-V") +include(Compiler/XL) +__compiler_xl(C) +set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG") +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG") # -qthreaded = Ensures that all optimizations will be thread-safe # -qalias=noansi = Turns off type-based aliasing completely (safer optimizer) # -qhalt=e = Halt on error messages (rather than just severe errors) SET(CMAKE_C_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e") - -SET(CMAKE_C_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_C_FLAGS_RELEASE_INIT "-O -DNDEBUG") -SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG") -SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g") - -SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") -SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 961cfee..29c4b5e 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -1,12 +1,11 @@ -SET(CMAKE_CXX_VERBOSE_FLAG "-V") +include(Compiler/XL) +__compiler_xl(CXX) +set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_CXX_FLAGS_RELEASE_INIT} -DNDEBUG") +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG") -SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_CXX_FLAGS_RELEASE_INIT "-O -DNDEBUG") -SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG") -SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g") +# -qthreaded = Ensures that all optimizations will be thread-safe +# -qhalt=e = Halt on error messages (rather than just severe errors) +SET(CMAKE_CXX_FLAGS_INIT "-qthreaded -qhalt=e") SET(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> -+ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>") - -SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") -SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake index cf9b2b6..e6f2317 100644 --- a/Modules/Compiler/XL-Fortran.cmake +++ b/Modules/Compiler/XL-Fortran.cmake @@ -1,8 +1,12 @@ -SET(CMAKE_Fortran_VERBOSE_FLAG "-V") +include(Compiler/XL) +__compiler_xl(Fortran) SET(CMAKE_Fortran_DEFINE_FLAG "-WF,-D") -SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O") -SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-O") -SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g") +# -qthreaded = Ensures that all optimizations will be thread-safe +# -qhalt=e = Halt on error messages (rather than just severe errors) +SET(CMAKE_Fortran_FLAGS_INIT "-qthreaded -qhalt=e") + +# We require updates to CMake C++ code to support preprocessing rules for Fortran. +SET(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) +SET(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE) diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake new file mode 100644 index 0000000..d07890f --- /dev/null +++ b/Modules/Compiler/XL.cmake @@ -0,0 +1,48 @@ + +#============================================================================= +# Copyright 2002-2011 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_XL) + return() +endif() +set(__COMPILER_XL 1) + +# Find the CreateExportList program that comes with this toolchain. +find_program(CMAKE_XL_CreateExportList + NAMES CreateExportList + DOC "IBM XL CreateExportList tool" + ) + +macro(__compiler_xl lang) + # Feature flags. + set(CMAKE_${lang}_VERBOSE_FLAG "-V") + + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") + + # The compiler front-end passes all object files, archive files, and shared + # library files named on the command line to CreateExportList to create a + # list of all symbols to be exported from the shared library. This causes + # all archive members to be copied into the shared library whether they are + # needed or not. Instead we run the tool ourselves to pass only the object + # files so that we export only the symbols actually provided by the sources. + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>" + "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" + ) +endmacro() diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake new file mode 100644 index 0000000..6df2473 --- /dev/null +++ b/Modules/FindArmadillo.cmake @@ -0,0 +1,100 @@ +# - Find Armadillo +# Find the Armadillo C++ library +# +# +# == Using Armadillo: == +# find_package(Armadillo RECQUIRED) +# include_directories(${ARMADILLO_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# target_link_libraries(foo ${ARMADILLO_LIBRARIES}) +# +#============================================================================= +# +# This module sets the following variables: +# ARMADILLO_FOUND - set to true if the library is found +# ARMADILLO_INCLUDE_DIRS - list of required include directories +# ARMADILLO_LIBRARIES - list of libraries to be linked +# ARMADILLO_VERSION_MAJOR - major version number +# ARMADILLO_VERSION_MINOR - minor version number +# ARMADILLO_VERSION_PATCH - patch version number +# ARMADILLO_VERSION_STRING - version number as a string (ex: "1.0.4") +# ARMADILLO_VERSION_NAME - name of the version (ex: "Antipodean Antileech") +# + +#============================================================================= +# Copyright 2011 Clement Creusot <creusot@cs.york.ac.uk> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +# UNIX paths are standard, no need to write. +find_library(ARMADILLO_LIBRARY + NAMES armadillo + PATHS "$ENV{ProgramFiles}/Armadillo/lib" "$ENV{ProgramFiles}/Armadillo/lib64" "$ENV{ProgramFiles}/Armadillo" + ) +find_path(ARMADILLO_INCLUDE_DIR + NAMES armadillo + PATHS "$ENV{ProgramFiles}/Armadillo/include" + ) + + +if(ARMADILLO_INCLUDE_DIR) + + # ------------------------------------------------------------------------ + # Extract version information from <armadillo> + # ------------------------------------------------------------------------ + + # WARNING: Early releases of Armadillo didn't have the arma_version.hpp file. + # (e.g. v.0.9.8-1 in ubuntu maverick packages (2001-03-15)) + # If the file is missing, set all values to 0 + set(ARMADILLO_VERSION_MAJOR 0) + set(ARMADILLO_VERSION_MINOR 0) + set(ARMADILLO_VERSION_PATCH 0) + set(ARMADILLO_VERSION_NAME "EARLY RELEASE") + + if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp") + + # Read and parse armdillo version header file for version number + file(READ "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp" _armadillo_HEADER_CONTENTS) + string(REGEX REPLACE ".*#define ARMA_VERSION_MAJOR ([0-9]+).*" "\\1" ARMADILLO_VERSION_MAJOR "${_armadillo_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define ARMA_VERSION_MINOR ([0-9]+).*" "\\1" ARMADILLO_VERSION_MINOR "${_armadillo_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define ARMA_VERSION_PATCH ([0-9]+).*" "\\1" ARMADILLO_VERSION_PATCH "${_armadillo_HEADER_CONTENTS}") + + # WARNING: The number of spaces before the version name is not one. + string(REGEX REPLACE ".*#define ARMA_VERSION_NAME\ +\"([0-9a-zA-Z\ _-]+)\".*" "\\1" ARMADILLO_VERSION_NAME "${_armadillo_HEADER_CONTENTS}") + + endif(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp") + + set(ARMADILLO_VERSION_STRING "${ARMADILLO_VERSION_MAJOR}.${ARMADILLO_VERSION_MINOR}.${ARMADILLO_VERSION_PATCH}") +endif (ARMADILLO_INCLUDE_DIR) + +#====================== + + +# Checks 'RECQUIRED', 'QUIET' and versions. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Armadillo + REQUIRED_VARS ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR + VERSION_VAR ARMADILLO_VERSION_STRING) +# version_var fails with cmake < 2.8.4. + +if (ARMADILLO_FOUND) + set(ARMADILLO_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIR}) + set(ARMADILLO_LIBRARIES ${ARMADILLO_LIBRARY}) +endif (ARMADILLO_FOUND) + + +# Hide internal variables +mark_as_advanced( + ARMADILLO_INCLUDE_DIR + ARMADILLO_LIBRARY) + +#====================== diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index f41a66b..af799d6 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -7,11 +7,12 @@ # OPENSSL_FOUND - system has the OpenSSL library # OPENSSL_INCLUDE_DIR - the OpenSSL include directory # OPENSSL_LIBRARIES - The libraries needed to use OpenSSL +# OPENSSL_VERSION - This is set to $major.$minor.$revision (eg. 0.9.8) #============================================================================= # Copyright 2006-2009 Kitware, Inc. # Copyright 2006 Alexander Neundorf <neundorf@kde.org> -# Copyright 2009-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com> +# Copyright 2009-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -23,24 +24,41 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +if (UNIX) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(_OPENSSL openssl) + endif (PKG_CONFIG_FOUND) +endif (UNIX) + # http://www.slproweb.com/products/Win32OpenSSL.html SET(_OPENSSL_ROOT_HINTS + $ENV{OPENSSL_ROOT_DIR} + ${OPENSSL_ROOT_DIR} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]" ) SET(_OPENSSL_ROOT_PATHS + "$ENV{PROGRAMFILES}/OpenSSL" + "$ENV{PROGRAMFILES}/OpenSSL-Win32" + "$ENV{PROGRAMFILES}/OpenSSL-Win64" "C:/OpenSSL/" + "C:/OpenSSL-Win32/" + "C:/OpenSSL-Win64/" ) -FIND_PATH(OPENSSL_ROOT_DIR - NAMES include/openssl/ssl.h +SET(_OPENSSL_ROOT_HINTS_AND_PATHS HINTS ${_OPENSSL_ROOT_HINTS} PATHS ${_OPENSSL_ROOT_PATHS} -) -MARK_AS_ADVANCED(OPENSSL_ROOT_DIR) + ) -# Re-use the previous path: -FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h - PATHS ${OPENSSL_ROOT_DIR}/include +FIND_PATH(OPENSSL_INCLUDE_DIR + NAMES + openssl/ssl.h + HINTS + ${_OPENSSL_INCLUDEDIR} + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + include ) IF(WIN32 AND NOT CYGWIN) @@ -60,18 +78,52 @@ IF(WIN32 AND NOT CYGWIN) # We are using the libraries located in the VC subdir instead of the parent directory eventhough : # libeay32MD.lib is identical to ../libeay32.lib, and # ssleay32MD.lib is identical to ../ssleay32.lib - FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd libeay32 - PATHS ${OPENSSL_ROOT_DIR}/lib/VC - ) - FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD libeay32 - PATHS ${OPENSSL_ROOT_DIR}/lib/VC - ) - FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssleay32 ssl - PATHS ${OPENSSL_ROOT_DIR}/lib/VC - ) - FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssleay32 ssl - PATHS ${OPENSSL_ROOT_DIR}/lib/VC - ) + FIND_LIBRARY(LIB_EAY_DEBUG + NAMES + libeay32MDd + libeay32 + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + "lib" + "VC" + "lib/VC" + ) + + FIND_LIBRARY(LIB_EAY_RELEASE + NAMES + libeay32MD + libeay32 + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + "lib" + "VC" + "lib/VC" + ) + + FIND_LIBRARY(SSL_EAY_DEBUG + NAMES + ssleay32MDd + ssleay32 + ssl + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + "lib" + "VC" + "lib/VC" + ) + + FIND_LIBRARY(SSL_EAY_RELEASE + NAMES + ssleay32MD + ssleay32 + ssl + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + "lib" + "VC" + "lib/VC" + ) + if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) set( OPENSSL_LIBRARIES optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG} @@ -84,40 +136,115 @@ IF(WIN32 AND NOT CYGWIN) MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE) ELSEIF(MINGW) # same player, for MingW - FIND_LIBRARY(LIB_EAY NAMES libeay32 - PATHS ${OPENSSL_ROOT_DIR}/lib/MinGW - ) - FIND_LIBRARY(SSL_EAY NAMES ssleay32 - PATHS ${OPENSSL_ROOT_DIR}/lib/MinGW - ) + FIND_LIBRARY(LIB_EAY + NAMES + libeay32 + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + "lib" + "lib/MinGW" + ) + + FIND_LIBRARY(SSL_EAY + NAMES + ssleay32 + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + "lib" + "lib/MinGW" + ) + MARK_AS_ADVANCED(SSL_EAY LIB_EAY) set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) ELSE(MSVC) # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues: - FIND_LIBRARY(LIB_EAY NAMES libeay32 - PATHS ${OPENSSL_ROOT_DIR}/lib - ) - FIND_LIBRARY(SSL_EAY NAMES ssleay32 - PATHS ${OPENSSL_ROOT_DIR}/lib - ) + FIND_LIBRARY(LIB_EAY + NAMES + libeay32 + HINTS + ${_OPENSSL_LIBDIR} + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + lib + ) + + FIND_LIBRARY(SSL_EAY + NAMES + ssleay32 + HINTS + ${_OPENSSL_LIBDIR} + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + lib + ) + MARK_AS_ADVANCED(SSL_EAY LIB_EAY) set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) ENDIF(MSVC) ELSE(WIN32 AND NOT CYGWIN) - FIND_LIBRARY(OPENSSL_SSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD) - FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARIES NAMES crypto) - MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARIES OPENSSL_SSL_LIBRARIES) + FIND_LIBRARY(OPENSSL_SSL_LIBRARY + NAMES + ssl + ssleay32 + ssleay32MD + HINTS + ${_OPENSSL_LIBDIR} + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + lib + ) - SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES}) + FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY + NAMES + crypto + HINTS + ${_OPENSSL_LIBDIR} + ${_OPENSSL_ROOT_HINTS_AND_PATHS} + PATH_SUFFIXES + lib + ) + + MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY) + + # compat defines + SET(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY}) + SET(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) + + SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) ENDIF(WIN32 AND NOT CYGWIN) +if (OPENSSL_INCLUDE_DIR) + file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*") + + string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1" OPENSSL_VERSION_MAJOR "${openssl_version_str}") + string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x[0-9]([0-9][0-9]).*$" "\\1" OPENSSL_VERSION_MINOR "${openssl_version_str}") + string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x[0-9][0-9][0-9]([0-9][0-9]).*$" "\\1" OPENSSL_VERSION_PATCH "${openssl_version_str}") + + string(REGEX REPLACE "^0" "" OPENSSL_VERSION_MINOR "${OPENSSL_VERSION_MINOR}") + string(REGEX REPLACE "^0" "" OPENSSL_VERSION_PATCH "${OPENSSL_VERSION_PATCH}") + + set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_PATCH}") +endif (OPENSSL_INCLUDE_DIR) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(OpenSSL DEFAULT_MSG - OPENSSL_LIBRARIES - OPENSSL_INCLUDE_DIR -) -MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) +if (OPENSSL_VERSION) + find_package_handle_standard_args(OpenSSL + REQUIRED_VARS + OPENSSL_LIBRARIES + OPENSSL_INCLUDE_DIR + VERSION_VAR + OPENSSL_VERSION + FAIL_MESSAGE + "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" + ) +else (OPENSSL_VERSION) + find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" + OPENSSL_LIBRARIES + OPENSSL_INCLUDE_DIR + ) +endif (OPENSSL_VERSION) +MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 2e719ff..8c60bcb 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -15,6 +15,7 @@ #============================================================================= # Copyright 2004-2009 Kitware, Inc. +# Copyright 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -26,7 +27,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(SWIG_EXECUTABLE swig) +FIND_PROGRAM(SWIG_EXECUTABLE swig2.0 swig) IF(SWIG_EXECUTABLE) EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -swiglib diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index 2062a7e..77f9fda 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -67,7 +67,7 @@ ENDIF() # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_INCLUDE_DIR ZLIB_LIBRARY +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR VERSION_VAR ZLIB_VERSION_STRING) IF(ZLIB_FOUND) diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index 4bcaae9..d35a72c 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -70,6 +70,17 @@ else() endif() # Generate C symbol sources. +set(symbol_sources) +if(NOT "${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(PathScale|Cray)$") + # Provide mymodule_ and my_module_ init symbols because: + # - PGI Fortran uses module init symbols + # but not for: + # - PathScale Fortran uses module init symbols but module symbols + # use '.in.' so we cannot provide them anyway. + # - Cray Fortran >= 7.3.2 uses module init symbols but module symbols + # use 'mysub$mymodule_' so we cannot provide them anyway. + list(APPEND symbol_sources mymodule_.c my_module_.c) +endif() foreach(symbol IN LISTS global_symbols module_symbols) # Skip symbols with '$' if C cannot handle them. if(C_SUPPORTS_DOLLAR OR NOT "${symbol}" MATCHES "\\$") @@ -89,7 +100,7 @@ endforeach() add_library(myfort STATIC mysub.f my_sub.f ${myfort_modules}) # Provide symbols through C but fall back to Fortran. -add_library(symbols STATIC mymodule_.c my_module_.c ${symbol_sources}) +add_library(symbols STATIC ${symbol_sources}) target_link_libraries(symbols myfort) # Require symbols through Fortran. diff --git a/Modules/FortranCInterface/my_module_.c b/Modules/FortranCInterface/my_module_.c index 364b214..6510ae9 100644 --- a/Modules/FortranCInterface/my_module_.c +++ b/Modules/FortranCInterface/my_module_.c @@ -1,8 +1 @@ -#if defined(__PATHSCALE__) -/* PathScale Fortran wants my_module_ when calling any my_module symbol, - but module symbols use '.in.' so we cannot provide them anyway. */ -void pathscale_my_module_(void) {} -#else -/* PGI Fortran wants my_module_ when calling any my_module symbol. */ void my_module_(void) {} -#endif diff --git a/Modules/FortranCInterface/mymodule_.c b/Modules/FortranCInterface/mymodule_.c index b5feda6..5270605 100644 --- a/Modules/FortranCInterface/mymodule_.c +++ b/Modules/FortranCInterface/mymodule_.c @@ -1,8 +1 @@ -#if defined(__PATHSCALE__) -/* PathScale Fortran wants mymodule_ when calling any mymodule symbol, - but module symbols use '.in.' so we cannot provide them anyway. */ -void pathscale_mymodule_(void) {} -#else -/* PGI Fortran wants mymodule_ when calling any mymodule symbol. */ void mymodule_(void) {} -#endif diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake new file mode 100644 index 0000000..a114dcb --- /dev/null +++ b/Modules/GNUInstallDirs.cmake @@ -0,0 +1,182 @@ +# - Define GNU standard installation directories +# Provides install directory variables as defined for GNU software: +# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html +# Inclusion of this module defines the following variables: +# CMAKE_INSTALL_<dir> - destination for files of a given type +# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path +# where <dir> is one of: +# BINDIR - user executables (bin) +# SBINDIR - system admin executables (sbin) +# LIBEXECDIR - program executables (libexec) +# SYSCONFDIR - read-only single-machine data (etc) +# SHAREDSTATEDIR - modifiable architecture-independent data (com) +# LOCALSTATEDIR - modifiable single-machine data (var) +# LIBDIR - object code libraries (lib or lib64) +# INCLUDEDIR - C header files (include) +# OLDINCLUDEDIR - C header files for non-gcc (/usr/include) +# DATAROOTDIR - read-only architecture-independent data root (share) +# DATADIR - read-only architecture-independent data (DATAROOTDIR) +# INFODIR - info documentation (DATAROOTDIR/info) +# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale) +# MANDIR - man documentation (DATAROOTDIR/man) +# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME) +# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of +# install() commands for the corresponding file type. If the includer does +# not define a value the above-shown default will be used and the value will +# appear in the cache for editing by the user. +# Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed +# from the corresponding destination by prepending (if necessary) the value +# of CMAKE_INSTALL_PREFIX. + +#============================================================================= +# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com> +# Copyright 2011 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Installation directories +# +if(NOT DEFINED CMAKE_INSTALL_BINDIR) + set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_SBINDIR) + set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR) + set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR) + set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR) + set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR) + set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(_LIBDIR_DEFAULT "lib") + # Override this default 'lib' with 'lib64' iff: + # - we are on Linux system but NOT cross-compiling + # - we are NOT on debian + # - we are on a 64 bits system + # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf + # Note that the future of multi-arch handling may be even + # more complicated than that: http://wiki.debian.org/Multiarch + if(CMAKE_SYSTEM_NAME MATCHES "Linux" + AND NOT CMAKE_CROSSCOMPILING + AND NOT EXISTS "/etc/debian_version") + if(NOT DEFINED CMAKE_SIZEOF_VOID_P) + message(AUTHOR_WARNING + "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. " + "Please enable at least one language before including GNUInstallDirs.") + else() + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(_LIBDIR_DEFAULT "lib64") + endif() + endif() + endif() + set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})") +endif() + +if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR) + set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR) + set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR) + set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)") +endif() + +#----------------------------------------------------------------------------- +# Values whose defaults are relative to DATAROOTDIR. Store empty values in +# the cache and store the defaults in local variables if the cache values are +# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes. + +if(NOT CMAKE_INSTALL_DATADIR) + set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)") + set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}") +endif() + +if(NOT CMAKE_INSTALL_INFODIR) + set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)") + set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info") +endif() + +if(NOT CMAKE_INSTALL_LOCALEDIR) + set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)") + set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale") +endif() + +if(NOT CMAKE_INSTALL_MANDIR) + set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)") + set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man") +endif() + +if(NOT CMAKE_INSTALL_DOCDIR) + set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)") + set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}") +endif() + +#----------------------------------------------------------------------------- + +mark_as_advanced( + CMAKE_INSTALL_BINDIR + CMAKE_INSTALL_SBINDIR + CMAKE_INSTALL_LIBEXECDIR + CMAKE_INSTALL_SYSCONFDIR + CMAKE_INSTALL_SHAREDSTATEDIR + CMAKE_INSTALL_LOCALSTATEDIR + CMAKE_INSTALL_LIBDIR + CMAKE_INSTALL_INCLUDEDIR + CMAKE_INSTALL_OLDINCLUDEDIR + CMAKE_INSTALL_DATAROOTDIR + CMAKE_INSTALL_DATADIR + CMAKE_INSTALL_INFODIR + CMAKE_INSTALL_LOCALEDIR + CMAKE_INSTALL_MANDIR + CMAKE_INSTALL_DOCDIR + ) + +# Result directories +# +foreach(dir + BINDIR + SBINDIR + LIBEXECDIR + SYSCONFDIR + SHAREDSTATEDIR + LOCALSTATEDIR + LIBDIR + INCLUDEDIR + OLDINCLUDEDIR + DATAROOTDIR + DATADIR + INFODIR + LOCALEDIR + MANDIR + DOCDIR + ) + if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}}) + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}") + endif() +endforeach() diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index b547dc7..f9808c5 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -4,6 +4,9 @@ # - Define swig module with given name and specified language # SWIG_LINK_LIBRARIES(name [ libraries ]) # - Link libraries to swig module +# SWIG_GET_WRAPPER_DEPENDENCIES(swigFile genWrapper language DEST_VARIABLE) +# - Put dependencies of the wrapper genWrapper generated by swig from +# swigFile in DEST_VARIABLE # All other macros are for internal use only. # To get the actual name of the swig module, # use: ${SWIG_MODULE_${name}_REAL_NAME}. @@ -39,6 +42,58 @@ SET(SWIG_EXTRA_LIBRARIES "") SET(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py") # +# Get dependencies of the generated wrapper. +# +MACRO(SWIG_GET_WRAPPER_DEPENDENCIES swigFile genWrapper language DEST_VARIABLE) + GET_FILENAME_COMPONENT(swig_getdeps_basename ${swigFile} NAME_WE) + GET_FILENAME_COMPONENT(swig_getdeps_outdir ${genWrapper} PATH) + GET_SOURCE_FILE_PROPERTY(swig_getdeps_extra_flags "${swigFile}" SWIG_FLAGS) + IF("${swig_getdeps_extra_flags}" STREQUAL "NOTFOUND") + SET(swig_getdeps_extra_flags "") + ENDIF("${swig_getdeps_extra_flags}" STREQUAL "NOTFOUND") + + IF(NOT swig_getdeps_outdir) + SET(swig_getdeps_outdir ${CMAKE_CURRENT_BINARY_DIR}) + ENDIF(NOT swig_getdeps_outdir) + SET(swig_getdeps_depsfile + ${swig_getdeps_outdir}/swig_${swig_getdeps_basename}_deps.txt) + GET_DIRECTORY_PROPERTY(swig_getdeps_include_directories INCLUDE_DIRECTORIES) + SET(swig_getdeps_include_dirs) + FOREACH(it ${swig_getdeps_include_directories}) + SET(swig_getdeps_include_dirs ${swig_getdeps_include_dirs} "-I${it}") + ENDFOREACH(it) + EXECUTE_PROCESS( + COMMAND ${SWIG_EXECUTABLE} + -MM -MF ${swig_getdeps_depsfile} ${swig_getdeps_extra_flags} + ${CMAKE_SWIG_FLAGS} -${language} + -o ${genWrapper} ${swig_getdeps_include_dirs} ${swigFile} + RESULT_VARIABLE swig_getdeps_result + ERROR_VARIABLE swig_getdeps_error + OUTPUT_STRIP_TRAILING_WHITESPACE) + IF(NOT ${swig_getdeps_error} EQUAL 0) + MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -MM -MF ${swig_getdeps_depsfile} ${swig_getdeps_extra_flags} ${CMAKE_SWIG_FLAGS} -${language} -o ${genWrapper} ${swig_getdeps_include_dirs} ${swigFile}\" failed with output:\n${swig_getdeps_error}") + SET(swig_getdeps_dependencies "") + ELSE(NOT ${swig_getdeps_error} EQUAL 0) + FILE(READ ${swig_getdeps_depsfile} ${DEST_VARIABLE}) + # Remove the first line + STRING(REGEX REPLACE "^.+: +\\\\\n +" "" + ${DEST_VARIABLE} "${${DEST_VARIABLE}}") + # Clean the end of each line + STRING(REGEX REPLACE " +(\\\\)?\n" "\n" ${DEST_VARIABLE} + "${${DEST_VARIABLE}}") + # Clean beginning of each line + STRING(REGEX REPLACE "\n +" "\n" + ${DEST_VARIABLE} "${${DEST_VARIABLE}}") + # clean paths + STRING(REGEX REPLACE "\\\\\\\\" "/" ${DEST_VARIABLE} + "${${DEST_VARIABLE}}") + STRING(REGEX REPLACE "\n" ";" + ${DEST_VARIABLE} "${${DEST_VARIABLE}}") + ENDIF(NOT ${swig_getdeps_error} EQUAL 0) +ENDMACRO(SWIG_GET_WRAPPER_DEPENDENCIES) + + +# # For given swig module initialize variables associated with it # MACRO(SWIG_MODULE_INITIALIZE name language) @@ -166,6 +221,10 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) IF(SWIG_MODULE_${name}_EXTRA_FLAGS) SET(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS}) ENDIF(SWIG_MODULE_${name}_EXTRA_FLAGS) + SWIG_GET_WRAPPER_DEPENDENCIES("${swig_source_file_fullname}" + "${swig_generated_file_fullname}" ${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG} + swig_extra_dependencies) + LIST(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${swig_extra_dependencies}) ADD_CUSTOM_COMMAND( OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files} COMMAND "${SWIG_EXECUTABLE}" diff --git a/Modules/readme.txt b/Modules/readme.txt index dd52000..e2d7f06 100644 --- a/Modules/readme.txt +++ b/Modules/readme.txt @@ -64,10 +64,32 @@ For example: # VAR_REALLY_COOL - cool right? # +Test the documentation formatting by running "cmake --help-module FindXXX". +Edit the comments until the output of this command looks satisfactory. + To have a .cmake file in this directory NOT show up in the modules documentation, you should start the file with a blank line. +After the documentation, leave a *BLANK* line, and then add a +copyright and licence notice block like this one: + +#============================================================================= +# Copyright 2009-2011 Your Name +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +The layout of the notice block is strictly enforced by the ModuleNotices test. +Only the year range and name may be changed freely. + A FindXXX.cmake module will typically be loaded by the command FIND_PACKAGE(XXX [major[.minor[.patch[.tweak]]]] [EXACT] diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 278d4df..e284967 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -394,6 +394,8 @@ SET(CTEST_SRCS cmCTest.cxx CTest/cmCTestTestHandler.cxx CTest/cmCTestUpdateCommand.cxx CTest/cmCTestUpdateHandler.cxx + CTest/cmCTestUploadCommand.cxx + CTest/cmCTestUploadHandler.cxx CTest/cmCTestVC.cxx CTest/cmCTestVC.h diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index b629c63..0ce5b01 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -207,7 +207,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) } //---------------------------------------------------------------------- -int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponent) +int cmCPackArchiveGenerator::PackageComponentsAllInOne() { // reset the package file names packageFileNames.clear(); @@ -221,38 +221,15 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponent) << std::endl); DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive); - // The ALL GROUP in ONE package case - if (! allComponent) { - // iterate over the component groups - std::map<std::string, cmCPackComponentGroup>::iterator compGIt; - for (compGIt=this->ComponentGroups.begin(); - compGIt!=this->ComponentGroups.end(); ++compGIt) - { - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: " - << compGIt->first - << std::endl); - // now iterate over the component of this group - std::vector<cmCPackComponent*>::iterator compIt; - for (compIt=(compGIt->second).Components.begin(); - compIt!=(compGIt->second).Components.end(); - ++compIt) - { - // Add the files of this component to the archive - addOneComponentToArchive(archive,*compIt); - } - } - } - // The ALL COMPONENT in ONE package case - else + // The ALL COMPONENTS in ONE package case + std::map<std::string, cmCPackComponent>::iterator compIt; + for (compIt=this->Components.begin();compIt!=this->Components.end(); + ++compIt ) { - std::map<std::string, cmCPackComponent>::iterator compIt; - for (compIt=this->Components.begin();compIt!=this->Components.end(); - ++compIt ) - { - // Add the files of this component to the archive - addOneComponentToArchive(archive,&(compIt->second)); - } + // Add the files of this component to the archive + addOneComponentToArchive(archive,&(compIt->second)); } + // archive goes out of scope so it will finalized and closed. return 1; } @@ -265,21 +242,20 @@ int cmCPackArchiveGenerator::PackageFiles() if (SupportsComponentInstallation()) { // CASE 1 : COMPONENT ALL-IN-ONE package - // If ALL GROUPS or ALL COMPONENTS in ONE package has been requested + // If ALL COMPONENTS in ONE package has been requested // then the package file is unique and should be open here. - if (allComponentInOne || - (allGroupInOne && (!this->ComponentGroups.empty())) - ) + if (componentPackageMethod == ONE_PACKAGE) { - return PackageComponentsAllInOne(allComponentInOne); + return PackageComponentsAllInOne(); } // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup)) + else { - return PackageComponents(ignoreComponentGroup); + return PackageComponents(componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } } diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index dc17257..b1bbb83 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -65,7 +65,7 @@ protected: * Special case of component install where all * components will be put in a single installer. */ - int PackageComponentsAllInOne(bool allComponent); + int PackageComponentsAllInOne(); virtual const char* GetOutputExtension() = 0; cmArchiveWrite::Compress Compress; cmArchiveWrite::Type Archive; diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 06a0509..af78e78 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -165,5 +165,10 @@ int cmCPackBundleGenerator::PackageFiles() cmSystemTools::SetPermissions(command_target.str().c_str(), 0777); } - return this->CreateDMG(); + return this->CreateDMG(toplevel, packageFileNames[0]); +} + +bool cmCPackBundleGenerator::SupportsComponentInstallation() const +{ + return false; } diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h index 82814b0..ed0187d 100644 --- a/Source/CPack/cmCPackBundleGenerator.h +++ b/Source/CPack/cmCPackBundleGenerator.h @@ -32,6 +32,7 @@ protected: virtual int InitializeInternal(); virtual const char* GetPackagingInstallPrefix(); int PackageFiles(); + bool SupportsComponentInstallation() const; std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index ca2185c..5665404 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -51,6 +51,62 @@ int cmCPackDebGenerator::InitializeInternal() } //---------------------------------------------------------------------- +int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel, + std::string packageName) + { + int retval = 1; + // Begin the archive for this pack + std::string localToplevel(initialTopLevel); + std::string packageFileName( + cmSystemTools::GetParentDirectory(toplevel.c_str()) + ); + std::string outputFileName( + std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) + +"-"+packageName + this->GetOutputExtension() + ); + + localToplevel += "/"+ packageName; + /* replace the TEMP DIRECTORY with the component one */ + this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str()); + packageFileName += "/"+ outputFileName; + /* replace proposed CPACK_OUTPUT_FILE_NAME */ + this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); + /* replace the TEMPORARY package file name */ + this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", + packageFileName.c_str()); + // Tell CPackDeb.cmake the name of the component GROUP. + this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",packageName.c_str()); + if (!this->ReadListFile("CPackDeb.cmake")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error while execution CPackDeb.cmake" << std::endl); + retval = 0; + return retval; + } + + cmsys::Glob gl; + std::string findExpr(this->GetOption("WDIR")); + findExpr += "/*"; + gl.RecurseOn(); + if ( !gl.FindFiles(findExpr) ) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot find any files in the installed directory" << std::endl); + return 0; + } + packageFiles = gl.GetFiles(); + + int res = createDeb(); + if (res != 1) + { + retval = 0; + } + // add the generated package to package file names list + packageFileNames.push_back(packageFileName); + return retval; +} + +//---------------------------------------------------------------------- int cmCPackDebGenerator::PackageComponents(bool ignoreGroup) { int retval = 1; @@ -71,53 +127,24 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup) << compGIt->first << std::endl); // Begin the archive for this group - std::string localToplevel(initialTopLevel); - std::string packageFileName( - cmSystemTools::GetParentDirectory(toplevel.c_str()) - ); - std::string outputFileName( - std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) - +"-"+compGIt->first + this->GetOutputExtension() - ); - - localToplevel += "/"+ compGIt->first; - /* replace the TEMP DIRECTORY with the component one */ - this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str()); - packageFileName += "/"+ outputFileName; - /* replace proposed CPACK_OUTPUT_FILE_NAME */ - this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); - /* replace the TEMPORARY package file name */ - this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", - packageFileName.c_str()); - // Tell CPackDeb.cmake the name of the component GROUP. - this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",compGIt->first.c_str()); - if (!this->ReadListFile("CPackDeb.cmake")) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error while execution CPackDeb.cmake" << std::endl); - retval = 0; - return retval; - } - - cmsys::Glob gl; - std::string findExpr(this->GetOption("WDIR")); - findExpr += "/*"; - gl.RecurseOn(); - if ( !gl.FindFiles(findExpr) ) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot find any files in the installed directory" << std::endl); - return 0; - } - packageFiles = gl.GetFiles(); - - int res = createDeb(); - if (res != 1) + retval &= PackageOnePack(initialTopLevel,compGIt->first); + } + // Handle Orphan components (components not belonging to any groups) + std::map<std::string, cmCPackComponent>::iterator compIt; + for (compIt=this->Components.begin(); + compIt!=this->Components.end(); ++compIt ) + { + // Does the component belong to a group? + if (compIt->second.Group==NULL) { - retval = 0; + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "Component <" + << compIt->second.Name + << "> does not belong to any group, package it separately." + << std::endl); + // Begin the archive for this orphan component + retval &= PackageOnePack(initialTopLevel,compIt->first); } - // add the generated package to package file names list - packageFileNames.push_back(packageFileName); } } // CPACK_COMPONENTS_IGNORE_GROUPS is set @@ -128,59 +155,14 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup) for (compIt=this->Components.begin(); compIt!=this->Components.end(); ++compIt ) { - std::string localToplevel(initialTopLevel); - std::string packageFileName( - cmSystemTools::GetParentDirectory(toplevel.c_str()) - ); - std::string outputFileName( - std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME") - ) - +"-"+compIt->first + this->GetOutputExtension()); - - localToplevel += "/"+ compIt->first; - /* replace the TEMP DIRECTORY with the component one */ - this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str()); - packageFileName += "/"+ outputFileName; - /* replace proposed CPACK_OUTPUT_FILE_NAME */ - this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); - /* replace the TEMPORARY package file name */ - this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", - packageFileName.c_str()); - - this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",compIt->first.c_str()); - if (!this->ReadListFile("CPackDeb.cmake")) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error while execution CPackDeb.cmake" << std::endl); - retval = 0; - return retval; - } - cmsys::Glob gl; - std::string findExpr(this->GetOption("WDIR")); - findExpr += "/*"; - gl.RecurseOn(); - if ( !gl.FindFiles(findExpr) ) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot find any files in the installed directory" << std::endl); - return 0; - } - packageFiles = gl.GetFiles(); - - int res = createDeb(); - if (res != 1) - { - retval = 0; - } - // add the generated package to package file names list - packageFileNames.push_back(packageFileName); + retval &= PackageOnePack(initialTopLevel,compIt->first); } } return retval; } //---------------------------------------------------------------------- -int cmCPackDebGenerator::PackageComponentsAllInOne(bool allComponent) +int cmCPackDebGenerator::PackageComponentsAllInOne() { int retval = 1; std::string compInstDirName; @@ -189,15 +171,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne(bool allComponent) packageFileNames.clear(); std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); - // all GROUP in one vs all COMPONENT in one - if (allComponent) - { - compInstDirName = "ALL_COMPONENTS_IN_ONE"; - } - else - { - compInstDirName = "ALL_GROUPS_IN_ONE"; - } + compInstDirName = "ALL_COMPONENTS_IN_ONE"; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging all groups in one package..." @@ -266,19 +240,18 @@ int cmCPackDebGenerator::PackageFiles() // CASE 1 : COMPONENT ALL-IN-ONE package // If ALL GROUPS or ALL COMPONENTS in ONE package has been requested // then the package file is unique and should be open here. - if (allComponentInOne || - (allGroupInOne && (!this->ComponentGroups.empty())) - ) + if (componentPackageMethod == ONE_PACKAGE) { - return PackageComponentsAllInOne(allComponentInOne); + return PackageComponentsAllInOne(); } // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup)) + else { - return PackageComponents(ignoreComponentGroup); + return PackageComponents(componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } } // CASE 3 : NON COMPONENT package. @@ -588,11 +561,11 @@ bool cmCPackDebGenerator::SupportsComponentInstallation() const std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( const std::string& componentName) { - if (ignoreComponentGroup) { + if (componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { return componentName; } - if (allComponentInOne) { + if (componentPackageMethod == ONE_PACKAGE) { return std::string("ALL_COMPONENTS_IN_ONE"); } // We have to find the name of the COMPONENT GROUP @@ -601,14 +574,7 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( cmSystemTools::UpperCase(componentName) + "_GROUP"; if (NULL != GetOption(groupVar.c_str())) { - if (allGroupInOne) - { - return std::string("ALL_GROUPS_IN_ONE"); - } - else - { - return std::string(GetOption(groupVar.c_str())); - } + return std::string(GetOption(groupVar.c_str())); } else { diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index de1ea77..f536c47 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -34,6 +34,10 @@ public: protected: virtual int InitializeInternal(); /** + * This method factors out the work done in component packaging case. + */ + int PackageOnePack(std::string initialToplevel, std::string packageName); + /** * The method used to package files when component * install is used. This will create one * archive for each component group. @@ -43,7 +47,7 @@ protected: * Special case of component install where all * components will be put in a single installer. */ - int PackageComponentsAllInOne(bool allComponent); + int PackageComponentsAllInOne(); virtual int PackageFiles(); virtual const char* GetOutputExtension() { return ".deb"; } virtual bool SupportsComponentInstallation() const; diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index e9ce76c..83b6b64 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -51,6 +51,8 @@ static const char* SLASTREnglish = //---------------------------------------------------------------------- cmCPackDragNDropGenerator::cmCPackDragNDropGenerator() { + // default to one package file for components + this->componentPackageMethod = ONE_PACKAGE; } //---------------------------------------------------------------------- @@ -106,8 +108,57 @@ const char* cmCPackDragNDropGenerator::GetOutputExtension() //---------------------------------------------------------------------- int cmCPackDragNDropGenerator::PackageFiles() { + // gather which directories to make dmg files for + // multiple directories occur if packaging components or groups separately - return this->CreateDMG(); + // monolith + if(this->Components.empty()) + { + return this->CreateDMG(toplevel, packageFileNames[0]); + } + + // component install + std::vector<std::string> package_files; + + std::map<std::string, cmCPackComponent>::iterator compIt; + for (compIt=this->Components.begin(); + compIt!=this->Components.end(); ++compIt ) + { + std::string name = GetComponentInstallDirNameSuffix(compIt->first); + package_files.push_back(name); + } + std::sort(package_files.begin(), package_files.end()); + package_files.erase(std::unique(package_files.begin(), + package_files.end()), + package_files.end()); + + + // loop to create dmg files + packageFileNames.clear(); + for(size_t i=0; i<package_files.size(); i++) + { + std::string full_package_name = std::string(toplevel) + std::string("/"); + if(package_files[i] == "ALL_IN_ONE") + { + full_package_name += this->GetOption("CPACK_PACKAGE_FILE_NAME"); + } + else + { + full_package_name += package_files[i]; + } + full_package_name += std::string(GetOutputExtension()); + packageFileNames.push_back(full_package_name); + + std::string src_dir = toplevel; + src_dir += "/"; + src_dir += package_files[i]; + + if(0 == this->CreateDMG(src_dir, full_package_name)) + { + return 0; + } + } + return 1; } //---------------------------------------------------------------------- @@ -159,10 +210,11 @@ bool cmCPackDragNDropGenerator::RunCommand(cmOStringStream& command, } //---------------------------------------------------------------------- -int cmCPackDragNDropGenerator::CreateDMG() +int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, + const std::string& output_file) { // Get optional arguments ... - const std::string cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON") + const std::string cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON") ? this->GetOption("CPACK_PACKAGE_ICON") : ""; const std::string cpack_dmg_volume_name = @@ -197,7 +249,7 @@ int cmCPackDragNDropGenerator::CreateDMG() // The staging directory contains everything that will end-up inside the // final disk image ... cmOStringStream staging; - staging << toplevel; + staging << src_dir; // Add a symlink to /Applications so users can drag-and-drop the bundle // into it @@ -472,7 +524,7 @@ int cmCPackDragNDropGenerator::CreateDMG() final_image_command << cpack_dmg_format; final_image_command << " -imagekey"; final_image_command << " zlib-level=9"; - final_image_command << " -o \"" << packageFileNames[0] << "\""; + final_image_command << " -o \"" << output_file << "\""; if(!this->RunCommand(final_image_command)) { @@ -485,3 +537,47 @@ int cmCPackDragNDropGenerator::CreateDMG() return 1; } + +bool cmCPackDragNDropGenerator::SupportsComponentInstallation() const +{ + return true; +} + +std::string +cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( + const std::string& componentName) +{ + // we want to group components together that go in the same dmg package + std::string package_file_name = this->GetOption("CPACK_PACKAGE_FILE_NAME"); + + // we have 3 mutually exclusive modes to work in + // 1. all components in one package + // 2. each group goes in its own package with left over + // components in their own package + // 3. ignore groups - if grouping is defined, it is ignored + // and each component goes in its own package + + if(this->componentPackageMethod == ONE_PACKAGE) + { + return "ALL_IN_ONE"; + } + + if(this->componentPackageMethod == ONE_PACKAGE_PER_GROUP) + { + // We have to find the name of the COMPONENT GROUP + // the current COMPONENT belongs to. + std::string groupVar = "CPACK_COMPONENT_" + + cmSystemTools::UpperCase(componentName) + "_GROUP"; + const char* _groupName = GetOption(groupVar.c_str()); + if (_groupName) + { + std::string groupName = _groupName; + + groupName = GetComponentPackageFileName(package_file_name, + groupName, true); + return groupName; + } + } + + return GetComponentPackageFileName(package_file_name, componentName, false); +} diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index dcef7fb..808c618 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -30,11 +30,16 @@ protected: virtual int InitializeInternal(); virtual const char* GetOutputExtension(); int PackageFiles(); + bool SupportsComponentInstallation() const; + bool CopyFile(cmOStringStream& source, cmOStringStream& target); bool RunCommand(cmOStringStream& command, std::string* output = 0); - int CreateDMG(); + std::string + GetComponentInstallDirNameSuffix(const std::string& componentName); + + int CreateDMG(const std::string& src_dir, const std::string& output_file); std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index c343acf..c8a77d1 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -36,9 +36,7 @@ cmCPackGenerator::cmCPackGenerator() this->GeneratorVerbose = false; this->MakefileMap = 0; this->Logger = 0; - this->allGroupInOne = false; - this->allComponentInOne = false; - this->ignoreComponentGroup = false; + this->componentPackageMethod = ONE_PACKAGE_PER_GROUP; } //---------------------------------------------------------------------- @@ -1264,17 +1262,23 @@ int cmCPackGenerator::CleanTemporaryDirectory() //---------------------------------------------------------------------- int cmCPackGenerator::PrepareGroupingKind() { - // The default behavior is to create 1 package by component group - // unless the user asked to put all COMPONENTS in a single package - allGroupInOne = (NULL != - (this->GetOption( - "CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE"))); - allComponentInOne = (NULL != - (this->GetOption( - "CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE"))); - ignoreComponentGroup = (NULL != - (this->GetOption( - "CPACK_COMPONENTS_IGNORE_GROUPS"))); + // find a component package method specified by the user + ComponentPackageMethod method = UNKNOWN_COMPONENT_PACKAGE_METHOD; + + if(this->GetOption("CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE")) + { + method = ONE_PACKAGE; + } + + if(this->GetOption("CPACK_COMPONENTS_IGNORE_GROUPS")) + { + method = ONE_PACKAGE_PER_COMPONENT; + } + + if(this->GetOption("CPACK_COMPONENTS_ONE_PACKAGE_PER_GROUP")) + { + method = ONE_PACKAGE_PER_GROUP; + } std::string groupingType; @@ -1288,47 +1292,66 @@ int cmCPackGenerator::PrepareGroupingKind() cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" << this->Name << "]" << " requested component grouping = "<< groupingType <<std::endl); - if (groupingType == "ALL_GROUPS_IN_ONE") + if (groupingType == "ALL_COMPONENTS_IN_ONE") { - allGroupInOne = true; + method = ONE_PACKAGE; } - else if (groupingType == "ALL_COMPONENTS_IN_ONE") + else if (groupingType == "IGNORE") { - allComponentInOne = true; + method = ONE_PACKAGE_PER_COMPONENT; } - else if (groupingType == "IGNORE") + else if (groupingType == "ONE_PER_GROUP") { - ignoreComponentGroup = true; + method = ONE_PACKAGE_PER_GROUP; } else { cmCPackLogger(cmCPackLog::LOG_WARNING, "[" - << this->Name << "]" - << " requested component grouping type <"<< groupingType - << "> UNKNOWN not in (ALL_GROUPS_IN_ONE," - "ALL_COMPONENTS_IN_ONE,IGNORE)" <<std::endl); + << this->Name << "]" + << " requested component grouping type <"<< groupingType + << "> UNKNOWN not in (ALL_COMPONENTS_IN_ONE,IGNORE,ONE_PER_GROUP)" + << std::endl); + } + } + + // Some components were defined but NO group + // fallback to default if not group based + if(method == ONE_PACKAGE_PER_GROUP && + this->ComponentGroups.empty() && !this->Components.empty()) + { + if(componentPackageMethod == ONE_PACKAGE) + { + method = ONE_PACKAGE; + } + else + { + method = ONE_PACKAGE_PER_COMPONENT; } + cmCPackLogger(cmCPackLog::LOG_WARNING, "[" + << this->Name << "]" + << " One package per component group requested, " + << "but NO component groups exist: Ignoring component group." + << std::endl); } + // if user specified packaging method, override the default packaging method + if(method != UNKNOWN_COMPONENT_PACKAGE_METHOD) + { + componentPackageMethod = method; + } + + const char* method_names[] = + { + "ALL_COMPONENTS_IN_ONE", + "IGNORE_GROUPS", + "ONE_PER_GROUP" + }; + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" << this->Name << "]" - << " requested component grouping = (" - << "ALL_GROUPS_IN_ONE=" << allGroupInOne - << ", ALL_COMPONENTS_IN_ONE=" << allComponentInOne - << ", IGNORE_GROUPS=" << ignoreComponentGroup - << ")" + << " requested component grouping = " + << method_names[componentPackageMethod] << std::endl); - // Some components were defined but NO group - // force ignoreGroups - if (this->ComponentGroups.empty() && (!this->Components.empty()) - && (!ignoreComponentGroup)) { - cmCPackLogger(cmCPackLog::LOG_WARNING, "[" - << this->Name << "]" - << " Some Components defined but NO component group:" - << " Ignoring component group." - << std::endl); - ignoreComponentGroup = true; - } return 1; } diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 0497d1c..05d95b8 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -122,11 +122,10 @@ protected: /** * Prepare requested grouping kind from CPACK_xxx vars - * CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE * CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE * CPACK_COMPONENTS_IGNORE_GROUPS * or - * CPACK_COMPONENTS_GROUPING + * CPACK_COMPONENTS_ONE_PACKAGE_PER_GROUP * @return 1 on success 0 on failure. */ virtual int PrepareGroupingKind(); @@ -238,20 +237,30 @@ protected: */ std::map<std::string, cmCPackComponent> Components; std::map<std::string, cmCPackComponentGroup> ComponentGroups; + /** - * If true All component groups will be put in a single package. - */ - bool allGroupInOne; - /** - * If true All component will be put in a single package. + * If components are enabled, this enum represents the different + * ways of mapping components to package files. */ - bool allComponentInOne; + enum ComponentPackageMethod + { + /* one package for all components */ + ONE_PACKAGE, + /* one package for each component */ + ONE_PACKAGE_PER_COMPONENT, + /* one package for each group, + * with left over components in their own package */ + ONE_PACKAGE_PER_GROUP, + UNKNOWN_COMPONENT_PACKAGE_METHOD + }; + /** - * If true component grouping will be ignored. - * You will still get 1 package for each component unless - * allComponentInOne is true. + * The component package method + * The default is ONE_PACKAGE_PER_GROUP, + * and generators may override the default + * before PrepareGroupingKind() is called. */ - bool ignoreComponentGroup; + ComponentPackageMethod componentPackageMethod; cmCPackLog* Logger; private: diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 0b0c6b1..1a6c3be 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -50,6 +50,45 @@ int cmCPackRPMGenerator::InitializeInternal() } //---------------------------------------------------------------------- +int cmCPackRPMGenerator::PackageOnePack(std::string initialToplevel, + std::string packageName) +{ + int retval = 1; + // Begin the archive for this pack + std::string localToplevel(initialToplevel); + std::string packageFileName( + cmSystemTools::GetParentDirectory(toplevel.c_str()) + ); + std::string outputFileName( + GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"), + packageName, + true) + + this->GetOutputExtension() + ); + + localToplevel += "/"+ packageName; + /* replace the TEMP DIRECTORY with the component one */ + this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str()); + packageFileName += "/"+ outputFileName; + /* replace proposed CPACK_OUTPUT_FILE_NAME */ + this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); + /* replace the TEMPORARY package file name */ + this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", + packageFileName.c_str()); + // Tell CPackRPM.cmake the name of the component NAME. + this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",packageName.c_str()); + if (!this->ReadListFile("CPackRPM.cmake")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error while execution CPackRPM.cmake" << std::endl); + retval = 0; + } + // add the generated package to package file names list + packageFileNames.push_back(packageFileName); + return retval; +} + +//---------------------------------------------------------------------- int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) { int retval = 1; @@ -69,37 +108,23 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: " << compGIt->first << std::endl); - // Begin the archive for this group - std::string localToplevel(initialTopLevel); - std::string packageFileName( - cmSystemTools::GetParentDirectory(toplevel.c_str()) - ); - std::string outputFileName( - GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"), - compGIt->first, - true) - + this->GetOutputExtension() - ); - - localToplevel += "/"+ compGIt->first; - /* replace the TEMP DIRECTORY with the component one */ - this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str()); - packageFileName += "/"+ outputFileName; - /* replace proposed CPACK_OUTPUT_FILE_NAME */ - this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); - /* replace the TEMPORARY package file name */ - this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", - packageFileName.c_str()); - // Tell CPackRPM.cmake the name of the component GROUP. - this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",compGIt->first.c_str()); - if (!this->ReadListFile("CPackRPM.cmake")) + retval &= PackageOnePack(initialTopLevel,compGIt->first); + } + // Handle Orphan components (components not belonging to any groups) + std::map<std::string, cmCPackComponent>::iterator compIt; + for (compIt=this->Components.begin(); + compIt!=this->Components.end(); ++compIt ) + { + // Does the component belong to a group? + if (compIt->second.Group==NULL) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error while execution CPackRPM.cmake" << std::endl); - retval = 0; + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "Component <" + << compIt->second.Name + << "> does not belong to any group, package it separately." + << std::endl); + retval &= PackageOnePack(initialTopLevel,compIt->first); } - // add the generated package to package file names list - packageFileNames.push_back(packageFileName); } } // CPACK_COMPONENTS_IGNORE_GROUPS is set @@ -110,42 +135,14 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) for (compIt=this->Components.begin(); compIt!=this->Components.end(); ++compIt ) { - std::string localToplevel(initialTopLevel); - std::string packageFileName( - cmSystemTools::GetParentDirectory(toplevel.c_str()) - ); - std::string outputFileName( - GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"), - compIt->first, - false) - + this->GetOutputExtension()); - - localToplevel += "/"+ compIt->first; - /* replace the TEMP DIRECTORY with the component one */ - this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str()); - packageFileName += "/"+ outputFileName; - /* replace proposed CPACK_OUTPUT_FILE_NAME */ - this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); - /* replace the TEMPORARY package file name */ - this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", - packageFileName.c_str()); - - this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",compIt->first.c_str()); - if (!this->ReadListFile("CPackRPM.cmake")) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error while execution CPackRPM.cmake" << std::endl); - retval = 0; - } - // add the generated package to package file names list - packageFileNames.push_back(packageFileName); + retval &= PackageOnePack(initialTopLevel,compIt->first); } } return retval; } //---------------------------------------------------------------------- -int cmCPackRPMGenerator::PackageComponentsAllInOne(bool allComponent) +int cmCPackRPMGenerator::PackageComponentsAllInOne() { int retval = 1; std::string compInstDirName; @@ -154,15 +151,7 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne(bool allComponent) packageFileNames.clear(); std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); - // all GROUP in one vs all COMPONENT in one - if (allComponent) - { - compInstDirName = "ALL_COMPONENTS_IN_ONE"; - } - else - { - compInstDirName = "ALL_GROUPS_IN_ONE"; - } + compInstDirName = "ALL_COMPONENTS_IN_ONE"; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging all groups in one package..." @@ -214,21 +203,20 @@ int cmCPackRPMGenerator::PackageFiles() /* Are we in the component packaging case */ if (SupportsComponentInstallation()) { // CASE 1 : COMPONENT ALL-IN-ONE package - // If ALL GROUPS or ALL COMPONENTS in ONE package has been requested + // If ALL COMPONENTS in ONE package has been requested // then the package file is unique and should be open here. - if (allComponentInOne || - (allGroupInOne && (!this->ComponentGroups.empty())) - ) + if (componentPackageMethod == ONE_PACKAGE) { - return PackageComponentsAllInOne(allComponentInOne); + return PackageComponentsAllInOne(); } // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup)) + else { - return PackageComponents(ignoreComponentGroup); + return PackageComponents(componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } } // CASE 3 : NON COMPONENT package. @@ -265,11 +253,11 @@ bool cmCPackRPMGenerator::SupportsComponentInstallation() const std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( const std::string& componentName) { - if (ignoreComponentGroup) { + if (componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { return componentName; } - if (allComponentInOne) { + if (componentPackageMethod == ONE_PACKAGE) { return std::string("ALL_COMPONENTS_IN_ONE"); } // We have to find the name of the COMPONENT GROUP @@ -278,14 +266,7 @@ std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( cmSystemTools::UpperCase(componentName) + "_GROUP"; if (NULL != GetOption(groupVar.c_str())) { - if (allGroupInOne) - { - return std::string("ALL_GROUPS_IN_ONE"); - } - else - { - return std::string(GetOption(groupVar.c_str())); - } + return std::string(GetOption(groupVar.c_str())); } else { diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 7c2e434..4883a0d 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -39,6 +39,10 @@ protected: virtual int InitializeInternal(); virtual int PackageFiles(); /** + * This method factors out the work done in component packaging case. + */ + int PackageOnePack(std::string initialToplevel, std::string packageName); + /** * The method used to package files when component * install is used. This will create one * archive for each component group. @@ -48,7 +52,7 @@ protected: * Special case of component install where all * components will be put in a single installer. */ - int PackageComponentsAllInOne(bool allComponent); + int PackageComponentsAllInOne(); virtual const char* GetOutputExtension() { return ".rpm"; } virtual bool SupportsComponentInstallation() const; virtual std::string GetComponentInstallDirNameSuffix( diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 12d5fd1..5841b8d 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -50,6 +50,7 @@ #include "cmCTestSubmitCommand.h" #include "cmCTestTestCommand.h" #include "cmCTestUpdateCommand.h" +#include "cmCTestUploadCommand.h" #define CTEST_INITIAL_CMAKE_OUTPUT_FILE_NAME "CTestInitialCMakeOutput.log" @@ -357,6 +358,7 @@ void cmCTestScriptHandler::CreateCMake() this->AddCTestCommand(new cmCTestSubmitCommand); this->AddCTestCommand(new cmCTestTestCommand); this->AddCTestCommand(new cmCTestUpdateCommand); + this->AddCTestCommand(new cmCTestUploadCommand); } void cmCTestScriptHandler::GetCommandDocumentation( diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 43441c0..142bb46 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -1204,6 +1204,7 @@ int cmCTestSubmitHandler::ProcessHandler() this->CTest->AddIfExists(cmCTest::PartMemCheck, "DynamicAnalysis.xml"); this->CTest->AddIfExists(cmCTest::PartMemCheck, "Purify.xml"); this->CTest->AddIfExists(cmCTest::PartNotes, "Notes.xml"); + this->CTest->AddIfExists(cmCTest::PartUpload, "Upload.xml"); // Query parts for files to submit. for(cmCTest::Part p = cmCTest::PartStart; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index f87c929..bad26c5 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1282,7 +1282,7 @@ void cmCTestTestHandler::AttachFiles(std::ostream& os, result->Properties->AttachedFiles.begin(); file != result->Properties->AttachedFiles.end(); ++file) { - std::string base64 = this->EncodeFile(*file); + std::string base64 = this->CTest->Base64GzipEncodeFile(*file); std::string fname = cmSystemTools::GetFilenameName(*file); os << "\t\t<NamedMeasurement name=\"Attached File\" encoding=\"base64\" " "compression=\"tar/gzip\" filename=\"" << fname << "\" type=\"file\">" @@ -1293,48 +1293,6 @@ void cmCTestTestHandler::AttachFiles(std::ostream& os, } //---------------------------------------------------------------------- -std::string cmCTestTestHandler::EncodeFile(std::string file) -{ - std::string tarFile = file + "_temp.tar.gz"; - std::vector<cmStdString> files; - files.push_back(file); - - if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false)) - { - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error creating tar while " - "attaching file: " << file << std::endl); - return ""; - } - long len = cmSystemTools::FileLength(tarFile.c_str()); - std::ifstream ifs(tarFile.c_str(), std::ios::in -#ifdef _WIN32 - | std::ios::binary -#endif - ); - unsigned char *file_buffer = new unsigned char [ len + 1 ]; - ifs.read(reinterpret_cast<char*>(file_buffer), len); - ifs.close(); - cmSystemTools::RemoveFile(tarFile.c_str()); - - unsigned char *encoded_buffer - = new unsigned char [ static_cast<int>( - static_cast<double>(len) * 1.5 + 5.0) ]; - - unsigned long rlen - = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1); - - std::string base64 = ""; - for(unsigned long i = 0; i < rlen; i++) - { - base64 += encoded_buffer[i]; - } - delete [] file_buffer; - delete [] encoded_buffer; - - return base64; -} - -//---------------------------------------------------------------------- int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec) { std::vector<cmStdString>::iterator it; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 2c4b230..3089d35 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -151,8 +151,6 @@ protected: void WriteTestResultFooter(std::ostream& os, cmCTestTestResult* result); // Write attached test files into the xml void AttachFiles(std::ostream& os, cmCTestTestResult* result); - // Helper function to encode attached test files - std::string EncodeFile(std::string file); //! Clean test output to specified length bool CleanTestOutput(std::string& output, size_t length); diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx new file mode 100644 index 0000000..731c1c7 --- /dev/null +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -0,0 +1,69 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmCTestUploadCommand.h" + +#include "cmCTest.h" +#include "cmCTestGenericHandler.h" +#include "cmCTestUploadHandler.h" + +cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler() +{ + cmCTestGenericHandler* handler + = this->CTest->GetInitializedHandler("upload"); + if ( !handler ) + { + this->SetError("internal CTest error. Cannot instantiate upload handler"); + return 0; + } + static_cast<cmCTestUploadHandler*>(handler)->SetFiles(this->Files); + + return handler; +} + + +//---------------------------------------------------------------------------- +bool cmCTestUploadCommand::CheckArgumentKeyword(std::string const& arg) +{ + if(arg == "FILES") + { + this->ArgumentDoing = ArgumentDoingFiles; + return true; + } + return false; +} + + +//---------------------------------------------------------------------------- +bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg) +{ + if(this->ArgumentDoing == ArgumentDoingFiles) + { + cmStdString filename(arg); + if(cmSystemTools::FileExists(filename.c_str())) + { + this->Files.insert(filename); + return true; + } + else + { + cmOStringStream e; + e << "File \"" << filename << "\" does not exist. Cannot submit " + << "a non-existent file."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->ArgumentDoing = ArgumentDoingError; + return false; + } + } + + // Look for other arguments. + return this->Superclass::CheckArgumentValue(arg); +} diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h new file mode 100644 index 0000000..6c2a4c2 --- /dev/null +++ b/Source/CTest/cmCTestUploadCommand.h @@ -0,0 +1,85 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmCTestUploadCommand_h +#define cmCTestUploadCommand_h + +#include "cmCTestHandlerCommand.h" +#include "cmCTest.h" + +/** \class cmCTestUpload + * \brief Run a ctest script + * + * cmCTestUploadCommand defines the command to upload result files for + * the project. + */ +class cmCTestUploadCommand : public cmCTestHandlerCommand +{ +public: + + cmCTestUploadCommand() + { + } + + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + cmCTestUploadCommand* ni = new cmCTestUploadCommand; + ni->CTest = this->CTest; + ni->CTestScriptHandler = this->CTestScriptHandler; + return ni; + } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "ctest_upload";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Upload files to a dashboard server."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " ctest_upload(FILES ...)\n" + "Pass a list of files to be sent along with the build results to " + "the dashboard server.\n"; + } + + cmTypeMacro(cmCTestUploadCommand, cmCTestHandlerCommand); + +protected: + cmCTestGenericHandler* InitializeHandler(); + + virtual bool CheckArgumentKeyword(std::string const& arg); + virtual bool CheckArgumentValue(std::string const& arg); + + enum + { + ArgumentDoingFiles = Superclass::ArgumentDoingLast1, + ArgumentDoingLast2 + }; + + cmCTest::SetOfStrings Files; +}; + + +#endif diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx new file mode 100644 index 0000000..caf2e53 --- /dev/null +++ b/Source/CTest/cmCTestUploadHandler.cxx @@ -0,0 +1,77 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmCTestUploadHandler.h" + +#include "cmGeneratedFileStream.h" +#include "cmVersion.h" +#include "cmXMLSafe.h" + +//---------------------------------------------------------------------------- +cmCTestUploadHandler::cmCTestUploadHandler() +{ + this->Initialize(); +} + +//---------------------------------------------------------------------------- +void cmCTestUploadHandler::Initialize() +{ + this->Superclass::Initialize(); + this->Files.clear(); +} + +void cmCTestUploadHandler::SetFiles(const cmCTest::SetOfStrings& files) +{ + this->Files = files; +} + +//---------------------------------------------------------------------------- +int cmCTestUploadHandler::ProcessHandler() +{ + cmGeneratedFileStream ofs; + if ( !this->CTest->OpenOutputFile(this->CTest->GetCurrentTag(), + "Upload.xml", ofs)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Cannot open Upload.xml file" << std::endl); + return -1; + } + + cmCTest::SetOfStrings::const_iterator it; + ofs << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + << "<?xml-stylesheet type=\"text/xsl\" " + "href=\"Dart/Source/Server/XSL/Build.xsl " + "<file:///Dart/Source/Server/XSL/Build.xsl> \"?>\n" + << "<Site BuildName=\"" + << this->CTest->GetCTestConfiguration("BuildName") + << "\" BuildStamp=\"" + << this->CTest->GetCurrentTag() << "-" + << this->CTest->GetTestModelString() << "\" Name=\"" + << this->CTest->GetCTestConfiguration("Site") << "\" Generator=\"ctest" + << cmVersion::GetCMakeVersion() + << "\">\n"; + this->CTest->AddSiteProperties(ofs); + ofs << "<Upload>\n"; + + for ( it = this->Files.begin(); it != this->Files.end(); it ++ ) + { + cmCTestLog(this->CTest, OUTPUT, + "\tUpload file: " << it->c_str() << std::endl); + ofs << "<File filename=\"" << cmXMLSafe(*it) << "\">\n" + << "<Content encoding=\"base64\">\n"; + ofs << this->CTest->Base64EncodeFile(*it); + ofs << "\n</Content>\n" + << "</File>\n"; + } + ofs << "</Upload>\n" + << "</Site>\n"; + return 0; +} diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h new file mode 100644 index 0000000..23ed35a --- /dev/null +++ b/Source/CTest/cmCTestUploadHandler.h @@ -0,0 +1,45 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmCTestUploadHandler_h +#define cmCTestUploadHandler_h + +#include "cmCTestGenericHandler.h" + +/** \class cmCTestUploadHandler + * \brief Helper class for CTest + * + * Submit arbitrary files + * + */ +class cmCTestUploadHandler : public cmCTestGenericHandler +{ +public: + cmTypeMacro(cmCTestUploadHandler, cmCTestGenericHandler); + + cmCTestUploadHandler(); + ~cmCTestUploadHandler() {} + + /* + * The main entry point for this class + */ + int ProcessHandler(); + + void Initialize(); + + /** Specify a set of files to submit. */ + void SetFiles(cmCTest::SetOfStrings const& files); + +private: + cmCTest::SetOfStrings Files; +}; + +#endif diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 502829e..5634849 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -195,11 +195,13 @@ bool cmAddCustomCommandCommand { // An implicit dependency starting point is also an // explicit dependency. - depends.push_back(copy); + std::string dep = copy; + cmSystemTools::ConvertToUnixSlashes(dep); + depends.push_back(dep); // Add the implicit dependency language and file. cmCustomCommand::ImplicitDependsPair - entry(implicit_depends_lang, copy); + entry(implicit_depends_lang, dep); implicit_depends.push_back(entry); // Switch back to looking for a language. @@ -213,7 +215,11 @@ bool cmAddCustomCommandCommand target = copy; break; case doing_depends: - depends.push_back(copy); + { + std::string dep = copy; + cmSystemTools::ConvertToUnixSlashes(dep); + depends.push_back(dep); + } break; case doing_outputs: outputs.push_back(filename); diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 27dea98..4eba886 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -123,7 +123,11 @@ bool cmAddCustomTargetCommand currentLine.push_back(copy); break; case doing_depends: - depends.push_back(copy); + { + std::string dep = copy; + cmSystemTools::ConvertToUnixSlashes(dep); + depends.push_back(dep); + } break; case doing_comment: comment_buffer = copy; diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index d9e4742..25dc8ba 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -236,6 +236,9 @@ bool cmArchiveWrite::AddFile(const char* file, this->Error += archive_error_string(this->Disk); return false; } + // Clear acl and xattr fields not useful for distribution. + archive_entry_acl_clear(e); + archive_entry_xattr_clear(e); if(archive_write_header(this->Archive, e) != ARCHIVE_OK) { this->Error = "archive_write_header: "; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 2e05883..70b1c01 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -16,6 +16,7 @@ #include "cmMakefile.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" +#include <cmsys/Base64.h> #include <cmsys/Directory.hxx> #include <cmsys/SystemInformation.hxx> #include "cmDynamicLoader.h" @@ -31,9 +32,10 @@ #include "cmCTestCoverageHandler.h" #include "cmCTestMemCheckHandler.h" #include "cmCTestScriptHandler.h" +#include "cmCTestSubmitHandler.h" #include "cmCTestTestHandler.h" #include "cmCTestUpdateHandler.h" -#include "cmCTestSubmitHandler.h" +#include "cmCTestUploadHandler.h" #include "cmVersion.h" @@ -339,6 +341,7 @@ cmCTest::cmCTest() this->Parts[PartSubmit].SetName("Submit"); this->Parts[PartNotes].SetName("Notes"); this->Parts[PartExtraFiles].SetName("ExtraFiles"); + this->Parts[PartUpload].SetName("Upload"); // Fill the part name-to-id map. for(Part p = PartStart; p != PartCount; p = Part(p+1)) @@ -357,6 +360,7 @@ cmCTest::cmCTest() this->TestingHandlers["configure"] = new cmCTestConfigureHandler; this->TestingHandlers["memcheck"] = new cmCTestMemCheckHandler; this->TestingHandlers["submit"] = new cmCTestSubmitHandler; + this->TestingHandlers["upload"] = new cmCTestUploadHandler; cmCTest::t_TestingHandlers::iterator it; for ( it = this->TestingHandlers.begin(); @@ -1584,6 +1588,56 @@ int cmCTest::GenerateNotesFile(const char* cfiles) } //---------------------------------------------------------------------- +std::string cmCTest::Base64GzipEncodeFile(std::string file) +{ + std::string tarFile = file + "_temp.tar.gz"; + std::vector<cmStdString> files; + files.push_back(file); + + if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false)) + { + cmCTestLog(this, ERROR_MESSAGE, "Error creating tar while " + "encoding file: " << file << std::endl); + return ""; + } + std::string base64 = this->Base64EncodeFile(tarFile); + cmSystemTools::RemoveFile(tarFile.c_str()); + return base64; +} + +//---------------------------------------------------------------------- +std::string cmCTest::Base64EncodeFile(std::string file) +{ + long len = cmSystemTools::FileLength(file.c_str()); + std::ifstream ifs(file.c_str(), std::ios::in +#ifdef _WIN32 + | std::ios::binary +#endif + ); + unsigned char *file_buffer = new unsigned char [ len + 1 ]; + ifs.read(reinterpret_cast<char*>(file_buffer), len); + ifs.close(); + + unsigned char *encoded_buffer + = new unsigned char [ static_cast<int>( + static_cast<double>(len) * 1.5 + 5.0) ]; + + unsigned long rlen + = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1); + + std::string base64 = ""; + for(unsigned long i = 0; i < rlen; i++) + { + base64 += encoded_buffer[i]; + } + delete [] file_buffer; + delete [] encoded_buffer; + + return base64; +} + + +//---------------------------------------------------------------------- bool cmCTest::SubmitExtraFiles(const std::vector<cmStdString> &files) { std::vector<cmStdString>::const_iterator it; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index e54a205..3b02748 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -61,6 +61,7 @@ public: PartSubmit, PartNotes, PartExtraFiles, + PartUpload, PartCount // Update names in constructor when adding a part }; @@ -192,8 +193,13 @@ public: ///! Get the current time as string std::string CurrentTime(); + //! tar/gzip and then base 64 encode a file + std::string Base64GzipEncodeFile(std::string file); + //! base64 encode a file + std::string Base64EncodeFile(std::string file); + /** - * Return the time remaianing that the script is allowed to run in + * Return the time remaining that the script is allowed to run in * seconds if the user has set the variable CTEST_TIME_LIMIT. If that has * not been set it returns 1e7 seconds */ @@ -515,7 +521,7 @@ private: //! Reread the configuration file bool UpdateCTestConfiguration(); - //! Create not from files. + //! Create note from files. int GenerateCTestNotesOutput(std::ostream& os, const VectorOfStrings& files); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index fdc1a01..d3c4bc7 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -101,9 +101,10 @@ void cmFindPackageCommand::GenerateDocumentation() "The [version] argument requests a version with which the package found " "should be compatible (format is major[.minor[.patch[.tweak]]]). " "The EXACT option requests that the version be matched exactly. " - "If no [version] is given to a recursive invocation inside a " - "find-module, the [version] and EXACT arguments are forwarded " - "automatically from the outer call. " + "If no [version] and/or component list is given to a recursive " + "invocation inside a find-module, the corresponding arguments " + "are forwarded automatically from the outer call (including the " + "EXACT flag for [version]). " "Version support is currently provided only on a package-by-package " "basis (details below).\n" "User code should generally look for packages using the above simple " @@ -524,7 +525,7 @@ bool cmFindPackageCommand cmake::AUTHOR_WARNING, "Ignoring EXACT since no version is requested."); } - if(this->Version.empty()) + if(this->Version.empty() || components.empty()) { // Check whether we are recursing inside "Find<name>.cmake" within // another find_package(<name>) call. @@ -532,16 +533,24 @@ bool cmFindPackageCommand mod += "_FIND_MODULE"; if(this->Makefile->IsOn(mod.c_str())) { - // Get version information from the outer call if necessary. - // Requested version string. - std::string ver = this->Name; - ver += "_FIND_VERSION"; - this->Version = this->Makefile->GetSafeDefinition(ver.c_str()); - - // Whether an exact version is required. - std::string exact = this->Name; - exact += "_FIND_VERSION_EXACT"; - this->VersionExact = this->Makefile->IsOn(exact.c_str()); + if(this->Version.empty()) + { + // Get version information from the outer call if necessary. + // Requested version string. + std::string ver = this->Name; + ver += "_FIND_VERSION"; + this->Version = this->Makefile->GetSafeDefinition(ver.c_str()); + + // Whether an exact version is required. + std::string exact = this->Name; + exact += "_FIND_VERSION_EXACT"; + this->VersionExact = this->Makefile->IsOn(exact.c_str()); + } + if(components.empty()) + { + std::string components_var = this->Name + "_FIND_COMPONENTS"; + components = this->Makefile->GetSafeDefinition(components_var.c_str()); + } } } diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 8710dfc..f88ab0b 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -23,7 +23,7 @@ cmGeneratorExpression::cmGeneratorExpression( this->TargetInfo.compile("^\\$<TARGET" "(|_SONAME|_LINKER)" // File with what purpose? "_FILE(|_NAME|_DIR):" // Filename component. - "([A-Za-z0-9_-]+)" // Target name. + "([A-Za-z0-9_.-]+)" // Target name. ">$"); } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d47fb6f..6c8938e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -903,8 +903,6 @@ void cmGlobalGenerator::Generate() } this->CMakeInstance->UpdateProgress("Generating done", -1); - - this->CMakeInstance->RunCheckForUnusedVariables("generation"); } //---------------------------------------------------------------------------- diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index d00f843..3b35d55 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -61,7 +61,7 @@ public: "Add the given directories to those searched by the compiler for " "include files. By default the directories are appended onto " "the current list of directories. This default behavior can be " - "changed by setting CMAKE_include_directories_BEFORE to ON. " + "changed by setting CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. " "By using BEFORE or AFTER you can select between appending and " "prepending, independent from the default. " "If the SYSTEM option is given the compiler will be told that the " diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7b3fc86..7da35eb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1904,7 +1904,6 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, { // This is a full path. Return it as given. dep = inName; - cmSystemTools::ConvertToUnixSlashes(dep); return true; } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8a27ffd..b8fef25 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -367,10 +367,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, static_cast<cmGlobalVisualStudio7Generator *> (this->GlobalGenerator)->GetConfigurations(); this->WriteString("<CustomBuild Include=\"", 2); - std::string path = - cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), - sourcePath.c_str()); + std::string path = sourcePath; this->ConvertToWindowsSlash(path); (*this->BuildFileStream ) << path << "\">\n"; for(std::vector<std::string>::iterator i = configs->begin(); @@ -452,6 +449,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups() bool header = (*s)->GetPropertyAsBool("HEADER_FILE_ONLY") || this->GlobalGenerator->IgnoreFile ((*s)->GetExtension().c_str()); + std::string ext = + cmSystemTools::LowerCase((*s)->GetExtension()); if(!lang) { lang = "None"; @@ -472,7 +471,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() { headers.push_back(sf); } - else if(sf->GetExtension() == "idl") + else if(ext == "idl") { idls.push_back(sf); } @@ -609,9 +608,6 @@ WriteGroupSources(const char* name, const char* filter = sourceGroup.GetFullName(); this->WriteString("<", 2); std::string path = source; - path = cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), - source.c_str()); this->ConvertToWindowsSlash(path); (*this->BuildFileStream) << name << " Include=\"" << path; @@ -642,14 +638,28 @@ void cmVisualStudio10TargetGenerator::WriteObjSources() for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); source != sources.end(); ++source) { - if((*source)->GetExtension() == "obj") + std::string ext = + cmSystemTools::LowerCase((*source)->GetExtension()); + if(ext == "obj" || ext == "o") { if(first) { this->WriteString("<ItemGroup>\n", 1); first = false; } - this->WriteString("<None Include=\"", 2); + // If an object file is generated, then vs10 + // will use it in the build, and we have to list + // it as None instead of Object + if((*source)->GetPropertyAsBool("GENERATED")) + { + this->WriteString("<None Include=\"", 2); + } + // If it is not a generated object then we have + // to use the Object type + else + { + this->WriteString("<Object Include=\"", 2); + } (*this->BuildFileStream ) << (*source)->GetFullPath() << "\" />\n"; } } @@ -671,8 +681,8 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); source != sources.end(); ++source) { - std::string ext = (*source)->GetExtension(); - if((*source)->GetCustomCommand() || ext == "obj") + std::string ext = cmSystemTools::LowerCase((*source)->GetExtension()); + if((*source)->GetCustomCommand() || ext == "o" || ext == "obj") { continue; } @@ -685,9 +695,6 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() bool rc = lang && (strcmp(lang, "RC") == 0); bool idl = ext == "idl"; std::string sourceFile = (*source)->GetFullPath(); - sourceFile = cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), - sourceFile.c_str()); this->ConvertToWindowsSlash(sourceFile); // output the source file if(header) diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 5920470..71c7c25 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -146,13 +146,15 @@ void cmXCodeObject::Print(std::ostream& out) if(j->second->TypeValue == STRING) { - out << j->first << " = "; + cmXCodeObject::PrintString(out,j->first); + out << " = "; j->second->PrintString(out); out << ";"; } else if(j->second->TypeValue == OBJECT_LIST) { - out << j->first << " = ("; + cmXCodeObject::PrintString(out,j->first); + out << " = ("; for(unsigned int k = 0; k < j->second->List.size(); k++) { if(j->second->List[k]->TypeValue == STRING) @@ -169,7 +171,8 @@ void cmXCodeObject::Print(std::ostream& out) } else { - out << j->first << " = error_unexpected_TypeValue_" << + cmXCodeObject::PrintString(out,j->first); + out << " = error_unexpected_TypeValue_" << j->second->TypeValue << ";"; } @@ -180,7 +183,8 @@ void cmXCodeObject::Print(std::ostream& out) } else if(object->TypeValue == OBJECT_REF) { - out << i->first << " = " << object->Object->Id; + cmXCodeObject::PrintString(out,i->first); + out << " = " << object->Object->Id; if(object->Object->HasComment() && i->first != "remoteGlobalIDString") { out << " "; @@ -190,7 +194,8 @@ void cmXCodeObject::Print(std::ostream& out) } else if(object->TypeValue == STRING) { - out << i->first << " = "; + cmXCodeObject::PrintString(out,i->first); + out << " = "; object->PrintString(out); out << ";" << separator; } @@ -230,19 +235,19 @@ void cmXCodeObject::CopyAttributes(cmXCodeObject* copy) } //---------------------------------------------------------------------------- -void cmXCodeObject::PrintString(std::ostream& os) const +void cmXCodeObject::PrintString(std::ostream& os,cmStdString String) { // The string needs to be quoted if it contains any characters // considered special by the Xcode project file parser. bool needQuote = - (this->String.empty() || - this->String.find_first_of(" <>.+-=@$") != this->String.npos); + (String.empty() || + String.find_first_of(" <>.+-=@$[]") != String.npos); const char* quote = needQuote? "\"" : ""; // Print the string, quoted and escaped as necessary. os << quote; - for(std::string::const_iterator i = this->String.begin(); - i != this->String.end(); ++i) + for(std::string::const_iterator i = String.begin(); + i != String.end(); ++i) { if(*i == '"') { @@ -254,6 +259,11 @@ void cmXCodeObject::PrintString(std::ostream& os) const os << quote; } +void cmXCodeObject::PrintString(std::ostream& os) const +{ + cmXCodeObject::PrintString(os,this->String); +} + //---------------------------------------------------------------------------- void cmXCodeObject::SetString(const char* s) { diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 2bea63b..bdb4f15 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -141,6 +141,7 @@ public: } std::vector<cmXCodeObject*> const& GetObjectList() { return this->List;} void SetComment(const char* c) { this->Comment = c;} + static void PrintString(std::ostream& os,cmStdString String); protected: void PrintString(std::ostream& os) const; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ea8cdfd..4eef7dd 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2346,11 +2346,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) std::string oldstartoutputdir = this->GetStartOutputDirectory(); this->SetStartDirectory(this->GetHomeDirectory()); this->SetStartOutputDirectory(this->GetHomeOutputDirectory()); - const bool warncli = this->WarnUnusedCli; - if (!this->ScriptMode) - { - this->WarnUnusedCli = false; - } int ret = this->Configure(); if (ret || this->ScriptMode) { @@ -2372,7 +2367,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) #endif return ret; } - this->WarnUnusedCli = warncli; ret = this->Generate(); std::string message = "Build files have been written to: "; message += this->GetHomeOutputDirectory(); @@ -2394,6 +2388,10 @@ int cmake::Generate() return -1; } this->GlobalGenerator->Generate(); + if(this->WarnUnusedCli) + { + this->RunCheckForUnusedVariables(); + } if(cmSystemTools::GetErrorOccuredFlag()) { return -1; @@ -4347,7 +4345,10 @@ void cmake::WatchUnusedCli(const char* var) { #ifdef CMAKE_BUILD_WITH_CMAKE this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this); - this->UsedCliVariables[var] = false; + if(this->UsedCliVariables.find(var) == this->UsedCliVariables.end()) + { + this->UsedCliVariables[var] = false; + } #endif } @@ -4355,27 +4356,29 @@ void cmake::UnwatchUnusedCli(const char* var) { #ifdef CMAKE_BUILD_WITH_CMAKE this->VariableWatch->RemoveWatch(var, cmWarnUnusedCliWarning); - this->UsedCliVariables[var] = true; + this->UsedCliVariables.erase(var); #endif } -void cmake::RunCheckForUnusedVariables(const std::string& reason) const +void cmake::RunCheckForUnusedVariables() { #ifdef CMAKE_BUILD_WITH_CMAKE - if(this->WarnUnusedCli) + bool haveUnused = false; + cmOStringStream msg; + msg << "Manually-specified variables were not used by the project:"; + for(std::map<cmStdString, bool>::const_iterator + it = this->UsedCliVariables.begin(); + it != this->UsedCliVariables.end(); ++it) + { + if(!it->second) { - std::map<std::string, bool>::const_iterator it; - for(it = this->UsedCliVariables.begin(); - it != this->UsedCliVariables.end(); ++it) - { - if(!it->second) - { - std::string message = "CMake Warning: The variable, '" + it->first + - "', specified manually, was not used during the " + reason + - "."; - cmSystemTools::Message(message.c_str()); - } - } + haveUnused = true; + msg << "\n " << it->first; } + } + if(haveUnused) + { + this->IssueMessage(cmake::WARNING, msg.str(), cmListFileBacktrace()); + } #endif } diff --git a/Source/cmake.h b/Source/cmake.h index 132a86d..fac86c1 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -368,8 +368,8 @@ class cmake void UnwatchUnusedCli(const char* var); void WatchUnusedCli(const char* var); - void RunCheckForUnusedVariables(const std::string& reason) const; protected: + void RunCheckForUnusedVariables(); void InitializeProperties(); int HandleDeleteCacheVariables(const char* var); cmPropertyMap Properties; @@ -467,7 +467,7 @@ private: bool WarnUnused; bool WarnUnusedCli; bool CheckSystemVars; - std::map<std::string, bool> UsedCliVariables; + std::map<cmStdString, bool> UsedCliVariables; std::string CMakeEditCommand; std::string CMakeCommand; std::string CXXEnvironment; diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c index 3bf2579..7a3266f 100644 --- a/Source/kwsys/Terminal.c +++ b/Source/kwsys/Terminal.c @@ -160,6 +160,7 @@ static const char* kwsysTerminalVT100Names[] = "rxvt-cygwin", "rxvt-cygwin-native", "rxvt-unicode", + "rxvt-unicode-256color", "screen", "screen-256color", "screen-bce", diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 685baf6..cae4bbd 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -15,7 +15,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2011) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 03) +SET(KWSYS_DATE_STAMP_MONTH 04) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 28) +SET(KWSYS_DATE_STAMP_DAY 12) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 77c5752..157814e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -566,6 +566,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}") # set up list of CPack generators list(APPEND GENLST "ZIP") + if(APPLE) + list(APPEND GENLST "DragNDrop") + endif(APPLE) if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") find_program(RPMBUILD NAMES rpmbuild) endif(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") @@ -583,7 +586,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ list(APPEND CWAYLST "OnePackPerGroup") list(APPEND CWAYLST "IgnoreGroup") list(APPEND CWAYLST "AllInOne") - list(APPEND CWAYLST "AllGroupsInOne") foreach(CPackGen ${GENLST}) set(CPackRun_CPackGen "-DCPackGen=${CPackGen}") foreach(CPackComponentWay ${CWAYLST}) @@ -1245,7 +1247,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project WarnUnusedCliUnused --build-options "-DUNUSED_CLI_VARIABLE=Unused") SET_TESTS_PROPERTIES(WarnUnusedCliUnused PROPERTIES - PASS_REGULAR_EXPRESSION "CMake Warning: The variable, 'UNUSED_CLI_VARIABLE'") + PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused") ADD_TEST(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND} @@ -1443,6 +1445,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ PASS_REGULAR_EXPRESSION "Could not find executable" FAIL_REGULAR_EXPRESSION "SegFault") + CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/CTestTestUpload/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" + @ONLY ESCAPE_QUOTES) + ADD_TEST(CTestTestUpload ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestUpload/testOut.log" + ) + SET_TESTS_PROPERTIES(CTestTestUpload PROPERTIES + PASS_REGULAR_EXPRESSION "Upload\\.xml") # Use macro, not function so that build can still be driven by CMake 2.4. # After 2.6 is required, this could be a function without the extra 'set' diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index ce12b3b..5449d09 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -10,13 +10,8 @@ cmake_minimum_required(VERSION 2.8.3.20101130 FATAL_ERROR) project(CPackComponentsForAll) -set(LIBDEST "lib") -include(${CMAKE_SOURCE_DIR}/SystemSpecificInformations.cmake) -if(DISTRO_ID MATCHES "SUSE") - if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - set(LIBDEST "lib64") - endif("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) -endif(DISTRO_ID MATCHES "SUSE") +# Use GNUInstallDirs in order to enforce lib64 if needed +include(GNUInstallDirs) # Create the mylib library add_library(mylib mylib.cpp) @@ -35,7 +30,7 @@ target_link_libraries(mylibapp2 mylib) # be used to create the installation components. install(TARGETS mylib ARCHIVE - DESTINATION ${LIBDEST} + DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) install(TARGETS mylibapp RUNTIME diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-AllGroupsInOne.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-AllGroupsInOne.cmake.in deleted file mode 100644 index 85626be..0000000 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-AllGroupsInOne.cmake.in +++ /dev/null @@ -1,22 +0,0 @@ -# -# Activate component packaging -# -if(CPACK_GENERATOR MATCHES "ZIP") - set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") -endif(CPACK_GENERATOR MATCHES "ZIP") - -if(CPACK_GENERATOR MATCHES "RPM") - set(CPACK_RPM_COMPONENT_INSTALL "ON") -endif(CPACK_GENERATOR MATCHES "RPM") - -if(CPACK_GENERATOR MATCHES "DEB") - set(CPACK_DEB_COMPONENT_INSTALL "ON") -endif(CPACK_GENERATOR MATCHES "DEB") - -# -# Choose grouping way -# -set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE 1) -#set(CPACK_COMPONENTS_GROUPING) -#set(CPACK_COMPONENTS_IGNORE_GROUPS 1) -#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in index 7b665b6..1e1a410 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in @@ -13,10 +13,14 @@ if(CPACK_GENERATOR MATCHES "DEB") set(CPACK_DEB_COMPONENT_INSTALL "ON") endif(CPACK_GENERATOR MATCHES "DEB") +if(CPACK_GENERATOR MATCHES "DragNDrop") + set(CPACK_COMPONENTS_GROUPING "ONE_PER_GROUP") +endif(CPACK_GENERATOR MATCHES "DragNDrop") + # # Choose grouping way # #set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE) #set(CPACK_COMPONENTS_GROUPING) #set(CPACK_COMPONENTS_IGNORE_GROUPS) -#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE)
\ No newline at end of file +#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index ae0ee1a..e2d343d 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -37,38 +37,50 @@ if(CPackGen MATCHES "ZIP") set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.zip") if (${CPackComponentWay} STREQUAL "default") set(expected_count 1) - endif(${CPackComponentWay} STREQUAL "default") - if (${CPackComponentWay} STREQUAL "OnePackPerGroup") + elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup") set(expected_count 3) - endif (${CPackComponentWay} STREQUAL "OnePackPerGroup") - if (${CPackComponentWay} STREQUAL "IgnoreGroup") + elseif (${CPackComponentWay} STREQUAL "IgnoreGroup") set(expected_count 4) - endif (${CPackComponentWay} STREQUAL "IgnoreGroup") - if (${CPackComponentWay} STREQUAL "AllInOne") + elseif (${CPackComponentWay} STREQUAL "AllInOne") set(expected_count 1) - endif (${CPackComponentWay} STREQUAL "AllInOne") - if (${CPackComponentWay} STREQUAL "AllGroupsInOne") - set(expected_count 1) - endif (${CPackComponentWay} STREQUAL "AllGroupsInOne") + endif () elseif (CPackGen MATCHES "RPM") set(config_verbose -D "CPACK_RPM_PACKAGE_DEBUG=1") set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.rpm") if (${CPackComponentWay} STREQUAL "default") set(expected_count 1) - endif (${CPackComponentWay} STREQUAL "default") - if (${CPackComponentWay} STREQUAL "OnePackPerGroup") - set(expected_count 2) - endif (${CPackComponentWay} STREQUAL "OnePackPerGroup") - if (${CPackComponentWay} STREQUAL "IgnoreGroup") + elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup") + set(expected_count 3) + elseif (${CPackComponentWay} STREQUAL "IgnoreGroup") + set(expected_count 4) + elseif (${CPackComponentWay} STREQUAL "AllInOne") + set(expected_count 1) + endif () +elseif (CPackGen MATCHES "DEB") + set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.deb") + if (${CPackComponentWay} STREQUAL "default") + set(expected_count 1) + elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup") + set(expected_count 3) + elseif (${CPackComponentWay} STREQUAL "IgnoreGroup") set(expected_count 4) - endif (${CPackComponentWay} STREQUAL "IgnoreGroup") - if (${CPackComponentWay} STREQUAL "AllInOne") + elseif (${CPackComponentWay} STREQUAL "AllInOne") + set(expected_count 1) + endif () +endif() + +if(CPackGen MATCHES "DragNDrop") + set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.dmg") + if (${CPackComponentWay} STREQUAL "default") set(expected_count 1) - endif (${CPackComponentWay} STREQUAL "AllInOne") - if (${CPackComponentWay} STREQUAL "AllGroupsInOne") + elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup") + set(expected_count 3) + elseif (${CPackComponentWay} STREQUAL "IgnoreGroup") + set(expected_count 4) + elseif (${CPackComponentWay} STREQUAL "AllInOne") set(expected_count 1) - endif (${CPackComponentWay} STREQUAL "AllGroupsInOne") -endif(CPackGen MATCHES "ZIP") + endif () +endif(CPackGen MATCHES "DragNDrop") # clean-up previously CPack generated files if(expected_file_mask) diff --git a/Tests/CPackComponentsForAll/SystemSpecificInformations.cmake b/Tests/CPackComponentsForAll/SystemSpecificInformations.cmake deleted file mode 100644 index 8d11400..0000000 --- a/Tests/CPackComponentsForAll/SystemSpecificInformations.cmake +++ /dev/null @@ -1,164 +0,0 @@ - -# define a set of string with may-be useful readable name -# this file is meant to be included in a CMakeLists.txt -# not as a standalone CMake script -set(SPECIFIC_COMPILER_NAME "") -set(SPECIFIC_SYSTEM_VERSION_NAME "") -set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "") - -# In the WIN32 case try to guess a "readable system name" -if(WIN32) - set(SPECIFIC_SYSTEM_PREFERED_PACKAGE "NSIS") - # information taken from - # http://www.codeguru.com/cpp/w-p/system/systeminformation/article.php/c8973/ - # Win9x series - if(CMAKE_SYSTEM_VERSION MATCHES "4.0") - set(SPECIFIC_SYSTEM_VERSION_NAME "Win95") - endif(CMAKE_SYSTEM_VERSION MATCHES "4.0") - if(CMAKE_SYSTEM_VERSION MATCHES "4.10") - set(SPECIFIC_SYSTEM_VERSION_NAME "Win98") - endif(CMAKE_SYSTEM_VERSION MATCHES "4.10") - if(CMAKE_SYSTEM_VERSION MATCHES "4.90") - set(SPECIFIC_SYSTEM_VERSION_NAME "WinME") - endif(CMAKE_SYSTEM_VERSION MATCHES "4.90") - - # WinNTyyy series - if(CMAKE_SYSTEM_VERSION MATCHES "3.0") - set(SPECIFIC_SYSTEM_VERSION_NAME "WinNT351") - endif(CMAKE_SYSTEM_VERSION MATCHES "3.0") - if(CMAKE_SYSTEM_VERSION MATCHES "4.1") - set(SPECIFIC_SYSTEM_VERSION_NAME "WinNT4") - endif(CMAKE_SYSTEM_VERSION MATCHES "4.1") - - # Win2000/XP series - if(CMAKE_SYSTEM_VERSION MATCHES "5.0") - set(SPECIFIC_SYSTEM_VERSION_NAME "Win2000") - endif(CMAKE_SYSTEM_VERSION MATCHES "5.0") - if(CMAKE_SYSTEM_VERSION MATCHES "5.1") - set(SPECIFIC_SYSTEM_VERSION_NAME "WinXP") - endif(CMAKE_SYSTEM_VERSION MATCHES "5.1") - if(CMAKE_SYSTEM_VERSION MATCHES "5.2") - set(SPECIFIC_SYSTEM_VERSION_NAME "Win2003") - endif(CMAKE_SYSTEM_VERSION MATCHES "5.2") - - # WinVista/7 series - if(CMAKE_SYSTEM_VERSION MATCHES "6.0") - set(SPECIFIC_SYSTEM_VERSION_NAME "WinVISTA") - endif(CMAKE_SYSTEM_VERSION MATCHES "6.0") - if(CMAKE_SYSTEM_VERSION MATCHES "6.1") - set(SPECIFIC_SYSTEM_VERSION_NAME "Win7") - endif(CMAKE_SYSTEM_VERSION MATCHES "6.1") - - # Compilers - # taken from http://predef.sourceforge.net/precomp.html#sec34 - if(MSVC) - set(SPECIFIC_COMPILER_NAME "MSVC-Unknown-${MSVC_VERSION}") - if(MSVC_VERSION EQUAL 1200) - set(SPECIFIC_COMPILER_NAME "MSVC-6.0") - endif(MSVC_VERSION EQUAL 1200) - if(MSVC_VERSION EQUAL 1300) - set(SPECIFIC_COMPILER_NAME "MSVC-7.0") - endif(MSVC_VERSION EQUAL 1300) - if(MSVC_VERSION EQUAL 1310) - set(SPECIFIC_COMPILER_NAME "MSVC-7.1-2003") #Visual Studio 2003 - endif(MSVC_VERSION EQUAL 1310) - if(MSVC_VERSION EQUAL 1400) - set(SPECIFIC_COMPILER_NAME "MSVC-8.0-2005") #Visual Studio 2005 - endif(MSVC_VERSION EQUAL 1400) - if(MSVC_VERSION EQUAL 1500) - set(SPECIFIC_COMPILER_NAME "MSVC-9.0-2008") #Visual Studio 2008 - endif(MSVC_VERSION EQUAL 1500) - if(MSVC_VERSION EQUAL 1600) - set(SPECIFIC_COMPILER_NAME "MSVC-10.0-2010") #Visual Studio 2010 - endif(MSVC_VERSION EQUAL 1600) - endif(MSVC) - if(MINGW) - set(SPECIFIC_COMPILER_NAME "MinGW") - endif(MINGW) - if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") - set(SPECIFIC_SYSTEM_VERSION_NAME "${SPECIFIC_SYSTEM_VERSION_NAME}-x86_64") - endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") -endif(WIN32) - -# In the Linux case try to guess the distro name/type -# using either lsb_release program or fallback -# to the content of the /etc/issue file -if(UNIX) - if(CMAKE_SYSTEM_NAME MATCHES "Linux") - set(SPECIFIC_SYSTEM_VERSION_NAME "${CMAKE_SYSTEM_NAME}") - set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "TGZ") - find_program(LSB_RELEASE_EXECUTABLE lsb_release) - if(LSB_RELEASE_EXECUTABLE) - execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -i - OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX MATCH "Distributor ID:(.*)" DISTRO_ID ${_TMP_LSB_RELEASE_OUTPUT}) - string(STRIP "${CMAKE_MATCH_1}" DISTRO_ID) - # replace potential space with underscore - string(REPLACE " " "_" DISTRO_ID "${DISTRO_ID}") - execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -r - OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX MATCH "Release:(.*)" DISTRO_RELEASE ${_TMP_LSB_RELEASE_OUTPUT}) - string(STRIP "${CMAKE_MATCH_1}" DISTRO_RELEASE) - execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -c - OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX MATCH "Codename:(.*)" DISTRO_CODENAME ${_TMP_LSB_RELEASE_OUTPUT}) - string(STRIP "${CMAKE_MATCH_1}" DISTRO_CODENAME) - elseif (EXISTS "/etc/issue") - set(LINUX_NAME "") - file(READ "/etc/issue" LINUX_ISSUE) - # Fedora case - if(LINUX_ISSUE MATCHES "Fedora") - string(REGEX MATCH "release ([0-9]+)" FEDORA "${LINUX_ISSUE}") - set(DISTRO_ID "Fedora") - set(DISTRO_RELEASE "${CMAKE_MATCH_1}") - # FIXME can we find that in /etc/issue - set(DISTRO_CODENAME "") - endif(LINUX_ISSUE MATCHES "Fedora") - # Ubuntu case - if(LINUX_ISSUE MATCHES "Ubuntu") - string(REGEX MATCH "buntu ([0-9]+\\.[0-9]+)" UBUNTU "${LINUX_ISSUE}") - set(DISTRO_ID "Ubuntu") - set(DISTRO_RELEASE "${CMAKE_MATCH_1}") - # FIXME can we find that in /etc/issue - set(DISTRO_CODENAME "") - endif(LINUX_ISSUE MATCHES "Ubuntu") - # Debian case - if(LINUX_ISSUE MATCHES "Debian") - string(REGEX MATCH "Debian .*ux ([0-9]+\\.[0-9]+)" - DEBIAN "${LINUX_ISSUE}") - set(DISTRO_ID "Debian") - set(DISTRO_RELEASE "${CMAKE_MATCH_1}") - set(DISTRO_CODENAME "") - endif(LINUX_ISSUE MATCHES "Debian") - # Open SuSE case - if(LINUX_ISSUE MATCHES "SUSE") - string(REGEX MATCH "SUSE ([0-9]+\\.[0-9]+)" SUSE "${LINUX_ISSUE}") - set(DISTRO_ID "SUSE") - set(DISTRO_RELEASE "${CMAKE_MATCH_1}") - set(DISTRO_CODENAME "") - endif(LINUX_ISSUE MATCHES "SUSE") - # Mandriva case - # TODO - endif(LSB_RELEASE_EXECUTABLE) - # Now mangle some names - set(LINUX_NAME "${DISTRO_ID}_${DISTRO_RELEASE}") - if(DISTRO_ID MATCHES "Fedora|Mandriva|SUSE|OpenSUSE") - set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "RPM") - endif(DISTRO_ID MATCHES "Fedora|Mandriva|SUSE|OpenSUSE") - if(DISTRO_ID MATCHES "Debian|Ubuntu") - set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "DEB") - endif(DISTRO_ID MATCHES "Debian|Ubuntu") - if(LINUX_NAME) - set(SPECIFIC_SYSTEM_VERSION_NAME "${CMAKE_SYSTEM_NAME}-${LINUX_NAME}") - endif(LINUX_NAME) - endif(CMAKE_SYSTEM_NAME MATCHES "Linux") - set(SPECIFIC_SYSTEM_VERSION_NAME - "${SPECIFIC_SYSTEM_VERSION_NAME}-${CMAKE_SYSTEM_PROCESSOR}") - set(SPECIFIC_COMPILER_NAME "") -endif(UNIX) diff --git a/Tests/CTestTestUpload/CMakeLists.txt b/Tests/CTestTestUpload/CMakeLists.txt new file mode 100644 index 0000000..bc164b1 --- /dev/null +++ b/Tests/CTestTestUpload/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required (VERSION 2.6) +PROJECT(CTestTestUpload) + +add_executable (Sleep sleep.c) diff --git a/Tests/CTestTestUpload/CTestConfig.cmake b/Tests/CTestTestUpload/CTestConfig.cmake new file mode 100644 index 0000000..89c5b94 --- /dev/null +++ b/Tests/CTestTestUpload/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestUpload") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set (CTEST_DROP_METHOD "http") +set (CTEST_DROP_SITE "www.cdash.org") +set (CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set (CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestUpload/sleep.c b/Tests/CTestTestUpload/sleep.c new file mode 100644 index 0000000..b589647 --- /dev/null +++ b/Tests/CTestTestUpload/sleep.c @@ -0,0 +1,21 @@ +#if defined(_WIN32) +# include <windows.h> +#else +# include <unistd.h> +#endif + +/* sleeps for n seconds, where n is the argument to the program */ +int main(int argc, char** argv) +{ + int time; + if(argc > 1) + { + time = atoi(argv[1]); + } +#if defined(_WIN32) + Sleep(time * 1000); +#else + sleep(time); +#endif + return 0; +} diff --git a/Tests/CTestTestUpload/test.cmake.in b/Tests/CTestTestUpload/test.cmake.in new file mode 100644 index 0000000..acfa233 --- /dev/null +++ b/Tests/CTestTestUpload/test.cmake.in @@ -0,0 +1,17 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.1) + +# Settings: +SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +SET(CTEST_SITE "@SITE@") +SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Upload") + +SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestUpload") +SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestUpload") +SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_UPLOAD(FILES "${CTEST_SOURCE_DIRECTORY}/sleep.c" "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt") +CTEST_SUBMIT() diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 19e3c2c..b7c9ea2 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -102,7 +102,7 @@ ADD_CUSTOM_TARGET(TDocument ALL COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1.h to doc2.h." COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1.h ${PROJECT_BINARY_DIR}/doc2.h - DEPENDS ${PROJECT_BINARY_DIR}/doc1.h doc1.txt + DEPENDS doc1.txt ${PROJECT_BINARY_DIR}//doc1.h # test 2 slashes COMMENT "Running top-level TDocument commands" SOURCES doc1.tex ) diff --git a/Tests/ExternalOBJ/CMakeLists.txt b/Tests/ExternalOBJ/CMakeLists.txt index 3fef135..f12de11 100644 --- a/Tests/ExternalOBJ/CMakeLists.txt +++ b/Tests/ExternalOBJ/CMakeLists.txt @@ -51,5 +51,11 @@ ADD_CUSTOM_COMMAND( DEPENDS ${EXTERNAL_OBJECT} ) +message("${EXTERNAL_OBJECT}") # Build an executable using the external object file. ADD_EXECUTABLE(ExternalOBJ executable.cxx ${CUSTOM_OBJECT}) +# A bug showed up in VS2010 where an object file that was +# part of a custom commad output worked, but ones that were +# not didn't work. So, repeat the executable using the object +# directly and not from the output of the copy. +ADD_EXECUTABLE(ExternalOBJ2 executable.cxx ${EXTERNAL_OBJECT}) diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index f420f4b..d4984d7 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -105,7 +105,7 @@ FIND_PACKAGE(wibbleA NAMES wibble PATHS B) FIND_PACKAGE(wibbleB NAMES wibble HINTS B) # Look for package with recursive find-modules. -FIND_PACKAGE(RecursiveA) +FIND_PACKAGE(RecursiveA COMPONENTS A) FIND_PACKAGE(RecursiveB 2) FIND_PACKAGE(RecursiveC 3.1 EXACT) diff --git a/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake b/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake index deffa57..eff4d4f 100644 --- a/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake +++ b/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake @@ -1 +1,4 @@ # Test config file. +if(NOT "${RecursiveA_FIND_COMPONENTS}" STREQUAL "A") + message(FATAL_ERROR "find_package(RecursiveA NO_MODULE) did not forward components") +endif() |