Commit Graph

271 Commits

Author SHA1 Message Date
Brad King 4224513cce Save source dependencies from custom command trace
In each target we trace dependencies among custom commands to pull in
all source files and build rules necessary to complete the target.  This
commit teaches cmTarget to save the inter-source dependencies found
during its analysis.  Later this can be used by generators that need to
topologically order custom command rules.
2009-09-07 10:11:43 -04:00
Brad King 368a18b83c Cleanup source file dependency tracing logic
In cmTarget we trace the dependencies of source files in the target to
bring in all custom commands needed to generate them.  We clean up the
implementation to use simpler logic and better method names.  The new
approach is based on the observation that a source file is actually an
input (dependency) of the rule that it runs (compiler or custom) even in
the case that it is generated (another .rule file has the rule to
generate it).
2009-09-04 12:39:18 -04:00
Brad King 4eb5f1bef6 Cleanup cmTarget source file list representation
This teaches cmTarget to use a set of cmSourceFile pointers to guarantee
unique insertion of source files in a target.  The order of insertion is
still preserved in the SourceFiles vector.
2009-09-04 12:39:05 -04:00
Brad King 69251f7549 Define 'multiplicity' for cyclic dependencies
We create target property "LINK_INTERFACE_MULTIPLICITY" and a per-config
version "LINK_INTERFACE_MULTIPLICITY_<CONFIG>".  It sets the number of
times a linker should scan through a mutually dependent group of static
libraries.  The largest value of this property on any target in the
group is used.  This will help projects link even for extreme cases of
cyclic inter-target dependencies.
2009-09-01 10:37:37 -04:00
Brad King 463b3f03bd Create cmTarget DLL query methods
We creates methods IsDLLPlatform() and HasImportLibrary().  The former
returns true on Windows.  The latter returns whether the target has a
DLL import library.  It is true on Windows for shared libraries and
executables with exports.
2009-08-11 09:07:42 -04:00
Brad King fcab87c9f8 Do not always propagate linker language preference
The commit "Consider link dependencies for link language" taught CMake
to propagate linker language preference from languages compiled into
libraries linked by a target.  It turns out this should only be done for
some languages, such as C++, because normally the language of the
program entry point (main) should be used.

We introduce variable CMAKE_<LANG>_LINKER_PREFERENCE_PROPAGATES to tell
CMake whether a language should propagate its linker preference across
targets.  Currently it is true only for C++.
2009-07-30 10:59:37 -04:00
Brad King fd633b33cf Refactor target linker language selection
This factors the decision logic out of cmTarget::ComputeLinkClosure into
dedicated class cmTargetSelectLinker.  We replace several local
variables with a single object instance, and organize code into methods.
2009-07-30 10:59:25 -04:00
Brad King f888a0efaf ENH: Export and import link interface languages
Now that languages are part of the link interface of a target we need to
export/import the information.  A new IMPORTED_LINK_INTERFACE_LANGUAGES
property and per-config IMPORTED_LINK_INTERFACE_LANGUAGES_<CONFIG>
property specify the information for imported targets.  The export() and
install(EXPORT) commands automatically set the properties.
2009-07-11 10:12:05 -04:00
Brad King bb2228ea1a ENH: Update LINKER_LANGUAGE and HAS_CXX docs
This updates the documentation of these properties to account for the
new automatic linker language computation.
2009-07-10 13:53:48 -04:00
Brad King 19792bf30e ENH: Consider link dependencies for link language
This teaches cmTarget to account for the languages compiled into link
dependencies when determining the linker language for its target.

We list the languages compiled into a static archive in its link
interface.  Any target linking to it knows that the runtime libraries
for the static archive's languages must be available at link time.  For
now this affects only the linker language selection, but later it will
allow CMake to automatically list the language runtime libraries.
2009-07-10 13:53:28 -04:00
Bill Hoffman 5c4208f50e ENH: only 5 failing tests for VS 10 2009-07-10 09:12:39 -04:00
Brad King 99e432508e BUG: Use link language for target name computation
The commit "Do not compute link language for LOCATION" was wrong.  The
variables

  CMAKE_STATIC_LIBRARY_PREFIX_Java
  CMAKE_STATIC_LIBRARY_SUFFIX_Java

