Commit Graph

2276 Commits

Author SHA1 Message Date
Stephen Kelly 5a5e0fa9d3 Fix clearing of the INCLUDE_DIRECTORIES DIRECTORY property.
This was broken by commit 18a3195a (Keep track of INCLUDE_DIRECTORIES
as a vector of structs., 2012-11-19).
2013-04-10 18:12:56 +02:00
Brad King de13d68d11 add_dependencies: Distinguish target v. file dependencies in error (#14050)
When called with a non-existent LHS target name the user may be trying
to add file-level dependencies.  Clarify the error message to explain
the difference between target-level and file-level dependencies.  Point
the reader at the commands and options needed for the latter.
2013-03-29 15:00:33 -04:00
Brad King 4ce263288a Merge topic 'fix-Qt5-incompatibility-check-version'
535e53c Fix the Qt 5 version required to run the IncompatibleQt test.
2013-03-28 10:43:02 -04:00
Brad King 2afcbe3090 Merge topic 'error-on-exported-missing-include-dir'
634bb33 Error if linked target has relative paths in INTERFACE_INCLUDE_DIRECTORIES
2013-03-28 10:42:42 -04:00
Stephen Kelly 535e53c7cc Fix the Qt 5 version required to run the IncompatibleQt test.
The commit to add the INTERFACE_QT_MAJOR_VERSION in qtbase.git
is 14054d45 (Set the INTERFACE_QT_MAJOR_VERSION to 5., 2013-03-16)
which will be part of Qt 5.1.0.

If there is a Qt 5.0.3 release, there is no guarantee it will
contain that commit. Make sure such a Qt version does not fail
with this test if not.
2013-03-27 00:15:08 +01:00
Stephen Kelly 634bb33f3a Error if linked target has relative paths in INTERFACE_INCLUDE_DIRECTORIES
We can do this check only if the TargetName is non-empty, which means
that we're evaluating INTERFACE_INCLUDE_DIRECTORIES from a linked
dependency which was set using target_link_libraries.

It is possible to have relative paths in INCLUDE_DIRECTORIES already
in CMake 2.8.10.2, so that part will require a policy to fix.
2013-03-26 19:56:10 +01:00
Brad King b9e4a5abb4 Merge topic 'error-on-exported-missing-include-dir'
28051f1 Report an error on IMPORTED targets with a faulty INTERFACE
af81a3c install(EXPORT): Ensure clean INTERFACE_INCLUDE_DIRECTORIES
2013-03-26 14:36:45 -04:00
Brad King 0261bdfc1d Merge topic 'fix-COMPILE_DEFINITIONS-config'
1703b00 Test evaluation of per-config COMPILE_DEFINITIONS (#14037)
a6286e9 Fix the evaluation of per-config COMPILE_DEFINITIONS (#14037)
2013-03-26 14:36:07 -04:00
Stephen Kelly 28051f1150 Report an error on IMPORTED targets with a faulty INTERFACE
It is considered an error if the INTERFACE_INCLUDE_DIRECTORIES contains
a directory which does not exist, which indicates a programmer error
by the upstream, or a packaging error.

One of the RunCMake.CompatibleInterface tests also needs to be updated
due to this change. Non-existant includes were used in the test, but
are not needed.
2013-03-26 10:45:28 -04:00
Stephen Kelly af81a3c31b install(EXPORT): Ensure clean INTERFACE_INCLUDE_DIRECTORIES
Check that source and binary directories are not part of the
INTERFACE_INCLUDE_DIRECTORIES for installed IMPORTED targets.

This is limited to directories which do not contain generator
expressions to evaluate. Such paths can only be checked at time
of use of the imported target, which will be done in a follow up
patch.
2013-03-26 10:45:07 -04:00
Brad King 1703b00c7f Test evaluation of per-config COMPILE_DEFINITIONS (#14037)
Teach the CompileDefinitions test to cover evaluation of config-specific
generator expressions.
2013-03-25 10:49:42 -04:00
Brad King fc43477de0 Rename variable for including current directory in interfaces
Rename the variable added by commit 9ce1b9ef (Add
CMAKE_BUILD_INTERFACE_INCLUDES build-variable, 2012-11-25) to
CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE to be more consistent with the
existing CMAKE_INCLUDE_CURRENT_DIR variable.

Suggested-by: Alex Neundorf <neundorf@kde.org>
2013-03-19 16:44:17 -04:00
Brad King 16695a6d77 Merge topic 'fix-genex-preprocess'
7a619fa Fix cmGeneratorExpression::Preprocess for interleaved inputs.
2013-03-19 15:20:27 -04:00
Stephen Kelly 7a619fa6fb Fix cmGeneratorExpression::Preprocess for interleaved inputs.
We can't find both preprocessing expressions at once, because then
the BUILD_INTERFACE will always be favored if both are present, even
if INSTALL_INTERFACE appears first.

This was affecting the behavior of install(EXPORT) because the
INTERFACE_INCLUDE_DIRECTORIES contained entries like

 /foo/include;$<INSTALL_INTERFACE:/bar/include>

As the INSTALL_INTERFACE always evaluates to '0', it always needs
to be preprocessed properly.
2013-03-18 15:09:47 +01:00
Stephen Kelly 4aa10cd6d6 FindQt4: Set the INTERFACE_QT_MAJOR_VERSION for Qt4::QtCore
With a similar commit in Qt 5, this will error at CMake time if
an attempt is made to use

 target_link_libraries(foo Qt4::QtCore Qt5::Core)
2013-03-18 09:31:33 -04:00
Brad King dd8a06bd65 Configure Tests/CMakeTests only with BUILD_TESTING ON
Since commit e03f83f3 (ProcessorCount test: fix path to cmsysTestsCxx
executable, 2013-01-24) the directory references a target that is not
built when BUILD_TESTING is OFF.  It makes no sense to add tests without
BUILD_TESTING anyway.

While at it, use add_subdirectory instead of subdirs to add CMakeTests.
2013-03-13 14:09:43 -04:00
Brad King 8128940ac1 Merge topic 'cleanup-early-include-CTest-failure'
d90f49b CTest: Fail early without PROJECT_BINARY_DIR (#14005)
2e1c2bd build_command: Fail early without CMAKE_MAKE_PROGRAM (#14005)
4e5cb37 Refactor RunCMake.build_command test to allow more cases
2013-03-13 13:34:36 -04:00
Brad King 26bfece1af Merge topic 'fix-automoc-no-qt'
a223a3b Automoc: Don't create automoc targets if Qt is not used (#13999)
65b5c1e Merge branch 'property-link-depends-no-crash' into fix-automoc-no-qt
2013-03-13 13:34:24 -04:00
Brad King 7d9d0efc7b Merge topic 'genex-SEMICOLON'
7f3bb8b Add $<SEMICOLON> generator expression.
2013-03-13 13:34:16 -04:00
Brad King edf200a50b Merge topic 'ExternalData-escape-semicolons'
1823ab4 ExternalData: Preserve escaped semicolons during argument expansion
2013-03-13 13:34:06 -04:00
Brad King d90f49b894 CTest: Fail early without PROJECT_BINARY_DIR (#14005)
Do not use PROJECT_BINARY_DIR before it is defined.  If it is not
defined when needed, fail with an error message suggesting that the
project() command be invoked first.
2013-03-12 18:20:44 -04:00
Brad King 2e1c2bd2dd build_command: Fail early without CMAKE_MAKE_PROGRAM (#14005)
If CMAKE_MAKE_PROGRAM is not set fail with an error message instead of
crashing.  Suggest calling project() or enable_language() first to
ensure that CMAKE_MAKE_PROGRAM is set.
2013-03-12 18:17:40 -04:00
Brad King 4e5cb37590 Refactor RunCMake.build_command test to allow more cases
Move the ErrorsOFF/ON common logic from CMakeLists.txt into an
ErrorsCommon file to allow other test cases to be added that do not use
the Errors test logic.
2013-03-12 18:09:22 -04:00
Stephen Kelly a223a3b65f Automoc: Don't create automoc targets if Qt is not used (#13999)
Commit 79568f95 (automoc: Add source file to target early to set the
linker language, 2013-02-20) changed automoc initialization to a two
step process. In the first step, the generated source file was added
to the target, which allows the link language to be determined.

However, this bypassed the check for the availability of Qt itself.
At build-time the automoc file could not be generated because the moc
tool was not available to create it.

The solution is to only add the automoc file to the target if Qt is
found.
2013-03-12 17:42:02 -04:00
Jean-Christophe Fillion-Robin 7f3bb8b392 Add $<SEMICOLON> generator expression.
This expression is useful to put a ';' in a command line argument
without dividing the argument during CMake list expansion.
2013-03-12 16:46:03 -04:00
Brad King 1823ab4d76 ExternalData: Preserve escaped semicolons during argument expansion
The CMake language implicitly flattens lists so a ";" in a list element
must be escaped with a backslash.  List expansion removes backslashes
escaping semicolons to leave raw semicolons in the values.  Teach
ExternalData_Add_Test and ExternalData_Expand_Arguments to re-escape
semicolons found in list elements so the resulting argument lists work
as if constructed directly by the set() command.

For example:

  ExternalData_Add_Test(Data NAME test1 COMMAND ... "a\\;b")
  ExternalData_Expand_Arguments(Data args2 "c\\;d")
  add_test(NAME test2 COMMAND ... ${args2})

should be equivalent to

  set(args1 "a\\;b")
  add_test(NAME test1 COMMAND ... ${args1})
  set(args2 "c\\;d")
  add_test(NAME test2 COMMAND ... ${args2})

which is equivalent to

  add_test(NAME test1 COMMAND ... "a;b")
  add_test(NAME test2 COMMAND ... "c;d")

Note that it is not possible to make ExternalData_Add_Test act exactly
like add_test when quoted arguments contain semicolons because the CMake
language flattens lists when constructing function ARGN values.  This
re-escape approach at least allows test arguments to have semicolons.

While at it, teach ExternalData APIs to not transform "DATA{...;...}"
arguments because the contained semicolons are non-sensical.

Suggested-by: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
2013-03-12 16:33:19 -04:00
Brad King 950541618c Merge topic 'fix-transitive-target-names'
1bdd167 Restore support for target names with '+' (#13986)
254687d Only process transitive interface properties for valid target names.
2013-03-12 13:46:40 -04:00
Stephen Kelly 1bdd167577 Restore support for target names with '+' (#13986)
Extend the range of valid target names with the + sign.  This character
can commonly be used for target names, such as those containing 'c++'.
Add a test but skip it for Borland and Watcom tools which do not support
the character.

Suggested-By: Benjamin Kloster
2013-03-12 13:39:11 -04:00
Stephen Kelly adcc00b16a Remove unused parameters from target_link_libraries tests. 2013-03-06 22:54:49 +01:00
Brad King bbfc1ce942 Merge topic 'FixPreLinkTest'
5ab1259 Use PRE_LINK instead of PRE_BUILD when testing PRE_LINK.
2013-03-05 14:11:02 -05:00
Brad King e162d88fbb Merge topic 'GetPrerequisites-objdump'
12fb50d GetPrerequisites: Add documentation for objdump
8eb2fe9 GetPrerequisites: Enable test for BundleUtilities on MinGW
33c94c8 GetPrerequisites: Add support for objdump
5260a86 GetPrerequisites: Move tool search paths up
2013-03-04 15:40:24 -05:00
Brad King 8106570606 Merge topic 'ctest_update-Git-HEAD'
78b81b7 CTest: Fix ctest_update with 'HEAD' file in source tree
2013-03-04 15:40:08 -05:00
Brad King b4bb074d8b Merge topic 'remove-TARGET_DEFINED-genex'
cbf0756 Revert "Add the TARGET_DEFINED generator expression"
21a342c Remove use of TARGET_DEFINED from the target_link_libraries test.
47b8d32 Remove use of TARGET_DEFINED from the ExportImport test.
2e39d21 Remove use of TARGET_DEFINED from target_include_directories test.
2013-03-04 15:39:45 -05:00
James Bigler 5ab1259140 Use PRE_LINK instead of PRE_BUILD when testing PRE_LINK. 2013-03-04 13:21:41 -07:00
Michael Tänzer 8eb2fe955a GetPrerequisites: Enable test for BundleUtilities on MinGW
Signed-off-by: Michael Tänzer <neo@nhng.de>
2013-03-01 16:26:07 +01:00
Brad King 78b81b773c CTest: Fix ctest_update with 'HEAD' file in source tree
Add the '--' command-line separator to make the HEAD reference
unambiguous.  Extend the CTest.UpdateGIT test to cover this case.
2013-02-28 11:52:30 -05:00
Brad King 57072c12d2 Merge topic 'interface-property-external-read'
8dfdf1c Fix the tests for evaluating includes and defines.
98a6725 Fix constness of accessors.
7e70744 Expand includes and defines transitively in 'external' genexes.
d1a2729 Fix DAG checker finding cycling dependencies.
e72eaad Workaround broken code where a target has itself in its link iface.
ec2c67b Strip stray semicolons when evaluating generator expressions.
2013-02-25 13:12:12 -05:00
Brad King 9d4394148a Merge topic 'FPHSA_FOUND_VAR_OPTION'
f17711c FPHSA: Convert FOUND_VAR failure test to RunCMake
c1f5780 FPHSA: improve documentation
7bb1abe FPHSA: Add FOUND_VAR option to specify _FOUND variable name
2013-02-25 13:12:05 -05:00
Brad King b887bca6ee Merge topic 'try_compile-targets'
236133e Handle targets in the LINK_LIBRARIES of try_compile.
1c0597c Add a new Export generator for IMPORTED targets.
f2ab17d Keep track of all targets seen while evaluating a genex.
2013-02-25 13:12:02 -05:00
Brad King 6e567cabea Merge topic 'fix-automoc-linker-language'
79568f9 automoc: Add source file to target early to set the linker language
2013-02-25 13:11:55 -05:00
Stephen Kelly cbf07569ed Revert "Add the TARGET_DEFINED generator expression"
This reverts commit 2bee6f5ba5.

This expression is not used, and has a semantic which is not completely
optimal (namely considering utility targets to be targets, though
usually we are interested in linkable targets).

Remove it so that we have more freedom to define better expressions in
the future.

Conflicts:
        Source/cmGeneratorExpressionEvaluator.cxx
        Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
        Tests/CMakeCommands/target_compile_definitions/consumer.cpp
2013-02-25 15:35:11 +01:00
Stephen Kelly 21a342c8b1 Remove use of TARGET_DEFINED from the target_link_libraries test.
Update the unit test introduced in commit 57175d55 (Only use early
evaluation termination for transitive properties., 2013-02-07) to
not use the expression, but still test the appropriate code.
2013-02-25 15:33:07 +01:00
Stephen Kelly 47b8d322a4 Remove use of TARGET_DEFINED from the ExportImport test.
Update the unit test introduced in commit 5daaa5c4 (Fix TARGET_PROPERTY
target extractions., 2013-01-26) to not use the expression, but still
test the appropriate code.
2013-02-25 15:33:03 +01:00
Stephen Kelly 2e39d21c87 Remove use of TARGET_DEFINED from target_include_directories test.
Change the unit test introduced in commit 24dcf0c0 (Make sure
generator expressions can be used with target_include_directories.,
2013-01-16) to not use the expression, but still test the appropriate
code.
2013-02-25 15:25:38 +01:00
Stephen Kelly 8dfdf1c734 Fix the tests for evaluating includes and defines.
We should also check whether the INTERFACE_ variant of a property
is being read, and in the case of the compile definitions, we should
test the _<CONFIG> suffixed variants. That is already available
through the use of the methods.

This way, we use the ALREADY_SEEN optimization when evaluating
the includes of a target in 'external' generator expressions, ie, those
used in a add_custom_command invokation, as opposed to evaluating the
INCLUDE_DIRECTORIES of a target itself via GetIncludeDirectories.
2013-02-23 09:42:24 +01:00
Stephen Kelly 7e707444be Expand includes and defines transitively in 'external' genexes.
This means that we can use expressions of the form

 $<TARGET_PROPERTY:foo,INTERFACE_INCLUDE_DIRECTORIES>

to get a list of the interface include directories of foo, including
those coming from dependencies.

We can't have a test of a target which has a single include directory in
its INCLUDE_DIRECTORIES because the shell on the MSYS platforms transforms
a single include directory to include a prefix, which is not what the test
expects. We test a target with two directories instead as a means to
test a target with no link dependencies.
2013-02-23 09:42:24 +01:00
Brad King f17711c546 FPHSA: Convert FOUND_VAR failure test to RunCMake
Move the Tests/FPHSA_InvalidFOUND_VAR test case over to a new
RunCMake.FPHSA test with a BadFoundVar case.  The RunCMake tests are
built to cover failure cases easily and robustly.
2013-02-22 08:57:11 -05:00
Stephen Kelly 236133e79e Handle targets in the LINK_LIBRARIES of try_compile.
Imported targets are re-exported so that they can be used by the
try_compile generated code with target_link_libraries.

This makes the use of the cmake_expand_imported_targets macro
obsolete. The macro is not able to expand the generator expressions
which may appear in the IMPORTED_LINK_INTERFACE_LIBRARIES content.
Instead it just sees them as 'not a target'.
2013-02-22 08:35:39 -05:00
Alex Neundorf 7bb1abe56a FPHSA: Add FOUND_VAR option to specify _FOUND variable name
In the new mode FPHSA now accepts a FOUND_VAR option, which can be set
either to ExactCase_FOUND or UPPERCASE_FOUND, no other values are
accepted.  Also add tests for that, including failure.

Alex
2013-02-22 08:31:00 -05:00
Stephen Kelly 79568f95ab automoc: Add source file to target early to set the linker language
Previously, GetIncludeDirectories was called before calling
target->AddSourceFile(mocCppSource). Since commit a1c4905f (Use the
link information as a source of compile definitions and
includes., 2013-02-12), the include directories are determined by
the link information.

Valid link information requires that the linker language can be
determined, which depends on the source files languages and the
dependent targets languages. In the case of the no_link_languages
target in the unit test, there are no dependencies and the additional
source file no_link_languages_automoc.cpp is added to the target
at generate-time. That file can be used to determine the linker
language, but it must be added to the target before calling
GetIncludeDirectories.
2013-02-22 08:29:33 -05:00