Commit Graph

655 Commits

Author SHA1 Message Date
Brad King 0d9e8b1ab9 Merge topic 'double-colon-is-imported'
f063c45 Consider targets with double colons to be IMPORTED or ALIAS targets.
2013-10-22 09:07:40 -04:00
Stephen Kelly f063c45589 Consider targets with double colons to be IMPORTED or ALIAS targets.
Introduce a policy to control the behavior.

The AliasTargets unit test already tests that using a
double-semicolon in the name is not an error. Change the ExportImport
test to use a namespace with a double-semicolon too.
2013-10-21 15:56:31 +02:00
Brad King bf02e75079 Merge topic 'INTERFACE_LIBRARY-build-targets'
b04f3b9 Create make rules for INTERFACE_LIBRARY targets.
dba4962 Makefile: Always create clean target command
2013-10-21 09:48:04 -04:00
Stephen Kelly b04f3b9a2a Create make rules for INTERFACE_LIBRARY targets.
The result is that the depends of the target are created.

So,

 add_library(somelib foo.cpp)
 add_library(anotherlib EXCLUDE_FROM_ALL foo.cpp)
 add_library(extra EXCLUDE_FROM_ALL foo.cpp)
 target_link_libraries(anotherlib extra)

 add_library(iface INTERFACE)
 target_link_libraries(iface INTERFACE anotherlib)

Executing 'make iface' will result in the anotherlib and extra targets
being made.

Adding a regular executable to the INTERFACE of an INTERFACE_LIBRARY
will not result in the executable being built with 'make iface' because
of the logic in cmComputeTargetDepends::AddTargetDepend.

So far, this is implemented only for the Makefile generator. Other
generators will follow if this feature is possible for them.

