diff options
104 files changed, 980 insertions, 451 deletions
diff --git a/Help/command/install.rst b/Help/command/install.rst index 5d2add7..189b51c 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -45,11 +45,15 @@ signatures that specify them. The common options are: is associated, such as "runtime" or "development". During component-specific installation only install rules associated with the given component name will be executed. During a full installation - all components are installed. If ``COMPONENT`` is not provided a - default component "Unspecified" is created. The default component - name may be controlled with the + all components are installed unless marked with ``EXCLUDE_FROM_ALL``. + If ``COMPONENT`` is not provided a default component "Unspecified" is + created. The default component name may be controlled with the :variable:`CMAKE_INSTALL_DEFAULT_COMPONENT_NAME` variable. +``EXCLUDE_FROM_ALL`` + Specify that the file is excluded from a full installation and only + installed as part of a component-specific installation + ``RENAME`` Specify a name for an installed file that may be different from the original file. Renaming is allowed only when a single file is @@ -76,7 +80,8 @@ Installing Targets [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT <component>] - [OPTIONAL] [NAMELINK_ONLY|NAMELINK_SKIP] + [OPTIONAL] [EXCLUDE_FROM_ALL] + [NAMELINK_ONLY|NAMELINK_SKIP] ] [...]) The ``TARGETS`` form specifies rules for installing targets from a @@ -172,7 +177,7 @@ Installing Files [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT <component>] - [RENAME <name>] [OPTIONAL]) + [RENAME <name>] [OPTIONAL] [EXCLUDE_FROM_ALL]) The ``FILES`` form specifies rules for installing files for a project. File names given as relative paths are interpreted with respect to the @@ -206,7 +211,8 @@ Installing Directories [DIRECTORY_PERMISSIONS permissions...] [USE_SOURCE_PERMISSIONS] [OPTIONAL] [MESSAGE_NEVER] [CONFIGURATIONS [Debug|Release|...]] - [COMPONENT <component>] [FILES_MATCHING] + [COMPONENT <component>] [EXCLUDE_FROM_ALL] + [FILES_MATCHING] [[PATTERN <pattern> | REGEX <regex>] [EXCLUDE] [PERMISSIONS permissions...]] [...]) @@ -282,7 +288,7 @@ Custom Installation Logic :: install([[SCRIPT <file>] [CODE <code>]] - [COMPONENT <component>] [...]) + [COMPONENT <component>] [EXCLUDE_FROM_ALL] [...]) The ``SCRIPT`` form will invoke the given CMake script files during installation. If the script file name is a relative path it will be @@ -307,7 +313,8 @@ Installing Exports [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [EXPORT_LINK_INTERFACE_LIBRARIES] - [COMPONENT <component>]) + [COMPONENT <component>] + [EXCLUDE_FROM_ALL]) The ``EXPORT`` form generates and installs a CMake file containing code to import targets from the installation tree into another project. diff --git a/Help/command/list.rst b/Help/command/list.rst index a7a05c7..f6b75bc 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -9,6 +9,7 @@ List operations. list(GET <list> <element index> [<element index> ...] <output variable>) list(APPEND <list> [<element> ...]) + list(FILTER <list> <INCLUDE|EXCLUDE> REGEX <regular_expression>) list(FIND <list> <value> <output variable>) list(INSERT <list> <element_index> <element> [<element> ...]) list(REMOVE_ITEM <list> <value> [<value> ...]) @@ -23,6 +24,12 @@ List operations. ``APPEND`` will append elements to the list. +``FILTER`` will include or remove items from the list that match the +mode's pattern. +In ``REGEX`` mode, items will be matched against the given regular expression. +For more information on regular expressions see also the :command:`string` +command. + ``FIND`` will return the index of the element specified in the list or -1 if it wasn't found. @@ -38,9 +45,9 @@ difference is that ``REMOVE_ITEM`` will remove the given items, while ``SORT`` sorts the list in-place alphabetically. -The list subcommands ``APPEND``, ``INSERT``, ``REMOVE_AT``, ``REMOVE_ITEM``, -``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create new values for -the list within the current CMake variable scope. Similar to the +The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``REMOVE_AT``, +``REMOVE_ITEM``, ``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create new +values for the list within the current CMake variable scope. Similar to the :command:`set` command, the LIST command creates new variable values in the current scope, even if the list itself is actually defined in a parent scope. To propagate the results of these operations upwards, use diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 91af3e3..959148e 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -58,13 +58,14 @@ Options <dir> = Project binary directory to be built. --target <tgt> = Build <tgt> instead of default targets. + May only be specified once. --config <cfg> = For multi-configuration tools, choose <cfg>. --clean-first = Build target 'clean' first, then build. (To clean only, use --target 'clean'.) --use-stderr = Ignored. Behavior is default in CMake >= 3.0. -- = Pass remaining options to the native tool. - Run cmake --build with no options for quick help. + Run ``cmake --build`` with no options for quick help. ``-N`` View mode only. diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 0000000..e4cc01e --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/dev/cpack-rpm-upper-cased-components.rst b/Help/release/dev/cpack-rpm-upper-cased-components.rst new file mode 100644 index 0000000..a5fb233 --- /dev/null +++ b/Help/release/dev/cpack-rpm-upper-cased-components.rst @@ -0,0 +1,15 @@ +cpack-rpm-upper-cased-components +-------------------------------- + +* The "CPackRPM" module now supports upper cased component name + in per component CPackRPM specific variables. + E.g. component named ``foo`` now expects component specific + variable to be ``CPACK_RPM_FOO_PACKAGE_NAME`` while before + it expected ``CPACK_RPM_foo_PACKAGE_NAME``. + Upper cased component name part in variables is compatible + with convention used for other CPack variables. + For back compatibility old format of variables is still valid + and prefered if both versions of variable are set, but the + preferred future use is upper cased component names in variables. + New variables that will be added to CPackRPM in later versions + will only support upper cased component variable format. diff --git a/Help/release/dev/error-multiple-targets.rst b/Help/release/dev/error-multiple-targets.rst new file mode 100644 index 0000000..060b26b --- /dev/null +++ b/Help/release/dev/error-multiple-targets.rst @@ -0,0 +1,6 @@ +error-multiple-targets +---------------------- + +* The :manual:`cmake(1)` ``--build`` command-line tool now rejects multiple + ``--target`` options with an error instead of silently ignoring all but the + last one. diff --git a/Help/release/dev/install-EXCLUDE_FROM_ALL.rst b/Help/release/dev/install-EXCLUDE_FROM_ALL.rst new file mode 100644 index 0000000..a611eae --- /dev/null +++ b/Help/release/dev/install-EXCLUDE_FROM_ALL.rst @@ -0,0 +1,5 @@ +install-EXCLUDE_FROM_ALL +------------------------ + +* The :command:`install` command learned a new ``EXCLUDE_FROM_ALL`` option + to leave installation rules out of the default installation. diff --git a/Help/release/dev/list-FILTER-command.rst b/Help/release/dev/list-FILTER-command.rst new file mode 100644 index 0000000..3fee4f0 --- /dev/null +++ b/Help/release/dev/list-FILTER-command.rst @@ -0,0 +1,5 @@ +list-FILTER-command +------------------- + +* The :command:`list` command gained a ``FILTER`` sub-command to filter + list elements by regular expression. diff --git a/Help/release/index.rst b/Help/release/index.rst index 6b7da3c..7ecf910 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -5,6 +5,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 45dda40..73ff0af 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -479,7 +479,7 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag) get_item_rpaths("${resolved_item}" item_rpaths) - if(item MATCHES "[^/]+\\.framework/") + if((item NOT MATCHES "\\.dylib$") AND (item MATCHES "[^/]+\\.framework/")) # For frameworks, construct the name under the embedded path from the # opening "${item_name}.framework/" to the closing "/${item_name}": # diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 7fb11c3..7ffec13 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -7,25 +7,35 @@ # Variables specific to CPack RPM generator # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # -# CPackRPM may be used to create RPM package using CPack. CPackRPM is a -# CPack generator thus it uses the CPACK_XXX variables used by CPack : -# https://cmake.org/Wiki/CMake:CPackConfiguration -# -# However CPackRPM has specific features which are controlled by the -# specifics CPACK_RPM_XXX variables. CPackRPM is a component aware -# generator so when CPACK_RPM_COMPONENT_INSTALL is ON some more -# CPACK_RPM_<ComponentName>_XXXX variables may be used in order to have -# component specific values. Note however that <componentName> refers -# to the **grouping name**. This may be either a component name or a -# component GROUP name. Usually those vars correspond to RPM spec file -# entities, one may find information about spec files here -# http://www.rpm.org/wiki/Docs. You'll find a detailed usage of -# CPackRPM on the wiki: -# -# :: +# CPackRPM may be used to create RPM package using CPack. +# CPackRPM is a CPack generator thus it uses the ``CPACK_XXX`` variables +# used by CPack : https://cmake.org/Wiki/CMake:CPackConfiguration. # -# https://cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29 +# CPackRPM has specific features which are controlled by the specifics +# :code:`CPACK_RPM_XXX` variables. # +# :code:`CPACK_RPM_<COMPONENT>_XXXX` variables may be used in order to have +# **component** specific values. Note however that ``<COMPONENT>`` refers to the +# **grouping name** written in upper case. It may be either a component name or +# a component GROUP name. Usually those vars correspond to RPM spec file +# entities, one may find information about spec files here +# http://www.rpm.org/wiki/Docs +# +# .. note:: +# +# `<COMPONENT>` part of variables is prefered to be in upper case (for e.g. if +# component is named `foo` then use `CPACK_RPM_FOO_XXXX` variable name format) +# as is with other `CPACK_<COMPONENT>_XXXX` variables. +# For the purposes of back compatibility (CMake/CPack version 3.5 and lower) +# support for same cased component (e.g. `fOo` would be used as +# `CPACK_RPM_fOo_XXXX`) is still supported for variables defined in older +# versions of CMake/CPack but is not guaranteed for variables that +# will be added in the future. For the sake of back compatibility same cased +# component variables also override upper cased versions where both are +# present. +# +# List of CPack/RPM specific variables: +# https://cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 . # However as a handy reminder here comes the list of specific variables: # # .. variable:: CPACK_RPM_PACKAGE_SUMMARY @@ -557,7 +567,7 @@ # invalid location. #============================================================================= -# Copyright 2007-2009 Kitware, Inc. +# Copyright 2007-2016 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -575,6 +585,8 @@ function(cpack_rpm_prepare_relocation_paths) # set appropriate prefix, remove possible trailing slash and convert backslashes to slashes if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX) file(TO_CMAKE_PATH "${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX}" PATH_PREFIX) + elseif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_PREFIX) + file(TO_CMAKE_PATH "${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_PREFIX}" PATH_PREFIX) else() file(TO_CMAKE_PATH "${CPACK_PACKAGING_INSTALL_PREFIX}" PATH_PREFIX) endif() @@ -585,7 +597,8 @@ function(cpack_rpm_prepare_relocation_paths) # set base path prefix if(EXISTS "${WDIR}/${PATH_PREFIX}") if(NOT CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION AND - NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT}_INSTALL_PREFIX_RELOCATION) + NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT}_INSTALL_PREFIX_RELOCATION AND + NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_INSTALL_PREFIX_RELOCATION) set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n") list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}") @@ -1044,6 +1057,17 @@ if(NOT UNIX) message(FATAL_ERROR "CPackRPM.cmake may only be used under UNIX.") endif() +function(cpack_rpm_variable_fallback OUTPUT_VAR_NAME) + set(FALLBACK_VAR_NAMES ${ARGN}) + + foreach(variable_name IN LISTS FALLBACK_VAR_NAMES) + if(${variable_name}) + set(${OUTPUT_VAR_NAME} "${${variable_name}}" PARENT_SCOPE) + break() + endif() + endforeach() +endfunction() + function(cpack_rpm_generate_package) # rpmbuild is the basic command for building RPM package # it may be a simple (symbolic) link to rpm command. @@ -1124,12 +1148,10 @@ function(cpack_rpm_generate_package) # CPACK_RPM_PACKAGE_SUMMARY (mandatory) - #Check for component summary first. - #If not set, it will use regular package summary logic. if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY) - set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY}) - endif() + cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_SUMMARY" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_SUMMARY") endif() if(NOT CPACK_RPM_PACKAGE_SUMMARY) @@ -1142,17 +1164,15 @@ function(cpack_rpm_generate_package) endif() # CPACK_RPM_PACKAGE_NAME (mandatory) - if(NOT CPACK_RPM_PACKAGE_NAME) string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) endif() if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME) - set(CPACK_RPM_PACKAGE_NAME ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME}) - else() - set(CPACK_RPM_PACKAGE_NAME ${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_COMPONENT}) - endif() + set(CPACK_RPM_PACKAGE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_COMPONENT}") + cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_NAME" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME") endif() # CPACK_RPM_PACKAGE_VERSION (mandatory) @@ -1179,19 +1199,18 @@ function(cpack_rpm_generate_package) endif() endif() - set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_PACKAGE_ARCHITECTURE}) - - #prefer component architecture if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE) - set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using component build arch = ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") - endif() + cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_ARCHITECTURE" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_ARCHITECTURE") + + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using component build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") endif() endif() - if(${_CPACK_RPM_PACKAGE_ARCHITECTURE} STREQUAL "noarch") - set(TMP_RPM_BUILDARCH "Buildarch: ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") + + if(${CPACK_RPM_PACKAGE_ARCHITECTURE} STREQUAL "noarch") + set(TMP_RPM_BUILDARCH "Buildarch: ${CPACK_RPM_PACKAGE_ARCHITECTURE}") else() set(TMP_RPM_BUILDARCH "") endif() @@ -1214,13 +1233,10 @@ function(cpack_rpm_generate_package) endif() # CPACK_RPM_PACKAGE_GROUP - - #Check for component group first. - #If not set, it will use regular package group logic. if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP) - set(CPACK_RPM_PACKAGE_GROUP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP}) - endif() + cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_GROUP" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_GROUP") endif() if(NOT CPACK_RPM_PACKAGE_GROUP) @@ -1247,14 +1263,11 @@ function(cpack_rpm_generate_package) # - set to a default value # - #Check for a component description first. - #If not set, it will use regular package description logic. if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION) - set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION}) - elseif(CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION) - set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION}) - endif() + cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_DESCRIPTION" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_DESCRIPTION" + "CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION") endif() if(NOT CPACK_RPM_PACKAGE_DESCRIPTION) @@ -1306,32 +1319,21 @@ function(cpack_rpm_generate_package) # If component specific var is not provided we use the global one # for each component foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}") + endif() + if(CPACK_RPM_PACKAGE_COMPONENT) + cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_${_RPM_SPEC_HEADER}") + endif() + + if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}") - endif() - if(CPACK_RPM_PACKAGE_COMPONENT) - if(DEFINED CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}") - endif() - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}}) - else() - if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER} not defined") - message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") - endif() - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) - endif() - endif() - else() - if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") - endif() - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) - endif() + message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") endif() + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + endif() # Treat the RPM Spec keyword iff it has been properly defined if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) @@ -1373,94 +1375,38 @@ function(cpack_rpm_generate_package) # May be used to embed a post (un)installation script in the spec file. # The refered script file(s) will be read and directly # put after the %post or %postun section - if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE) - set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE}) - else() - set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) - endif() - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE) - set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE}) - else() - set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) - endif() - else() - set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) - set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) - endif() - - # Handle post-install file if it has been specified - if(CPACK_RPM_POST_INSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) - file(READ ${CPACK_RPM_POST_INSTALL_READ_FILE} CPACK_RPM_SPEC_POSTINSTALL) - else() - message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring") - endif() - else() - # reset SPEC var value if no post install file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_POSTINSTALL "") - endif() - - # Handle post-uninstall file if it has been specified - if(CPACK_RPM_POST_UNINSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) - file(READ ${CPACK_RPM_POST_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_POSTUNINSTALL) - else() - message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring") - endif() - else() - # reset SPEC var value if no post uninstall file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_POSTUNINSTALL "") - endif() - + # ---------------------------------------------------------------- # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE) # CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE) # May be used to embed a pre (un)installation script in the spec file. # The refered script file(s) will be read and directly # put after the %pre or %preun section - if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE) - set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE}) - else() - set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) - endif() - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE) - set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE}) - else() - set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) - endif() - else() - set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) - set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) - endif() + foreach(RPM_SCRIPT_FILE_TYPE_ "INSTALL" "UNINSTALL") + foreach(RPM_SCRIPT_FILE_TIME_ "PRE" "POST") + set("CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE" + "${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE}") - # Handle pre-install file if it has been specified - if(CPACK_RPM_PRE_INSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) - file(READ ${CPACK_RPM_PRE_INSTALL_READ_FILE} CPACK_RPM_SPEC_PREINSTALL) - else() - message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring") - endif() - else() - # reset SPEC var value if no pre-install file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_PREINSTALL "") - endif() + if(CPACK_RPM_PACKAGE_COMPONENT) + cpack_rpm_variable_fallback("CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE") + endif() - # Handle pre-uninstall file if it has been specified - if(CPACK_RPM_PRE_UNINSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) - file(READ ${CPACK_RPM_PRE_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_PREUNINSTALL) - else() - message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring") - endif() - else() - # reset SPEC var value if no pre-uninstall file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_PREUNINSTALL "") - endif() + # Handle file if it has been specified + if(CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE) + if(EXISTS ${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE}) + file(READ ${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE} + "CPACK_RPM_SPEC_${RPM_SCRIPT_FILE_TIME_}${RPM_SCRIPT_FILE_TYPE_}") + else() + message("CPackRPM:Warning: CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE <${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE}> does not exists - ignoring") + endif() + else() + # reset SPEC var value if no file has been specified + # (either globally or component-wise) + set("CPACK_RPM_SPEC_${RPM_SCRIPT_FILE_TIME_}${RPM_SCRIPT_FILE_TYPE_}" "") + endif() + endforeach() + endforeach() # CPACK_RPM_CHANGELOG_FILE # May be used to embed a changelog in the spec file. @@ -1495,7 +1441,7 @@ function(cpack_rpm_generate_package) file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS) file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS) - #set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${_CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") + #set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") # it seems rpmbuild can't handle spaces in the path # neither escaping (as below) nor putting quotes around the path seem to help @@ -1510,12 +1456,14 @@ function(cpack_rpm_generate_package) # This must be done BEFORE the CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL handling if(CPACK_RPM_PACKAGE_COMPONENT) if(CPACK_ABSOLUTE_DESTINATION_FILES) - set(COMPONENT_FILES_TAG "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT}") - set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${${COMPONENT_FILES_TAG}}") - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>") - message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") - endif() + cpack_rpm_variable_fallback("COMPONENT_FILES_TAG" + "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT}" + "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}") + set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${${COMPONENT_FILES_TAG}}") + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>") + message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") + endif() endif() else() if(CPACK_ABSOLUTE_DESTINATION_FILES) @@ -1524,22 +1472,18 @@ function(cpack_rpm_generate_package) endif() # In component case, set CPACK_RPM_USER_FILELIST_INTERNAL with CPACK_RPM_<COMPONENT>_USER_FILELIST. + set(CPACK_RPM_USER_FILELIST_INTERNAL "") if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST) - set(CPACK_RPM_USER_FILELIST_INTERNAL ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") - message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") - endif() - else() - set(CPACK_RPM_USER_FILELIST_INTERNAL "") - endif() - else() - if(CPACK_RPM_USER_FILELIST) - set(CPACK_RPM_USER_FILELIST_INTERNAL "${CPACK_RPM_USER_FILELIST}") - else() - set(CPACK_RPM_USER_FILELIST_INTERNAL "") + cpack_rpm_variable_fallback("CPACK_RPM_USER_FILELIST_INTERNAL" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_USER_FILELIST") + + if(CPACK_RPM_PACKAGE_DEBUG AND CPACK_RPM_USER_FILELIST_INTERNAL) + message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") + message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") endif() + elseif(CPACK_RPM_USER_FILELIST) + set(CPACK_RPM_USER_FILELIST_INTERNAL "${CPACK_RPM_USER_FILELIST}") endif() # Handle user specified file line list in CPACK_RPM_USER_FILELIST_INTERNAL @@ -1578,7 +1522,6 @@ function(cpack_rpm_generate_package) if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) endif() - endforeach() # Rebuild CPACK_RPM_INSTALL_FILES @@ -1650,8 +1593,10 @@ function(cpack_rpm_generate_package) # # We can have a component specific spec file. - if(CPACK_RPM_PACKAGE_COMPONENT AND CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE) - set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE}) + if(CPACK_RPM_PACKAGE_COMPONENT) + cpack_rpm_variable_fallback("CPACK_RPM_USER_BINARY_SPECFILE" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_USER_BINARY_SPECFILE") endif() # We should generate a USER spec file template: @@ -1762,7 +1707,7 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT COMMAND "${RPMBUILD_EXECUTABLE}" -bb --define "_topdir ${CPACK_RPM_DIRECTORY}" --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" - --target "${_CPACK_RPM_PACKAGE_ARCHITECTURE}" + --target "${CPACK_RPM_PACKAGE_ARCHITECTURE}" "${CPACK_RPM_BINARY_SPECFILE}" WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index ef3aa76..f31e432 100644 --- a/Modules/CTestCoverageCollectGCOV.cmake +++ b/Modules/CTestCoverageCollectGCOV.cmake @@ -46,6 +46,13 @@ # is run as ``gcov <options>... -o <gcov-dir> <file>.gcda``. # If not specified, the default option is just ``-b``. # +# ``GLOB`` +# Recursively search for .gcda files in build_dir rather than +# determining search locations by reading TargetDirectories.txt. +# +# ``DELETE`` +# Delete coverage files after they've been packaged into the .tar. +# # ``QUIET`` # Suppress non-error messages that otherwise would have been # printed out by this function. @@ -64,7 +71,7 @@ # License text for the above reference.) include(CMakeParseArguments) function(ctest_coverage_collect_gcov) - set(options QUIET) + set(options QUIET GLOB DELETE) set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND) set(multiValueArgs GCOV_OPTIONS) cmake_parse_arguments(GCOV "${options}" "${oneValueArgs}" @@ -91,22 +98,32 @@ function(ctest_coverage_collect_gcov) # run gcov on each gcda file in the binary tree set(gcda_files) set(label_files) - # look for gcda files in the target directories - # could do a glob from the top of the binary tree but - # this will be faster and only look where the files will be - file(STRINGS "${binary_dir}/CMakeFiles/TargetDirectories.txt" target_dirs - ENCODING UTF-8) - foreach(target_dir ${target_dirs}) - file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "${target_dir}/*.gcda") - list(LENGTH gfiles len) - # if we have gcda files then also grab the labels file for that target - if(${len} GREATER 0) - file(GLOB_RECURSE lfiles RELATIVE ${binary_dir} - "${target_dir}/Labels.json") - list(APPEND gcda_files ${gfiles}) - list(APPEND label_files ${lfiles}) - endif() - endforeach() + if (GCOV_GLOB) + file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "*.gcda") + list(LENGTH gfiles len) + # if we have gcda files then also grab the labels file for that target + if(${len} GREATER 0) + file(GLOB_RECURSE lfiles RELATIVE ${binary_dir} "Labels.json") + list(APPEND gcda_files ${gfiles}) + list(APPEND label_files ${lfiles}) + endif() + else() + # look for gcda files in the target directories + # this will be faster and only look where the files will be + file(STRINGS "${binary_dir}/CMakeFiles/TargetDirectories.txt" target_dirs + ENCODING UTF-8) + foreach(target_dir ${target_dirs}) + file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "${target_dir}/*.gcda") + list(LENGTH gfiles len) + # if we have gcda files then also grab the labels file for that target + if(${len} GREATER 0) + file(GLOB_RECURSE lfiles RELATIVE ${binary_dir} + "${target_dir}/Labels.json") + list(APPEND gcda_files ${gfiles}) + list(APPEND label_files ${lfiles}) + endif() + endforeach() + endif() # return early if no coverage files were found list(LENGTH gcda_files len) if(len EQUAL 0) @@ -134,6 +151,11 @@ function(ctest_coverage_collect_gcov) OUTPUT_VARIABLE out RESULT_VARIABLE res WORKING_DIRECTORY ${coverage_dir}) + + if (GCOV_DELETE) + file(REMOVE ${gcda_file}) + endif() + endforeach() if(NOT "${res}" EQUAL 0) if (NOT GCOV_QUIET) @@ -201,4 +223,12 @@ ${label_files} "--format=gnutar" --files-from=${coverage_dir}/coverage_file_list.txt WORKING_DIRECTORY ${binary_dir}) + + if (GCOV_DELETE) + string(REPLACE "\n" ";" gcov_files "${gcov_files}") + foreach(gcov_file ${gcov_files}) + file(REMOVE ${binary_dir}/${gcov_file}) + endforeach() + endif() + endfunction() diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 764fbf9..d1ca85e 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -52,7 +52,7 @@ macro(__compiler_gnu lang) set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") - if(NOT APPLE) + if(NOT APPLE OR NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4) # work around #4462 set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") endif() endmacro() diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index d2c7df9..f1b6ff7 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -7,6 +7,9 @@ set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <I set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>") set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy") +set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "-f") +set(CMAKE_DEPFILE_FLAGS_C "--dependencies=ns <DEPFILE>") + # The toolchains for ARM and AVR are quite different: if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index 03ecdf1..ffb144f 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -7,7 +7,8 @@ set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>") set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy") - +set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "-f") +set(CMAKE_DEPFILE_FLAGS_CXX "--dependencies=ns <DEPFILE>") if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake index c433fa8..802f93a 100644 --- a/Modules/FindCUDA/make2cmake.cmake +++ b/Modules/FindCUDA/make2cmake.cmake @@ -35,6 +35,16 @@ # This converts a file written in makefile syntax into one that can be included # by CMake. +# Input variables +# +# verbose:BOOL=<> OFF: Be as quiet as possible (default) +# ON : Extra output +# +# input_file:FILEPATH=<> Path to dependecy file in makefile format +# +# output_file:FILEPATH=<> Path to file with dependencies in CMake readable variable +# + file(READ ${input_file} depend_text) if (NOT "${depend_text}" STREQUAL "") @@ -62,12 +72,16 @@ if (NOT "${depend_text}" STREQUAL "") if (EXISTS "/${file}") set(file "/${file}") else() - message(WARNING " Removing non-existent dependency file: ${file}") + if(verbose) + message(WARNING " Removing non-existent dependency file: ${file}") + endif() set(file "") endif() endif() - if(NOT IS_DIRECTORY "${file}") + # Make sure we check to see if we have a file, before asking if it is not a directory. + # if(NOT IS_DIRECTORY "") will return TRUE. + if(file AND NOT IS_DIRECTORY "${file}") # If softlinks start to matter, we should change this to REALPATH. For now we need # to flatten paths, because nvcc can generate stuff like /bin/../include instead of # just /include. diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index 8032309..12b83e0 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -207,6 +207,7 @@ cuda_execute_process( COMMAND "${CMAKE_COMMAND}" -D "input_file:FILEPATH=${NVCC_generated_dependency_file}" -D "output_file:FILEPATH=${cmake_dependency_file}.tmp" + -D "verbose=${verbose}" -P "${CUDA_make2cmake}" ) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 2f13b09..0875349 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -210,32 +210,33 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(_PROTOBUF_ARCH_DIR x64/) endif() +include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + # Internal function: search for normal library as well as a debug one # if the debug one is specified also include debug/optimized keywords # in *_LIBRARIES variable function(_protobuf_find_libraries name filename) - find_library(${name}_LIBRARY - NAMES ${filename} - PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release) - mark_as_advanced(${name}_LIBRARY) - - find_library(${name}_LIBRARY_DEBUG - NAMES ${filename} - PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug) - mark_as_advanced(${name}_LIBRARY_DEBUG) - - if(NOT ${name}_LIBRARY_DEBUG) - # There is no debug library - set(${name}_LIBRARY_DEBUG ${${name}_LIBRARY} PARENT_SCOPE) - set(${name}_LIBRARIES ${${name}_LIBRARY} PARENT_SCOPE) - else() - # There IS a debug library - set(${name}_LIBRARIES - optimized ${${name}_LIBRARY} - debug ${${name}_LIBRARY_DEBUG} - PARENT_SCOPE - ) - endif() + if(${name}_LIBRARIES) + # Use result recorded by a previous call. + return() + elseif(${name}_LIBRARY) + # Honor cache entry used by CMake 3.5 and lower. + set(${name}_LIBRARIES "${${name}_LIBRARY}" PARENT_SCOPE) + else() + find_library(${name}_LIBRARY_RELEASE + NAMES ${filename} + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release) + mark_as_advanced(${name}_LIBRARY_RELEASE) + + find_library(${name}_LIBRARY_DEBUG + NAMES ${filename} + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug) + mark_as_advanced(${name}_LIBRARY_DEBUG) + + select_library_configurations(${name}) + set(${name}_LIBRARY "${${name}_LIBRARY}" PARENT_SCOPE) + set(${name}_LIBRARIES "${${name}_LIBRARIES}" PARENT_SCOPE) + endif() endfunction() # Internal function: find threads library diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index 70c3fd7..c12dd4c 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -1,129 +1,190 @@ -#.rst: -# FortranCInterface -# ----------------- -# -# Fortran/C Interface Detection -# -# This module automatically detects the API by which C and Fortran -# languages interact. Variables indicate if the mangling is found: -# -# :: -# -# FortranCInterface_GLOBAL_FOUND = Global subroutines and functions -# FortranCInterface_MODULE_FOUND = Module subroutines and functions -# (declared by "MODULE PROCEDURE") -# -# A function is provided to generate a C header file containing macros -# to mangle symbol names: -# -# :: -# -# FortranCInterface_HEADER(<file> -# [MACRO_NAMESPACE <macro-ns>] -# [SYMBOL_NAMESPACE <ns>] -# [SYMBOLS [<module>:]<function> ...]) -# -# It generates in <file> definitions of the following macros: -# -# :: -# -# #define FortranCInterface_GLOBAL (name,NAME) ... -# #define FortranCInterface_GLOBAL_(name,NAME) ... -# #define FortranCInterface_MODULE (mod,name, MOD,NAME) ... -# #define FortranCInterface_MODULE_(mod,name, MOD,NAME) ... -# -# These macros mangle four categories of Fortran symbols, respectively: -# -# :: -# -# - Global symbols without '_': call mysub() -# - Global symbols with '_' : call my_sub() -# - Module symbols without '_': use mymod; call mysub() -# - Module symbols with '_' : use mymod; call my_sub() -# -# If mangling for a category is not known, its macro is left undefined. -# All macros require raw names in both lower case and upper case. The -# MACRO_NAMESPACE option replaces the default "FortranCInterface_" -# prefix with a given namespace "<macro-ns>". -# -# The SYMBOLS option lists symbols to mangle automatically with C -# preprocessor definitions: -# -# :: -# -# <function> ==> #define <ns><function> ... -# <module>:<function> ==> #define <ns><module>_<function> ... -# -# If the mangling for some symbol is not known then no preprocessor -# definition is created, and a warning is displayed. The -# SYMBOL_NAMESPACE option prefixes all preprocessor definitions -# generated by the SYMBOLS option with a given namespace "<ns>". -# -# Example usage: -# -# :: -# -# include(FortranCInterface) -# FortranCInterface_HEADER(FC.h MACRO_NAMESPACE "FC_") -# -# This creates a "FC.h" header that defines mangling macros FC_GLOBAL(), -# FC_GLOBAL_(), FC_MODULE(), and FC_MODULE_(). -# -# Example usage: -# -# :: -# -# include(FortranCInterface) -# FortranCInterface_HEADER(FCMangle.h -# MACRO_NAMESPACE "FC_" -# SYMBOL_NAMESPACE "FC_" -# SYMBOLS mysub mymod:my_sub) -# -# This creates a "FCMangle.h" header that defines the same FC_*() -# mangling macros as the previous example plus preprocessor symbols -# FC_mysub and FC_mymod_my_sub. -# -# Another function is provided to verify that the Fortran and C/C++ -# compilers work together: -# -# :: -# -# FortranCInterface_VERIFY([CXX] [QUIET]) -# -# It tests whether a simple test executable using Fortran and C (and C++ -# when the CXX option is given) compiles and links successfully. The -# result is stored in the cache entry FortranCInterface_VERIFIED_C (or -# FortranCInterface_VERIFIED_CXX if CXX is given) as a boolean. If the -# check fails and QUIET is not given the function terminates with a -# FATAL_ERROR message describing the problem. The purpose of this check -# is to stop a build early for incompatible compiler combinations. The -# test is built in the Release configuration. -# -# FortranCInterface is aware of possible GLOBAL and MODULE manglings for -# many Fortran compilers, but it also provides an interface to specify -# new possible manglings. Set the variables -# -# :: -# -# FortranCInterface_GLOBAL_SYMBOLS -# FortranCInterface_MODULE_SYMBOLS -# -# before including FortranCInterface to specify manglings of the symbols -# "MySub", "My_Sub", "MyModule:MySub", and "My_Module:My_Sub". For -# example, the code: -# -# :: -# -# set(FortranCInterface_GLOBAL_SYMBOLS mysub_ my_sub__ MYSUB_) -# # ^^^^^ ^^^^^^ ^^^^^ -# set(FortranCInterface_MODULE_SYMBOLS -# __mymodule_MOD_mysub __my_module_MOD_my_sub) -# # ^^^^^^^^ ^^^^^ ^^^^^^^^^ ^^^^^^ -# include(FortranCInterface) -# -# tells FortranCInterface to try given GLOBAL and MODULE manglings. -# (The carets point at raw symbol names for clarity in this example but -# are not needed.) +#[=======================================================================[.rst: +FortranCInterface +----------------- + +Fortran/C Interface Detection + +This module automatically detects the API by which C and Fortran +languages interact. + +Module Variables +^^^^^^^^^^^^^^^^ + +Variables that indicate if the mangling is found: + +``FortranCInterface_GLOBAL_FOUND`` + Global subroutines and functions. + +``FortranCInterface_MODULE_FOUND`` + Module subroutines and functions (declared by "MODULE PROCEDURE"). + +This module also provides the following variables to specify +the detected mangling, though a typical use case does not need +to reference them and can use the `Module Functions`_ below. + +``FortranCInterface_GLOBAL_PREFIX`` + Prefix for a global symbol without an underscore. + +``FortranCInterface_GLOBAL_SUFFIX`` + Suffix for a global symbol without an underscore. + +``FortranCInterface_GLOBAL_CASE`` + The case for a global symbol without an underscore, + either ``UPPER`` or ``LOWER``. + +``FortranCInterface_GLOBAL__PREFIX`` + Prefix for a global symbol with an underscore. + +``FortranCInterface_GLOBAL__SUFFIX`` + Suffix for a global symbol with an underscore. + +``FortranCInterface_GLOBAL__CASE`` + The case for a global symbol with an underscore, + either ``UPPER`` or ``LOWER``. + +``FortranCInterface_MODULE_PREFIX`` + Prefix for a module symbol without an underscore. + +``FortranCInterface_MODULE_MIDDLE`` + Middle of a module symbol without an underscore that appears + between the name of the module and the name of the symbol. + +``FortranCInterface_MODULE_SUFFIX`` + Suffix for a module symbol without an underscore. + +``FortranCInterface_MODULE_CASE`` + The case for a module symbol without an underscore, + either ``UPPER`` or ``LOWER``. + +``FortranCInterface_MODULE__PREFIX`` + Prefix for a module symbol with an underscore. + +``FortranCInterface_MODULE__MIDDLE`` + Middle of a module symbol with an underscore that appears + between the name of the module and the name of the symbol. + +``FortranCInterface_MODULE__SUFFIX`` + Suffix for a module symbol with an underscore. + +``FortranCInterface_MODULE__CASE`` + The case for a module symbol with an underscore, + either ``UPPER`` or ``LOWER``. + +Module Functions +^^^^^^^^^^^^^^^^ + +.. command:: FortranCInterface_HEADER + + The ``FortranCInterface_HEADER`` function is provided to generate a + C header file containing macros to mangle symbol names:: + + FortranCInterface_HEADER(<file> + [MACRO_NAMESPACE <macro-ns>] + [SYMBOL_NAMESPACE <ns>] + [SYMBOLS [<module>:]<function> ...]) + + It generates in ``<file>`` definitions of the following macros:: + + #define FortranCInterface_GLOBAL (name,NAME) ... + #define FortranCInterface_GLOBAL_(name,NAME) ... + #define FortranCInterface_MODULE (mod,name, MOD,NAME) ... + #define FortranCInterface_MODULE_(mod,name, MOD,NAME) ... + + These macros mangle four categories of Fortran symbols, respectively: + + * Global symbols without '_': ``call mysub()`` + * Global symbols with '_' : ``call my_sub()`` + * Module symbols without '_': ``use mymod; call mysub()`` + * Module symbols with '_' : ``use mymod; call my_sub()`` + + If mangling for a category is not known, its macro is left undefined. + All macros require raw names in both lower case and upper case. + + The options are: + + ``MACRO_NAMESPACE`` + Replace the default ``FortranCInterface_`` prefix with a given + namespace ``<macro-ns>``. + + ``SYMBOLS`` + List symbols to mangle automatically with C preprocessor definitions:: + + <function> ==> #define <ns><function> ... + <module>:<function> ==> #define <ns><module>_<function> ... + + If the mangling for some symbol is not known then no preprocessor + definition is created, and a warning is displayed. + + ``SYMBOL_NAMESPACE`` + Prefix all preprocessor definitions generated by the ``SYMBOLS`` + option with a given namespace ``<ns>``. + +.. command:: FortranCInterface_VERIFY + + The ``FortranCInterface_VERIFY`` function is provided to verify + that the Fortran and C/C++ compilers work together:: + + FortranCInterface_VERIFY([CXX] [QUIET]) + + It tests whether a simple test executable using Fortran and C (and C++ + when the CXX option is given) compiles and links successfully. The + result is stored in the cache entry ``FortranCInterface_VERIFIED_C`` + (or ``FortranCInterface_VERIFIED_CXX`` if ``CXX`` is given) as a boolean. + If the check fails and ``QUIET`` is not given the function terminates with a + fatal error message describing the problem. The purpose of this check + is to stop a build early for incompatible compiler combinations. The + test is built in the ``Release`` configuration. + +Example Usage +^^^^^^^^^^^^^ + +.. code-block:: cmake + + include(FortranCInterface) + FortranCInterface_HEADER(FC.h MACRO_NAMESPACE "FC_") + +This creates a "FC.h" header that defines mangling macros ``FC_GLOBAL()``, +``FC_GLOBAL_()``, ``FC_MODULE()``, and ``FC_MODULE_()``. + +.. code-block:: cmake + + include(FortranCInterface) + FortranCInterface_HEADER(FCMangle.h + MACRO_NAMESPACE "FC_" + SYMBOL_NAMESPACE "FC_" + SYMBOLS mysub mymod:my_sub) + +This creates a "FCMangle.h" header that defines the same ``FC_*()`` +mangling macros as the previous example plus preprocessor symbols +``FC_mysub`` and ``FC_mymod_my_sub``. + +Additional Manglings +^^^^^^^^^^^^^^^^^^^^ + +FortranCInterface is aware of possible ``GLOBAL`` and ``MODULE`` manglings +for many Fortran compilers, but it also provides an interface to specify +new possible manglings. Set the variables:: + + FortranCInterface_GLOBAL_SYMBOLS + FortranCInterface_MODULE_SYMBOLS + +before including FortranCInterface to specify manglings of the symbols +``MySub``, ``My_Sub``, ``MyModule:MySub``, and ``My_Module:My_Sub``. +For example, the code: + +.. code-block:: cmake + + set(FortranCInterface_GLOBAL_SYMBOLS mysub_ my_sub__ MYSUB_) + # ^^^^^ ^^^^^^ ^^^^^ + set(FortranCInterface_MODULE_SYMBOLS + __mymodule_MOD_mysub __my_module_MOD_my_sub) + # ^^^^^^^^ ^^^^^ ^^^^^^^^^ ^^^^^^ + include(FortranCInterface) + +tells FortranCInterface to try given ``GLOBAL`` and ``MODULE`` manglings. +(The carets point at raw symbol names for clarity in this example but +are not needed.) +#]=======================================================================] #============================================================================= # Copyright 2008-2009 Kitware, Inc. diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 58eb1fc..d81477a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 5) -set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 2) +set(CMake_VERSION_PATCH 20160216) +#set(CMake_VERSION_RC 1) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 13098ad..2796fdf 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -931,7 +931,7 @@ cmComputeLinkDepends::MakePendingComponent(unsigned int component) //---------------------------------------------------------------------------- int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl) { - int count = 2; + unsigned int count = 2; for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { if(cmGeneratorTarget const* target = this->EntryList[*ni].Target) diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index d96a32c..65c29f5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -599,7 +599,7 @@ private: { ImportInfo(): NoSOName(false), Multiplicity(0) {} bool NoSOName; - int Multiplicity; + unsigned int Multiplicity; std::string Location; std::string SOName; std::string ImportLibrary; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 0f06e43..bb5f921 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -991,6 +991,7 @@ cmGlobalNinjaGenerator std::set<std::string> const& utils = target->GetUtilities(); std::copy(utils.begin(), utils.end(), std::back_inserter(outputs)); } else { + cmNinjaDeps outs; cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target); for (cmTargetDependSet::const_iterator i = targetDeps.begin(); i != targetDeps.end(); ++i) @@ -999,8 +1000,10 @@ cmGlobalNinjaGenerator { continue; } - this->AppendTargetOutputs(*i, outputs); + this->AppendTargetOutputs(*i, outs); } + std::sort(outs.begin(), outs.end()); + outputs.insert(outputs.end(), outs.begin(), outs.end()); } } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 2d78a41..26a1485 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -33,6 +33,7 @@ static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target, impLib, args.GetPermissions().c_str(), args.GetConfigurations(), args.GetComponent().c_str(), message, + args.GetExcludeFromAll(), args.GetOptional() || forceOpt); } @@ -48,7 +49,8 @@ static cmInstallFilesGenerator* CreateInstallFilesGenerator( programs, args.GetPermissions().c_str(), args.GetConfigurations(), args.GetComponent().c_str(), message, - args.GetRename().c_str(), args.GetOptional()); + args.GetExcludeFromAll(), args.GetRename().c_str(), + args.GetOptional()); } @@ -117,6 +119,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args) int componentCount = 0; bool doing_script = false; bool doing_code = false; + bool exclude_from_all = false; // Scan the args once for COMPONENT. Only allow one. // @@ -128,6 +131,10 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args) ++i; component = args[i]; } + if(args[i] == "EXCLUDE_FROM_ALL") + { + exclude_from_all = true; + } } if(componentCount>1) @@ -175,7 +182,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args) } this->Makefile->AddInstallGenerator( new cmInstallScriptGenerator(script.c_str(), false, - component.c_str())); + component.c_str(), exclude_from_all)); } else if(doing_code) { @@ -183,7 +190,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args) std::string code = args[i]; this->Makefile->AddInstallGenerator( new cmInstallScriptGenerator(code.c_str(), true, - component.c_str())); + component.c_str(), exclude_from_all)); } } @@ -949,6 +956,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) Doing doing = DoingDirs; bool in_match_mode = false; bool optional = false; + bool exclude_from_all = false; bool message_never = false; std::vector<std::string> dirs; const char* destination = 0; @@ -1130,6 +1138,19 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) // Switch to setting the component property. doing = DoingComponent; } + else if(args[i] == "EXCLUDE_FROM_ALL") + { + if(in_match_mode) + { + std::ostringstream e; + e << args[0] << " does not allow \"" + << args[i] << "\" after PATTERN or REGEX."; + this->SetError(e.str().c_str()); + return false; + } + exclude_from_all = true; + doing = DoingNone; + } else if(doing == DoingDirs) { // Convert this directory to a full path. @@ -1273,6 +1294,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) configurations, component.c_str(), message, + exclude_from_all, literal_args.c_str(), optional)); @@ -1403,7 +1425,8 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), ica.GetConfigurations(), - ica.GetComponent().c_str(), message, fname.c_str(), + ica.GetComponent().c_str(), message, + ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), exportOld.IsEnabled()); this->Makefile->AddInstallGenerator(exportGenerator); diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 236ca1f..6ded365 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -27,14 +27,15 @@ cmInstallCommandArguments::cmInstallCommandArguments( const std::string& defaultComponent) :Parser() ,ArgumentGroup() -,Destination (&Parser, "DESTINATION" , &ArgumentGroup) -,Component (&Parser, "COMPONENT" , &ArgumentGroup) -,Rename (&Parser, "RENAME" , &ArgumentGroup) -,Permissions (&Parser, "PERMISSIONS" , &ArgumentGroup) -,Configurations(&Parser, "CONFIGURATIONS", &ArgumentGroup) -,Optional (&Parser, "OPTIONAL" , &ArgumentGroup) -,NamelinkOnly (&Parser, "NAMELINK_ONLY" , &ArgumentGroup) -,NamelinkSkip (&Parser, "NAMELINK_SKIP" , &ArgumentGroup) +,Destination (&Parser, "DESTINATION" , &ArgumentGroup) +,Component (&Parser, "COMPONENT" , &ArgumentGroup) +,ExcludeFromAll(&Parser, "EXCLUDE_FROM_ALL", &ArgumentGroup) +,Rename (&Parser, "RENAME" , &ArgumentGroup) +,Permissions (&Parser, "PERMISSIONS" , &ArgumentGroup) +,Configurations(&Parser, "CONFIGURATIONS" , &ArgumentGroup) +,Optional (&Parser, "OPTIONAL" , &ArgumentGroup) +,NamelinkOnly (&Parser, "NAMELINK_ONLY" , &ArgumentGroup) +,NamelinkSkip (&Parser, "NAMELINK_SKIP" , &ArgumentGroup) ,GenericArguments(0) ,DefaultComponentName(defaultComponent) { @@ -110,6 +111,19 @@ bool cmInstallCommandArguments::GetOptional() const return false; } +bool cmInstallCommandArguments::GetExcludeFromAll() const +{ + if (this->ExcludeFromAll.IsEnabled()) + { + return true; + } + if (this->GenericArguments!=0) + { + return this->GenericArguments->GetExcludeFromAll(); + } + return false; +} + bool cmInstallCommandArguments::GetNamelinkOnly() const { if (this->NamelinkOnly.IsEnabled()) diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h index 90347e6..694f1ed 100644 --- a/Source/cmInstallCommandArguments.h +++ b/Source/cmInstallCommandArguments.h @@ -30,6 +30,7 @@ class cmInstallCommandArguments const std::string& GetDestination() const; const std::string& GetComponent() const; + bool GetExcludeFromAll() const; const std::string& GetRename() const; const std::string& GetPermissions() const; const std::vector<std::string>& GetConfigurations() const; @@ -48,6 +49,7 @@ class cmInstallCommandArguments cmInstallCommandArguments(); // disabled cmCAString Destination; cmCAString Component; + cmCAEnabler ExcludeFromAll; cmCAString Rename; cmCAStringVector Permissions; cmCAStringVector Configurations; diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index f2e8609..6ad6c75 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -23,9 +23,11 @@ cmInstallDirectoryGenerator std::vector<std::string> const& configurations, const char* component, MessageLevel message, + bool exclude_from_all, const char* literal_args, bool optional): - cmInstallGenerator(dest, configurations, component, message), + cmInstallGenerator(dest, configurations, component, message, + exclude_from_all), LocalGenerator(0), Directories(dirs), FilePermissions(file_permissions), DirPermissions(dir_permissions), diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 9b732d3..b137f44 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -27,6 +27,7 @@ public: std::vector<std::string> const& configurations, const char* component, MessageLevel message, + bool exclude_from_all, const char* literal_args, bool optional = false); virtual ~cmInstallDirectoryGenerator(); diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 9570ba3..80fc054 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -33,9 +33,11 @@ cmInstallExportGenerator::cmInstallExportGenerator( std::vector<std::string> const& configurations, const char* component, MessageLevel message, + bool exclude_from_all, const char* filename, const char* name_space, bool exportOld) - :cmInstallGenerator(destination, configurations, component, message) + :cmInstallGenerator(destination, configurations, component, message, + exclude_from_all) ,ExportSet(exportSet) ,FilePermissions(file_permissions) ,FileName(filename) diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 885ed05..1b1c046 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -31,6 +31,7 @@ public: const std::vector<std::string>& configurations, const char* component, MessageLevel message, + bool exclude_from_all, const char* filename, const char* name_space, bool exportOld); ~cmInstallExportGenerator(); diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 68557bd..d3d258e 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -122,6 +122,7 @@ void cmInstallFilesCommand::CreateInstallGenerator() const // Use a file install generator. const char* no_permissions = ""; const char* no_rename = ""; + bool no_exclude_from_all = false; std::string no_component = this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); std::vector<std::string> no_configurations; @@ -131,7 +132,8 @@ void cmInstallFilesCommand::CreateInstallGenerator() const new cmInstallFilesGenerator(this->Files, destination.c_str(), false, no_permissions, no_configurations, - no_component.c_str(), message, no_rename)); + no_component.c_str(), message, + no_exclude_from_all, no_rename)); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 383031b..3dd5528 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -24,9 +24,11 @@ cmInstallFilesGenerator std::vector<std::string> const& configurations, const char* component, MessageLevel message, + bool exclude_from_all, const char* rename, bool optional): - cmInstallGenerator(dest, configurations, component, message), + cmInstallGenerator(dest, configurations, component, message, + exclude_from_all), LocalGenerator(0), Files(files), FilePermissions(file_permissions), diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index bfe4039..efaf62b 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -26,6 +26,7 @@ public: std::vector<std::string> const& configurations, const char* component, MessageLevel message, + bool exclude_from_all, const char* rename, bool optional = false); virtual ~cmInstallFilesGenerator(); diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 2e1c5f0..660e44f 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -19,11 +19,13 @@ cmInstallGenerator ::cmInstallGenerator(const char* destination, std::vector<std::string> const& configurations, const char* component, - MessageLevel message): + MessageLevel message, + bool exclude_from_all): cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations), Destination(destination? destination:""), Component(component? component:""), - Message(message) + Message(message), + ExcludeFromAll(exclude_from_all) { } @@ -146,12 +148,16 @@ void cmInstallGenerator //---------------------------------------------------------------------------- std::string -cmInstallGenerator::CreateComponentTest(const char* component) +cmInstallGenerator::CreateComponentTest(const char* component, + bool exclude_from_all) { - std::string result = "NOT CMAKE_INSTALL_COMPONENT OR " - "\"${CMAKE_INSTALL_COMPONENT}\" STREQUAL \""; + std::string result = "\"${CMAKE_INSTALL_COMPONENT}\" STREQUAL \""; result += component; result += "\""; + if(!exclude_from_all) + { + result += " OR NOT CMAKE_INSTALL_COMPONENT"; + } return result; } @@ -163,7 +169,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os) // Begin this block of installation. std::string component_test = - this->CreateComponentTest(this->Component.c_str()); + this->CreateComponentTest(this->Component.c_str(),this->ExcludeFromAll); os << indent << "if(" << component_test << ")\n"; // Generate the script possibly with per-configuration code. diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index b8e5b53..db895908 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -36,7 +36,8 @@ public: cmInstallGenerator(const char* destination, std::vector<std::string> const& configurations, const char* component, - MessageLevel message); + MessageLevel message, + bool exclude_from_all); virtual ~cmInstallGenerator(); void AddInstallRule( @@ -67,12 +68,14 @@ public: protected: virtual void GenerateScript(std::ostream& os); - std::string CreateComponentTest(const char* component); + std::string CreateComponentTest(const char* component, + bool exclude_from_all); // Information shared by most generator types. std::string Destination; std::string Component; MessageLevel Message; + bool ExcludeFromAll; }; #endif diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index e6fbe88..b6d0c45 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -85,6 +85,7 @@ void cmInstallProgramsCommand::FinalPass() // Use a file install generator. const char* no_permissions = ""; const char* no_rename = ""; + bool no_exclude_from_all = false; std::string no_component = this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); std::vector<std::string> no_configurations; @@ -94,7 +95,8 @@ void cmInstallProgramsCommand::FinalPass() new cmInstallFilesGenerator(this->Files, destination.c_str(), true, no_permissions, no_configurations, - no_component.c_str(), message, no_rename)); + no_component.c_str(), message, + no_exclude_from_all, no_rename)); } /** diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index 933aa07..d58d039 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -14,8 +14,9 @@ //---------------------------------------------------------------------------- cmInstallScriptGenerator ::cmInstallScriptGenerator(const char* script, bool code, - const char* component) : - cmInstallGenerator(0, std::vector<std::string>(), component, MessageDefault), + const char* component, bool exclude_from_all) : + cmInstallGenerator(0, std::vector<std::string>(), component, MessageDefault, + exclude_from_all), Script(script), Code(code) { } @@ -31,7 +32,7 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os) { Indent indent; std::string component_test = - this->CreateComponentTest(this->Component.c_str()); + this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll); os << indent << "if(" << component_test << ")\n"; if(this->Code) diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index 54a7b21..7e7c0c8 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -21,7 +21,7 @@ class cmInstallScriptGenerator: public cmInstallGenerator { public: cmInstallScriptGenerator(const char* script, bool code, - const char* component); + const char* component, bool exclude_from_all); virtual ~cmInstallScriptGenerator(); protected: diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 5e88fa2..3d44fe2 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -30,8 +30,10 @@ cmInstallTargetGenerator std::vector<std::string> const& configurations, const char* component, MessageLevel message, + bool exclude_from_all, bool optional): - cmInstallGenerator(dest, configurations, component, message), + cmInstallGenerator(dest, configurations, component, message, + exclude_from_all), TargetName(targetName), Target(0), FilePermissions(file_permissions), diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 18b3130..46b4532 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -28,6 +28,7 @@ public: std::vector<std::string> const& configurations, const char* component, MessageLevel message, + bool exclude_from_all, bool optional ); virtual ~cmInstallTargetGenerator(); diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h index b603bcc..561293e 100644 --- a/Source/cmLinkItem.h +++ b/Source/cmLinkItem.h @@ -73,7 +73,7 @@ struct cmLinkInterface: public cmLinkInterfaceLibraries // Number of repetitions of a strongly connected component of two // or more static libraries. - int Multiplicity; + unsigned int Multiplicity; // Libraries listed for other configurations. // Needed only for OLD behavior of CMP0003. diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 6041fb7..15a1af5 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -14,6 +14,7 @@ #include <cmsys/SystemTools.hxx> #include "cmAlgorithms.h" +#include <algorithm> #include <stdlib.h> // required for atoi #include <ctype.h> #include <assert.h> @@ -68,6 +69,10 @@ bool cmListCommand { return this->HandleReverseCommand(args); } + if(subCommand == "FILTER") + { + return this->HandleFilterCommand(args); + } std::string e = "does not recognize sub-command "+subCommand; this->SetError(e); @@ -517,3 +522,107 @@ bool cmListCommand::HandleRemoveAtCommand( return true; } +//---------------------------------------------------------------------------- +bool cmListCommand::HandleFilterCommand( + std::vector<std::string> const& args) +{ + if(args.size() < 2) + { + this->SetError("sub-command FILTER requires a list to be specified."); + return false; + } + + if(args.size() < 3) + { + this->SetError("sub-command FILTER requires an operator to be specified."); + return false; + } + + if(args.size() < 4) + { + this->SetError("sub-command FILTER requires a mode to be specified."); + return false; + } + + const std::string& listName = args[1]; + // expand the variable + std::vector<std::string> varArgsExpanded; + if ( !this->GetList(varArgsExpanded, listName) ) + { + this->SetError("sub-command FILTER requires list to be present."); + return false; + } + + const std::string& op = args[2]; + bool includeMatches; + if(op == "INCLUDE") + { + includeMatches = true; + } + else if(op == "EXCLUDE") + { + includeMatches = false; + } + else + { + this->SetError("sub-command FILTER does not recognize operator " + op); + return false; + } + + const std::string& mode = args[3]; + if(mode == "REGEX") + { + if(args.size() != 5) + { + this->SetError("sub-command FILTER, mode REGEX " + "requires five arguments."); + return false; + } + return this->FilterRegex(args, includeMatches, listName, varArgsExpanded); + } + + this->SetError("sub-command FILTER does not recognize mode " + mode); + return false; +} + +//---------------------------------------------------------------------------- +class MatchesRegex { +public: + MatchesRegex(cmsys::RegularExpression& in_regex, bool in_includeMatches) + : regex(in_regex), includeMatches(in_includeMatches) {} + + bool operator()(const std::string& target) { + return regex.find(target) ^ includeMatches; + } + +private: + cmsys::RegularExpression& regex; + const bool includeMatches; +}; + +bool cmListCommand::FilterRegex(std::vector<std::string> const& args, + bool includeMatches, + std::string const& listName, + std::vector<std::string>& varArgsExpanded) +{ + const std::string& pattern = args[4]; + cmsys::RegularExpression regex(pattern); + if(!regex.is_valid()) + { + std::string error = "sub-command FILTER, mode REGEX "; + error += "failed to compile regex \""; + error += pattern; + error += "\"."; + this->SetError(error); + return false; + } + + std::vector<std::string>::iterator argsBegin = varArgsExpanded.begin(); + std::vector<std::string>::iterator argsEnd = varArgsExpanded.end(); + std::vector<std::string>::iterator newArgsEnd = + std::remove_if(argsBegin, argsEnd, MatchesRegex(regex, includeMatches)); + + std::string value = cmJoin(cmMakeRange(argsBegin, newArgsEnd), ";"); + this->Makefile->AddDefinition(listName, value.c_str()); + return true; +} diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index 5ea1d9f..25edee8 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -58,6 +58,12 @@ protected: bool HandleRemoveDuplicatesCommand(std::vector<std::string> const& args); bool HandleSortCommand(std::vector<std::string> const& args); bool HandleReverseCommand(std::vector<std::string> const& args); + bool HandleFilterCommand(std::vector<std::string> const& args); + bool FilterRegex(std::vector<std::string> const& args, + bool includeMatches, + std::string const& listName, + std::vector<std::string>& varArgsExpanded + ); bool GetList(std::vector<std::string>& list, const std::string& var); diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 03e0abe..4d3055f 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -58,8 +58,9 @@ struct cmListFileArgument long Line; }; -struct cmListFileContext +class cmListFileContext { +public: std::string Name; std::string FilePath; long Line; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 912be0c..6a6359a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2559,7 +2559,7 @@ public: cmInstallTargetGenerator( t, dest, implib, "", std::vector<std::string>(), "Unspecified", cmInstallGenerator::SelectMessageLevel(lg->GetMakefile()), - false) + false, false) { this->Compute(lg); } @@ -2586,7 +2586,7 @@ cmLocalGenerator // Include the user-specified pre-install script for this target. if(const char* preinstall = (*l)->GetProperty("PRE_INSTALL_SCRIPT")) { - cmInstallScriptGenerator g(preinstall, false, 0); + cmInstallScriptGenerator g(preinstall, false, 0, false); g.Generate(os, config, configurationTypes); } @@ -2647,7 +2647,7 @@ cmLocalGenerator // Include the user-specified post-install script for this target. if(const char* postinstall = (*l)->GetProperty("POST_INSTALL_SCRIPT")) { - cmInstallScriptGenerator g(postinstall, false, 0); + cmInstallScriptGenerator g(postinstall, false, 0, false); g.Generate(os, config, configurationTypes); } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index b2927a9..8a68af6 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -454,13 +454,24 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc, cmGeneratorTarget* target) { - this->CustomCommandTargets[cc].insert(target); + CustomCommandTargetMap::value_type v(cc, std::set<cmGeneratorTarget*>()); + std::pair<CustomCommandTargetMap::iterator, bool> + ins = this->CustomCommandTargets.insert(v); + if (ins.second) + { + this->CustomCommands.push_back(cc); + } + ins.first->second.insert(target); } void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements() { - for (CustomCommandTargetMap::iterator i = this->CustomCommandTargets.begin(); - i != this->CustomCommandTargets.end(); ++i) { + for (std::vector<cmCustomCommand const*>::iterator vi = + this->CustomCommands.begin(); vi != this->CustomCommands.end(); ++vi) + { + CustomCommandTargetMap::iterator i = this->CustomCommandTargets.find(*vi); + assert(i != this->CustomCommandTargets.end()); + // A custom command may appear on multiple targets. However, some build // systems exist where the target dependencies on some of the targets are // overspecified, leading to a dependency cycle. If we assume all target diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index b6987ef..5e1d6f2 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -106,6 +106,7 @@ private: typedef std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*> > CustomCommandTargetMap; CustomCommandTargetMap CustomCommandTargets; + std::vector<cmCustomCommand const*> CustomCommands; }; #endif // ! cmLocalNinjaGenerator_h diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index a06b26f..c60b962 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -60,6 +60,7 @@ static const char * cmDocumentationUsageNote[][2] = #define CMAKE_BUILD_OPTIONS \ " <dir> = Project binary directory to be built.\n" \ " --target <tgt> = Build <tgt> instead of default targets.\n" \ + " May only be specified once.\n" \ " --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \ " --clean-first = Build target 'clean' first, then build.\n" \ " (To clean only, use --target 'clean'.)\n" \ @@ -386,6 +387,7 @@ static int do_build(int ac, char const* const* av) std::string dir; std::vector<std::string> nativeOptions; bool clean = false; + bool hasTarget = false; enum Doing { DoingNone, DoingDir, DoingTarget, DoingConfig, DoingNative}; Doing doing = DoingDir; @@ -397,7 +399,17 @@ static int do_build(int ac, char const* const* av) } else if(strcmp(av[i], "--target") == 0) { - doing = DoingTarget; + if (!hasTarget) + { + doing = DoingTarget; + hasTarget = true; + } + else + { + std::cerr << "'--target' may not be specified more than once.\n\n"; + dir = ""; + break; + } } else if(strcmp(av[i], "--config") == 0) { diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index ac9b552..0f2b774 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -14,24 +14,24 @@ if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/foo/bar") # test requires - set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") + set(CPACK_RPM_APPLICATIONS_PACKAGE_REQUIRES "mylib-libraries") # test a "noarch" rpm - set(CPACK_RPM_headers_PACKAGE_ARCHITECTURE "noarch") + set(CPACK_RPM_HEADERS_PACKAGE_ARCHITECTURE "noarch") # test cross-built rpm - set(CPACK_RPM_applications_PACKAGE_ARCHITECTURE "armv7hf") + set(CPACK_RPM_APPLICATIONS_PACKAGE_ARCHITECTURE "armv7hf") # test package summary override - headers rpm is generated in the middle set(CPACK_RPM_PACKAGE_SUMMARY "default summary") - set(CPACK_RPM_headers_PACKAGE_SUMMARY "headers summary") + set(CPACK_RPM_HEADERS_PACKAGE_SUMMARY "headers summary") # test package description override - headers rpm is generated in the middle - set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") + set(CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION "headers description") # test package do not use CPACK_PACKAGING_INSTALL_PREFIX # as relocation path - set(CPACK_RPM_NO_libraries_INSTALL_PREFIX_RELOCATION true) + set(CPACK_RPM_NO_LIBRARIES_INSTALL_PREFIX_RELOCATION true) endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in index 60bdd06..ac65dc9 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in @@ -7,7 +7,7 @@ endif() if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") - set(CPACK_RPM_Development_PACKAGE_REQUIRES "mylib-Runtime") + set(CPACK_RPM_DEVELOPMENT_PACKAGE_REQUIRES "mylib-Runtime") endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index d94a477..34b9c82 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -136,8 +136,8 @@ if(CPackGen MATCHES "RPM") endif() set(CPACK_RPM_PACKAGE_SUMMARY "default summary") - set(CPACK_RPM_headers_PACKAGE_SUMMARY "headers summary") - set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") + set(CPACK_RPM_HEADERS_PACKAGE_SUMMARY "headers summary") + set(CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION "headers description") set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "An extremely useful application that makes use of MyLib") set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION @@ -206,8 +206,8 @@ if(CPackGen MATCHES "RPM") /usr/foo/bar/other_relocatable /usr/foo/bar/other_relocatable/depth_two$") elseif(check_file_headers_match) - set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") - set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") + set(check_file_match_expected_summary ".*${CPACK_RPM_HEADERS_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") set(check_file_match_expected_architecture "noarch") set(spec_regex "*headers*") diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index a1f8e68..c30dcbc 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -146,7 +146,8 @@ add_dependencies(notInAllCustom notInAllExe) # add_subdirectory(Temp) -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX + AND NOT XCODE) # XCODE is excluded due to #15687 add_executable(testSystemDir testSystemDir.cxx) set_target_properties(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror") endif() diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index b2307b2..4897b48 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -146,7 +146,8 @@ add_dependencies(notInAllCustom notInAllExe) # add_subdirectory(Temp) -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX + AND NOT XCODE) # XCODE is excluded due to #15687 add_executable(testSystemDir testSystemDir.cxx) set_target_properties(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror") endif() diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index ecf38a6..1268982 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.0) +cmake_minimum_required (VERSION 3.1) project(testf C CXX Fortran) if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") @@ -119,7 +119,7 @@ endfunction() # call the test_fortran_c_interface_module function if("${CMAKE_Fortran_COMPILER_ID}:${CMAKE_C_COMPILER_ID}" MATCHES "(Intel:MSVC|Absoft:GNU)" - OR (CMAKE_Fortran_COMPILER_ID MATCHES CMAKE_C_COMPILER_ID )) + OR ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "${CMAKE_C_COMPILER_ID}" )) test_fortran_c_interface_module() else() message("Fortran does not match c compiler") diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index 8cd25a4..7fce330 100644 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt @@ -124,6 +124,6 @@ endif() message("#### Testing reference: ${_platform}") target_compile_definitions(GenerateExportHeader PRIVATE - "SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}" - "BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}" + "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}\"" + "BIN_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\"" ) diff --git a/Tests/Module/GenerateExportHeader/exportheader_test.cpp b/Tests/Module/GenerateExportHeader/exportheader_test.cpp index 4f45f37..7802c43 100644 --- a/Tests/Module/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/Module/GenerateExportHeader/exportheader_test.cpp @@ -136,13 +136,10 @@ int main() libstatic_not_exported(); libstatic_excluded(); -#define STRINGIFY_IMPL(A) #A -#define STRINGIFY(A) STRINGIFY_IMPL(A) - - compare(STRINGIFY(SRC_DIR) "/libshared_export.h", - STRINGIFY(BIN_DIR) "/libshared/libshared_export.h"); - compare(STRINGIFY(SRC_DIR) "/libstatic_export.h", - STRINGIFY(BIN_DIR) "/libstatic/libstatic_export.h"); + compare(SRC_DIR "/libshared_export.h", + BIN_DIR "/libshared/libshared_export.h"); + compare(SRC_DIR "/libstatic_export.h", + BIN_DIR "/libstatic/libstatic_export.h"); return 0; } diff --git a/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake b/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake new file mode 100644 index 0000000..13aa77b --- /dev/null +++ b/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake @@ -0,0 +1,26 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +# default +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh" + "echo \"pre install\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh" + "echo \"post install\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh" + "echo \"pre uninstall\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh" + "echo \"post uninstall\"\n") + +# specific +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh" + "echo \"pre install foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh" + "echo \"post install foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh" + "echo \"pre uninstall foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh" + "echo \"post uninstall foo\"\n") + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) + +set(CPACK_PACKAGE_NAME "install_scripts") diff --git a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake b/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake index 2cdfece..8b7fb1e 100644 --- a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake +++ b/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake @@ -4,19 +4,19 @@ set(CPACK_RPM_COMPONENT_INSTALL "ON") # does not use them correctly: https://bugs.launchpad.net/rpm/+bug/1475755 set(CPACK_RPM_PACKAGE_AUTOREQ "no") set(CPACK_RPM_PACKAGE_AUTOPROV "no") -set(CPACK_RPM_applications_auto_PACKAGE_AUTOREQPROV "yes") -set(CPACK_RPM_libs_auto_PACKAGE_AUTOREQPROV "yes") +set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_AUTOREQPROV "yes") +set(CPACK_RPM_LIBS_AUTO_PACKAGE_AUTOREQPROV "yes") set(CPACK_RPM_PACKAGE_REQUIRES "depend-default, depend-default-b") -set(CPACK_RPM_applications_PACKAGE_REQUIRES "depend-application, depend-application-b") -set(CPACK_RPM_applications_auto_PACKAGE_REQUIRES "depend-application, depend-application-b") -set(CPACK_RPM_headers_PACKAGE_REQUIRES "depend-headers") +set(CPACK_RPM_APPLICATIONS_PACKAGE_REQUIRES "depend-application, depend-application-b") +set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_REQUIRES "depend-application, depend-application-b") +set(CPACK_RPM_HEADERS_PACKAGE_REQUIRES "depend-headers") set(CPACK_RPM_PACKAGE_CONFLICTS "conflict-default, conflict-default-b") -set(CPACK_RPM_applications_PACKAGE_CONFLICTS "conflict-application, conflict-application-b") -set(CPACK_RPM_applications_auto_PACKAGE_CONFLICTS "conflict-application, conflict-application-b") -set(CPACK_RPM_headers_PACKAGE_CONFLICTS "conflict-headers") +set(CPACK_RPM_APPLICATIONS_PACKAGE_CONFLICTS "conflict-application, conflict-application-b") +set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_CONFLICTS "conflict-application, conflict-application-b") +set(CPACK_RPM_HEADERS_PACKAGE_CONFLICTS "conflict-headers") set(CPACK_RPM_PACKAGE_PROVIDES "provided-default, provided-default-b") -set(CPACK_RPM_libs_PACKAGE_PROVIDES "provided-lib") -set(CPACK_RPM_libs_auto_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b") +set(CPACK_RPM_LIBS_PACKAGE_PROVIDES "provided-lib") +set(CPACK_RPM_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b") diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake new file mode 100644 index 0000000..033a45d --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake @@ -0,0 +1,7 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "2") +set(EXPECTED_FILE_1 "install_scripts*-foo.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_2 "install_scripts*-bar.rpm") +set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake new file mode 100644 index 0000000..d7d82f2 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake @@ -0,0 +1,29 @@ +function(checkScripts_ FILE COMPARE_LIST) + set(whitespaces_ "[\t\n\r ]*") + + execute_process(COMMAND ${RPM_EXECUTABLE} -qp --scripts ${FILE} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + OUTPUT_VARIABLE FILE_SCRIPTS_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + string(REPLACE "\n" ";" FILE_SCRIPTS_LIST_ "${FILE_SCRIPTS_}") + + foreach(COMPARE_REGEX_ IN LISTS COMPARE_LIST) + unset(FOUND_) + + foreach(COMPARE_ IN LISTS FILE_SCRIPTS_LIST_) + if(COMPARE_ MATCHES "${COMPARE_REGEX_}") + set(FOUND_ true) + break() + endif() + endforeach() + + if(NOT FOUND_) + message(FATAL_ERROR "Missing scripts in '${FILE}'; file info: '${FILE_SCRIPTS_}'; missing: '${COMPARE_REGEX_}'") + endif() + endforeach() +endfunction() + +checkScripts_("${FOUND_FILE_1}" "echo \"pre install foo\";echo \"post install foo\";echo \"pre uninstall foo\";echo \"post uninstall foo\"") +checkScripts_("${FOUND_FILE_2}" "echo \"pre install\";echo \"post install\";echo \"pre uninstall\";echo \"post uninstall\"") diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake new file mode 100644 index 0000000..4eb53c3 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake @@ -0,0 +1,19 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh") +set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh") +set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh") +set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh") + +set(CPACK_RPM_foo_PRE_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh") +set(CPACK_RPM_foo_POST_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh") +set(CPACK_RPM_foo_PRE_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh") +set(CPACK_RPM_foo_POST_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh") diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake index d398168..524ef0c 100644 --- a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake +++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake @@ -1,5 +1,5 @@ set(CPACK_RPM_COMPONENT_INSTALL "ON") set(CPACK_RPM_PACKAGE_GROUP "default") -set(CPACK_RPM_pkg_2_PACKAGE_NAME "second") -set(CPACK_RPM_pkg_2_PACKAGE_GROUP "second_group") +set(CPACK_RPM_PKG_2_PACKAGE_NAME "second") +set(CPACK_RPM_PKG_2_PACKAGE_GROUP "second_group") diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index fe2b48b..ee4112d 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -11,3 +11,4 @@ run_cpack_test(DEPENDENCIES "RPM;DEB" true) run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false) +run_cpack_test(INSTALL_SCRIPTS "RPM" false) diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-stderr.txt new file mode 100644 index 0000000..f2cbaa6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-stderr.txt @@ -0,0 +1,3 @@ +^'--target' may not be specified more than once\. ++ +Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt index 20df108..d2a2831 100644 --- a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt +++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt @@ -3,3 +3,5 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt ) add_custom_target(CustomTarget ALL DEPENDS output.txt) +add_custom_target(CustomTarget2 ALL DEPENDS output.txt) +add_custom_target(CustomTarget3 ALL DEPENDS output.txt) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index e3b73ff..a07bbbe 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -51,6 +51,8 @@ function(run_BuildDir) run_cmake(BuildDir) run_cmake_command(BuildDir--build ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget) + run_cmake_command(BuildDir--build-multiple-targets ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget2 --target CustomTarget3) endfunction() run_BuildDir() diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-all-check.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-all-check.cmake new file mode 100644 index 0000000..0368df1 --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src-all;src-all/main\.c$]]) diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-exc-check.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-exc-check.cmake new file mode 100644 index 0000000..41a816f --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-exc-check.cmake @@ -0,0 +1 @@ +check_installed([[^src-exc;src-exc/main\.c$]]) diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-uns-check.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-uns-check.cmake new file mode 100644 index 0000000..68a1378 --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-uns-check.cmake @@ -0,0 +1 @@ +check_installed([[^src-all;src-all/main\.c;src-uns;src-uns/main\.c$]]) diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL.cmake new file mode 100644 index 0000000..720299b --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL.cmake @@ -0,0 +1,3 @@ +install(FILES main.c DESTINATION src-all) +install(FILES main.c DESTINATION src-uns EXCLUDE_FROM_ALL) +install(FILES main.c DESTINATION src-exc EXCLUDE_FROM_ALL COMPONENT exc) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index c2347d8..45693b5 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -1,4 +1,46 @@ +cmake_minimum_required(VERSION 3.4) include(RunCMake) + +# Function to build and install a project. The latter step *-check.cmake +# scripts can check installed files using the check_installed function. +function(run_install_test case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${case}) + run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config Debug) + # Check "all" components. + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-all) + run_cmake_command(${case}-all ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -P cmake_install.cmake) + # Check unspecified component. + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-uns) + run_cmake_command(${case}-uns ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=Unspecified -P cmake_install.cmake) + # Check explicit component. + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-exc) + run_cmake_command(${case}-exc ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=exc -P cmake_install.cmake) +endfunction() + +# Function called in *-check.cmake scripts to check installed files. +function(check_installed expect) + file(GLOB_RECURSE actual + LIST_DIRECTORIES TRUE + RELATIVE ${CMAKE_INSTALL_PREFIX} + ${CMAKE_INSTALL_PREFIX}/* + ) + if(actual) + list(SORT actual) + endif() + if(NOT "${actual}" MATCHES "${expect}") + set(RunCMake_TEST_FAILED "Installed files: + ${actual} +do not match what we expected: + ${expect} +in directory: + ${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE) + endif() +endfunction() + run_cmake(DIRECTORY-MESSAGE_NEVER) run_cmake(DIRECTORY-PATTERN-MESSAGE_NEVER) run_cmake(DIRECTORY-message) @@ -14,3 +56,6 @@ run_cmake(EXPORT-OldIFace) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) + +run_install_test(FILES-EXCLUDE_FROM_ALL) +run_install_test(TARGETS-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-all-check.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-all-check.cmake new file mode 100644 index 0000000..9b538bb --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin-all;bin-all/myexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-exc-check.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-exc-check.cmake new file mode 100644 index 0000000..aef0d27 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-exc-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin-exc;bin-exc/myexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-uns-check.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-uns-check.cmake new file mode 100644 index 0000000..56fd264 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-uns-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin-all;bin-all/myexe(\.exe)?;bin-uns;bin-uns/myexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL.cmake new file mode 100644 index 0000000..6fb2036 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL.cmake @@ -0,0 +1,5 @@ +enable_language(C) +add_executable(myexe main.c) +install(TARGETS myexe DESTINATION bin-all) +install(TARGETS myexe DESTINATION bin-uns EXCLUDE_FROM_ALL) +install(TARGETS myexe DESTINATION bin-exc EXCLUDE_FROM_ALL COMPONENT exc) diff --git a/Tests/RunCMake/install/main.c b/Tests/RunCMake/install/main.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/RunCMake/install/main.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Tests/RunCMake/list/EmptyFilterRegex-result.txt b/Tests/RunCMake/list/EmptyFilterRegex-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/list/EmptyFilterRegex-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/list/EmptyFilterRegex-stderr.txt b/Tests/RunCMake/list/EmptyFilterRegex-stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/list/EmptyFilterRegex-stderr.txt diff --git a/Tests/RunCMake/list/EmptyFilterRegex.cmake b/Tests/RunCMake/list/EmptyFilterRegex.cmake new file mode 100644 index 0000000..33849cd --- /dev/null +++ b/Tests/RunCMake/list/EmptyFilterRegex.cmake @@ -0,0 +1,2 @@ +set(mylist "") +list(FILTER mylist INCLUDE REGEX "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-NotList-result.txt b/Tests/RunCMake/list/FILTER-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-NotList-stderr.txt b/Tests/RunCMake/list/FILTER-NotList-stderr.txt new file mode 100644 index 0000000..159c28d --- /dev/null +++ b/Tests/RunCMake/list/FILTER-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-NotList.cmake:2 \(list\): + list sub-command FILTER requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-NotList.cmake b/Tests/RunCMake/list/FILTER-NotList.cmake new file mode 100644 index 0000000..1e15635 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(FILTER nosuchlist EXCLUDE REGEX "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-result.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-stderr.txt new file mode 100644 index 0000000..7f783fa --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-InvalidMode.cmake:2 \(list\): + list sub-command FILTER does not recognize mode NOOP +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidMode.cmake b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode.cmake new file mode 100644 index 0000000..e02b929 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist EXCLUDE NOOP "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-result.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-stderr.txt new file mode 100644 index 0000000..94f2427 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-InvalidOperator.cmake:2 \(list\): + list sub-command FILTER does not recognize operator RM +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator.cmake b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator.cmake new file mode 100644 index 0000000..9624622 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist RM REGEX "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-result.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-stderr.txt new file mode 100644 index 0000000..9e98cbf --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-InvalidRegex.cmake:2 \(list\): + list sub-command FILTER, mode REGEX failed to compile regex "UHOH!\)\(". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex.cmake b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex.cmake new file mode 100644 index 0000000..0641062 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist EXCLUDE REGEX "UHOH!)(") diff --git a/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-result.txt b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-stderr.txt new file mode 100644 index 0000000..ec7f41c --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-TooManyArguments.cmake:2 \(list\): + list sub-command FILTER, mode REGEX requires five arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments.cmake b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments.cmake new file mode 100644 index 0000000..d9cd8eb --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist EXCLUDE REGEX "^FILTER_THIS_.+" one_too_many) diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid0-result.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid0-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid0-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid0-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid0-stderr.txt new file mode 100644 index 0000000..d9ba38d --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid0-stderr.txt @@ -0,0 +1,2 @@ +^mylist was: FILTER_THIS_BIT;DO_NOT_FILTER_THIS;thisisanitem;FILTER_THIS_THING +mylist is: DO_NOT_FILTER_THIS;thisisanitem$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid0.cmake b/Tests/RunCMake/list/FILTER-REGEX-Valid0.cmake new file mode 100644 index 0000000..f395e61 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid0.cmake @@ -0,0 +1,4 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +message("mylist was: ${mylist}") +list(FILTER mylist EXCLUDE REGEX "^FILTER_THIS_.+") +message("mylist is: ${mylist}") diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid1-result.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid1-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid1-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid1-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid1-stderr.txt new file mode 100644 index 0000000..5e5280d --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid1-stderr.txt @@ -0,0 +1,2 @@ +^mylist was: FILTER_THIS_BIT;DO_NOT_FILTER_THIS;thisisanitem;FILTER_THIS_THING +mylist is: FILTER_THIS_BIT;FILTER_THIS_THING$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid1.cmake b/Tests/RunCMake/list/FILTER-REGEX-Valid1.cmake new file mode 100644 index 0000000..e659281 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid1.cmake @@ -0,0 +1,4 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +message("mylist was: ${mylist}") +list(FILTER mylist INCLUDE REGEX "^FILTER_THIS_.+") +message("mylist is: ${mylist}") diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index 25d6a03..b002ab3 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(EmptyFilterRegex) run_cmake(EmptyGet0) run_cmake(EmptyRemoveAt0) run_cmake(EmptyInsert-1) @@ -8,17 +9,25 @@ run_cmake(NoArguments) run_cmake(InvalidSubcommand) run_cmake(GET-CMP0007-WARN) +run_cmake(FILTER-REGEX-InvalidRegex) run_cmake(GET-InvalidIndex) run_cmake(INSERT-InvalidIndex) run_cmake(REMOVE_AT-InvalidIndex) +run_cmake(FILTER-REGEX-TooManyArguments) run_cmake(LENGTH-TooManyArguments) run_cmake(REMOVE_DUPLICATES-TooManyArguments) run_cmake(REVERSE-TooManyArguments) run_cmake(SORT-TooManyArguments) +run_cmake(FILTER-NotList) run_cmake(REMOVE_AT-NotList) run_cmake(REMOVE_DUPLICATES-NotList) run_cmake(REMOVE_ITEM-NotList) run_cmake(REVERSE-NotList) run_cmake(SORT-NotList) + +run_cmake(FILTER-REGEX-InvalidMode) +run_cmake(FILTER-REGEX-InvalidOperator) +run_cmake(FILTER-REGEX-Valid0) +run_cmake(FILTER-REGEX-Valid1) diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake index 81442e7..4787d69 100644 --- a/Utilities/Release/linux64_release.cmake +++ b/Utilities/Release/linux64_release.cmake @@ -12,9 +12,9 @@ CURSES_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/home/kitware/ncurses-5.9/include FORM_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libform.a CMAKE_USE_OPENSSL:BOOL=ON -OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libcrypto.a -OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2d/include -OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libssl.a +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2f/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2f/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2f/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-x86_64 BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake index 0634dda..00abcc1 100644 --- a/Utilities/Release/magrathea_release.cmake +++ b/Utilities/Release/magrathea_release.cmake @@ -12,9 +12,9 @@ CURSES_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/usr/i686-gcc-332s/include/ncurses FORM_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libform.a CMAKE_USE_OPENSSL:BOOL=ON -OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libcrypto.a -OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2d/include -OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libssl.a +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2f/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2f/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2f/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-i386 BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE |