Commit Graph

46 Commits

Author SHA1 Message Date
Stephen Kelly b8259c3d69 Centralize maintenance of usage requirement include directories
Maintain a target's internal list of usage requirement include
directories whenever the LINK_LIBRARIES property is set by either
target_link_libraries or set_property.
2013-05-06 09:54:11 -04: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 a1c4905f72 Use the link information as a source of compile definitions and includes.
After evaluating the INTERFACE_INCLUDE_DIRECTORIES, of a target in a
generator expression, also read the INTERFACE_INCLUDE_DIRECTORIES of
its link interface dependencies.

That means that code such as this will result in the 'user' target
using /bar/include and /foo/include:

 add_library(foo ...)
 target_include_directories(foo INTERFACE /foo/include)
 add_library(bar ...)
 target_include_directories(bar INTERFACE /bar/include)
 target_link_libraries(bar LINK_PUBLIC foo)

 add_executable(user ...)
 target_include_directories(user PRIVATE
    $<TARGET_PROPERTY:bar,INTERFACE_INCLUDE_DIRECTORIES>)

Also process the interface include directories from direct link
dependencies for in-build targets.

The situation is similar for the INTERFACE_COMPILE_DEFINITIONS. The
include directories related code is currently more complex because
we also need to store a backtrace at configure-time for the purpose
of debugging includes. The compile definitions related code will use
the same pattern in the future.

This is not a change in behavior, as existing code has the same effect,
but that existing code will be removed in follow-up commits.
2013-02-13 15:12:30 +01:00
Stephen Kelly 7c0ec75cfa De-duplicate validation of genex target names. 2013-02-07 16:21:08 +01:00
Stephen Kelly 92e98dd909 Deduplicate the isGeneratorExpression method.
This API seems like the most appropriate.
2013-02-07 16:21:08 +01:00
Stephen Kelly 77cecb778f Add includes and compile definitions with target_link_libraries.
This establishes that linking is used to propagate usage-requirements
between targets in CMake code. The use of the target_link_libraries
command as the API for this is chosen because introducing a new command
would introduce confusion due to multiple commands which differ only in
a subtle way.
2013-01-31 17:34:20 +01:00
Stephen Kelly 48a4cf2182 Revert "Allow target_link_libraries with IMPORTED targets."
This reverts commit 9cfe4f1b76.

It turns out that correctly adding the content to
the IMPORTED_LINK_INTERFACE_LIBARIES_<CONFIG> of an upstream target
from the buildsystem of a downstream project is not simple.

If upstream had added the INTERFACE content, the config-specific
properties would  be determined by the DEBUG_CONFIGURATIONS of
upstream.

As downstream, we don't have any information about what
the DEBUG_CONFIGURATIONS of upstream were, so we can't determine
which configuration-specific properties to populate. The best we can do
is add it to all of them or add it to the ones downstream considers to
be DEBUG_CONFIGURATIONS, neither of which is a good solution.

So, removing the porcelain API for that is the best approach. A human
can still determine which properties to populate and use
the set_property API to populate the desired properies.

Another solution to this would be for upstream targets to publish
what they consider DEBUG_CONFIGURATIONS, but that can be added in
a future release.
2013-01-21 12:19:39 +01:00
Stephen Kelly 9cfe4f1b76 Allow target_link_libraries with IMPORTED targets.
This makes it possible to use:

 target_link_libraries(foo LINK_INTERFACE_LIBRARIES bar)

where foo is an IMPORTED target. Other tll() signatures are not
allowed.
2013-01-08 18:58:18 +01:00
Stephen Kelly 50b1ea5bed Fix minor typos.
nothe -> note
than -> that
duplicat -> duplicate
directory -> directly
Wipe wipe -> Wipe
2012-09-29 18:44:10 +02:00
Brad King b87d7a60a0 Add OBJECT_LIBRARY target type
This library type can compile sources to object files but does not link
or archive them.  It will be useful to reference from executable and
normal library targets for direct inclusion of object files in them.

Diagnose and reject the following as errors:

* An OBJECT library may not be referenced in target_link_libraries.

* An OBJECT library may contain only compiling sources and supporting
  headers and custom commands.  Other source types that are not normally
  ignored are not allowed.

