summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/target_link_libraries.rst208
-rw-r--r--Help/manual/OPTIONS_BUILD.txt2
-rw-r--r--Modules/CTestCoverageCollectGCOV.cmake31
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cpack.cxx3
-rw-r--r--Source/cmDependsC.cxx21
-rw-r--r--Tests/CMakeLists.txt3
-rw-r--r--Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp1
-rw-r--r--Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt41
-rw-r--r--Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp1
-rw-r--r--Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake7
-rw-r--r--Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake12
-rw-r--r--Tests/CTestCoverageCollectGCOV/TestProject/main.cpp1
-rw-r--r--Tests/CTestCoverageCollectGCOV/fakegcov.cmake12
-rw-r--r--Tests/CTestCoverageCollectGCOV/test.cmake.in37
-rw-r--r--Tests/RunCMake/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake20
-rw-r--r--Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt10
-rw-r--r--Tests/RunCMake/CPackSymlinks/testcpacksym.tarbin0 -> 10240 bytes
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake26
-rw-r--r--Tests/RunCMake/CommandLine/cmake_depends-check.cmake13
-rw-r--r--Tests/RunCMake/CommandLine/cmake_depends-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/cmake_depends/test.c2
-rw-r--r--Tests/RunCMake/CommandLine/cmake_depends/test.h1
-rw-r--r--Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.hbin0 -> 58 bytes
25 files changed, 350 insertions, 110 deletions
diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst
index 88a555a..393c8b4 100644
--- a/Help/command/target_link_libraries.rst
+++ b/Help/command/target_link_libraries.rst
@@ -1,38 +1,107 @@
target_link_libraries
---------------------
-Link a target to given libraries.
+.. only:: html
+
+ .. contents::
+
+Specify libraries or flags to use when linking a given target and/or
+its dependents. :ref:`Usage requirements <Target Usage Requirements>`
+from linked library targets will be propagated. Usage requirements
+of a target's dependencies affect compilation of its own sources.
+
+Overview
+^^^^^^^^
+
+This command has several signatures as detailed in subsections below.
+All of them have the general form::
+
+ target_link_libraries(<target> ... <item>... ...)
+
+The named ``<target>`` must have been created in the current directory by
+a command such as :command:`add_executable` or :command:`add_library`.
+Repeated calls for the same ``<target>`` append items in the order called.
+Each ``<item>`` may be:
+
+* **A library target name**: The generated link line will have the
+ full path to the linkable library file associated with the target.
+ The buildsystem will have a dependency to re-link ``<target>`` if
+ the library file changes.
+
+ The named target must be created by :command:`add_library` within
+ the project or as an :ref:`IMPORTED library <Imported Targets>`.
+ If it is created within the project an ordering dependency will
+ automatically be added in the build system to make sure the named
+ library target is up-to-date before the ``<target>`` links.
+
+* **A full path to a library file**: The generated link line will
+ normally preserve the full path to the file. However, there are
+ some cases where CMake must ask the linker to search for the library
+ (e.g. ``/usr/lib/libfoo.so`` becomes ``-lfoo``), such as when it
+ appears in a system library directory that the compiler front-end
+ may replace with an alternative. Either way, the buildsystem will
+ have a dependency to re-link ``<target>`` if the library file changes.
+
+ If the library file is in a Mac OSX framework, the ``Headers`` directory
+ of the framework will also be processed as a
+ :ref:`usage requirement <Target Usage Requirements>`. This has the same
+ effect as passing the framework directory as an include directory.
+
+* **A plain library name**: The generated link line will ask the linker
+ to search for the library (e.g. ``foo`` becomes ``-lfoo`` or ``foo.lib``).
+
+* **A link flag**: Item names starting with ``-``, but not ``-l`` or
+ ``-framework``, are treated as linker flags. Note that such flags will
+ be treated like any other library link item for purposes of transitive
+ dependencies, so they are generally safe to specify only as private link
+ items that will not propagate to dependents.
+
+* A ``debug``, ``optimized``, or ``general`` keyword immediately followed
+ by another ``<item>``. The item following such a keyword will be used
+ only for the corresponding build configuration. The ``debug`` keyword
+ corresponds to the ``Debug`` configuration (or to configurations named
+ in the :prop_gbl:`DEBUG_CONFIGURATIONS` global property if it is set).
+ The ``optimized`` keyword corresponds to all other configurations. The
+ ``general`` keyword corresponds to all configurations, and is purely
+ optional. Higher granularity may be achieved for per-configuration
+ rules by creating and linking to
+ :ref:`IMPORTED library targets <Imported Targets>`.
+
+Items containing ``::``, such as ``Foo::Bar``, are assumed to be
+:ref:`IMPORTED <Imported Targets>` or :ref:`ALIAS <Alias Targets>` library
+target names and will cause an error if no such target exists.
+See policy :policy:`CMP0028`.
+
+Arguments to ``target_link_libraries`` may use "generator expressions"
+with the syntax ``$<...>``. Note however, that generator expressions
+will not be used in OLD handling of :policy:`CMP0003` or :policy:`CMP0004`.
+See the :manual:`cmake-generator-expressions(7)` manual for available
+expressions. See the :manual:`cmake-buildsystem(7)` manual for more on
+defining buildsystem properties.
+
+Libraries for a Target and/or its Dependents
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+::
+
+ target_link_libraries(<target>
+ <PRIVATE|PUBLIC|INTERFACE> <item>...
+ [<PRIVATE|PUBLIC|INTERFACE> <item>...]...)
+
+The ``PUBLIC``, ``PRIVATE`` and ``INTERFACE`` keywords can be used to
+specify both the link dependencies and the link interface in one command.
+Libraries and targets following ``PUBLIC`` are linked to, and are made
+part of the link interface. Libraries and targets following ``PRIVATE``
+are linked to, but are not made part of the link interface. Libraries
+following ``INTERFACE`` are appended to the link interface and are not
+used for linking ``<target>``.
+
+Libraries for both a Target and its Dependents
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
- target_link_libraries(<target> [item1 [item2 [...]]]
- [[debug|optimized|general] <item>] ...)
-
-Specify libraries or flags to use when linking a given target. The
-named ``<target>`` must have been created in the current directory by a
-command such as :command:`add_executable` or :command:`add_library`. The
-remaining arguments specify library names or flags. Repeated calls for
-the same ``<target>`` append items in the order called.
-
-If a library name matches that of another target in the project a
-dependency will automatically be added in the build system to make sure
-the library being linked is up-to-date before the target links. Item names
-starting with ``-``, but not ``-l`` or ``-framework``, are treated as
-linker flags. Note that such flags will be treated like any other library
-link item for purposes of transitive dependencies, so they are generally
-safe to specify only as private link items that will not propagate to
-dependents of ``<target>``.
-
-A ``debug``, ``optimized``, or ``general`` keyword indicates that the
-library immediately following it is to be used only for the
-corresponding build configuration. The ``debug`` keyword corresponds to
-the Debug configuration (or to configurations named in the
-:prop_gbl:`DEBUG_CONFIGURATIONS` global property if it is set). The
-``optimized`` keyword corresponds to all other configurations. The
-``general`` keyword corresponds to all configurations, and is purely
-optional (assumed if omitted). Higher granularity may be achieved for
-per-configuration rules by creating and linking to
-:ref:`IMPORTED library targets <Imported Targets>`.
+ target_link_libraries(<target> <item>...)
Library dependencies are transitive by default with this signature.
When this target is linked into another target then the libraries
@@ -45,37 +114,34 @@ by setting the property directly. When :policy:`CMP0022` is not set to
of this command may set the property making any libraries linked
exclusively by this signature private.
-CMake will also propagate :ref:`usage requirements <Target Usage Requirements>`
-from linked library targets. Usage requirements of dependencies affect
-compilation of sources in the ``<target>``.
-
-If an ``<item>`` is a library in a Mac OX framework, the ``Headers``
-directory of the framework will also be processed as a
-:ref:`usage requirement <Target Usage Requirements>`. This has the same
-effect as passing the framework directory as an include directory.
-
---------------------------------------------------------------------------
+Libraries for a Target and/or its Dependents (Legacy)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
target_link_libraries(<target>
- <PRIVATE|PUBLIC|INTERFACE> <lib> ...
- [<PRIVATE|PUBLIC|INTERFACE> <lib> ... ] ...])
+ <LINK_PRIVATE|LINK_PUBLIC> <lib>...
+ [<LINK_PRIVATE|LINK_PUBLIC> <lib>...]...)
-The ``PUBLIC``, ``PRIVATE`` and ``INTERFACE`` keywords can be used to
-specify both the link dependencies and the link interface in one command.
-Libraries and targets following ``PUBLIC`` are linked to, and are made
-part of the link interface. Libraries and targets following ``PRIVATE``
-are linked to, but are not made part of the link interface. Libraries
-following ``INTERFACE`` are appended to the link interface and are not
-used for linking ``<target>``.
+The ``LINK_PUBLIC`` and ``LINK_PRIVATE`` modes can be used to specify both
+the link dependencies and the link interface in one command.
---------------------------------------------------------------------------
+This signature is for compatibility only. Prefer the ``PUBLIC`` or
+``PRIVATE`` keywords instead.
+
+Libraries and targets following ``LINK_PUBLIC`` are linked to, and are
+made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy
+:policy:`CMP0022` is not ``NEW``, they are also made part of the
+:prop_tgt:`LINK_INTERFACE_LIBRARIES`. Libraries and targets following
+``LINK_PRIVATE`` are linked to, but are not made part of the
+:prop_tgt:`INTERFACE_LINK_LIBRARIES` (or :prop_tgt:`LINK_INTERFACE_LIBRARIES`).
+
+Libraries for Dependents Only (Legacy)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
- target_link_libraries(<target> LINK_INTERFACE_LIBRARIES
- [[debug|optimized|general] <lib>] ...)
+ target_link_libraries(<target> LINK_INTERFACE_LIBRARIES <item>...)
The ``LINK_INTERFACE_LIBRARIES`` mode appends the libraries to the
:prop_tgt:`INTERFACE_LINK_LIBRARIES` target property instead of using them
@@ -99,28 +165,8 @@ is not ``NEW``, they are also appended to the
``general`` (or without any keyword) are treated as if specified for both
``debug`` and ``optimized``.
---------------------------------------------------------------------------
-
-::
-
- target_link_libraries(<target>
- <LINK_PRIVATE|LINK_PUBLIC>
- [[debug|optimized|general] <lib>] ...
- [<LINK_PRIVATE|LINK_PUBLIC>
- [[debug|optimized|general] <lib>] ...])
-
-The ``LINK_PUBLIC`` and ``LINK_PRIVATE`` modes can be used to specify both
-the link dependencies and the link interface in one command.
-
-This signature is for compatibility only. Prefer the ``PUBLIC`` or
-``PRIVATE`` keywords instead.
-
-Libraries and targets following ``LINK_PUBLIC`` are linked to, and are
-made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy
-:policy:`CMP0022` is not ``NEW``, they are also made part of the
-:prop_tgt:`LINK_INTERFACE_LIBRARIES`. Libraries and targets following
-``LINK_PRIVATE`` are linked to, but are not made part of the
-:prop_tgt:`INTERFACE_LINK_LIBRARIES` (or :prop_tgt:`LINK_INTERFACE_LIBRARIES`).
+Cyclic Dependencies of Static Libraries
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The library dependency graph is normally acyclic (a DAG), but in the case
of mutually-dependent ``STATIC`` libraries CMake allows the graph to
@@ -139,17 +185,11 @@ For example, the code
links ``main`` to ``A B A B``. While one repetition is usually
sufficient, pathological object file and symbol arrangements can require
-more. One may handle such cases by manually repeating the component in
-the last ``target_link_libraries`` call. However, if two archives are
-really so interdependent they should probably be combined into a single
-archive.
-
-Arguments to target_link_libraries may use "generator expressions"
-with the syntax ``$<...>``. Note however, that generator expressions
-will not be used in OLD handling of :policy:`CMP0003` or :policy:`CMP0004`.
-See the :manual:`cmake-generator-expressions(7)` manual for available
-expressions. See the :manual:`cmake-buildsystem(7)` manual for more on
-defining buildsystem properties.
+more. One may handle such cases by using the
+:prop_tgt:`LINK_INTERFACE_MULTIPLICITY` target property or by manually
+repeating the component in the last ``target_link_libraries`` call.
+However, if two archives are really so interdependent they should probably
+be combined into a single archive, perhaps by using :ref:`Object Libraries`.
Creating Relocatable Packages
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt
index 986b541..e4c5873 100644
--- a/Help/manual/OPTIONS_BUILD.txt
+++ b/Help/manual/OPTIONS_BUILD.txt
@@ -43,7 +43,7 @@
CMake may support multiple native build systems on certain
platforms. A generator is responsible for generating a particular
build system. Possible generator names are specified in the
- Generators section.
+ :manual:`cmake-generators(7)` manual.
``-T <toolset-name>``
Specify toolset name if supported by generator.
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index 4519627..8659a69 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -147,8 +147,37 @@ function(ctest_coverage_collect_gcov)
\"Binary\": \"${binary_dir}\"
}")
# collect the gcov files
+ set(unfiltered_gcov_files)
+ file(GLOB_RECURSE unfiltered_gcov_files RELATIVE ${binary_dir} "${coverage_dir}/*.gcov")
+
set(gcov_files)
- file(GLOB_RECURSE gcov_files RELATIVE ${binary_dir} "${coverage_dir}/*.gcov")
+ foreach(gcov_file ${unfiltered_gcov_files})
+ file(STRINGS ${binary_dir}/${gcov_file} first_line LIMIT_COUNT 1 ENCODING UTF-8)
+
+ set(is_excluded false)
+ if(first_line MATCHES "^ -: 0:Source:(.*)$")
+ set(source_file ${CMAKE_MATCH_1})
+ elseif(NOT GCOV_QUIET)
+ message(STATUS "Could not determine source file corresponding to: ${gcov_file}")
+ endif()
+
+ foreach(exclude_entry ${CTEST_CUSTOM_COVERAGE_EXCLUDE})
+ if(source_file MATCHES "${exclude_entry}")
+ set(is_excluded true)
+
+ if(NOT GCOV_QUIET)
+ message("Excluding coverage for: ${source_file} which matches ${exclude_entry}")
+ endif()
+
+ break()
+ endif()
+ endforeach()
+
+ if(NOT is_excluded)
+ list(APPEND gcov_files ${gcov_file})
+ endif()
+ endforeach()
+
# 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
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 48f02d1..2e9ee68 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 2)
-set(CMake_VERSION_PATCH 20150404)
+set(CMake_VERSION_PATCH 20150406)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 6106472..00b23cd 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -203,6 +203,9 @@ int main (int argc, char const* const* argv)
cmgg.SetCMakeInstance(&cminst);
cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator());
cmMakefile* globalMF = cmlg->GetMakefile();
+#if defined(__CYGWIN__)
+ globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");
+#endif
bool cpackConfigFileSpecified = true;
if ( cpackConfigFile.empty() )
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 63d8fa6..6cdd4c1 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -242,13 +242,22 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
cmsys::ifstream fin(fullName.c_str());
if(fin)
{
- // Add this file as a dependency.
- dependencies.insert(fullName);
+ cmsys::FStream::BOM bom = cmsys::FStream::ReadBOM(fin);
+ if(bom == cmsys::FStream::BOM_None ||
+ bom == cmsys::FStream::BOM_UTF8)
+ {
+ // Add this file as a dependency.
+ dependencies.insert(fullName);
- // Scan this file for new dependencies. Pass the directory
- // containing the file to handle double-quote includes.
- std::string dir = cmSystemTools::GetFilenamePath(fullName);
- this->Scan(fin, dir.c_str(), fullName);
+ // Scan this file for new dependencies. Pass the directory
+ // containing the file to handle double-quote includes.
+ std::string dir = cmSystemTools::GetFilenamePath(fullName);
+ this->Scan(fin, dir.c_str(), fullName);
+ }
+ else
+ {
+ // Skip file with encoding we do not implement.
+ }
}
}
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 1df39aa..f80191b 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2356,12 +2356,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
"${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake"
@ONLY ESCAPE_QUOTES)
add_test(CTestCoverageCollectGCOV ${CMAKE_CTEST_COMMAND}
+ -C \${CTEST_CONFIGURATION_TYPE}
-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")
+ "PASSED with correct output.*Testing/CoverageInfo/main.cpp.gcov")
configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in"
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp
new file mode 100644
index 0000000..85e6cd8
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp
@@ -0,0 +1 @@
+void foo() {}
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt b/Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt
new file mode 100644
index 0000000..ce6fac4
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt
@@ -0,0 +1,41 @@
+cmake_minimum_required(VERSION 3.2)
+
+project(TestProject CXX)
+
+include(CTest)
+
+set(SOURCES
+ main.cpp
+ 3rdparty/foo.cpp
+ extra/extra.cpp
+)
+
+add_executable(myexecutable ${SOURCES})
+
+set_property(SOURCE main.cpp APPEND PROPERTY LABELS SourceLabel)
+set_property(TARGET myexecutable APPEND PROPERTY LABELS TargetLabel)
+
+set(MYEXECUTABLE_INFO_FILE "${CMAKE_CURRENT_BINARY_DIR}/myexecutable_info.cmake")
+
+file(WRITE "${MYEXECUTABLE_INFO_FILE}" "
+ set(TARGET myexecutable)
+ set(SOURCE_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\")
+ set(SOURCES \"${SOURCES}\")
+")
+
+add_custom_command(TARGET myexecutable
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ "-DINFO_FILE=${MYEXECUTABLE_INFO_FILE}"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/fake_compile_time_gcno.cmake"
+ VERBATIM
+)
+
+add_test(NAME mytest
+ COMMAND ${CMAKE_COMMAND}
+ "-DMYEXECUTABLE=$<TARGET_FILE:myexecutable>"
+ "-DTARGETDIR=${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/myexecutable.dir"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/fake_run_time_gcda.cmake"
+)
+
+set_property(TEST mytest APPEND PROPERTY LABELS TestLabel)
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp
new file mode 100644
index 0000000..c3a2c12
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp
@@ -0,0 +1 @@
+void extra() {}
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake b/Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake
new file mode 100644
index 0000000..881460b
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake
@@ -0,0 +1,7 @@
+include("${INFO_FILE}")
+
+foreach(source ${SOURCES})
+ file(WRITE "CMakeFiles/${TARGET}.dir/${source}.gcno"
+ "${SOURCE_DIR}/${source}"
+ )
+endforeach()
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake b/Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake
new file mode 100644
index 0000000..26ce2bd
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake
@@ -0,0 +1,12 @@
+execute_process(COMMAND ${MYEXECUTABLE} RESULT_VARIABLE RESULT)
+
+if(NOT RESULT_VARIABLE STREQUAL "0")
+ message("Test failure")
+endif()
+
+file(GLOB_RECURSE gcno_files "${TARGETDIR}/*.gcno")
+
+foreach(gcno_file ${gcno_files})
+ string(REPLACE ".gcno" ".gcda" gcda_file "${gcno_file}")
+ configure_file(${gcno_file} ${gcda_file} COPYONLY)
+endforeach()
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp
new file mode 100644
index 0000000..237c8ce
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp
@@ -0,0 +1 @@
+int main() {}
diff --git a/Tests/CTestCoverageCollectGCOV/fakegcov.cmake b/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
index e704f14..b0c3a9b 100644
--- a/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
+++ b/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
@@ -3,6 +3,12 @@ foreach(I RANGE 0 ${CMAKE_ARGC})
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")
+
+get_filename_component(gcda_name ${gcda_file} NAME)
+string(REPLACE ".gcda" ".gcov" gcov_name "${gcda_name}")
+
+file(STRINGS "${gcda_file}" source_file LIMIT_COUNT 1 ENCODING UTF-8)
+
+file(WRITE "${CMAKE_SOURCE_DIR}/${gcov_name}"
+ " -: 0:Source:${source_file}"
+)
diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in
index 4bdcb10..29f7e7f 100644
--- a/Tests/CTestCoverageCollectGCOV/test.cmake.in
+++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in
@@ -1,16 +1,21 @@
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_PROJECT_NAME "TestProject")
+set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/TestProject")
+set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestCoverageCollectGCOV/TestProject")
set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
+
+ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
+
ctest_start(Experimental)
ctest_configure()
ctest_build()
ctest_test()
-file(WRITE ${CTEST_BINARY_DIRECTORY}/CMakeFiles/echoargs.dir/echoargs.gcda
-"dummy
-")
+list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
+ "/foo/something"
+ "/3rdparty/"
+ "/bar/somethingelse"
+)
include(CTestCoverageCollectGCOV)
set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.tar)
@@ -22,15 +27,21 @@ ctest_coverage_collect_gcov(
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})
+ ${CMAKE_COMMAND} -E tar tf ${tar_file}
+ OUTPUT_VARIABLE out
+ WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+string(REPLACE "\n" ";" out "${out}")
+list(SORT out)
set(expected_out
-"Testing/CoverageInfo/echoargs.gcov
-Testing/CoverageInfo/data.json
-CMakeFiles/echoargs.dir/Labels.json
-")
+ CMakeFiles/myexecutable.dir/Labels.json
+ Testing/CoverageInfo/data.json
+ Testing/CoverageInfo/extra.cpp.gcov
+ Testing/CoverageInfo/main.cpp.gcov
+)
if("${out}" STREQUAL "${expected_out}")
message("PASSED with correct output: ${out}")
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 6daf27a..60a8a82 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -204,6 +204,11 @@ add_RunCMake_test(install)
add_RunCMake_test(CPackInstallProperties)
add_RunCMake_test(ExternalProject)
add_RunCMake_test(CTestCommandLine)
+# Only run this test on unix platforms that support
+# symbolic links
+if(UNIX)
+ add_RunCMake_test(CPackSymlinks)
+endif()
set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES)
add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths)
diff --git a/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake b/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake
new file mode 100644
index 0000000..439d95e
--- /dev/null
+++ b/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake
@@ -0,0 +1,20 @@
+include(RunCMake)
+
+function(run_cpack_symlink_test)
+ set(RunCMake_TEST_NO_CLEAN TRUE)
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/SrcSymlinks-build")
+ set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/SrcSymlinks")
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}")
+ run_cmake_command(SrcSymlinksTar
+ ${CMAKE_COMMAND} -E chdir ${RunCMake_TEST_SOURCE_DIR}
+ ${CMAKE_COMMAND} -E tar xvf ${RunCMake_SOURCE_DIR}/testcpacksym.tar
+ )
+ run_cmake(SrcSymlinksCMake)
+ run_cmake_command(SrcSymlinksCPack
+ ${CMAKE_CPACK_COMMAND} --config CPackSourceConfig.cmake
+ )
+endfunction()
+
+run_cpack_symlink_test()
diff --git a/Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt b/Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt
new file mode 100644
index 0000000..24ad124
--- /dev/null
+++ b/Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt
@@ -0,0 +1,10 @@
+^x CMakeLists.txt
+x cygwin/
+x cygwin/build.sh
+x cygwin/setup.patch
+x include/
+x include/src.h
+x link.h
+x real.h
+x src/
+x src/src.h$
diff --git a/Tests/RunCMake/CPackSymlinks/testcpacksym.tar b/Tests/RunCMake/CPackSymlinks/testcpacksym.tar
new file mode 100644
index 0000000..a44c656
--- /dev/null
+++ b/Tests/RunCMake/CPackSymlinks/testcpacksym.tar
Binary files differ
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index a9c49e7..e8b4584 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -80,3 +80,29 @@ run_cmake(D_nested_cache)
set(RunCMake_TEST_OPTIONS
"-DFOO:STRING=-DBAR:BOOL=BAZ")
run_cmake(D_typed_nested_cache)
+
+function(run_cmake_depends)
+ set(RunCMake_TEST_SOURCE_DIR "${RunCMake_SOURCE_DIR}/cmake_depends")
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/cmake_depends-build")
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake" "
+set(CMAKE_DEPENDS_LANGUAGES \"C\")
+set(CMAKE_DEPENDS_CHECK_C
+ \"${RunCMake_TEST_SOURCE_DIR}/test.c\"
+ \"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/test.c.o\"
+ )
+")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/CMakeDirectoryInformation.cmake" "
+set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"${RunCMake_TEST_SOURCE_DIR}\")
+set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\")
+")
+ run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E cmake_depends
+ "Unix Makefiles"
+ ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR}
+ ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR}
+ ${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake
+ )
+endfunction()
+run_cmake_depends()
diff --git a/Tests/RunCMake/CommandLine/cmake_depends-check.cmake b/Tests/RunCMake/CommandLine/cmake_depends-check.cmake
new file mode 100644
index 0000000..031478b
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cmake_depends-check.cmake
@@ -0,0 +1,13 @@
+set(depend_make "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/depend.make")
+if(EXISTS "${depend_make}")
+ file(READ "${depend_make}" depend_make_content)
+ string(REGEX REPLACE "\n+$" "" depend_make_content "${depend_make_content}")
+ if(NOT depend_make_content MATCHES "
+CMakeFiles/DepTarget.dir/test.c.o: .*/Tests/RunCMake/CommandLine/cmake_depends/test.c
+CMakeFiles/DepTarget.dir/test.c.o: .*/Tests/RunCMake/CommandLine/cmake_depends/test.h$")
+ string(REPLACE "\n" "\n " depend_make_content " ${depend_make_content}")
+ set(RunCMake_TEST_FAILED "depend.make does not have expected content:\n${depend_make_content}")
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "depend.make missing:\n ${depend_make}")
+endif()
diff --git a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt
new file mode 100644
index 0000000..8fe092b
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt
@@ -0,0 +1 @@
+^Scanning dependencies of target DepTarget$
diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test.c b/Tests/RunCMake/CommandLine/cmake_depends/test.c
new file mode 100644
index 0000000..92c056f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cmake_depends/test.c
@@ -0,0 +1,2 @@
+#include "test.h"
+#include "test_UTF-16LE.h"
diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test.h b/Tests/RunCMake/CommandLine/cmake_depends/test.h
new file mode 100644
index 0000000..fd87388
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cmake_depends/test.h
@@ -0,0 +1 @@
+void test(void) {}
diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h b/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h
new file mode 100644
index 0000000..bf56ec6
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h
Binary files differ