summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/try_compile.rst126
-rw-r--r--Help/command/try_run.rst128
-rw-r--r--Help/release/dev/CTestCoverageCollectGCOV-refinements.rst6
-rw-r--r--Help/release/dev/rpm_multi_prefix.rst11
-rw-r--r--Modules/CPack.cmake11
-rw-r--r--Modules/CPackRPM.cmake115
-rw-r--r--Modules/CTestCoverageCollectGCOV.cmake31
-rw-r--r--Modules/Compiler/GNU-CXX-FeatureTests.cmake2
-rw-r--r--Modules/Platform/Windows-MSVC.cmake2
-rw-r--r--Modules/Platform/Windows-df.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmLocalGenerator.cxx14
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmQtAutoGenerators.cxx3
-rw-r--r--Tests/CMakeLists.txt12
-rw-r--r--Tests/CPackComponentsForAll/CMakeLists.txt6
-rw-r--r--Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in16
-rw-r--r--Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake30
-rw-r--r--Tests/CTestCoverageCollectGCOV/fakegcov.cmake8
-rw-r--r--Tests/CTestCoverageCollectGCOV/test.cmake.in39
-rw-r--r--Tests/RunCMake/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/CPackRPM/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt1
-rw-r--r--Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake7
-rw-r--r--Tests/RunCMake/CPackRPM/RunCMakeTest.cmake17
25 files changed, 466 insertions, 136 deletions
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 224c67b..9a70885 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -1,72 +1,100 @@
try_compile
-----------
+.. only:: html
+
+ .. contents::
+
Try building some code.
+Try Compiling Whole Projects
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
::
try_compile(RESULT_VAR <bindir> <srcdir>
- <projectName> [targetName] [CMAKE_FLAGS flags...]
+ <projectName> [<targetName>] [CMAKE_FLAGS <flags>...]
[OUTPUT_VARIABLE <var>])
-Try building a project. In this form, srcdir should contain a
-complete CMake project with a CMakeLists.txt file and all sources.
-The bindir and srcdir will not be deleted after this command is run.
-Specify targetName to build a specific target instead of the 'all' or
-'ALL_BUILD' target.
+Try building a project. The success or failure of the ``try_compile``,
+i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``RESULT_VAR``.
+
+In this form, ``<srcdir>`` should contain a complete CMake project with a
+``CMakeLists.txt`` file and all sources. The ``<bindir>`` and ``<srcdir>``
+will not be deleted after this command is run. Specify ``<targetName>`` to
+build a specific target instead of the ``all`` or ``ALL_BUILD`` target. See
+below for the meaning of other options.
+
+Try Compiling Source Files
+^^^^^^^^^^^^^^^^^^^^^^^^^^
::
try_compile(RESULT_VAR <bindir> <srcfile|SOURCES srcfile...>
- [CMAKE_FLAGS flags...]
- [COMPILE_DEFINITIONS flags...]
- [LINK_LIBRARIES libs...]
+ [CMAKE_FLAGS <flags>...]
+ [COMPILE_DEFINITIONS <defs>...]
+ [LINK_LIBRARIES <libs>...]
[OUTPUT_VARIABLE <var>]
[COPY_FILE <fileName> [COPY_FILE_ERROR <var>]])
-Try building an executable from one or more source files. In this
-form the user need only supply one or more source files that include a
-definition for 'main'. CMake will create a CMakeLists.txt file to
-build the source(s) as an executable. Specify COPY_FILE to get a copy
-of the linked executable at the given fileName and optionally
-COPY_FILE_ERROR to capture any error.
-
-In this version all files in bindir/CMakeFiles/CMakeTmp will be
-cleaned automatically. For debugging, --debug-trycompile can be
-passed to cmake to avoid this clean. However, multiple sequential
-try_compile operations reuse this single output directory. If you use
---debug-trycompile, you can only debug one try_compile call at a time.
-The recommended procedure is to protect all try_compile calls in your
-project by ``if(NOT DEFINED RESULT_VAR)`` logic, configure with cmake
-all the way through once, then delete the cache entry associated with
-the try_compile call of interest, and then re-run cmake again with
---debug-trycompile.
-
-Some extra flags that can be included are, INCLUDE_DIRECTORIES,
-LINK_DIRECTORIES, and LINK_LIBRARIES. COMPILE_DEFINITIONS are
--Ddefinition that will be passed to the compile line.
-
-The srcfile signature also accepts a LINK_LIBRARIES argument which may
-contain a list of libraries or IMPORTED targets which will be linked
-to in the generated project. If LINK_LIBRARIES is specified as a
-parameter to try_compile, then any LINK_LIBRARIES passed as
-CMAKE_FLAGS will be ignored.
+Try building an executable from one or more source files. The success or
+failure of the ``try_compile``, i.e. ``TRUE`` or ``FALSE`` respectively, is
+returned in ``RESULT_VAR``.
-try_compile creates a CMakeList.txt file on the fly that looks like
-this:
+In this form the user need only supply one or more source files that include a
+definition for ``main``. CMake will create a ``CMakeLists.txt`` file to build
+the source(s) as an executable that looks something like this::
-::
-
- add_definitions( <expanded COMPILE_DEFINITIONS from calling cmake>)
+ add_definitions(<expanded COMPILE_DEFINITIONS from caller>)
include_directories(${INCLUDE_DIRECTORIES})
link_directories(${LINK_DIRECTORIES})
- add_executable(cmTryCompileExec sources)
+ add_executable(cmTryCompileExec <srcfile>...)
target_link_libraries(cmTryCompileExec ${LINK_LIBRARIES})
-In both versions of the command, if OUTPUT_VARIABLE is specified, then
-the output from the build process is stored in the given variable.
-The success or failure of the try_compile, i.e. TRUE or FALSE
-respectively, is returned in RESULT_VAR. CMAKE_FLAGS can be used to
-pass -DVAR:TYPE=VALUE flags to the cmake that is run during the build.
-Set variable CMAKE_TRY_COMPILE_CONFIGURATION to choose a build
-configuration.
+The options are:
+
+``CMAKE_FLAGS <flags>...``
+ Specify flags of the form ``-DVAR:TYPE=VALUE`` to be passed to
+ the ``cmake`` command-line used to drive the test build.
+ The above example shows how values for variables
+ ``INCLUDE_DIRECTORIES``, ``LINK_DIRECTORIES``, and ``LINK_LIBRARIES``
+ are used.
+
+``COMPILE_DEFINITIONS <defs>...``
+ Specify ``-Ddefinition`` arguments to pass to ``add_definitions``
+ in the generated test project.
+
+``COPY_FILE <fileName>``
+ Copy the linked executable to the given ``<fileName>``.
+
+``COPY_FILE_ERROR <var>``
+ Use after ``COPY_FILE`` to capture into variable ``<var>`` any error
+ message encountered while trying to copy the file.
+
+``LINK_LIBRARIES <libs>...``
+ Specify libraries to be linked in the generated project.
+ The list of libraries may refer to system libraries and to
+ :ref:`Imported Targets <Imported Targets>` from the calling project.
+
+ If this option is specified, any ``-DLINK_LIBRARIES=...`` value
+ given to the ``CMAKE_FLAGS`` option will be ignored.
+
+``OUTPUT_VARIABLE <var>``
+ Store the output from the build process the given variable.
+
+In this version all files in ``<bindir>/CMakeFiles/CMakeTmp`` will be
+cleaned automatically. For debugging, ``--debug-trycompile`` can be
+passed to ``cmake`` to avoid this clean. However, multiple sequential
+``try_compile`` operations reuse this single output directory. If you use
+``--debug-trycompile``, you can only debug one ``try_compile`` call at a time.
+The recommended procedure is to protect all ``try_compile`` calls in your
+project by ``if(NOT DEFINED RESULT_VAR)`` logic, configure with cmake
+all the way through once, then delete the cache entry associated with
+the try_compile call of interest, and then re-run cmake again with
+``--debug-trycompile``.
+
+Other Behavior Settings
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose
+a build configuration.
diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst
index b8ea0fe..43ee219 100644
--- a/Help/command/try_run.rst
+++ b/Help/command/try_run.rst
@@ -1,59 +1,97 @@
try_run
-------
+.. only:: html
+
+ .. contents::
+
Try compiling and then running some code.
+Try Compiling and Running Source Files
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
::
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
- bindir srcfile [CMAKE_FLAGS <flags>]
- [COMPILE_DEFINITIONS <flags>]
- [LINK_LIBRARIES <libs>]
- [COMPILE_OUTPUT_VARIABLE comp]
- [RUN_OUTPUT_VARIABLE run]
- [OUTPUT_VARIABLE var]
- [ARGS <arg1> <arg2>...])
-
-Try compiling a srcfile. Return TRUE or FALSE for success or failure
-in COMPILE_RESULT_VAR. Then if the compile succeeded, run the
-executable and return its exit code in RUN_RESULT_VAR. If the
-executable was built, but failed to run, then RUN_RESULT_VAR will be
-set to FAILED_TO_RUN. COMPILE_OUTPUT_VARIABLE specifies the variable
-where the output from the compile step goes. RUN_OUTPUT_VARIABLE
-specifies the variable where the output from the running executable
-goes.
-
-The srcfile signature also accepts a LINK_LIBRARIES argument which may
-contain a list of libraries or IMPORTED targets which will be linked
-to in the generated project. If LINK_LIBRARIES is specified as a
-parameter to try_run, then any LINK_LIBRARIES passed as
-CMAKE_FLAGS will be ignored.
-
-For compatibility reasons OUTPUT_VARIABLE is still supported, which
-gives you the output from the compile and run step combined.
-
-Cross compiling issues
+ bindir srcfile [CMAKE_FLAGS <flags>...]
+ [COMPILE_DEFINITIONS <defs>...]
+ [LINK_LIBRARIES <libs>...]
+ [COMPILE_OUTPUT_VARIABLE <var>]
+ [RUN_OUTPUT_VARIABLE <var>]
+ [OUTPUT_VARIABLE <var>]
+ [ARGS <args>...])
+
+Try compiling a ``<srcfile>``. Returns ``TRUE`` or ``FALSE`` for success
+or failure in ``COMPILE_RESULT_VAR``. If the compile succeeded, runs the
+executable and returns its exit code in ``RUN_RESULT_VAR``. If the
+executable was built, but failed to run, then ``RUN_RESULT_VAR`` will be
+set to ``FAILED_TO_RUN``. See the :command:`try_compile` command for
+information on how the test project is constructed to build the source file.
+
+The options are:
+
+``CMAKE_FLAGS <flags>...``
+ Specify flags of the form ``-DVAR:TYPE=VALUE`` to be passed to
+ the ``cmake`` command-line used to drive the test build.
+ The example in :command:`try_compile` shows how values for variables
+ ``INCLUDE_DIRECTORIES``, ``LINK_DIRECTORIES``, and ``LINK_LIBRARIES``
+ are used.
+
+``COMPILE_DEFINITIONS <defs>...``
+ Specify ``-Ddefinition`` arguments to pass to ``add_definitions``
+ in the generated test project.
+
+``COMPILE_OUTPUT_VARIABLE <var>``
+ Report the compile step build output in a given variable.
+
+``LINK_LIBRARIES <libs>...``
+ Specify libraries to be linked in the generated project.
+ The list of libraries may refer to system libraries and to
+ :ref:`Imported Targets <Imported Targets>` from the calling project.
+
+ If this option is specified, any ``-DLINK_LIBRARIES=...`` value
+ given to the ``CMAKE_FLAGS`` option will be ignored.
+
+``OUTPUT_VARIABLE <var>``
+ Report the compile build output and the output from running the executable
+ in the given variable. This option exists for legacy reasons. Prefer
+ ``COMPILE_OUTPUT_VARIABLE`` and ``RUN_OUTPUT_VARIABLE`` instead.
+
+``RUN_OUTPUT_VARIABLE <var>``
+ Report the output from running the executable in a given variable.
+
+Other Behavior Settings
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose
+a build configuration.
+
+Behavior when Cross Compiling
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When cross compiling, the executable compiled in the first step
-usually cannot be run on the build host. try_run() checks the
-CMAKE_CROSSCOMPILING variable to detect whether CMake is in
-crosscompiling mode. If that's the case, it will still try to compile
+usually cannot be run on the build host. The ``try_run`` command checks
+the :variable:`CMAKE_CROSSCOMPILING` variable to detect whether CMake is in
+cross-compiling mode. If that is the case, it will still try to compile
the executable, but it will not try to run the executable. Instead it
will create cache variables which must be filled by the user or by
presetting them in some CMake script file to the values the executable
would have produced if it had been run on its actual target platform.
-These variables are RUN_RESULT_VAR (explanation see above) and if
-RUN_OUTPUT_VARIABLE (or OUTPUT_VARIABLE) was used, an additional cache
-variable RUN_RESULT_VAR__COMPILE_RESULT_VAR__TRYRUN_OUTPUT.This is
-intended to hold stdout and stderr from the executable.
-
-In order to make cross compiling your project easier, use try_run only
-if really required. If you use try_run, use RUN_OUTPUT_VARIABLE (or
-OUTPUT_VARIABLE) only if really required. Using them will require
-that when crosscompiling, the cache variables will have to be set
-manually to the output of the executable. You can also "guard" the
-calls to try_run with if(CMAKE_CROSSCOMPILING) and provide an
-easy-to-preset alternative for this case.
-
-Set variable CMAKE_TRY_COMPILE_CONFIGURATION to choose a build
-configuration.
+These cache entries are:
+
+``<RUN_RESULT_VAR>``
+ Exit code if the executable were to be run on the target platform.
+
+``<RUN_RESULT_VAR>__TRYRUN_OUTPUT``
+ Output from stdout and stderr if the executable were to be run on
+ the target platform. This is created only if the
+ ``RUN_OUTPUT_VARIABLE`` or ``OUTPUT_VARIABLE`` option was used.
+
+In order to make cross compiling your project easier, use ``try_run``
+only if really required. If you use ``try_run``, use the
+``RUN_OUTPUT_VARIABLE`` or ``OUTPUT_VARIABLE`` options only if really
+required. Using them will require that when cross-compiling, the cache
+variables will have to be set manually to the output of the executable.
+You can also "guard" the calls to ``try_run`` with an :command:`if`
+block checking the :variable:`CMAKE_CROSSCOMPILING` variable and
+provide an easy-to-preset alternative for this case.
diff --git a/Help/release/dev/CTestCoverageCollectGCOV-refinements.rst b/Help/release/dev/CTestCoverageCollectGCOV-refinements.rst
new file mode 100644
index 0000000..afa0a52
--- /dev/null
+++ b/Help/release/dev/CTestCoverageCollectGCOV-refinements.rst
@@ -0,0 +1,6 @@
+CTestCoverageCollectGCOV-refinements
+------------------------------------
+
+* The :module:`CTestCoverageCollectGCOV` module was introduced as an
+ alternative to the :command:`ctest_coverage` command for collecting
+ ``gcov`` results for submission to CDash.
diff --git a/Help/release/dev/rpm_multi_prefix.rst b/Help/release/dev/rpm_multi_prefix.rst
new file mode 100644
index 0000000..0329592
--- /dev/null
+++ b/Help/release/dev/rpm_multi_prefix.rst
@@ -0,0 +1,11 @@
+rpm_multi_prefix
+----------------
+
+* The :module:`CPackRPM` module learned a new
+ :variable:`CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX` variable to
+ specify a component-specific value to use instead of
+ :variable:`CPACK_PACKAGING_INSTALL_PREFIX`.
+
+* The :module:`CPackRPM` module learned a new
+ :variable:`CPACK_RPM_RELOCATION_PATHS` variable to
+ specify multiple relocation prefixes for a single rpm package.
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 35259c4..ce1536e 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -352,8 +352,8 @@ if(CPACK_NSIS_MODIFY_PATH)
endif()
set(__cpack_system_name ${CMAKE_SYSTEM_NAME})
-if(${__cpack_system_name} MATCHES Windows)
- if(CMAKE_CL_64)
+if(__cpack_system_name MATCHES "Windows")
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(__cpack_system_name win64)
else()
set(__cpack_system_name win32)
@@ -363,7 +363,12 @@ cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}")
# Root dir: default value should be the string literal "$PROGRAMFILES"
# for backwards compatibility. Projects may set this value to anything.
-set(__cpack_root_default "$PROGRAMFILES")
+# When creating 64 bit binaries we set the default value to "$PROGRAMFILES64"
+if("x${__cpack_system_name}" STREQUAL "xwin64")
+ set(__cpack_root_default "$PROGRAMFILES64")
+else()
+ set(__cpack_root_default "$PROGRAMFILES")
+endif()
cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
# <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index d2cb2ee..43e3fe0 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -379,6 +379,34 @@
#
# May be used to add more exclude path (directories or files) from the initial
# default list of excluded paths. See CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST.
+#
+# .. variable:: CPACK_RPM_RELOCATION_PATHS
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to specify more than one relocation path per relocatable RPM.
+# Variable contains a list of relocation paths that if relative are prefixed
+# by the value of CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX or by the value of
+# CPACK_PACKAGING_INSTALL_PREFIX if the component version is not provided.
+# Variable is not component based as its content can be used to set a different
+# path prefix for e.g. binary dir and documentation dir at the same time.
+# Only prefixes that are required by a certain component are added to that
+# component - component must contain at least one file/directory/symbolic link
+# with CPACK_RPM_RELOCATION_PATHS prefix for a certain relocation path
+# to be added. Package will not contain any relocation paths if there are no
+# files/directories/symbolic links on any of the provided prefix locations.
+# Packages that either do not contain any relocation paths or contain
+# files/directories/symbolic links that are outside relocation paths print
+# out an AUTHOR_WARNING that RPM will be partially relocatable.
+#
+# .. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
+#
+# * Mandatory : NO
+# * Default : CPACK_PACKAGING_INSTALL_PREFIX
+#
+# May be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for
+# relocatable RPM packages.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -395,6 +423,62 @@
# Author: Eric Noulard with the help of Alexander Neundorf.
+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)
+ else()
+ file(TO_CMAKE_PATH "${CPACK_PACKAGING_INSTALL_PREFIX}" PATH_PREFIX)
+ endif()
+
+ set(RPM_RELOCATION_PATHS "${CPACK_RPM_RELOCATION_PATHS}")
+ list(REMOVE_DUPLICATES RPM_RELOCATION_PATHS)
+
+ # set base path prefix
+ if(EXISTS "${WDIR}/${PATH_PREFIX}")
+ set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n")
+ list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}")
+ endif()
+
+ # set other path prefixes
+ foreach(RELOCATION_PATH ${RPM_RELOCATION_PATHS})
+ if(IS_ABSOLUTE "${RELOCATE_PATH}")
+ set(PREPARED_RELOCATION_PATH "${RELOCATION_PATH}")
+ else()
+ set(PREPARED_RELOCATION_PATH "${PATH_PREFIX}/${RELOCATION_PATH}")
+ endif()
+
+ if(EXISTS "${WDIR}/${PREPARED_RELOCATION_PATH}")
+ set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PREPARED_RELOCATION_PATH}\n")
+ list(APPEND RPM_USED_PACKAGE_PREFIXES "${PREPARED_RELOCATION_PATH}")
+ endif()
+ endforeach()
+
+ # warn about all the paths that are not relocatable
+ file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*")
+ foreach(TMP_PATH ${FILE_PATHS_})
+ string(LENGTH "${WDIR}" WDIR_LEN)
+ string(SUBSTRING "${TMP_PATH}" ${WDIR_LEN} -1 TMP_PATH)
+ unset(TMP_PATH_FOUND_)
+
+ foreach(RELOCATION_PATH ${RPM_USED_PACKAGE_PREFIXES})
+ file(RELATIVE_PATH REL_PATH_ "${RELOCATION_PATH}" "${TMP_PATH}")
+ string(SUBSTRING "${REL_PATH_}" 0 2 PREFIX_)
+
+ if(NOT "${PREFIX_}" STREQUAL "..")
+ set(TPM_PATH_FOUND_ TRUE)
+ break()
+ endif()
+ endforeach()
+
+ if(NOT TPM_PATH_FOUND_)
+ message(AUTHOR_WARNING "CPackRPM:Warning: Path ${TMP_PATH} is not on one of the relocatable paths! Package will be partially relocatable.")
+ endif()
+ endforeach()
+
+ set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE)
+endfunction()
+
if(CMAKE_BINARY_DIR)
message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.")
endif()
@@ -636,13 +720,16 @@ if(CPACK_PACKAGE_RELOCATABLE)
set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE)
endif()
if(CPACK_RPM_PACKAGE_RELOCATABLE)
+ unset(TMP_RPM_PREFIXES)
+
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: Trying to build a relocatable package")
endif()
if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON"))
message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.")
else()
- set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX})
+ set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for back compatibility (provided external RPM spec files)
+ cpack_rpm_prepare_relocation_paths()
endif()
endif()
@@ -856,15 +943,21 @@ if(CPACK_RPM_PACKAGE_RELOCATABLE)
# get a list of the elements in CPACK_RPM_PACKAGE_PREFIX and remove
# the final element (so the install-prefix dir itself is not omitted
# from the RPM's content-list)
- string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${CPACK_RPM_PACKAGE_PREFIX}")
- list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
- # Now generate all of the parent dirs of CPACK_RPM_PACKAGE_PREFIX
- foreach(_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
- list(APPEND _TMP_LIST "${_ELEM}")
- string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}")
- set(_OMIT_DIR "-o -path ${_OMIT_DIR}")
- separate_arguments(_OMIT_DIR)
- list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR})
+ foreach(CPACK_RPM_PACKAGE_PREFIX ${RPM_PACKAGE_PREFIXES})
+ string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${CPACK_RPM_PACKAGE_PREFIX}")
+ list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
+ unset(_TMP_LIST)
+ # Now generate all of the parent dirs of CPACK_RPM_PACKAGE_PREFIX
+ foreach(_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
+ list(APPEND _TMP_LIST "${_ELEM}")
+ string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}")
+ list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND)
+ if(_DUPLICATE_FOUND EQUAL -1)
+ set(_OMIT_DIR "-o -path ${_OMIT_DIR}")
+ separate_arguments(_OMIT_DIR)
+ list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR})
+ endif()
+ endforeach()
endforeach()
endif()
@@ -1101,7 +1194,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_AUTOREQ\@
\@TMP_RPM_AUTOREQPROV\@
\@TMP_RPM_BUILDARCH\@
-\@TMP_RPM_PREFIX\@
+\@TMP_RPM_PREFIXES\@
%define _rpmdir \@CPACK_RPM_DIRECTORY\@
%define _rpmfilename \@CPACK_RPM_FILE_NAME\@
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index f6616e0..a607c52 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -19,6 +19,7 @@
# ctest_coverage_collect_gcov(TARBALL <tarfile>
# [SOURCE <source_dir>][BUILD <build_dir>]
# [GCOV_COMMAND <gcov_command>]
+# [GCOV_OPTIONS <options>...]
# )
#
# Run gcov and package a tar file for CDash. The options are:
@@ -39,6 +40,11 @@
# ``GCOV_COMMAND <gcov_command>``
# Specify the full path to the ``gcov`` command on the machine.
# Default is the value of :variable:`CTEST_COVERAGE_COMMAND`.
+#
+# ``GCOV_OPTIONS <options>...``
+# Specify options to be passed to gcov. The ``gcov`` command
+# is run as ``gcov <options>... -o <gcov-dir> <file>.gcda``.
+# If not specified, the default option is just ``-b``.
#=============================================================================
# Copyright 2014-2015 Kitware, Inc.
@@ -56,7 +62,7 @@ include(CMakeParseArguments)
function(ctest_coverage_collect_gcov)
set(options "")
set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND)
- set(multiValueArgs "")
+ set(multiValueArgs GCOV_OPTIONS)
cmake_parse_arguments(GCOV "${options}" "${oneValueArgs}"
"${multiValueArgs}" "" ${ARGN} )
if(NOT DEFINED GCOV_TARBALL)
@@ -84,7 +90,8 @@ function(ctest_coverage_collect_gcov)
# 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)
+ 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)
@@ -113,11 +120,18 @@ function(ctest_coverage_collect_gcov)
get_filename_component(gcov_dir ${gcda_file} DIRECTORY)
# run gcov, this will produce the .gcov file in the current
# working directory
+ if(NOT DEFINED GCOV_GCOV_OPTIONS)
+ set(GCOV_GCOV_OPTIONS -b)
+ endif()
execute_process(COMMAND
- ${gcov_command} -b -o ${gcov_dir} ${gcda_file}
+ ${gcov_command} ${GCOV_GCOV_OPTIONS} -o ${gcov_dir} ${gcda_file}
OUTPUT_VARIABLE out
+ RESULT_VARIABLE res
WORKING_DIRECTORY ${coverage_dir})
endforeach()
+ if(NOT "${res}" EQUAL 0)
+ message(STATUS "Error running gcov: ${res} ${out}")
+ endif()
# create json file with project information
file(WRITE ${coverage_dir}/data.json
"{
@@ -130,9 +144,16 @@ function(ctest_coverage_collect_gcov)
# tar up the coverage info with the same date so that the md5
# sum will be the same for the tar file independent of file time
# stamps
+ string(REPLACE ";" "\n" gcov_files "${gcov_files}")
+ string(REPLACE ";" "\n" label_files "${label_files}")
+ file(WRITE "${coverage_dir}/coverage_file_list.txt"
+ "${gcov_files}
+${coverage_dir}/data.json
+${label_files}
+")
execute_process(COMMAND
${CMAKE_COMMAND} -E tar cvfj ${GCOV_TARBALL}
- "--mtime=1970-01-01 0:0:0 UTC" ${gcov_files}
- ${coverage_dir}/data.json ${label_files}
+ "--mtime=1970-01-01 0:0:0 UTC"
+ --files-from=${coverage_dir}/coverage_file_list.txt
WORKING_DIRECTORY ${binary_dir})
endfunction()
diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
index 5fc3deb..d18adaf 100644
--- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
@@ -6,6 +6,8 @@ set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404")
set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L")
set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}")
+set(_cmake_feature_test_cxx_relaxed_constexpr "${GNU50_CXX14}")
+set(_cmake_feature_test_cxx_aggregate_default_initializers "${GNU50_CXX14}")
# GNU 4.9 in c++14 mode sets __cplusplus to 201300L, so don't test for the
# correct value of it below.
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index a72f946..2440f89 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -235,7 +235,7 @@ set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO")
# shared linker flags
set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
+set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
# module linker flags
diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake
index 211cc9d..59d88a3 100644
--- a/Modules/Platform/Windows-df.cmake
+++ b/Modules/Platform/Windows-df.cmake
@@ -62,7 +62,7 @@ endif ()
set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
+set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 68dff35..a9b0511 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 1)
-set(CMake_VERSION_PATCH 20150202)
+set(CMake_VERSION_PATCH 20150205)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 400415b..7ca7684 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -407,27 +407,23 @@ void cmLocalGenerator::GenerateInstallRules()
this->Makefile->GetConfigurations(configurationTypes, false);
// Choose a default install configuration.
- const char* default_config = config.c_str();
+ std::string default_config = config;
const char* default_order[] = {"RELEASE", "MINSIZEREL",
"RELWITHDEBINFO", "DEBUG", 0};
- for(const char** c = default_order; *c && !default_config; ++c)
+ for(const char** c = default_order; *c && default_config.empty(); ++c)
{
for(std::vector<std::string>::iterator i = configurationTypes.begin();
i != configurationTypes.end(); ++i)
{
if(cmSystemTools::UpperCase(*i) == *c)
{
- default_config = i->c_str();
+ default_config = *i;
}
}
}
- if(!default_config && !configurationTypes.empty())
+ if(default_config.empty() && !configurationTypes.empty())
{
- default_config = configurationTypes[0].c_str();
- }
- if(!default_config)
- {
- default_config = "Release";
+ default_config = configurationTypes[0];
}
// Create the install script file.
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index f825f5f..fbf2140 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1826,7 +1826,7 @@ void cmLocalUnixMakefileGenerator3
std::vector<std::string> no_depends;
this->WriteMakeRule(ruleFileStream,
"Allow only one \"make -f Makefile2\" at a time, but pass parallelism.",
- ".NOTPARALLEL", no_depends, no_commands, true);
+ ".NOTPARALLEL", no_depends, no_commands, false);
}
}
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index bf79066..e18e757 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -2243,7 +2243,8 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
if (!result || retVal)
{
std::cerr << "AUTOUIC: error: process for " << ui_output_file <<
- " failed:\n" << output << std::endl;
+ " needed by\n \"" << realName << "\"\nfailed:\n" << output
+ << std::endl;
this->RunUicFailed = true;
cmSystemTools::RemoveFile(ui_output_file);
return false;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 035f161..7e7aa2e 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2269,6 +2269,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
PASS_REGULAR_EXPRESSION "Upload\\.xml")
configure_file(
+ "${CMake_SOURCE_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake.in"
+ "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake"
+ @ONLY ESCAPE_QUOTES)
+ add_test(CTestCoverageCollectGCOV ${CMAKE_CTEST_COMMAND}
+ -S "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake" -VV
+ --output-log "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/testOut.log"
+ )
+ set_tests_properties(CTestCoverageCollectGCOV PROPERTIES
+ PASS_REGULAR_EXPRESSION
+ "PASSED with correct output.*Testing/CoverageInfo/echoargs.gcov")
+
+ configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake"
@ONLY ESCAPE_QUOTES)
diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt
index ff40e30..b55594e 100644
--- a/Tests/CPackComponentsForAll/CMakeLists.txt
+++ b/Tests/CPackComponentsForAll/CMakeLists.txt
@@ -110,6 +110,12 @@ set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full)
set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full)
+# set CPACK_RPM_RELOCATION_PATHS here as GNUInstallDirs script
+# can not be used in CPack scripts due to CMAKE_SIZEOF_VOID_P
+# variable not being set
+set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}"
+ "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}")
+
# We may use the CPack specific config file in order
# to tailor CPack behavior on a CPack generator specific way
# (Behavior would be different for RPM or TGZ or DEB ...)
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
index 8c01b32..de0ee46 100644
--- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
@@ -6,15 +6,17 @@ if(CPACK_GENERATOR MATCHES "ZIP")
endif()
if(CPACK_GENERATOR MATCHES "RPM")
- set(CPACK_RPM_COMPONENT_INSTALL "ON")
- set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries")
+ set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
- # test package summary override
- set(CPACK_RPM_PACKAGE_SUMMARY "default summary")
- set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary")
+ set(CPACK_RPM_COMPONENT_INSTALL "ON")
+ set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries")
- # test package description override
- set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description")
+ # test package summary override
+ set(CPACK_RPM_PACKAGE_SUMMARY "default summary")
+ set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary")
+
+ # test package description override
+ set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description")
endif()
if(CPACK_GENERATOR MATCHES "DEB")
diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
index 4d56218..68d846f 100644
--- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
@@ -140,6 +140,12 @@ if(CPackGen MATCHES "RPM")
"C/C\\+\\+ header files for use with MyLib")
if(${CPackComponentWay} STREQUAL "IgnoreGroup")
+ # set gnu install prefixes to what they are set during rpm creation
+ # CMAKE_SIZEOF_VOID_P is not set here but lib is prefix of lib64 so
+ # relocation path test won't fail on OSes with lib64 library location
+ include(GNUInstallDirs)
+ set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
+
foreach(check_file ${expected_file})
string(REGEX MATCH ".*libraries.*" check_file_libraries_match ${check_file})
string(REGEX MATCH ".*headers.*" check_file_headers_match ${check_file})
@@ -154,15 +160,23 @@ if(CPackGen MATCHES "RPM")
if(check_file_libraries_match)
set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*")
set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*")
+ set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+ set(spec_regex "*libraries*")
elseif(check_file_headers_match)
set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*")
+ set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
+ set(spec_regex "*headers*")
elseif(check_file_applications_match)
set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*")
+ set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+ set(spec_regex "*applications*")
elseif(check_file_Unspecified_match)
set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
set(check_file_match_expected_description ".*DESCRIPTION.*")
+ set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+ set(spec_regex "*Unspecified*")
else()
message(FATAL_ERROR "error: unexpected rpm package '${check_file}'")
endif()
@@ -170,13 +184,25 @@ if(CPackGen MATCHES "RPM")
string(REGEX MATCH ${check_file_match_expected_summary} check_file_match_summary ${check_file_content})
if(NOT check_file_match_summary)
- message(FATAL_ERROR "error: '${check_file}' rpm package summary does not match expected value - regex '${check_file_match_expected_summary}'")
+ message(FATAL_ERROR "error: '${check_file}' rpm package summary does not match expected value - regex '${check_file_match_expected_summary}'; RPM output: '${check_file_content}'")
endif()
string(REGEX MATCH ${check_file_match_expected_description} check_file_match_description ${check_file_content})
if(NOT check_file_match_description)
- message(FATAL_ERROR "error: '${check_file}' rpm package description does not match expected value - regex '${check_file_match_expected_description}'")
+ message(FATAL_ERROR "error: '${check_file}' rpm package description does not match expected value - regex '${check_file_match_expected_description}'; RPM output: '${check_file_content}'")
+ endif()
+
+ string(REGEX MATCH ${check_file_match_expected_relocation_path} check_file_match_relocation_path ${check_file_content})
+
+ if(NOT check_file_match_relocation_path)
+ file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/${spec_regex}.spec")
+
+ if(spec_file)
+ file(READ ${spec_file} spec_file_content)
+ endif()
+
+ message(FATAL_ERROR "error: '${check_file}' rpm package relocation path does not match expected value - regex '${check_file_match_expected_relocation_path}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'")
endif()
endforeach()
elseif(${CPackComponentWay} STREQUAL "IgnoreGroup")
diff --git a/Tests/CTestCoverageCollectGCOV/fakegcov.cmake b/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
new file mode 100644
index 0000000..e704f14
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
@@ -0,0 +1,8 @@
+foreach(I RANGE 0 ${CMAKE_ARGC})
+ if("${CMAKE_ARGV${I}}" MATCHES ".*\\.gcda")
+ set(gcda_file "${CMAKE_ARGV${I}}")
+ endif()
+endforeach()
+get_filename_component(gcda_file ${gcda_file} NAME_WE)
+file(WRITE "${CMAKE_SOURCE_DIR}/${gcda_file}.gcov"
+"fake gcov file")
diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in
new file mode 100644
index 0000000..4bdcb10
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in
@@ -0,0 +1,39 @@
+cmake_minimum_required(VERSION 2.8.12)
+set(CTEST_PROJECT_NAME "SmallAndFast")
+set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTest/SmallAndFast")
+set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestCoverageCollectGCOV")
+set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
+ctest_start(Experimental)
+ctest_configure()
+ctest_build()
+ctest_test()
+
+file(WRITE ${CTEST_BINARY_DIRECTORY}/CMakeFiles/echoargs.dir/echoargs.gcda
+"dummy
+")
+
+include(CTestCoverageCollectGCOV)
+set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.tar)
+ctest_coverage_collect_gcov(
+ TARBALL "${tar_file}"
+ SOURCE "${CTEST_SOURCE_DIRECTORY}"
+ BUILD "${CTEST_BINARY_DIRECTORY}"
+ GCOV_COMMAND "${CMAKE_COMMAND}"
+ GCOV_OPTIONS -P "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/fakegcov.cmake")
+
+execute_process(COMMAND
+ ${CMAKE_COMMAND} -E tar tf ${tar_file}
+ OUTPUT_VARIABLE out
+ WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
+
+set(expected_out
+"Testing/CoverageInfo/echoargs.gcov
+Testing/CoverageInfo/data.json
+CMakeFiles/echoargs.dir/Labels.json
+")
+
+if("${out}" STREQUAL "${expected_out}")
+ message("PASSED with correct output: ${out}")
+else()
+ message(FATAL_ERROR "FAILED: expected:\n${expected_out}\nGot:\n${out}")
+endif()
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index d1457a7..801655f 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -177,3 +177,7 @@ add_RunCMake_test(CommandLine)
add_RunCMake_test(install)
add_RunCMake_test(CPackInstallProperties)
add_RunCMake_test(ExternalProject)
+
+if(RPMBUILD)
+ add_RunCMake_test(CPackRPM)
+endif()
diff --git a/Tests/RunCMake/CPackRPM/CMakeLists.txt b/Tests/RunCMake/CPackRPM/CMakeLists.txt
new file mode 100644
index 0000000..b7d170b
--- /dev/null
+++ b/Tests/RunCMake/CPackRPM/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
+
+set(CPACK_GENERATOR "RPM")
+include(CPack)
diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt
new file mode 100644
index 0000000..3b63d5b
--- /dev/null
+++ b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt
@@ -0,0 +1 @@
+CPackRPM:Warning: Path /not_relocatable/CMakeLists.txt is not on one of the.*relocatable paths! Package will be partially relocatable.
diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake
new file mode 100644
index 0000000..3ace6a8
--- /dev/null
+++ b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake
@@ -0,0 +1,7 @@
+install(FILES CMakeLists.txt DESTINATION /not_relocatable COMPONENT static)
+install(FILES CMakeLists.txt DESTINATION relocatable COMPONENT relocatable)
+
+set(CPACK_PACKAGE_RELOCATABLE TRUE)
+set(CPACK_PACKAGING_INSTALL_PREFIX "/opt")
+
+set(CPACK_RPM_COMPONENT_INSTALL ON)
diff --git a/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake b/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake
new file mode 100644
index 0000000..1935e32
--- /dev/null
+++ b/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake
@@ -0,0 +1,17 @@
+include(RunCMake)
+
+function(run_cpack_rpm_test TEST_NAME)
+ set(RunCMake_TEST_NO_CLEAN TRUE)
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build")
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ execute_process(
+ COMMAND "${CMAKE_COMMAND}" -D RunCMake_TEST=${TEST_NAME} "${RunCMake_SOURCE_DIR}"
+ WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}"
+ OUTPUT_QUIET
+ ERROR_QUIET
+ )
+ run_cmake_command(${TEST_NAME} ${CMAKE_CPACK_COMMAND})
+endfunction()
+
+run_cpack_rpm_test(CPackRPM_PARTIALLY_RELOCATABLE_WARNING)