Commit Graph

400 Commits

Author SHA1 Message Date
Stephen Kelly 40cf3fb95b Make linking APIs aware of 'head' target
The 'head' is the dependent target to be linked with the current target.
It will be used to evaluate generator expressions with proper handling
of mapped configurations and is used as the source target of properties.

This requires that memoization is done with a key of a pair of target
and config, instead of just config, because now the result also depends
on the target.  Removing the memoization entirely is not an option
because it slows cmake down considerably.
2013-01-08 08:53:25 -05:00
Stephen Kelly 894f52f32d Handle INTERFACE properties transitively for includes and defines.
Contextually, the behavior is as if the properties content from another
target is included in the string and then the result is evaluated.
2013-01-05 01:18:37 +01:00
Stephen Kelly d0f950fdba Use mapped config properties to evaluate $<CONFIG> 2013-01-05 01:18:36 +01:00
Stephen Kelly 0941d6232a Add a way to print the origins of used include directories. 2013-01-03 13:45:40 -05:00
Stephen Kelly 18a3195ad5 Keep track of INCLUDE_DIRECTORIES as a vector of structs.
The struct can keep track of where the include came from, which gives
us proper backtraces.
2013-01-03 13:45:40 -05:00
Stephen Kelly 76ea420fb9 Use cmsys::auto_ptr to manage cmCompiledGeneratorExpressions
The compiled generator expressions need to outlive the creating
type. For the same reason, store the input string in a std::string.
2012-12-20 12:17:37 +01:00
Brad King f0d938549e Makefile: Use modern link information for framework search paths
Use cmComputeLinkInformation::GetFrameworkPaths to get the list of
framework paths needed by the linker.  Drop the now unused framework
information from the old-style cmTarget link dependency analysis.
2012-12-07 15:29:21 -05:00
Stephen Kelly 0bbae6f95f Revert "Move GetLinkInformation to cmGeneratorTarget"
As we can't move all linking related code from cmTarget, it makes
sense to reverse the move in some cases.

This reverts commit 4f5384e75c.
2012-11-21 15:49:37 +01:00
Stephen Kelly d5cf644ac2 Split link information processing into two steps.
The first step can be ported to use the generator expression API,
while the second can not. This is for compatibility with CMP0003.
2012-11-21 15:49:36 +01:00
Brad King 508504ab6f Merge topic 'per-config-EXCLUDE_FROM_DEFAULT_BUILD'
739f166 Serialize tests for EXCLUDE_FROM_DEFAULT_BUILD
e31d83b Define property EXCLUDE_FROM_DEFAULT_BUILD
d1f8828 Add property EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>
b777272 Add tests for EXCLUDE_FROM_DEFAULT_BUILD
2012-11-20 11:47:35 -05:00
Brad King 035c29fee4 Merge topic 'link-depends-no-shared'
306796e Teach BuildDepends test to cover LINK_DEPENDS_NO_SHARED
ed97631 Optionally skip link dependencies on shared library files
2012-11-13 14:31:54 -05:00
Petr Kmoch e31d83b3b8 Define property EXCLUDE_FROM_DEFAULT_BUILD
Add definition and documentation of properties EXLCUDE_FROM_DEFAULT_BUILD
and EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>.
2012-11-13 09:08:46 -05:00
Brad King f309366873 Fix default PDB output directory (#13644)
The ComputePDBOutputDir added by commit 3f60dbf1 (Add
PDB_OUTPUT_DIRECTORY and PDB_NAME target properties, 2012-09-25) falls
back to the current binary directory instead of the target output
directory as before.  When no PDB_OUTPUT_DIRECTORY property is set we
instead should fall back to the target output directory where .pdb files
used to go before the new property was added.
2012-11-02 12:49:44 -04:00
Brad King ed9763136a Optionally skip link dependencies on shared library files
Add target property LINK_DEPENDS_NO_SHARED and initialization variable
CMAKE_LINK_DEPENDS_NO_SHARED to enable this behavior.

Suggested-by: Leif Walsh <leif.walsh@gmail.com>
2012-10-26 08:28:16 -04:00
Brad King 15cc55fe08 Merge topic 'documentation-cleanup'
4ad0233 Remove period at the end of the check message.
50b1ea5 Fix minor typos.
19c3206 Remove unused parameter marker and the unused parameter.
9d462b2 Document that generator expressions can be used in target properties.
daf88c3 Fix punctuation in some variables documentation.
3172cde Fix the layout of the generator expression documentation.
2012-10-01 14:05:44 -04:00
Brad King 7dce31f3d0 Merge topic 'vs-pdb-output'
2ccca05 Run PDBDirectoryAndName test on MSVC and Intel
efc83b3 Document that PDB_(NAME|OUTPUT_DIRECTORY) are ignored for VS 6
b294457 Verify that PDB_(NAME|OUTPUT_DIRECTORY) are honored in test
3f60dbf Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830)
2012-10-01 14:05:11 -04: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
Stephen Kelly 19c3206bdc Remove unused parameter marker and the unused parameter. 2012-09-29 18:42:56 +02:00
Stephen Kelly 9d462b22a3 Document that generator expressions can be used in target properties. 2012-09-29 18:42:56 +02:00
Brad King efc83b369b Document that PDB_(NAME|OUTPUT_DIRECTORY) are ignored for VS 6 2012-09-25 15:23:35 -04:00
Yuchen Deng 3f60dbf148 Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830)
This enables changing the name and output folder of the debug symbol
files produced by MS compilers.

