618 Commits

Author SHA1 Message Date
Brad King
930042f2d9 cmGeneratorTarget: Factor out a GetTargetObjectNames method 2017-04-18 09:03:32 -04:00
Brad King
a3636dde57 Merge topic 'fix-CMP0026-old'
5e616fcf CMP0026: Fix OLD behavior with file written during configure step

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !710
2017-04-18 08:51:54 -04:00
Brad King
5e616fcf9a CMP0026: Fix OLD behavior with file written during configure step
Refactoring in commit 60307c5056 (cmGeneratorTarget: Replace source
classifier implementation, 2017-04-07) accidentally regressed support
for CMP0026's OLD behavior in the case of a source file written by
project code during the configure step after getting a LOCATION.  We
should not perform full source classification until the generate step
because files written by the project's configure step may not exist yet.

Add special logic to support this case.  Add a test case for it.

Reported-by: David Stoup <david.stoup@kitware.com>
2017-04-17 10:10:15 -04:00
Brad King
ca697bfc26 cmGeneratorTarget: Drop obj libs from GetConfigCommonSourceFiles
Call sites such as those in the VS global generator that are used only
to reject per-config sources will now allow per-config object library
objects.  The corresponding generators have already been taught to deal
with per-config object library files.  Remaining call sites do not need
object library files anyway.

This will later allow `$<TARGET_OBJECTS:...>` generator expressions to
evaluate to values that vary by configuration (e.g. because each
configuration has its own object files).
2017-04-13 16:10:33 -04:00
Brad King
40aa6c059c cmGeneratorTarget: Add method to collect all sources for all configs
Multi-config generators like VS and Xcode need to loop over all the
source files first and then handle per-config information within
each one.  Teach cmGeneratorTarget to provide such a view.
2017-04-13 16:10:31 -04:00
Brad King
e155fba644 Merge topic 'xcode-remove-UseObjectLibraries'
229abfc8 cmGeneratorTarget: Drop unused UseObjectLibraries method
63fbf587 Xcode: Inline relevant parts of UseObjectLibraries
1afacebe Xcode: Do not add Object Libraries source group on Xcode >= 5

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !698
2017-04-13 08:15:25 -04:00
Brad King
8456ec833a Merge topic 'include-style'
1d829c86 Use quotes for non-system includes
26ee9e42 CPack: drop CPack prefix for includes
5afac50f cmConfigure: Ensure separate include block in headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !691
2017-04-13 08:12:40 -04:00
Brad King
229abfc8f9 cmGeneratorTarget: Drop unused UseObjectLibraries method 2017-04-12 15:38:54 -04:00
Daniel Pfeifer
1d829c862c Use quotes for non-system includes
Automate with:

git grep -l '#include <cm_' -- Source \
  | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g'

git grep -l '#include <cmsys/' -- Source \
  | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g'

git grep -l '#include <cm[A-Z]' -- Source \
  | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