* An OBJECT library may not have PRE_BUILD, PRE_LINK, or POST_BUILD
  commands.

* An OBJECT library may not be installed, exported, or imported.

Some of these cases may be supported in the future but are not for now.

Teach the VS generator that OBJECT_LIBRARY targets are "linkable" just
like STATIC_LIBRARY targets for the LinkLibraryDependencies behavior.
2012-03-13 14:37:32 -04:00
Brad King b1f12f8042 target_link_libraries: Simplify argument processing state tests
Remove extra parens in test for not handling LINK_INTERFACE_LIBRARIES.
Remove redundant test for equality with ProcessingPrivateInterface
subsumed by test for inequality with ProcessingPublicInterface.
2011-11-22 17:21:36 -05:00
Stephen Kelly 914382224d target_link_libraries: Add LINK_(PUBLIC|PRIVATE) options
Makes it possible to specify the link dependencies and link
interfaces in one command without repetition.
2011-11-22 16:52:35 -05:00
Alex Neundorf 6acc71c09d New CMP0016 for deciding whether an unknown target in TLL() is an error.
When set to OLD, target_link_libraries() silently accepts if it is called
with only one argument and this one argument is not a target.
When set to NEW, this is an error. By default it is a warning now.

Alex
2010-08-28 16:06:45 +02:00
Alex Neundorf 6aef6d84d7 Just warn in case of a bad target as only argument for t_l_l()
As discussed on cmake-devel, if target_link_libraries() is called with
only one argument, and this one argument is not a valid target, just
print a warning but don't fail, since otherwise probably some existing
code somewhere might stop building.

Alex
2010-08-26 21:54:43 +02:00
Alex Neundorf c786635149 Make target_link_libraries() complain if bad target name is used
target_link_libraries() did not complain if there was only one argument,
and this one (first) argument wasn't a valid target name, e.g.

add_executable(hello main.cpp)
target_link_libraries(-static-intel)

Here the target "hello" was forgotten in the tll() call, but cmake didn't
complain. With this commit it does.

Alex
2010-08-26 21:02:40 +02:00
Alex Neundorf 43f96eaf93 Remove trailing whitespace
Alex
2010-08-26 21:01:58 +02:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
This converts the CMake license to a pure 3-clause OSI-approved BSD
License.  We drop the previous license clause requiring modified
versions to be plainly marked.  We also update the CMake copyright to
cover the full development time range.
2009-09-28 11:43:28 -04:00
Brad King 3c5cf1bb8c ENH: Allow a custom list of debug configurations
Create a DEBUG_CONFIGURATIONS global property as a way for projects to
specify which configuration names are considered to be 'debug'
configurations.
2008-09-04 17:34:25 -04:00
Brad King 94c1fe83fd ENH: Make link interface mode more distinct
Rename the recently added INTERFACE mode of the target_link_libraries()
command to LINK_INTERFACE_LIBRARIES.  This makes it much more distinct
from a normal call to the command, and clearly states its connection to
the property of the same name.  Also require the option to appear
immediately after the target name to make it a mode rather than an
option.
2008-08-18 10:11:29 -04:00
Brad King e322d288af ENH: Simple specification of link interfaces
Create an INTERFACE option to the target_link_libraries command to help
set the LINK_INTERFACE_LIBRARIES and LINK_INTERFACE_LIBRARIES_DEBUG
properties.  This will help users specify link interfaces using
variables from Find*.cmake modules that include the 'debug' and
'optimized' keywords.
2008-08-11 16:23:02 -04:00
Brad King 40fc9174e2 ENH: Tolerate repeated link library types
The "debug", "optimized", and "general" link library type specifier
arguments to the target_link_library commands are sometimes repeated in
user code due to variable expansion and other complications.  Instead of
silently accepting the duplicates and trying to link to a bogus library
like "optimized.lib", warn and ignore the earlier specifiers.
2008-08-07 17:51:29 -04:00
Ken Martin 0e69d38004 ENH: add return and break support to cmake, also change basic command invocation signature to be able to return extra informaiton via the cmExecutionStatus class 2008-01-23 10:28:26 -05:00
Ken Martin daa6d2bc04 ENH: updated handling of debug and optimized target link libraries 2006-11-29 11:00:17 -05:00
Ken Martin cac30b5ff8 STYLE: fix line length 2006-05-12 14:12:13 -04:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Bill Hoffman 89e5fc63fe STYLE: fix line lengths 2006-03-10 13:54:57 -05:00
Brad King 22c62c9e65 BUG: Sweeping changes to cleanup computation of target names. This should
fix many bugs related to target names being computed inconsistently.