are used for building Java .jar files.  This commit re-enables the
feature and documents the variables:

  CMAKE_EXECUTABLE_SUFFIX_<LANG>
  CMAKE_IMPORT_LIBRARY_PREFIX_<LANG>
  CMAKE_IMPORT_LIBRARY_SUFFIX_<LANG>
  CMAKE_SHARED_LIBRARY_PREFIX_<LANG>
  CMAKE_SHARED_LIBRARY_SUFFIX_<LANG>
  CMAKE_SHARED_MODULE_PREFIX_<LANG>
  CMAKE_SHARED_MODULE_SUFFIX_<LANG>
  CMAKE_STATIC_LIBRARY_PREFIX_<LANG>
  CMAKE_STATIC_LIBRARY_SUFFIX_<LANG>

Instead of making separate, repetitive entries for the _<LANG> variable
documentation, we just mention the per-language name in the text of the
platform-wide variable documentation.  Internally we keep undocumented
definitions of these properties to satisfy CMAKE_STRICT mode.
2009-07-08 14:33:08 -04:00
Brad King 173448d988 ENH: Pass config to cmTarget::GetLinkerLanguage
This passes the build configuration to most GetLinkerLanguage calls.  In
the future the linker language will account for targets linked in each
configuration.
2009-07-08 13:04:04 -04:00
Brad King a3a046643a ENH: Pass config to cmTarget RPATH install methods
This passes the build configuration to cmTarget methods IsChrpathUsed
and NeedRelinkBeforeInstall.  Later these methods will use the value.
2009-07-08 13:03:47 -04:00
Brad King 2b5d97419f ENH: Do not compute link language for LOCATION
The LOCATION property requires the full file name of a target to be
computed.  Previously we computed the linker language for a target to
look up variables such as CMAKE_SHARED_LIBRARY_SUFFIX_<LANG>.  This led
to locating all the source files immediately instead of delaying the
search to generation time.  In the future even more computation will be
needed to get the linker language, so it is better to avoid it.

The _<LANG> versions of these variables are undocumented, not set in any
platform file we provide, and do not produce hits in google.  This
change just removes the unused feature outright.
2009-07-08 13:03:22 -04:00
Brad King 7c67524dfa ENH: Introduce cmTarget::LinkImplementation API
The new method centralizes loops that process raw OriginalLinkLibraries
to extract the link implementation (libraries linked into the target)
for each configuration.  Results are computed on demand and then cached.
This simplifies link interface computation because the default case
trivially copies the link implementation.
2009-07-08 12:04:48 -04:00
Brad King aef8fe509b COMP: Pimplize cmTarget ImportInfo and OutputInfo
These member structures are accessed only in the cmTarget implementation
so they do not need to be defined in the header.  This cleanup also aids
Visual Studio 6 in compiling them.
2009-07-08 08:31:30 -04:00
Brad King 2247aca9cf BUG: Do not recompute link interfaces
The config-to-interface map in cmTarget should use case-insensitive
configuration names.  The change avoids repeating work if the given
configuration has a different case than one already computed.
2009-07-07 11:30:36 -04:00
Brad King afbd595e85 BUG: Fix CMP0003 wrong-config link dir support
This fixes a dumb logic error introduced by the centralization of link
interface computation.  It prevented link directories from alternate
configurations from getting listed by the OLD behavior of CMP0003 for
targets linked as transitive dependencies.
2009-07-07 10:57:02 -04:00
Brad King 34f78ee552 ENH: Simplify cmTarget link interface storage
This makes the LinkInterface struct a member of cmTarget, pimplizes the
config-to-interface map, and stores interface instances by value.
2009-07-07 09:45:29 -04:00
Brad King a608467180 ENH: Simpler cmTarget::GetLinkerLanguage signature
This method previously required the global generator to be passed, but
that was left from before cmTarget had its Makefile member.  Now the
global generator can be retrieved automatically, so we can drop the
method argument.
2009-07-07 07:44:12 -04:00
Brad King 06b0a692f4 ENH: Centralize default link interface computation
When LINK_INTERFACE_LIBRARIES is not set we use the link implementation
to implicitly define the link interface.  These changes centralize the
decision so that all linkable targets internally have a link interface.
2009-07-06 16:25:20 -04:00
Brad King 26df00f83a ENH: Move CMP0004 check into cmTarget
This moves code implementing policy CMP0004 into cmTarget::CheckCMP0004.
The implementation is slightly simpler and can be re-used outside of
cmComputeLinkDepends.
2009-07-06 16:24:45 -04:00
Brad King 82a8c6b0c7 ENH: Exception safe link interface computation
This fixes cmTarget::GetLinkInterface to compute and return the link
interface in an exception-safe manner.  We manage the link interface
returned by cmTarget::ComputeLinkInterface using auto_ptr.
2009-07-06 16:24:32 -04:00
Brad King 275c21d351 ENH: Refactor target output dir computation
This creates cmTarget::GetOutputInfo to compute, cache, and lookup
target output directory information on a per-configuration basis.  It
avoids re-computing the information every time it is needed.
2009-07-03 10:33:59 -04:00
Brad King f74b876a58 ENH: Clarify COMPILE_DEFINITIONS separator in docs
The COMPILE_DEFINITIONS properties are semicolon-separated lists.
Make this clear in the documentation.  See issue #9199.
2009-06-24 09:36:29 -04:00
Brad King 516add4d58 ENH: On VMS use _dir and _tmp, not .dir and .tmp
The VMS posix path emulation does not handle multiple '.' characters in
file names in all cases.  This avoids adding extra '.'s to file and
directory names for target directories and generated files.
2009-06-10 13:03:11 -04:00
Brad King 392b38cef7 ENH: Remove cmTarget internal type arguments
Internally cmTarget was passing the target type in several name
computation signatures to support computation of both shared and static
library names for one target.  We no longer need to compute both names,
so this change simplifies the internals by using the GetType method and
dropping the type from method signatures.
2009-05-01 10:39:44 -04:00
Brad King bcb9a479db ENH: Remove cmTarget::GetExecutableCleanNames
This method was redundant with GetExecutableNames.
2009-05-01 10:39:28 -04:00
Brad King 430cc2b4b7 ENH: Always imply CLEAN_DIRECT_OUTPUT target prop
This property was left from before CMake always linked using full path
library names for targets it builds.  In order to safely link with
"-lfoo" we needed to avoid having both shared and static libraries in
the build tree for targets that switch on BUILD_SHARED_LIBS.  This meant
cleaning both shared and static names before creating the library, which
led to the creation of CLEAN_DIRECT_OUTPUT to disable the behavior.