2017-04-11 22:35:21 +02:00
Brad King
a2e91af99d cmGeneratorTarget: Drop unused GetIDLSources method 2017-04-11 13:36:40 -04:00
Brad King
60307c5056 cmGeneratorTarget: Replace source classifier implementation
Compute and memoize the list of sources with their kinds for each
configuration just once.
2017-04-07 15:35:48 -04:00
Brad King
a9784d0e26 cmGeneratorTarget: Remove unnecessary condition
Remove a condition where the "then" and "else" cases do the same thing.
2017-04-07 14:29:47 -04:00
Brad King
c791fb1254 Merge topic '16733-bundle-genex'
d1dac1ac Xcode: Execute RunCMake.Framework also for Xcode generator
d02709d7 Genex: Add `TARGET_BUNDLE_[CONTENT_]_DIR` generator expressions
013ffe76 cmGeneratorTarget: Call GetFrameworkDirectory in GetFullNameInternal
32e9d0ca cmGeneratorTarget: Use enum to describe bundle directory query level

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Craig Scott <craig.scott@crascit.com>
Merge-request: !635
2017-03-31 10:40:02 -04:00
Brad King
8772fc81c4 Merge topic 'ipo-policy-CMP0069'
dfa8263f Implement interprocedural optimization for GNU compilers
1588a577 Add policy CMP0069 to enforce INTERPROCEDURAL_OPTIMIZATION
a7575700 Refactoring: s,GetFeatureAsBool,IsIPOEnabled,
e05835c3 CheckIPOSupported: Visual Studio and Xcode generators do not support IPO

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Brad King <brad.king@kitware.com>
Reviewed-by: Nils Gladitz <nilsgladitz@gmail.com>
Merge-request: !568
2017-03-31 10:38:08 -04:00
Gregor Jasny
d02709d7f7 Genex: Add TARGET_BUNDLE_[CONTENT_]_DIR generator expressions
Closes #16733
2017-03-30 22:24:54 +02:00
Gregor Jasny
013ffe76e7 cmGeneratorTarget: Call GetFrameworkDirectory in GetFullNameInternal 2017-03-30 22:24:54 +02:00
Gregor Jasny
32e9d0ca23 cmGeneratorTarget: Use enum to describe bundle directory query level 2017-03-30 22:24:54 +02:00
Ruslan Baratov
dfa8263f4b Implement interprocedural optimization for GNU compilers
Honor the `INTERPROCEDURAL_OPTIMIZATION` target property for GNU
compilers by activating their link-time-optimization (LTO) flags.
2017-03-30 14:56:52 -04:00
Ruslan Baratov
1588a577d1 Add policy CMP0069 to enforce INTERPROCEDURAL_OPTIMIZATION
Previously the `INTERPROCEDURAL_OPTIMIZATION` target property was
honored only for the Intel compiler on Linux and otherwise ignored.  In
order to add support for more compilers incrementally without changing
behavior in the future, add a new policy whose NEW behavior enforces the
`INTERPROCEDURAL_OPTIMIZATION` property.  Add flags for supported
compilers and otherwise produce an error.
2017-03-30 14:56:46 -04:00
Ruslan Baratov
a75757004b Refactoring: s,GetFeatureAsBool,IsIPOEnabled,
Method 'GetFeatureAsBool' is used only with 'INTERPROCEDURAL_OPTIMIZATION'
feature. Substituting 'GetFeatureAsBool' with 'IsIPOEnabled'.
2017-03-30 10:16:30 -04:00
Gregor Jasny
c51c2cfac6 Apple: Fix Resources location for all generators
Issue: #16680
2017-03-23 16:43:55 +01:00
Gregor Jasny
060be58c6f Xcode: Properly handle Bundle Resources with more than one hierarchy level
Issue: #16680
2017-03-22 23:36:11 +01:00
Brad King
075f645409 Support WINDOWS_EXPORT_ALL_SYMBOLS with .def files
The `WINDOWS_EXPORT_ALL_SYMBOLS` target property exports all symbols
found in object files explicitly given to the linker.  However, the
linker may also find additional symbols in dependencies and copy them
into the linked binary (e.g. from `msvcrt.lib`).  Provide a way to
export an explicit list of such symbols by adding a `.def` file as a
source file.

Fixes: #16473
2017-03-21 10:02:34 -04:00
Brad King
f36eaf6a6e Refactor WINDOWS_EXPORT_ALL_SYMBOLS implementation
Use `cmGeneratorTarget::ModuleDefinitionInfo` to combine the
implementation of `WINDOWS_EXPORT_ALL_SYMBOLS` with that of using a
`.def` file as a source.  Only one of these could be used within a
single target before anyway.
2017-03-09 16:25:15 -05:00
Brad King
25d261efa7 Refactor module definition file selection
Create a `ModuleDefinitionInfo` structure for each configuration of a
target to hold corresponding information about the selected module
definition file (`.def` source).
2017-03-09 16:25:14 -05:00
Brad King
1e0a9ac45d Refactor module definition source enumeration
Add a `cmGeneratorTarget::GetModuleDefinitionSources` method.
2017-03-09 16:24:27 -05:00
Dmitry Kochkin
73a6d4566a VS: Cache the list of xaml and resx headers
Speed up VS project generation with many such headers.
2017-02-27 09:22:08 -05:00
Brad King
e348d8db55 Merge topic 'object-library-compile-pdb'
feff52d4 Fix COMPILE_PDB_NAME when used on an OBJECT library
2017-02-27 09:11:22 -05:00
Brad King
feff52d42c Fix COMPILE_PDB_NAME when used on an OBJECT library
When `COMPILE_PDB_NAME` is used without `COMPILE_PDB_OUTPUT_DIRECTORY`
we cannot fall back on the link `PDB_OUTPUT_DIRECTORY` for an object
library because it has no link step.

Fixes: #16674
2017-02-24 11:26:52 -05:00
Clinton Stimpson
1ba91291e3 Add policy CMP0068 separate install_name and RPATH settings on macOS
BUILD_WITH_INSTALL_RPATH, SKIP_BUILD_RPATH, CMAKE_SKIP_RPATH and
CMAKE_SKIP_INSTALL_RPATH no longer any effect on the install name
of a target on macOS.

Fixes: #16589
2017-02-14 14:28:07 -07:00
Clinton Stimpson
f7b9bf41c5 Apple: Add BUILD_WITH_INSTALL_NAME_DIR target property
This new property controls whether to apply INSTALL_NAME_DIR to the
build tree.  It also overrides BUILD_WITH_INSTALL_RPATH.
2017-02-14 14:28:07 -07:00
Clinton Stimpson
4bff2d14fd Apple: Refactor support for using INSTALL_NAME_DIR. 2017-02-14 14:28:01 -07:00
Gregor Jasny
071f8e78dd Apple: Add support for static frameworks
Closes: #16432
2017-01-31 08:59:15 -05:00
Gregor Jasny
10c9c73d58 Xcode: Control emission of EFFECTIVE_PLATFORM_NAME
When building with multiple SDKs within one project Xcode requires
the usage of ${EFFECTIVE_PLATFORM_NAME} to put temporary and build
outout into separate directories. For example an iOS device and
simulator build use two different SDKs (iphoneos and iphonesimulator).

In the past cmake tries to detect embedded toolchains that could
possibly use simulators and emitted EFFECTIVE_PLATFORM_NAME (EPN)
at the proper locations. In #16253 Mark noticed that if he
uses macosx and iphoneos in combination the necessary EPN is not
emitted. This is because CMake by default assumes macosx SDK which
does not trigger EPN emission.

The fist naive approach - enabling EPN unconditionally revealed that
then the EPN leaks into generator expressions like $<TARGET_FILE:xxx>
which might be a regression and thus is unacceptable.

The next approach was to add an CMake property to enable EPN emission
unconditionally. This solved the reported problem.

But the EPN leakage also happened for the embedded toolchains already
without anyone noticing. So the control property was turned into a
tri-state one:

 * No definition: EPN is activated for embedded toolchains like before
 * ON: EPN is always emitted
 * OFF: EPN is never emitted

That approach gives the user the chance to disable EPN for embedded
toolchains and restores generator expression functionality for those.

Closes: #16253
2017-01-20 13:51:48 -05:00
Daniel Pfeifer
2988abd939 clang-tidy: apply modernize-use-bool-literals fixes 2016-12-12 14:04:14 -05:00
Sebastian Holtermann
8f47a5f16a cmGeneratorTarget: Add AddIncludeDirectory method (experimental) 2016-12-07 08:24:00 -05:00
Brad King
453df662ba Merge topic 'imported-interface-libname'
09cda9d5 Allow imported INTERFACE libraries to specify a link library name
1d1f1eeb cmTarget: Refactor GetMappedConfig to choose location property up front
479932fa cmTarget: Add comment clarifying interface library special case
925e4270 cmTarget: Clarify comments in GetMappedConfig
2016-11-09 09:49:49 -05:00
Brad King
09cda9d5e7 Allow imported INTERFACE libraries to specify a link library name
Add an `IMPORTED_LIBNAME[_<CONFIG>]` target property to specify a library
name to be placed on the link line in place of an interface library
since it has no library file of its own.  Restrict use of the property
to imported `INTERFACE` libraries.

