Commit Graph

2248 Commits

Author SHA1 Message Date
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
Brad King 55f0148d7b ExternalData: Test content link with a space in its name
Extend the Module.ExternalData test to cover a DATA{} reference whose
name contains a space.  Skip the case when the native build tool does
not support spaces.
2013-02-22 08:25:06 -05:00
Brad King d45eb35350 Tests: Generalize decision for 'make' tool supporting spaces
Some make tools do not support spaces inside the source tree paths.
Decide early whether to add tests that depend on support for spaces so
we can use the result in a decision for any test.
2013-02-22 08:25:05 -05:00
Brad King ef8b2fd101 Tests: Replace exec_program with execute_process
Drop use of the old exec_program command from CMake's own CMakeLists.txt
files.
2013-02-22 08:25:05 -05:00
Brad King fc7b4d5cf3 Merge topic 'compiler-change-cleanup'
e83e6a1 Test Unix Makefiles generator support for changing compilers
c307e1c Tests/RunCMake: Allow tests to control build tree behavior
2963c98 Merge branch 'empty-compiler-crash' into compiler-change-cleanup
1df09e5 Delete entire CMakeFiles directory when deleting CMakeCache.txt (#13756)
2013-02-20 08:09:40 -05:00
Brad King e83e6a1c8c Test Unix Makefiles generator support for changing compilers
Add RunCMake.CompilerChange test to cover use of -DCMAKE_C_COMPILER=cc
to change the compiler of an existing build tree.  Also test for proper
failure with -DCMAKE_C_COMPILER="" and no CC in the environment.
2013-02-20 08:01:06 -05:00
Brad King c307e1c911 Tests/RunCMake: Allow tests to control build tree behavior
Teach the run_cmake to allow tests to set a custom test build directory.
Also add an option to skip removing the build directory.
2013-02-18 10:47:27 -05:00
Stephen Kelly 79ae968a18 Revert "Add a way to exclude INTERFACE properties from exported targets."
This reverts commit 2c3654c3de.

The removal of some tests added in commit 77cecb77 (Add includes and compile
definitions with target_link_libraries., 2012-11-05) are also squashed
into this commit.
2013-02-13 15:12:31 +01:00
Stephen Kelly 3df36b5954 Revert "Add the $<LINKED:...> generator expression."
This reverts commit 0b92602b81.

Conflicts:
	Source/cmGeneratorExpressionEvaluator.cxx
	Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
	Tests/CMakeCommands/target_include_directories/CMakeLists.txt
2013-02-13 15:12:31 +01:00
Stephen Kelly e1f908015f Don't populate INTERFACE includes and defines properties in tll.
This is a partial revert of commit 77cecb77 (Add includes and compile
definitions with target_link_libraries., 2012-11-05).

As the interface includes and defines are now determined by the link
closure, there is no need to populate the corresponding properties
explicitly.
2013-02-13 15:12:31 +01:00
Stephen Kelly 567c8d103e Revert "Don't allow utility or global targets in the LINKED expression."
This reverts commit 9712362b45.
2013-02-13 15:12:31 +01:00
Stephen Kelly 5c9f5e313f Don't use LINKED where not needed. 2013-02-12 10:39:35 +01:00
Brad King 813b519280 Merge topic 'minor-fixes'
ba48e63 Generate config-specific interface link libraries propeties.
deb51a7 Remove unused forward declarations.
9712362 Don't allow utility or global targets in the LINKED expression.
faa927e Make sure INTERFACE properties work with OBJECT libraries.
510fdcb Whitelist target types in target_{include_directories,compile_definitions}
4de7178 Ensure that the build interface includes have been added.
df74bc3 Only append build interface include dirs to particular targets.
d4e5c67 Don't keep track of content determined by target property values.
1fb545a Move a special case for PIC from the genex to the cmTarget code.
57175d5 Only use early evaluation termination for transitive properties.
4cf161a Fix determination of evaluating link libraries.
3a298c0 Fix generation of COMPILE_DEFINITIONS in DependInfo.cmake.
655e98b Ensure type specific compatible interface properties do not intersect.
46e2896 The COMPATIBLE_INTERFACE does not affect the target it is set on.
5f926a5 Test printing origin of include dirs from tll().
7c0ec75 De-duplicate validation of genex target names.
...
2013-02-11 13:59:48 -05:00
Stephen Kelly 9712362b45 Don't allow utility or global targets in the LINKED expression.
The LINKED expression is exclusively for handling INTERFACE content
and it does not make sense for utility targets to have INTERFACE
content.
2013-02-08 21:44:11 +01:00
Stephen Kelly faa927e273 Make sure INTERFACE properties work with OBJECT libraries. 2013-02-08 20:10:22 +01:00
Brad King 7dab997771 Merge topic 'generator-toolset'
56ca8d4 Tests: Add generator toolset support
f36c665 Tests: Consolidate ctest --build-and-test generator options
c0debb1 Merge branch 'master' into generator-toolset
daae0d2 ExternalProject: Propagate the generator toolset
e3841cf CTest: Add options to set generator toolset
f980a80 Xcode: Implement generator toolset selection (#9831, #13802)
650c647 VS: Implement generator toolset selection (#10722, #13774)
4fd5342 CMake: Add -T option to choose a generator toolset
118c32f Merge branch 'xcode-duplicate-flags-13354' into generator-toolset
cf8645e Tests: Run ctest custom commands with VERBATIM
5b2fba5 ExternalProject: Simplify CMake command line generation
2013-02-08 13:38:56 -05:00
Brad King 98cca40d9b Merge topic 'implicit-lib-canonical-path'
10e8b2d Normalize full paths in implicit link library list
2013-02-08 13:38:10 -05:00
Stephen Kelly 510fdcb188 Whitelist target types in target_{include_directories,compile_definitions}
Setting include directories or compile definitions on a target created
with add_custom_target does not make sense.
2013-02-08 19:21:30 +01:00
Stephen Kelly 4de71786e8 Ensure that the build interface includes have been added.
This is needed in the case that Automoc is used, as that calls
GetIncludeDirectories, which may cache the resulting include dirs
too early in the generate step.

Also, because the automoc step is so early, we can't cache the
include directories at that point. At that point the build interface
of all dependencies are not populated yet, so we'd be caching the
includes before appending the build interface. Only start caching
when we're definitely generating the buildsystem. At that point, the
includes should be stable.

We still need to invoke AppendBuildInterfaceIncludes
in the GlobalGenerator because the build interface includes affect
mostly the dependencies of targets (such as the automoc targets),
rather than the targets themselves, so the build interface needs
to be appended for all targets before generation is done.
2013-02-08 12:54:27 +01:00
Brad King 56ca8d4e63 Tests: Add generator toolset support
Propagate CMAKE_GENERATOR_TOOLSET through the test hierarchy so that all
tests can build with the selected generator toolset, if any.
2013-02-07 11:09:56 -05:00
Brad King f36c665df8 Tests: Consolidate ctest --build-and-test generator options
All ctest --build-and-test invocations require the options

  --build-generator ${CMAKE_GENERATOR}
  --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}

to be passed and have consistent values, except for a few special cases.
Collect the generator options in a variable instead of repeating the
options everywhere explicitly.
2013-02-07 11:09:24 -05:00
Brad King c0debb1f89 Merge branch 'master' into generator-toolset
We need the latest Tests/CMakeLists.txt so we can refactor all tests.
2013-02-07 11:09:01 -05:00
Brad King f980a80495 Xcode: Implement generator toolset selection (#9831, #13802)
Implement generator toolset selection (cmake -T) for Xcode > 2.0 by
adding the GCC_VERSION build setting to project files.
2013-02-07 11:07:48 -05:00
Brad King 650c647160 VS: Implement generator toolset selection (#10722, #13774)
Implement generator toolset selection (cmake -T) for VS >= 10 by setting
the PlatformToolset.  Extend the RunCMake.GeneratorToolset test case to
verify CMAKE_GENERATOR_TOOLSET when the generator supports -T.

Since commit 485a940e (VS: Simplify MSVC version reporting, 2012-08-23)
all MSVC version information is detected during the compiler id step
from the actual compiler invoked by generated build systems rather than
hard-coded in VS generators.  Therefore we can set the PlatformToolset
in VS >= 10 project files and support toolsets from other VS versions.
2013-02-07 11:06:28 -05:00
Brad King 4fd5342956 CMake: Add -T option to choose a generator toolset
Reject the option by default.  It will be implemented on a per-generator
basis.  Pass the setting into try_compile project generation.  Add cache
entry CMAKE_GENERATOR_TOOLSET and associated variable documentation to
hold the value persistently.

Add a RunCMake.GeneratorToolset test to cover basic "-T" option cases.
Verify that CMAKE_GENERATOR_TOOLSET is empty without -T, that -T is
rejected when the generator doesn't support it, and that two -T options
are always rejected.
2013-02-07 10:53:19 -05:00
Stephen Kelly 57175d559e Only use early evaluation termination for transitive properties.
We need to make sure expressions which evaluate TARGET_PROPERTY:TYPE
multiple times for example get the correct result each time, and
not an empty string instead.
2013-02-07 16:21:09 +01:00
Stephen Kelly 655e98bf71 Ensure type specific compatible interface properties do not intersect.
Before, the boolean version would always win, and the string one would
be ignored.
2013-02-07 16:21:09 +01:00
Stephen Kelly 46e28960a5 The COMPATIBLE_INTERFACE does not affect the target it is set on.
Test and document this.
2013-02-07 16:21:09 +01:00
Stephen Kelly 5f926a5802 Test printing origin of include dirs from tll(). 2013-02-07 16:21:09 +01:00