Now that we always link with a full path we do not need to clean old
library names left from an alternate setting of BUILD_SHARED_LIBS.  This
change removes the CLEAN_DIRECT_OUTPUT property and instead uses its
behavior always.  It removes some complexity from cmTarget internally.
2009-05-01 10:38:35 -04:00
Brad King 2740db5ede ENH: Allow more specification of target file names
This creates target properties ARCHIVE_OUTPUT_NAME, LIBRARY_OUTPUT_NAME,
and RUNTIME_OUTPUT_NAME, and per-configuration equivalent properties
ARCHIVE_OUTPUT_NAME_<CONFIG>, LIBRARY_OUTPUT_NAME_<CONFIG>, and
RUNTIME_OUTPUT_NAME_<CONFIG>.  They allow specification of target output
file names on a per-type, per-configuration basis.  For example, a .dll
and its .lib import library may have different base names.

For consistency and to avoid ambiguity, the old <CONFIG>_OUTPUT_NAME
property is now also available as OUTPUT_NAME_<CONFIG>.

See issue #8920.
2009-05-01 09:45:43 -04:00
Brad King 617eb981d4 ENH: Refactor target output file type computation
This creates method cmTarget::GetOutputTargetType to compute the output
file type 'ARCHIVE', 'LIBRARY', or 'RUNTIME' from the platform and
target type.  It factors out logic from the target output directory
computation code for later re-use.
2009-05-01 09:45:19 -04:00
Brad King d05e98f8d7 ENH: Allow IMPORTED_IMPLIB w/o IMPORTED_LOCATION
Linking to a Windows shared library (.dll) requires only its import
library (.lib).  This teaches CMake to recognize SHARED IMPORTED library
targets that set only IMPORTED_IMPLIB and not IMPORTED_LOCATION.
2009-04-08 16:29:04 -04:00
Brad King 5886d10334 BUG: Fix imported target config guess
When an IMPORTED target provides no generic configuration and no match
for a desired configuration then we choose any available configuration.
This change corrects the choice when the first listed available
configuration does not really have a location.
2009-04-08 16:28:55 -04:00
Brad King 4085454658 ENH: Support preprocessor def values in VS6
The add_definitions() command and COMPILE_DEFINITIONS dir/tgt/src
properties support preprocessor definitions with values.  Previously
values were not supported in the VS6 generator even though the native
tool supports them.  It is only values with spaces that VS6 does not
support.  This enables support and instead complains only for values
with spaces.  See issue #8779.
2009-03-23 14:48:09 -04:00
Brad King 6d02ee34c9 ENH: Mention CMAKE_* variables in RPATH properties
The RPATH target properties are initialized by CMAKE_<prop> variables at
target creation time.  This notes the feature in the property
documentation.  It is already noted in the variable documentation.
2009-03-19 10:53:51 -04:00
Brad King b604b98c56 ENH: Define RULE_LAUNCH_* properties
This defines global, directory, and target properties
RULE_LAUNCH_COMPILE, RULE_LAUNCH_LINK, and RULE_LAUNCH_CUSTOM.  Their
values specify 'launcher' command lines which are prefixed to compile,
link, and custom build rules by Makefile generators.
2009-02-10 08:51:15 -05:00
Brad King 13f9bb646d ENH: Define target and source property LABELS
This creates a new LABELS property for targets and source files.  We
write the labels of each target and its source files in target-specific
locations in the build tree for future use.
2009-02-10 08:50:21 -05:00
Brad King d0ed46e3d6 ENH: Define target-specific support directories
This creates method cmTarget::GetSupportDirectory to compute a
target-specific support directory in the build tree.  It uses the
"CMakeFiles/<name>.dir" convention already used by the Makefile
generators.  The method will be useful for any code that needs to
generate per-target information into the build tree for use by CMake
tools that do not run at generate time.
2009-02-10 08:50:09 -05:00
Brad King acb0e8fb85 BUG: Fix LOCATION property for Mac AppBundles
Previously cmTarget::GetLocation and cmTarget::GetFullPath would return
for Mac AppBundles the top-level bundle directory but without the .app
extension.  We worked around this at the call sites.  This fixes the
methods and removes the work-arounds.  See issue #8406.
2009-01-20 15:49:37 -05:00
Brad King d7ddcc214f ENH: Enable LOCATION property for imported targets
Previously we left the LOCATION property undefined for imported targets
since it should no longer be used for non-imported targets.  However, in
the case we do not know the name of an available imported configuration,
it is more readable to get the LOCATION property than LOCATION_<CONFIG>
for a bogus configuration <CONFIG>.  This enables LOCATION for imported
targets and returns an unspecified available imported configuration.
2009-01-05 09:53:14 -05:00
Brad King e4325e7d9c BUG: Fix <CONFIG>_POSTFIX property/variable docs
The CMAKE_<CONFIG>_POSTFIX variable and <CONFIG>_POSTFIX property were
not documented.  This updates the CMAKE_DEBUG_POSTFIX and DEBUG_POSTFIX
documentation to refer to the more general variable/property.  It also
clarifies that the variable is used as the property default only for
non-executable targets.  See issue #7868.
2008-12-15 13:30:09 -05:00
Bill Hoffman 086cf607c3 ENH: add missing property definitions 2008-10-07 16:46:25 -04:00
Alexander Neundorf fc7a017d1a STYLE: add documentation for the "TYPE" target property
Alex
2008-10-02 18:48:06 -04:00
Brad King 4f6137c70c ENH: Allow link line computation for static libs
In some cases it may be useful to compute a "link" line for a static
library even though it will not be put in the generated build system.
This removes the assertion which previously diallowed the case.
2008-09-15 13:30:11 -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 f89dae7a94 ENH: Create Info.plist files in OS X Frameworks
A Mac OS X Framework should provide a Resources/Info.plist file
containing meta-data about the framework.  This change generates a
default Info.plist for frameworks and provides an interface for users to
customize it.
2008-09-02 12:06:32 -04:00
Brad King fe98e57e38 ENH: Disallow link-type keywords in link interface
The LINK_INTERFACE_LIBRARIES target property may not contain the
"debug", "optimized", or "general" keywords.  These keywords are
supported only by the target_link_libraries (and link_libraries) command
and are not a generic library list feature in CMake.  When a user
attempts to add one of these keywords to the property value, we now
produce an error message that refers users to alternative means.
2008-08-19 11:43:51 -04:00
Brad King 41c5dd13dc ENH: Clarify link interface documentation
The LINK_INTERFACE_LIBRARIES property does not apply for STATIC
libraries.  The IMPORTED_LINK_INTERFACE_LIBRARIES property does apply
for STATIC libraries.  State both explicitly in the documentation.
Also, clarify that the per-configuration version of these properties
completely overrids the generic version.
2008-08-19 10:29:35 -04:00
Brad King 061d20be38 ENH: Add UNKNOWN type for IMPORTED libraries
When creating an IMPORTED target for a library that has been found on
disk, it may not be known whether the library is STATIC or SHARED.
However, the library may still be linked using the file found from disk.
Use of an IMPORTED target is still important to allow per-configuration
files to be specified for the library.

This change creates an UNKNOWN type for IMPORTED library targets.  The
IMPORTED_LOCATION property (and its per-config equivalents) specifies
the location of the library.  CMake makes no assumptions about the
library that cannot be inferred from the file on disk.  This will help
projects and find-modules import targets found on disk or specified by
the user.
2008-08-18 11:39:22 -04:00