This will be particularly useful for find modules that need to provide
imported libraries from system SDKs where the full path to the library
file is not known.  Now such find modules will be able to provide an
imported interface library and set `IMPORTED_LIBNAME` to refer to the
SDK library by name.

Issue: #15267
2016-11-09 09:45:14 -05:00
Brad King
666bb0e3fa Merge topic 'include-what-you-use'
2e620f0b Fix several include-what-you-use findings
2016-11-08 09:44:40 -05:00
Daniel Pfeifer
2e620f0b38 Fix several include-what-you-use findings 2016-11-08 09:42:04 -05:00
Daniel Pfeifer
0cd654c8e2 cmGeneratorTarget: Correctly set FortranModuleDirectoryCreated 2016-11-06 00:11:03 +01:00
Daniel Pfeifer
bac93dcf19 cmGeneratorTarget: Don't assing a bool to a string 2016-11-05 23:54:57 +01:00
Daniel Pfeifer
c15dc19728 Introduce CM_UNORDERED_SET
Avoid duplicating switch among std::unordered_set, cmsys::hash_set, and
std::set.
2016-10-24 22:34:52 +02:00
Brad King
a5f4463eed Merge topic 'clang-tidy'
effa6c83 fix more issues reported by clang-tidy
fb461cac silence selected clang-tidy violations
2016-10-20 08:51:09 -04:00
Daniel Pfeifer
effa6c8343 fix more issues reported by clang-tidy 2016-10-20 08:48:20 -04:00
Stephen Kelly
e6eecec761 cmListFileCache: Remove cmState header include
Include it in dependents which have previously relied on it
transitively.
2016-10-19 15:41:00 +02:00
Stephen Kelly
a49751fb2e cmState: Move TargetType enum to separate namespace 2016-10-19 15:40:58 +02:00
Brad King
188c762f8a Merge topic 'extract-computed-target-properties'
cef59bb8 cmTarget: Implement GetProperty in terms of cmState::Snapshot
0d57b07a cmTarget: Group code for checking written properties together
c3fb0d95 cmTarget: Move sanity checks and computed property access to callers
fa9dbc56 cmGeneratorTarget: Implement cmTargetPropertyComputer interface
848ae2a6 cmTargetPropertyComputer: Template some methods on the Target
a0a720e6 cm{,Generator}Target: Add global generator accessors
637e3f3e cmTargetPropertyComputer: Unify whitelist handling from cmTarget
05251e6d cmTargetPropertyComputer: Move whitelist check from cmTarget
fbf1721c cmTargetPropertyComputer: Extract into new files
390a7d86 cmTargetPropertyComputer: Implement GetProperty without cmMakefile
e32a6bdd cmListFileBacktrace: Add a method to retrieve the Bottom of a snapshot
7863fba1 cmTarget: Extract GetLocation method
8096682e cmTarget: Extract GetSources method
7d57c1a2 cmTarget: Extract location computation methods
a55cac4b cmTarget: Split property computation into separate class
705fcf52 cmTarget: Move IMPORTED check to callers
...
2016-10-17 10:15:21 -04:00
Gregor Jasny
3b6f1587be Factor IDE folder name retrieval out into helper method
Add a `cmGeneratorTarget::GetEffectiveFolderName` helper to abstract
lookup of the `FOLDER` property in combination with checking for
generator support of folders.
2016-10-17 10:06:18 -04:00
Stephen Kelly
c3fb0d95ad cmTarget: Move sanity checks and computed property access to callers
The GetProperty method is now just accessing contained data, meaning it
can be implemented in cmState.

Remove the cmMakefile context from the signature as a result and remove
the overload with the same signature.

Add a GetComputedProperty to cmTarget so that templates can be properly
instantiated.  Otherwise the Commands would need to be able to reach the
specializations which are currently in cmTarget.cxx.

As a side-effect, the CMP0026 warning now gives a backtrace to the
target when issued from a generator expression.
2016-10-16 13:56:12 +02:00