Make INTERFACE_LIBRARY targets part of the all target by default.
Test this by building the all target and making the expected library
EXCLUDE_FROM_ALL.
2013-10-21 09:46:27 -04:00
Stephen Kelly af2a3ab691 cmTarget: Remove unused variable. 2013-10-18 18:58:02 +02:00
Stephen Kelly 70ae6dfd92 Handle genexes when evaluating INTERFACE_INCLUDE_DIRECTORIES errors. 2013-10-18 10:11:49 -04:00
Brad King 399e9c46d8 Drop builtin property documentation
Drop all DefineProperty calls for non-chained properties.  Drop the
documentation from the chained ones.  The documentation for all
properties is now in Help/prop_*/*.rst files.
2013-10-16 09:22:36 -04:00
Brad King b336a1ebe4 Teach COMPATIBLE_INTERFACE_* checks to use Help .rst documents
These checks want to know if named target properties are builtin, which
is now known by checking the Help/prop_tgt directory.  (Previously the
check could be confused by a define_property call in the project.)
2013-10-16 09:22:35 -04:00
Brad King b31ca93ba2 Merge topic 'target-LOCATION-policy'
e4e5b28 cmTarget: Deprecate the LOCATION target property with a policy.
2013-10-15 09:33:05 -04:00
Stephen Kelly e4e5b28c27 cmTarget: Deprecate the LOCATION target property with a policy.
The final location and name of a build-target is not determined
until generate-time. However, reading the LOCATION property from
a target is currently allowed at configure time. Apart from creating
possibly-erroneous results, this has an impact on the implementation
of cmake itself, and prevents some major cleanups from being made.

Disallow reading LOCATION from build-targets with a policy. Port some
existing uses of it in CMake itself to use the TARGET_FILE generator
expression.
2013-10-11 21:17:27 +02:00
Stephen Kelly 3507d5afdd Deprecate COMPILE_FLAGS target property.
It is succeeded by COMPILE_OPTIONS, which supports generator
expressions, is a list rather than a string, and is properly
escaped.
2013-10-11 13:40:29 +02:00
Brad King f8241136b4 Merge topic 'INTERFACE_LIBRARY-target-type'
ce0c303 install: Teach EXPORT option to handle INTERFACE_LIBRARY targets
435c912 export: Add support for INTERFACE_LIBRARY targets
fe73226 Add the INTERFACE_LIBRARY target type.
2013-10-08 10:58:40 -04:00
Stephen Kelly 435c912848 export: Add support for INTERFACE_LIBRARY targets 2013-10-07 20:07:27 -04:00
Stephen Kelly fe732264e9 Add the INTERFACE_LIBRARY target type.
This target type only contains INTERFACE_* properties, so it can be
used as a structural node. The target-specific commands enforce
that they may only be used with the INTERFACE keyword when used
with INTERFACE_LIBRARY targets. The old-style target properties
matching LINK_INTERFACE_LIBRARIES_<CONFIG> are always ignored for
this target type.

The name of the INTERFACE_LIBRARY must match a validity generator
expression. The validity is similar to that of an ALIAS target,
but with the additional restriction that it may not contain
double colons. Double colons will carry the meaning of IMPORTED
or ALIAS targets in CMake 2.8.13.

An ALIAS target may be created for an INTERFACE library.

At this point it can not be exported and does not appear in the
buildsystem and project files are not created for them. That may
be added as a feature in a later commit.

The generators need some changes to handle the INTERFACE_LIBRARY
targets returned by cmComputeLinkInterface::GetItems. The Ninja
generator does not use that API, so it doesn't require changes
related to that.
2013-10-07 19:56:31 -04:00
Brad King 4e1368c1a0 Merge topic 'IMPORTED-target-SYSTEM-includes'
a63fcbc Always consider includes from IMPORTED targets to be SYSTEM.
2013-10-07 15:45:05 -04:00
Brad King e00089388c Merge topic 'cleanup-properties'
b78bc33 Cleanup some variable documentation names
bbfff52 Remove redundant cmake::GetIsPropertyDefined method
2013-10-07 15:43:55 -04:00
Brad King 2e7ba290a5 Merge topic 'minor_cleanup'
6931999 VS6: Add some delimiting between error message and content.
d1a5f12 cmTarget: Fix typo in comment.
961c0ba Fix comments to match the code.
7cca50c Remove unused include.
2013-10-07 15:43:23 -04:00
Brad King 31e6ee502e Merge topic 'authorative-LINK_LIBRARIES'
f01dc72 Use one authorative source of the LINK_LIBRARIES property.
2013-10-07 15:42:55 -04:00
Brad King 1e54b380cb Merge topic 'MAP_IMPORTED_CONFIG-property-default'
fb1294c cmTarget: Add initializer for MAP_IMPORTED_CONFIG_<CONFIG>
2013-10-07 15:41:49 -04:00
Stephen Kelly a63fcbcb9f Always consider includes from IMPORTED targets to be SYSTEM.
Introduce a target property to control this behavior variable
to set the default value for the target property.

This does not affect try_compile runs.
2013-09-24 20:00:31 +02:00
Brad King bbfff5233d Remove redundant cmake::GetIsPropertyDefined method
We already have cmake::IsPropertyDefined for the same reason.
2013-09-17 09:10:31 -04:00
Stephen Kelly 271bf10263 Fix CMP0022 warning when no old-style property is set
The string could be null at this point.
2013-09-13 11:34:08 -04:00
Stephen Kelly d1a5f1241d cmTarget: Fix typo in comment.
compatiblity -> compatibility
2013-09-12 16:43:05 +02:00
Stephen Kelly 81d2793e92 Add differing target property content to policy CMP0022 warning
List the contents of the INTERFACE_LINK_LIBRARIES and the old-style
property.
2013-09-11 22:28:32 +02:00
Stephen Kelly f01dc72c58 Use one authorative source of the LINK_LIBRARIES property.
We populate and maintain a vector of structs to keep track of
backtraces already, so no need to populate the Properties container
additionally.

For completeness, it is necessary to remove the condition for
populating the vector for only valid library names and generator
expressions. That condition is now determined when evaluating the
generator expressions.
2013-09-09 21:08:34 +02:00
Stephen Kelly fb1294c3a9 cmTarget: Add initializer for MAP_IMPORTED_CONFIG_<CONFIG> 2013-08-28 17:41:18 +02:00
Brad King 4923c6c724 Merge topic 'rpath-on-mac'
78cd884 OSX: Allow an empty INSTALL_NAME_DIR to override MACOSX_RPATH.
2013-08-26 10:28:10 -04:00
Stephen Kelly eef6df5c7d Fix OLD behavior of CMP0021.
Exclude Ninja and Xcode from the CMP0021 test

They do not behave the same as the makefile generator with
relative paths.

Don't overwrite the header file for in-source builds.
2013-08-24 15:14:56 +02:00
Clinton Stimpson 78cd884296 OSX: Allow an empty INSTALL_NAME_DIR to override MACOSX_RPATH.
With this, projects can enable MACOSX_RPATH by default, but still have
a way to install libraries with no install name dirs into locations
such as /usr/local/lib by setting INSTALL_NAME_DIR="".
2013-08-21 21:09:51 -06:00
Stephen Kelly 370bf55415 Add the ALIAS target concept for libraries and executables.
* The ALIAS name must match a validity regex.
* Executables and libraries may be aliased.
* An ALIAS acts immutable. It can not be used as the lhs
  of target_link_libraries or other commands.
* An ALIAS can be used with add_custom_command, add_custom_target,
  and add_test in the same way regular targets can.
* The target of an ALIAS can be retrieved with the ALIASED_TARGET
  target property.
* An ALIAS does not appear in the generated buildsystem. It
  is kept separate from cmMakefile::Targets for that reason.
* A target may have multiple aliases.
* An ALIAS target may not itself have an alias.
* An IMPORTED target may not have an alias.
* An ALIAS may not be exported or imported.
2013-08-02 15:21:00 +02:00
Stephen Kelly 43558156d4 cmTarget: Add NAME property
In generator expression contexts, this can be used to determine the
name of the head target in the evaluation.
2013-08-01 00:36:11 +02:00
Brad King 3dace78c2c Merge topic 'minor-cleanups'
b8dc7fa Genex: Disallow LINKER_LANGUAGE only when used on a static library.
c8a10ba cmTarget: Fix iface libraries and languages for static libraries.
f94bdb3 cmTarget: Remove duplicates when printing traces of tll signatures
ff3d5fa Export: Fix typo of LINK_INTERFACE_LIBRARIES.
79a7a81 Docs: Document variables for default visibility values.
6f6391b Docs: Generalize and de-duplicate VISIBILITY_PREFIX docs.
d8cb47f Docs: Trim trailing whitespace in generated doc.
f10e648 Docs: Document existing target property debugging options.
4f4d69f Qt4Macros: Simplify some variable population.
a413a40 Qt4Macros: Remove undefined varible use.
b60a29e Qt4Macros: Remove unneeded generate CONDITION.
e454cba Docs: Document file(GENERATE) CONDITION as optional.
2013-07-29 09:54:34 -04:00
Stephen Kelly b8dc7fad23 Genex: Disallow LINKER_LANGUAGE only when used on a static library.
For shared libraries and executables, the linker_language is
indepenedent of the linked libraries.
2013-07-26 16:58:25 +02:00
Stephen Kelly c8a10ba9ad cmTarget: Fix iface libraries and languages for static libraries. 2013-07-26 15:15:42 +02:00
Brad King 87402c995e Merge topic 'tid-system-argument'
9b9a596 cmTarget: Fix property name typo in docs.
2013-07-26 09:01:22 -04:00
Stephen Kelly f94bdb3deb cmTarget: Remove duplicates when printing traces of tll signatures 2013-07-26 14:05:25 +02:00
Stephen Kelly 6f6391b771 Docs: Generalize and de-duplicate VISIBILITY_PREFIX docs. 2013-07-26 09:37:12 +02:00
Stephen Kelly d8cb47f23c Docs: Trim trailing whitespace in generated doc. 2013-07-26 09:37:12 +02:00
Stephen Kelly 9b9a596004 cmTarget: Fix property name typo in docs. 2013-07-25 15:06:02 +02:00
Stephen Kelly b655865bbf target_link_libraries: Add PUBLIC/PRIVATE/INTERFACE keyword signature
Add a new signature to help populate INTERFACE_LINK_LIBRARIES and
LINK_LIBRARIES cleanly in a single call.  Add policy CMP0023 to control
whether the keyword signatures can be mixed with uses of the plain
signatures on the same target.
2013-07-24 11:52:44 -04:00
Brad King 828ddb6813 Merge topic 'framework-interface-includes'
f5ca872 Use linked frameworks as a source of include directories.
2013-07-24 11:50:49 -04:00
Stephen Kelly f5ca872e8b Use linked frameworks as a source of include directories. 2013-07-24 11:49:06 -04:00
Brad King a52f00e07c Merge topic 'minor-cleanups'
8f5b402 Remove TODO to uniq COMPILE_OPTIONS
5fb58b8 Don't add trailing whitespace to error message.
2013-07-24 11:02:24 -04:00
Stephen Kelly 4f6bd7022b Remove the LINK_LANGUAGE generator expression.
It accepted an optional argument to test for equality, but no way
to get the linker language of a particular target.

TARGET_PROPERTY provides this flexibility and STREQUAL provides
the necessary API for equality test.

Extend the CompileDefinitions test to cover accessing the
property of another target.
2013-07-24 10:40:00 -04:00
Stephen Kelly 5fb58b8686 Don't add trailing whitespace to error message. 2013-07-18 11:46:50 +02:00
Brad King ff6de6d325 Merge topic 'drop-old-vs-dependency'
4bb6e24 VS,Xcode: Drop incorrect legacy dependency trace (#14291)
2013-07-16 13:59:35 -04:00
Brad King 41a2fb5ba0 Merge topic 'tid-system-argument'
9cf3547 Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
1925cff Add a SYSTEM parameter to target_include_directories (#14180)
286f227 Extend the cmTargetPropCommandBase interface property handling.
83498d4 Store system include directories in the cmTarget.
f1fcbe3 Add Target API to determine if an include is a system include.
2679a34 Remove unused variable.
2013-07-16 13:59:07 -04:00
Stephen Kelly 9cf3547e1c Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
Unlike other target properties, this does not have a corresponding
non-INTERFACE variant.

This allows propagation of system attribute on include directories
from link dependents.
2013-07-16 13:44:57 -04:00
Brad King 4bb6e24809 VS,Xcode: Drop incorrect legacy dependency trace (#14291)
Drop the "vsProjectFile" argument from cmTarget::TraceDependencies.  It
appears to be the modern equivalent to a hunk added in commit ba68f771
(...added new custom command support, 2003-06-03):

 +  name = libName;
 +  name += ".dsp.cmake";
 +  srcFilesToProcess.push(name);

but was broken by refactoring at some point.  The current behavior tries
to trace dependencies on a source file named the same as a target, which
makes no sense.  Furthermore, in code of the form

 add_executable(foo foo.c)
 add_custom_command(OUTPUT "${somewhere}/foo" ... DEPENDS foo)

the "vsProjectFile" value "foo" matches source "${somewhere}/foo.rule"
generated to hold the custom command and causes the command to be added
to the "foo" target incorrectly.

Simply drop the incorrect source file trace and supporting logic.
2013-07-15 13:17:29 -04:00
Brad King d5d54b4629 Merge topic 'compile-defs-debugging'
d7dd010 Add target property debugging for COMPILE_DEFINITIONS
1841215 Refactor cmTarget::GetCompileDefinitions to use an out-vector, not a string.
afc9243 Add an overload of cmIDEOptions::AddDefines taking a vector of strings.
d95651e Overload cmLocalGenerator::AppendDefines to add a list.
2013-07-15 09:34:00 -04:00
Stephen Kelly d7dd01083a Add target property debugging for COMPILE_DEFINITIONS
Use constructs similar to those for COMPILE_OPTIONS. This is a little
different because there is a command to remove_definitions(), so
we can't populate the equivalent target property until generate-time
in cmGlobalGenerator.
2013-07-12 16:57:36 +02:00
Stephen Kelly 484bb888a0 Genex: Make CMP0021 and CMP0022 usable with TARGET_POLICY
Use preprocessor loops and add a unit test for the appropriate
policies. All policies whose value is recorded at target creation
time should be part of this list.
2013-07-11 11:56:14 +02:00
Stephen Kelly 184121538c Refactor cmTarget::GetCompileDefinitions to use an out-vector, not a string.
Refactor to create AddCompileDefinitions.
2013-07-11 08:23:56 +02:00
Stephen Kelly 3e30d9ed67 TLL: Don't populate old link interface if CMP0022 is NEW.
Always populate the INTERFACE_LINK_LIBRARIES for interface
entries. Don't populate the old interface properties
matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?
if CMP0022 is NEW.

Because the INTERFACE_LINK_LIBRARIES property is now populated by
the target_link_libraries when operating on a static library,
make an equivalent change which populates the property with
the same value when the old link_libraries() command is used. This
silences the policy warning in that case.
2013-07-08 22:39:58 +02:00
Stephen Kelly 574fec97fd Export: Generate INTERFACE_LINK_LIBRARIES property on targets.
This property is generated only for targets which have recorded
policy CMP0022 as NEW, and a compatibility mode is added to
additionally export the old interfaces in that case too.

If the old interfaces are not exported, the generated export files
require CMake 2.8.12. Because the unit tests use a version which
is not yet called 2.8.12, temporarily require a lower version.
2013-07-08 22:39:57 +02:00
Stephen Kelly d0a76ea07c Introduce the INTERFACE_LINK_LIBRARIES property.
This property replaces the properties which
match (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?, and is enabled
for IMPORTED targets, and for non-IMPORTED targets only with a policy.

For static libraries, the INTERFACE_LINK_LIBRARIES property is
also used as the source of transitive usage requirements content.
Static libraries still require users to link to all entries in
their LINK_LIBRARIES, but usage requirements such as INCLUDE_DIRECTORIES
COMPILE_DEFINITIONS and COMPILE_OPTIONS can be restricted to only
certain interface libraries.

Because the INTERFACE_LINK_LIBRARIES property is populated unconditionally,
we need to compare the evaluated result of it with the link implementation
to determine whether to issue the policy warning for static libraries. For
shared libraries, the policy warning is issued if the contents of
the INTERFACE_LINK_LIBRARIES property differs from the contents of the
relevant config-specific old LINK_INTERFACE_LIBRARIES property.
2013-07-08 22:39:09 +02:00
Stephen Kelly 5aa9731c9f GenexEval: Add abstracted access to link interface for a target.
This can be extended with special handling for static libraries
so that we can process the link dependencies separately from the
usage dependencies.
2013-07-08 00:00:17 +02:00
Stephen Kelly 83498d4135 Store system include directories in the cmTarget.
Entries from the cmMakefile are processed and maintained similarly
to other include directories. The include_directories(SYSTEM)
signature affects all following targets, and all prior targets
in the same makefile.
2013-07-02 16:40:02 +02:00
Alex Neundorf ba0e06f250 automoc: add a global AUTOMOC_TARGETS_FOLDER property
This has been requested, along with a patch, by Shaun Williams
 in http://public.kitware.com/Bug/view.php?id=13788 .
It adds a global property AUTOMOC_TARGETS_FOLDER, which can
be used to group the automoc targets together in a folder e.g.
in Visual Studio.

Alex
2013-06-28 21:40:16 +02:00
Christian Maaser cfe6300a41 VS: Add support for .NET target framework version
Teach CMake to generate the TargetFrameworkVersion XML node as
documented at

 http://msdn.microsoft.com/en-us/library/vstudio/ff770576.aspx

from target property VS_DOTNET_TARGET_FRAMEWORK_VERSION.
2013-06-14 08:09:00 -04:00
Brad King 93317839b0 Merge topic 'add_compile_options-command'
a984f32 Introduce add_compile_options command.
2013-06-05 09:39:05 -04:00
Brad King ff8917fdd2 Merge topic 'VISIBILITY_PRESET-property'
cd1fa53 Add a COMPILE_OPTION for a VISIBILITY_INLINES_HIDDEN target property.
0e9f4bc Introduce target property <LANG>_VISIBILITY_PRESET
2013-06-05 09:38:59 -04:00
Brad King 05e47f2122 Merge topic 'cfbundle-location'
483e208 OS X:  Fix getting of CFBundle LOCATION property.
2013-06-04 09:02:46 -04:00
Stephen Kelly a984f3257e Introduce add_compile_options command.
This command is similar to add_definitions, in that it affects
the compile options of all targets which follow it. The implementation
is similar to the implementation of the include_directories command,
in that it is based on populating a COMPILE_OPTIONS directory property
and using that to initialize the same property on targets.

Unlike the include_directories command however, the add_compile_options
command does not affect previously defined targets. That is, in
the following code, foo will not be compiled with -Wall, but bar
will be:

 add_library(foo ...)
 add_compile_options(-Wall)
 add_library(bar ...)
2013-06-04 11:36:55 +02:00
Brad King e57b6a2521 Merge topic 'target-COMPILE_OPTIONS'
24466f2 Add target_compile_options command.
80ca9c4 Add COMPILE_OPTIONS target property.
7cb2308 cmTarget: Rename LinkInterfaceIncludeDirectoriesEntries
47f80d9 cmTarget: Rename struct to be more re-usable.
1319a14 Add <LANG>_COMPILER_ID generator expressions.
3549676 Add cmLocalGenerator::GetCompileOptions.
f3ad863 VS6: Rename some variables to correspond to config values.
2013-06-03 09:57:44 -04:00
Brad King 90441b289d Merge topic 'vs-RootNamespace'
cca955a VS: Add VS_GLOBAL_ROOTNAMESPACE target property
2013-06-03 09:57:32 -04:00
Brad King db5f5243b5 Merge topic 'fix-style'
e162326 Fix indentation.
2013-06-03 09:57:27 -04:00
Brad King 3caf565d07 Merge topic 'rpath-on-mac'
dc1d025 OS X: Add test for rpaths on Mac.
8576b3f OS X: Add support for @rpath in export files.
00d71bd Xcode: Add rpath support in Xcode generator.
94e7fef OS X: Add RPATH support for Mac.
2013-06-03 09:56:44 -04:00
Brad King b0759da303 Merge topic 'framework-refactor'
373faae Refactor how bundles and frameworks are supported.
2013-06-03 09:56:32 -04:00
Clinton Stimpson 8576b3f978 OS X: Add support for @rpath in export files.
Also expand the IMPORTED_SONAME property for targets
to match the install_name.
2013-06-03 09:42:05 -04:00
Clinton Stimpson 94e7fef226 OS X: Add RPATH support for Mac.
RPATH support is activated on targets that have the MACOSX_RPATH
property turned on.
For install time, it is also useful to set INSTALL_RPATH to help
find dependent libraries with an @rpath in their install name.

Also adding detection of rpath conflicts when using frameworks.
2013-06-03 09:42:05 -04:00
Clinton Stimpson 483e208482 OS X: Fix getting of CFBundle LOCATION property.
This fixes bug #13797.
The kinds of changes applied in 373faae5 for frameworks are now
applied to CFBundle.  The prefix and suffix for CFBundles are
now handled in cmTarget::GetFullNameInternal.
2013-06-03 06:29:33 -06:00
Stephen Kelly cd1fa537a0 Add a COMPILE_OPTION for a VISIBILITY_INLINES_HIDDEN target property.
This corresponds to the g++ and clang++
option -fvisibility-inlines-hidden on linux. On Windows with MinGW,
this corresponds to -fno-keep-inline-dllexport. That option is
not supported by clang currently.
2013-06-02 12:00:51 +02:00
Stephen Kelly 0e9f4bc00c Introduce target property <LANG>_VISIBILITY_PRESET
This is initialized by CMAKE_<LANG>_VISIBILITY_PRESET. The target
property is used as the operand to the -fvisibility= compile option
with GNU compilers and clang.
2013-06-02 12:00:51 +02:00
Stephen Kelly 24466f22c0 Add target_compile_options command.
This command populates the COMPILE_OPTIONS target property.
2013-06-02 11:56:37 +02:00
Stephen Kelly 80ca9c4b41 Add COMPILE_OPTIONS target property.
This method reads generator expressions from the COMPILE_OPTIONS
target property, as well as INTERFACE_COMPILE_OPTIONS from linked
dependents.
2013-06-02 11:56:37 +02:00
Stephen Kelly 7cb23084b2 cmTarget: Rename LinkInterfaceIncludeDirectoriesEntries
This can be used for COMPILE_OPTIONS too.
2013-06-02 11:56:37 +02:00
Stephen Kelly 47f80d9c43 cmTarget: Rename struct to be more re-usable.
The same struct can be used to represent COMPILE_OPTIONS content.
2013-06-02 11:56:36 +02:00
John Farrier cca955a27c VS: Add VS_GLOBAL_ROOTNAMESPACE target property
Add a setting for Visual Studio projects for the root namespace in the
"Globals" PropertyGroup section of the project file.
2013-05-31 09:15:30 -04:00
Stephen Kelly e162326128 Fix indentation. 2013-05-29 08:40:00 +02:00
Brad King 14d90d81de Merge topic 'language-generator-expressions'
3241014 Add $<LINK_LANGUAGE> generator expression
2013-05-24 09:19:15 -04:00
Stephen Kelly 32410140a7 Add $<LINK_LANGUAGE> generator expression
They can't be used when evaluating link libraries, but they can be
used for include directories and compile definitions. Later they can
be used for compile options.
2013-05-24 09:06:53 -04:00
Clinton Stimpson 373faae5e1 Refactor how bundles and frameworks are supported.
Make handling of directory separators consistent between
non-bundle and bundle code.

Remove xcode specific flag from cmTarget when getting install_name.

Add (more) consistent convenience functions in cmTarget to get
directories inside of bundles and frameworks to add files to.

This refactor also fixes bug #12263 where frameworks
had the wrong install name when SKIP_BUILD_RPATH.

Also make install_name for frameworks consistent between Makefile
and Xcode generator.
2013-05-23 10:42:49 -04:00
Brad King ee334b6a0a Merge topic 'LinkLine-typedef'
776225d cmTarget: drop the unused local typedef LinkLine
2013-05-22 13:06:21 -04:00
Brad King fe4c1fb32e Merge topic 'add-EXPORT_NAME-property'
b5d6f5d Add EXPORT_NAME property.
2013-05-22 13:05:17 -04:00
Rolf Eike Beer 776225d379 cmTarget: drop the unused local typedef LinkLine 2013-05-22 12:54:57 -04:00
Brad King e41ef3d339 Merge topic 'unused-cleanup'
994dc70 Remove unused vector population.
44258cc Remove unused typedef.
0a4d7d8 Remove unused marker for a variable which is now used.
2013-05-21 15:19:22 -04:00
Brad King 1dbf0aac1b Merge topic 'fix-style'
3c7c332 Fix brace indentation.
c70b9b5 Fix style.
2013-05-21 15:13:49 -04:00
Brad King 5947d03987 Merge topic 'error-on-exported-missing-include-dir'
eabefa8 Error on relative path in INCLUDE_DIRECTORIES target property.
2013-05-21 15:13:26 -04:00
Stephen Kelly eabefa8b02 Error on relative path in INCLUDE_DIRECTORIES target property.
Add policy CMP0021 to preserve existing behavior in projects expecting
it from earlier CMake versions.
2013-05-21 14:59:17 -04:00
Stephen Kelly b5d6f5dd5b Add EXPORT_NAME property.
This allows for example, the buildsystem to use names like 'boost_any'
instead of the overly generic 'any', and still be able to generate
IMPORTED targets called 'boost::any'.
2013-05-18 10:00:48 +02:00
Brad King 0dc0e7d885 Merge topic 'doc-improvements'
7cc2805 Docs: Clarify wording "flag used" => "flag (to|will) be used"
2378a69 Docs: Clarify that CMAKE_*_(PREFIX|SUFFIX) affect filenames
56ca34d Docs: Update description of CMAKE_(BUILD_TYPE|CONFIGURATION_TYPES)
2bab472 VS10: add detailed comment about MIDL processing
e619111 Explain distribution of Win9x binary on all Windows versions.
5ca4336 FindwxWidgets: add DOC strings with usual style
f57800d Fix spelling and typos (product names)
bf019d7 Fix spelling and typos (non-binary)
ddac8d3 Fix spelling and typos (affecting binary data / module messages)
86832ce Fix spelling and typos (affecting users)
2013-05-16 14:38:07 -04:00
Brad King 1b4b64cd3c Merge topic 'vs-no-compiler-pdb-setting'
87c0d16 Ninja: Fix OBJECT_DIR placeholder path conversion
fb9f73d MSVC: Invoke 'link' directly for executables
42ba1b0 VS: Separate compiler and linker PDB files (#11899, #14062)
2013-05-16 14:36:11 -04:00
Stephen Kelly 0a4d7d883c Remove unused marker for a variable which is now used. 2013-05-16 19:34:21 +02:00
Stephen Kelly c70b9b51d9 Fix style. 2013-05-16 19:33:13 +02:00
Andreas Mohr f57800d6f5 Fix spelling and typos (product names)
API, Borland, MinGW, UNIX, Mac OS X.
2013-05-07 08:42:20 -04:00
Andreas Mohr ddac8d3d2d Fix spelling and typos (affecting binary data / module messages) 2013-05-07 08:39:19 -04:00
Stephen Kelly dea1df4e5e Memoize usage requirement include directories in a config-specific map
Commit 42ebb188 (Memoize includes and defines from interface libraries.,
2013-02-22) introduced caching of the includes.  Fix the memoization to
be configuration-specific so that we do not accumulate entries across
multiple evaluations in a multi-config generator.
2013-05-06 09:59:28 -04:00
Stephen Kelly 26dba6a162 Fix include dir propagation from conditionally linked targets
Generator expressions, including configuration-specific expressions may
be used as link libraries of targets.  The old-style keywords of
target_link_libraries are handled in terms of new generator expressions.
However, the generator expressions expect target names to be valid
against a regular expression, whereas target_link_libraries does not
require validation.  In generator expression constructed without any
action from the user we need to ensure that only valid expressions are
generated.  Ensure that strings which are not valid target names are not
used in generator expressions which validate the argument.

Code like

 target_link_libraries(B debug A)

generates usage requirement references such as "$<$<CONFIG:DEBUG>:A>".
When cmTarget::GetIncludeDirectories uses such references it generates
expressions like:

 $<TARGET_PROPERTY:$<$<CONFIG:DEBUG>:A>,INTERFACE_INCLUDE_DIRECTORIES>

When the conditions are false such references evaluate as an empty
string and the expression fails with an error such as:

 $<TARGET_PROPERTY:tgt,prop> expression requires a non-empty target name.

Fix this by teaching cmTarget::GetIncludeDirectories to wrap the above
expression inside a conditional:

 $<$<BOOL:$<$<CONFIG:DEBUG>:A>>:...>

so that $<TARGET_PROPERTY:...> will not be evaluated with an empty
target.
2013-05-06 09:55:45 -04:00
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
Brad King 42ba1b08f3 VS: Separate compiler and linker PDB files (#11899, #14062)
The MS tools create two types of PDB files as explained here:

 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.71%29.aspx
 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.80%29.aspx
 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.90%29.aspx
 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.100%29.aspx

One is created by the compiler (/Fd) and the other by the linker (/pdb).
The two options should not specify the same file.  Split them up.

In the VS IDE generators, simply drop ProgramDataBaseFileName to
take the VS default "/Fd$(IntDir)vc$(PlatformToolsetVersion).pdb".

In the Makefile generators, set "/Fd" on the compile line to be
the directory containing object files (with a trailing slash the
compiler will add the "vc$(PlatformToolsetVersion).pdb" filename
automatically).  Drop the /Fd option from the exe link command
line and add "/pdb" instead (already done for dll linking).
Update these rules for both MSVC and Intel tools.

Drop support for PDB_OUTPUT_DIRECTORY and PDB_NAME in STATIC
libraries because the generated .pdb files are only from /Fd
and not real linker-generated .pdb files.  Update documentation to
clarify that the PDB_* properties are only for linker .pdb files.

This regresses the PDBDirectoryAndName test for STATIC libraries.
Since it is not clear at this time what should be done for STATIC
library .pdb files, comment out the relevant portion of the test
and leave a TODO comment.
2013-04-05 11:25:09 -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 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 a6286e92c9 Fix the evaluation of per-config COMPILE_DEFINITIONS (#14037)
The API for retrieving per-config COMPILE_DEFINITIONS has long
existed because of the COMPILE_DEFINITIONS_<CONFIG> style
properties. Ensure that the provided configuration being generated
is also used to evaluate the generator expressions
in cmTarget::GetCompileDefinitions.

Both the generic COMPILE_DEFINITIONS and the config-specific
variant need to be evaluated with the requested configuration. This
has the side-effect that the COMPILE_DEFINITIONS does not need to
be additionally evaluated with no configuration, so the callers can
be cleaned up a bit too.
2013-03-25 10:49:22 -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
Stephen Kelly 1b386b3407 Document that CMAKE_AUTOMOC works with Qt 5. 2013-03-16 19:31:04 +01:00
Brad King 9a02a26702 Merge topic 'property-link-depends-no-crash'
ab079ee Avoid crash when checking property compatibility without link info
92a2ab7 Avoid crash when checking property link dependencies without link info
2013-03-13 13:34:20 -04:00
Brad King 26436346fb Merge topic 'doc-fixes'
3cf2f67 Documentation: Clarify a few subtleties
2013-03-13 13:33:53 -04:00
Brad King ab079ee682 Avoid crash when checking property compatibility without link info
Teach the compatibility check added by commit 042ecf04 (Add API to
calculate link-interface-dependent bool properties or error, 2013-01-06)
to return early if no link information is available.  This avoids
crashing in a case that should fail with an error message.
2013-03-12 17:25:59 -04:00
Brad King 92a2ab70b6 Avoid crash when checking property link dependencies without link info
Teach the isLinkDependentProperty helper added by commit e9879910 (Make
INTERFACE determined properties readable in generator expressions,
2013-01-19) to return early if no link information is available.
2013-03-12 17:17:24 -04:00
Petr Kmoch 3cf2f67adc Documentation: Clarify a few subtleties
* Clarify accepted values of <LANG> suffix in CMAKE_COMPILER_IS_GNU<LANG>.

* Clarify fact that target property GENERATOR_FILE_NAME usually cannot be
  used at configure time.

* Clarify that enable_language() can only be used in global scope of
  top-level project using language.

* State that enable_language(... OPTIONAL) currently doesn't work.

* Document regular expression operator precedence.
2013-03-12 09:29:55 -04:00
Stephen Kelly 254687d31f Only process transitive interface properties for valid target names.
Commit a1c4905f (Use the link information as a source of compile
definitions and includes., 2013-02-12) introduced the use of link
information as the source of target properties via the TARGET_PROPERTY
generator expression. This generator expression has a strict
interpretation of a valid target name and emits a fatal error for
invalid names.

Ensure that only targets with names valid for use with TARGET_PROPERTY
or targets which are determined by generator expressions are processed
by it. This means that at worst, invalid target names do not participate
in the transitive evaluation of properties, but the validation
generator expression can be extended where needed to resolve that.
2013-03-06 17:42:08 +01:00
Stephen Kelly dcb5907ed6 Fix RPATH information when only a genex is used as a link library.
As of commit 1da75022 (Don't include generator expressions in
old-style link handling., 2012-12-23), such entries are not
included in the LinkLibraries member. Generator expressions in
LinkLibraries are not processed anyway, so port to the new way
of getting link information.
2013-02-28 18:25:33 +01:00
Stephen Kelly 42ebb1886f Memoize includes and defines from interface libraries.
This is similar in spirit to commit e48d8420 (Cache context-independent
includes on evaluation., 2013-02-03), but it is needed since commit
a1c4905f (Use the link information as a source of compile definitions
and includes., 2013-02-12), which changed how includes and defines
are determined. As they are now determined through the link interface,
we need to cache the result of evaluating them through that.

In the case of the includes, the result was already being cached
and then immediately disposed. Store the result as a member variable
instead to make use of the caching.
2013-02-24 22:04:20 +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 5b88504f65 Rename the IncludeDirectoriesEntry to be more generic. 2013-02-12 10:39:35 +01:00
Stephen Kelly faa927e273 Make sure INTERFACE properties work with OBJECT libraries. 2013-02-08 20:10:22 +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
Stephen Kelly df74bc34d4 Only append build interface include dirs to particular targets.
We shouldn't set the property on all custom targets.
2013-02-07 21:57:35 +01:00
Stephen Kelly d4e5c6787c Don't keep track of content determined by target property values.
This tracking was added during the development of commit 042ecf04
(Add API to calculate link-interface-dependent bool properties
or error., 2013-01-06), but was never used.

It was not necessary to use the content because what is really
useful in that logic is to determine if a property has been implied
to be null by appearing in a LINK_LIBRARIES genex.

I think the motivating usecase for developing the feature of
keeping track of the targets relevant to a property was that I
thought it would  make it possible to allow requiring granular
compatibility of interface properties only for targets which
depended on the interface property. Eg:

 add_library(foo ...)
 add_library(bar ...)

 add_executable(user ...)
 # Read the INTERFACE_POSITION_INDEPENDENT_CODE from bar, but not
 # from foo:
 target_link_libraries(user foo $<$<TARGET_PROPERTY:POSTITION_INDEPENDENT_CODE>:bar>)

This obviously doesn't make sense. We require that INTERFACE
properties are consistent across all linked targets instead.
2013-02-07 16:21:09 +01:00
Stephen Kelly 1fb545ad3a Move a special case for PIC from the genex to the cmTarget code. 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 92e98dd909 Deduplicate the isGeneratorExpression method.
This API seems like the most appropriate.
2013-02-07 16:21:08 +01:00
Brad King ec85306025 Merge topic 'tll-includes-defines'
e48d842 Cache context-independent includes on evaluation.
089fe1c Optimize genex evaluation for includes and defines.
179f495 find_package: Reword <package>_NO_INTERFACES documentation
e7b579b Test workaround of bad interface include directories from depends.
77cecb7 Add includes and compile definitions with target_link_libraries.
0b92602 Add the $<LINKED:...> generator expression.
0fa7f69 Add API to check if we're reading a includes or defines property.
2c3654c Add a way to exclude INTERFACE properties from exported targets.
d4297d5 Export targets to a targets file, not a Config file.
df4d2b2 Make it an error for INSTALL_PREFIX to be evaluated.
7ceeba9 Advance more when preprocessing exported strings.
30268b4 Handle reading empty properties defined by the link interface.
2013-02-05 14:46:43 -05:00
Stephen Kelly b6f6654267 Use the result of converting to a unix path.
The commit 18a3195a ('Keep track of INCLUDE_DIRECTORIES as a vector
of structs.', 2012-11-19) moved the handling of includes from
cmGeneratorTarget to cmTarget, but in the process introduced this
bug.
2013-02-05 09:19:27 +01:00
Stephen Kelly e48d84209c Cache context-independent includes on evaluation.
Generator expressions whose output depends on the configuration
now record that fact. The GetIncludeDirectories method can use
that result to cache the include directories for later calls.

GetIncludeDirectories is called multiple times for a target
for each configuration, so this should restore performance for
multi-config generators.
2013-02-03 23:04:03 +01:00
Brad King 3e7bba3fb2 Merge topic 'fix-automoc-compile-defs'
429e369 Process COMPILE_DEFINITIONS as generator expressions in QtAutomoc.
0e10782 Move GetCompileDefinitions to cmTarget.
2013-01-29 14:52:13 -05:00
Stephen Kelly 0e10782ba7 Move GetCompileDefinitions to cmTarget. 2013-01-29 14:11:49 -05:00
Stephen Kelly 2fb2c32f9b Add the COMPATIBLE_INTERFACE_STRING property. 2013-01-24 20:36:04 +01:00
Stephen Kelly cd66b9131d Make calculation of link-interface-dependent properties type-sensitive. 2013-01-24 20:36:04 +01:00
Brad King 7db963a017 Merge topic 'clean-include-dirs-debugging'
6063fef Output include directories as LOG messages, not warnings.
aa66748 Specify the target whose includes are being listed.
d70204a Only output includes once after the start of 'generate-time' when debugging.
0d46e9a Store includes from the same include_directories call together.
2013-01-23 15:11:36 -05:00
Brad King 7a336d2e31 Merge topic 'fix-LINK_LIBRARIES-population'
d7f1520 Don't wrap all targets in LINK_LIBRARIES in a TARGET_NAME genex.
2013-01-23 15:11:28 -05:00
Brad King a37b0e3ebf Merge topic 'qt4-autolink-qtmain'
e3b5eb6 Automatically link to the qtmain library when linking to QtCore.
6c8d8af Add the $<TARGET_POLICY> expression
2013-01-23 15:11:24 -05:00
Stephen Kelly e3b5eb6b23 Automatically link to the qtmain library when linking to QtCore.
When using QAxServer, ensure that the qtmain library is excluded
by reporting an error at CMake time if it is not.
2013-01-23 14:15:41 -05:00
Stephen Kelly aa6674831c Specify the target whose includes are being listed. 2013-01-21 09:12:22 +01:00
Stephen Kelly d70204a86a Only output includes once after the start of 'generate-time' when debugging.
During configure-time, GetIncludeDirectories may be called too, for example
if using the export() command. As the content can be different, it should
be output each time then.
2013-01-21 09:12:22 +01:00
Stephen Kelly bd82bb4787 Clear the link information in ClearLinkMaps.
The cache here needs to be cleared if GetLinkInformation is called
at configure-time, such as during an export().

The next commit does exactly that, and without this patch,
the LinkLanguage test would fail.
2013-01-21 09:05:03 +01:00
Stephen Kelly e98799105b Make INTERFACE determined properties readable in generator expressions.
The properties are evaluated as link-dependent interface properties when
evaluating the generator expressions.
2013-01-20 17:06:47 +01:00
Stephen Kelly d7f1520938 Don't wrap all targets in LINK_LIBRARIES in a TARGET_NAME genex.
It is not necessary and the current state is unintentional. Before
this patch,

 target_link_libraries(foo bar)

causes the LINK_LIBRARIES property of foo to contain

 $<TARGET_NAME:bar>

instead of just

 bar
2013-01-20 11:25:35 +01:00
Stephen Kelly d9afacced3 Exit early if we find an inconsistent property.
Further messages about inconsistency are distracting.
2013-01-18 16:10:37 +01:00
Stephen Kelly 1800f702a0 Populate the link information cache before checking dependent properties.
The dependent properties check can require the link information.
2013-01-16 22:43:49 +01:00
Brad King 3a7d1ce3ff Merge topic 'test-export-iface-genex'
1d74ba2 Test evaluation target via export for generator expressions
522bdac Export the INTERFACE_PIC property.
4ee872c Make the BUILD_INTERFACE of export()ed targets work.
1d47cd9 Add a test for the interfaces in targets exported from the build tree.
6c828f9 Move the exported check for file existence.
cfd4f0a Move the exported check for dependencies of targets
d8fe1fc Only generate one check per missing target.
f623d37 Don't write a comment in the export file without the code.
b279f2b Strip consecutive semicolons when preprocessing genex strings.
2013-01-15 14:43:05 -05:00
Stephen Kelly 4ee872cb99 Make the BUILD_INTERFACE of export()ed targets work.
The existing BUILD_INTERFACE code is executed at generate time, which
is too late for export().
2013-01-15 14:36:22 -05:00
Brad King 8d91e23565 Merge topic 'tll-allow-genex'
1da7502 Don't include generator expressions in old-style link handling.
2013-01-15 14:34:29 -05:00
Stephen Kelly 7171fd0a90 Add a way to check INTERFACE user property compatibility. 2013-01-15 14:33:45 -05:00
Stephen Kelly 1da75022bb Don't include generator expressions in old-style link handling.
Don't add generator expressions to variables which are used
for CMP0003, CMP0004, and the old-style _LIB_DEPENDS content. They
will not be evaluated when read anyway and would probably confuse
the code reading them.

This makes it legitimate to use target_link_libraries with generator
expressions as arguments.
2013-01-13 09:59:42 +01:00