Inspired-by: Thomas Bernard <thomas.bernard@ipetronik.com>
2012-09-25 15:23:35 -04:00
Stephen Kelly 879fd354c1 Revert "Move GenerateTargetManifest to cmGeneratorTarget."
This reverts commit 987e12e2f9.

GenerateTargetManifest is called by the global generator before it
creates the generator targets, so we can't move it to cmGeneratorTarget
yet.
2012-09-20 08:34:30 +02:00
Stephen Kelly 290e92ada8 Move GetIncludeDirectories to cmGeneratorTarget. 2012-09-19 15:32:09 +02:00
Stephen Kelly 9facfd1336 Move GetCreateRuleVariable to cmGeneratorTarget. 2012-09-19 15:31:32 +02:00
Stephen Kelly 78bfee35d5 Make cmLocalGenerator::AddArchitectureFlags take a cmGeneratorTarget. 2012-09-19 15:31:29 +02:00
Stephen Kelly 4f5384e75c Move GetLinkInformation to cmGeneratorTarget 2012-09-19 15:30:57 +02:00
Stephen Kelly 987e12e2f9 Move GenerateTargetManifest to cmGeneratorTarget. 2012-09-19 15:30:49 +02:00
Stephen Kelly 91011bd217 cmGeneratorExpression: Port users to two-stage processing
Removing the Process() API and removing the parameters from the
constructor will allow cmGeneratorExpressions to be cached and evaluated
with multiple configs for example, such as when evaluating target
properties.  This requires the creation of a new compiled representation
of cmGeneratorExpression.  The cmListFileBacktrace remains in the
constructor so that we can record where a particular generator
expression appeared in the CMakeLists file.
2012-09-18 17:03:08 -04:00
Brad King 4eaea3c358 add_library: Document POSITION_INDEPENDENT_CODE default (#13479)
The POSITION_INDEPENDENT_CODE property documentation states that its
default value depends on whether SHARED or MODULE is given to the
add_library call.  Since these are options to the add_library command we
should document on the command how they affect the property.

While at it, add a missing space to the POSITION_INDEPENDENT_CODE
property documentation.
2012-08-31 07:36:05 -04:00
Stephen Kelly 325214900b Fix casing of 'Qt' in docs, comments and user-visible strings.
QT (cue-tea) is Apple QuickTime.
Qt (cute) is the C++ framework.
2012-08-28 11:24:55 +02:00
David Cole 56591cb9b4 Merge topic 'pic-docs'
c82fbe0 Fix unfortunate documentation error for PIC feature.
2012-08-24 14:24:01 -04:00
Stephen Kelly c82fbe0c1f Fix unfortunate documentation error for PIC feature.
The wrong variable is documented, and it is not referred to in
the target-specific property.
2012-08-20 22:33:27 +02:00
Stephen Kelly ee949d8871 Remove duplicate 'of' from docs. 2012-08-20 22:26:05 +02:00
Stephen Kelly 389d423177 Add missing whitespace to docs. 2012-08-19 23:31:09 +02:00
Nicolas Despres f8e0a5109f Re-factor framework directory computation. 2012-07-17 14:03:11 +02:00
Nicolas Despres f36c7b0bbe Re-factor Mac OS X content directory computation. 2012-07-17 14:03:11 +02:00
Nicolas Despres 54d9713adb Ninja: Add support for CFBundle.
This patch fixes test CFBundleTest on Darwin.
2012-07-17 14:03:08 +02:00
Stephen Kelly bd34963002 Refactor generation of shared library flags
CMAKE_SHARED_LIBRARY_<lang>_FLAGS has flags on various platforms for a
variety of purposes that are correlated with shared libraries but not
exclusive to them.  Refactor generation of these flags to use new
purpose-specific platform variables

  CMAKE_<lang>_COMPILE_OPTIONS_DLL
  CMAKE_<lang>_COMPILE_OPTIONS_PIC
  CMAKE_<lang>_COMPILE_OPTIONS_PIE

Activate the DLL flags specifically for shared libraries.  Add a new
POSITION_INDEPENDENT_CODE target property to activate PIC/PIE flags, and
default to true for shared libraries to preserve default behavior.
Initialize the new property from CMAKE_POSITION_INDEPENDENT_CODE to
allow easy global configuration in projects.

Although the default behavior is unchanged by this refactoring, the new
approach ignores CMAKE_SHARED_LIBRARY_<lang>_FLAGS completely.  We must
leave it set in case projects reference the value.  Furthermore, if a
project modifies CMAKE_SHARED_LIBRARY_<lang>_FLAGS it expects the new
value to be used.  Add policy CMP0018 to handle compatibility with
projects that modify this platform variable.

Add a PositionIndependentCode test on platforms where we can get
meaningful results.
2012-06-12 15:38:48 -04:00
Stephen Kelly bdc6e32d32 Update the docs of IMPORTED_LOCATION_CONFIG to match the code. 2012-05-25 12:22:27 +02:00
Modestas Vainius 1aa52163ef Fix a few typos in NO_SONAME property description. 2012-05-02 15:14:05 -04:00
Modestas Vainius e1409ac59b Support building shared libraries or modules without soname (#13155)
Add a boolean target property NO_SONAME which may be used to disable
soname for the specified shared library or module even if the platform
supports it.  This property should be useful for private shared
libraries or various plugins which live in private directories and have
not been designed to be found or loaded globally.

Replace references to <CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG> and
hard-coded -install_name flags with a conditional <SONAME_FLAG> which is
expanded to the value of the CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG
definition as long as soname supports is enabled for the target in
question.  Keep expanding CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG in
rules in case third party projects still use it.  Such projects would
not yet use NO_SONAME so the adjacent <TARGET_SONAME> will always be
expanded.  Make <TARGET_INSTALLNAME_DIR> NO_SONAME aware as well.  Since
-install_name is soname on OS X, this should not be a problem if this
variable is expanded only if soname is enabled.

The Ninja generator performs rule variable substitution only once
globally per rule to put its own placeholders.  Final substitution is
performed by ninja at build time.  Therefore we cannot conditionally
replace the soname placeholders on a per-target basis.  Rather than
omitting $SONAME from rules.ninja, simply do not write its contents for
targets which have NO_SONAME.  Since 3 variables are affected by
NO_SONAME ($SONAME, $SONAME_FLAG, $INSTALLNAME_DIR), set them only if
soname is enabled.
2012-04-30 11:50:27 -04:00
David Cole fa083753f1 CMake: Clarify SUFFIX target property documentation.
Make it clear that the property applies to libs, modules
and exes, not just libs.
2012-04-02 10:00:27 -04:00
David Cole 31c0bc0219 Merge topic 'object-library'
93d5509 Merge branch 'ninja-object-library' into object-library
821037c Merge branch 'xcode-object-library' into object-library
eb24c99 Merge branch 'object-library' into xcode-object-library
63d1be8 Xcode: Honor $<TARGET_OBJECTS:...> source expressions
020ba38 Merge branch 'object-library' into xcode-object-library
e8ea615 Build object library targets in Xcode
8045e17 Pre-compute object file names before Xcode generation
247a132 Allow txt files as ExtraSources in object library targets
b063599 Add a default source group for object files.
be01f3b Xcode: Re-factor some existing methods into "FromPath" variants
2693dbe Merge branch 'object-library' into ninja-object-library
51997cb Ninja: Honor $<TARGET_OBJECTS:...> source expressions
23ec258 Merge branch 'object-library' into ninja-object-library
61124de Build object library targets in Ninja
f5b06cd Pre-compute object file names before Ninja generation
a2514f1 Simplify cmNinjaTargetGenerator using cmGeneratorTarget
...
2012-03-20 09:34:35 -04:00
Brad King c403f27a2d Add $<TARGET_OBJECTS:...> expression to use an object library
For now do not allow an OBJECT library to reference other object
libraries.  Teach cmTarget::ComputeLinkImplementation to include the
languages of object libraries used by a target.
2012-03-16 10:12:15 -04: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 e8f1d7f031 Merge topic 'doc-Fortran-mod-dir-issue-13034'
54604ee Document Fortran_MODULE_DIRECTORY as OUTPUT only (#13034)
2012-03-13 11:54:58 -04:00
Brad King 1ee4b65a7f Merge topic 'cleanup-object-file-names'
0996f2a Hide Makefile local object info inside local generator
67734be VS: Simplify object name computation
4ae7f36 Remove unused partial OBJECT_FILES property implementation
2012-03-13 11:53:28 -04:00
Brad King 54604ee7e9 Document Fortran_MODULE_DIRECTORY as OUTPUT only (#13034)
CMake does not automatically pass the Fortran module output directory
location to the module search path.  Add a note to the documentation
that the location must also be specified by INCLUDE_DIRECTORIES.
2012-03-12 11:54:54 -04:00
Brad King 51b67366ed Merge branch 'cleanup-object-file-names' into object-library 2012-03-09 15:15:37 -05:00
David Cole 580171185b Merge topic 'target-include-directories'
d662dff Fix shadowed variable warning on dashboard results
f66e735 Fix compiler warning reported on older Borland dashboard.
d90eed4 Fix compiler error reported on older Borland dashboard.
8233636 Update the documentation regarding INCLUDE_DIRECTORIES.
d899eb7 Call ExpandVariablesInString for each target's INCLUDE_DIRECTORIES
c21db87 Make search paths ordered and unique
22021f0 Remove cmMakefile::GetIncludeDirectories
9106b56 Extract and use the INCLUDE_DIRECTORIES target properties.
840509b Keep the INCLUDE_DIRECTORIES target property up to date.
a4d5f7b Add API to get the ordered includes for a target.
8adaee2 CMake: Eliminate cmMakefile::IncludeDirectories
7620932 Remove include flags memoization.
97a5faa Make it safe to call this method without creating duplicates.
edd5303 Refactor GetIncludeFlags to take includes instead of fetching them
2012-03-08 15:13:15 -05:00