- Centralized computation of a target's file name to a method in
  cmTarget.  Now that global knowledge is always available the
  *_CMAKE_PATH cache variables are no longer needed.

- Centralized computation of link library command lines and link
  directory search order.

- Moved computation of link directories needed to link CMake targets
  to be after evaluation of linking dependencies.

This also removed alot of duplicate code in which each version had its
own bugs.

This commit is surrounded by the tags

  CMake-TargetNameCentralization1-pre

and

  CMake-TargetNameCentralization1-post

so make the large set of changes easy to identify.
2006-01-13 18:18:32 -05:00
Brad King e3edb83c51 BUG: Fixed crash when optimized/debug argument is not followed by a value. 2004-07-29 11:45:14 -04:00
Andy Cedilnik c3840b5cc3 BUG: Fix Bug #445 - Same library in multiple projects can cause problems 2003-12-18 13:04:28 -05:00
Andy Cedilnik 1e62f2392c ENH: Add CMAKE_IGNORE_DEPENDENCIES_ORDERING to prevent warnings about dependency problems 2003-10-02 14:50:46 -04:00
Andy Cedilnik 6c65c77d35 ENH: Report an error when ADD_LIBRARY and TARGET_LINK_LIBRARIES are in the wrong order and fix CMakeLists files to actually work 2003-08-07 16:09:19 -04:00
Bill Hoffman f58d7df66a ENH: add checking for NOTFOUND 2003-01-31 13:50:42 -05:00
Andy Cedilnik 6b228ff924 Add some error checking for missing include directories and link libraries 2003-01-30 14:34:40 -05:00
Brad King 4888c088ae ENH: Moved ExpandListVariables out of individual commands. Argument evaluation rules are now very consistent. Double quotes can always be used to create exactly one argument, regardless of contents inside. 2002-12-11 18:13:33 -05:00
Brad King 1f6a3c67b1 ENH: Added reference to Copyright.txt. Removed old reference to ITK copyright. Changed program name to CMake instead of Insight in source file header. Also removed tabs. 2002-10-23 18:03:27 -04:00
Ken Martin 6bbc8e9d45 does not need a second argument 2002-07-19 14:40:49 -04:00
Ken Martin 44a7cd55ff removed all source lists from the system and made them vectors. Also appended _CMAKE_PATH to the end of the automatic cache entries for executables and libraries. Odds of all these changes working are slim but cmake builds and passes all its tests. VTK40 starts building 2002-06-27 15:57:09 -04:00
Bill Hoffman 27fe57b716 ENH: change LINK_LIBRARY to add to targets 2002-05-02 13:17:10 -04:00
Amitha Perera 5e1d9ed39e ENH: Make it unnecessary to ever specify LINK_DIRECTORIES for any library
generated in this project, even when LIBRARY_OUTPUT_PATH is set.
2002-04-28 16:14:21 -04:00
Bill Hoffman 4591e41a62 BUG: add link directories for target link libraries and add a test for it 2002-04-19 15:28:43 -04:00
Bill Hoffman 8aa3c35dad ENH: add suport for semi-colon separated list variables 2002-03-06 10:10:46 -05:00
Will Schroeder a6a43d5320 ENH:Updated copyright 2002-01-21 15:30:43 -05:00
Bill Hoffman baa28efd10 ENH: change InitialPass to take a const reference to the argument string, to avoid changes to the file cache 2001-09-20 15:08:30 -04:00
Bill Hoffman 9922155423 ENH: rename Invoke to InitialPass 2001-06-06 13:19:15 -04:00
Ken Martin 237f960c89 BUG: added arg0 to link libraries 2001-05-08 11:40:47 -04:00
Ken Martin 2da0c57d46 added TARGET_LINK_LIBRARY command and support for debug and release libraries to link against 2001-04-30 10:44:00 -04:00