1074 Commits

Author SHA1 Message Date
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
dd7f9d8393 Merge topic 'allow-fallback-config-mapping'
587ab322 Tests: Add test for MAP_IMPORTED_CONFIG_<CONFIG> empty fallback
149d49ea Teach MAP_IMPORTED_CONFIG_<CONFIG> to support configuration-less import
60d73393 Help: Format MAP_IMPORTED_CONFIG_<CONFIG> documentation
2016-10-21 08:59:37 -04:00
Jens Weggemann
149d49ea7c Teach MAP_IMPORTED_CONFIG_<CONFIG> to support configuration-less import
If this property has an empty list entry, check for `IMPORTED_LOCATION`
instead of `IMPORTED_LOCATION_<CONFIG>`.  This allows custom imported
targets to have some configurations mapped and others fall back to a
default location.

Closes: #16280
2016-10-20 11:51:10 -04: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
2fe3e55d53 cmState: Move CacheEntryType enum to separate namespace
Port dependent code to the change.
2016-10-19 15:40:58 +02:00
Stephen Kelly
a49751fb2e cmState: Move TargetType enum to separate namespace 2016-10-19 15:40:58 +02:00
Stephen Kelly
cef59bb8ba cmTarget: Implement GetProperty in terms of cmState::Snapshot 2016-10-16 13:57:53 +02:00
Stephen Kelly
0d57b07ad9 cmTarget: Group code for checking written properties together 2016-10-16 13:57:53 +02: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
Stephen Kelly
848ae2a663 cmTargetPropertyComputer: Template some methods on the Target
Implement the methods for cmTarget in the cmTarget source.
2016-10-15 11:14:21 +02:00
Stephen Kelly
a0a720e6a7 cm{,Generator}Target: Add global generator accessors
Provide 'static polymorphism' between the types in this aspect so that
they can be used indiscriminately in a C++ template.
2016-10-15 11:14:21 +02:00
Stephen Kelly
637e3f3ee1 cmTargetPropertyComputer: Unify whitelist handling from cmTarget 2016-10-15 11:14:21 +02:00
Stephen Kelly
05251e6d80 cmTargetPropertyComputer: Move whitelist check from cmTarget 2016-10-15 11:14:21 +02:00
Stephen Kelly
fbf1721c94 cmTargetPropertyComputer: Extract into new files 2016-10-15 11:14:21 +02:00
Stephen Kelly
390a7d8647 cmTargetPropertyComputer: Implement GetProperty without cmMakefile
Only a cmMessenger and a backtrace are needed.
2016-10-15 11:14:21 +02:00
Stephen Kelly
7863fba1f6 cmTarget: Extract GetLocation method 2016-10-15 11:14:21 +02:00
Stephen Kelly
8096682e4e cmTarget: Extract GetSources method 2016-10-15 11:14:21 +02:00
Stephen Kelly
7d57c1a2c9 cmTarget: Extract location computation methods 2016-10-15 11:14:21 +02:00
Stephen Kelly
a55cac4ba4 cmTarget: Split property computation into separate class
Everything related to property computation will be moved here and
eventually shared with cmGeneratorTarget.
2016-10-15 11:14:21 +02:00
Stephen Kelly
705fcf522b cmTarget: Move IMPORTED check to callers
This way the policy can be checked without depending on cmTarget.
2016-10-15 11:14:21 +02:00
Stephen Kelly
1fb6f672bd cmTarget: Move SOURCES property computation before the rest
The SOURCES have to be computed.
2016-10-15 11:14:21 +02:00
Stephen Kelly
aaa5dbbf64 cmTarget: Use static storage for computed properties
Avoid having to populate a mutable container to return a value.
2016-10-15 11:14:21 +02:00
Stephen Kelly
d9b5f0a301 cmTarget: Remove target name from parameter list
Use the member state instead.
2016-10-07 20:13:36 +02:00
Stephen Kelly
3b4895fa35 cmTarget: Inline MergeLinkLibraries into only caller 2016-10-07 20:13:33 +02:00
Stephen Kelly
2232e97a6e cmTarget: Remove useless link library state 2016-10-07 20:13:33 +02:00
Stephen Kelly
9a1d4e4ba1 cmTarget: Remove addition of zero when merging link libraries
The size is always zero when this is called.
2016-10-07 20:13:33 +02:00
Stephen Kelly
8391b3015a cmTarget: Add assert about link data
MergeLinkLibraries is called only from

 cmMakefile::AddGlobalLinkInformation

which is only called immediately after creating a target.
2016-10-07 20:13:32 +02:00
Ruslan Baratov
dc6d806660 Add a BUILD_RPATH target property specifying build-tree RPATH entries
Users may need to add custom `RPATH` entries to be able to run binaries
from their build tree without setting `LD_LIBRARY_PATH`.  Provide a way
to do this that does not affect the install-tree `RPATH`.
2016-10-03 13:42:27 -04:00
Brad King
86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
Brad King
764775c4dd Fix XCODE_ATTRIBUTE_..._LOCATION target property lookup
Refactoring in commit v3.5.0-rc1~272^2~16 (cmGeneratorTarget: Add API for
property keys, 2015-10-25) changed the Xcode generator implementation of
`XCODE_ATTRIBUTE_...` properties to use the target `GetProperty` method on each
`XCODE_ATTRIBUTE_...` property listed by `GetPropertyKeys` instead of looping
over the property entries directly.  This made the lookup of property names of
the form `XCODE_ATTRIBUTE_..._LOCATION` accidentally trigger the computed
property logic for the undocumented/legacy `<CONFIG>_LOCATION` property.  Of
course the computed property value is not the same as the value stored in the
`XCODE_ATTRIBUTE_..._LOCATION` property.  Fix the computed property logic to
avoid triggering on `XCODE_ATTRIBUTE_...` attributes.

Closes: #16319
2016-09-22 11:29:52 -04:00
Stephen Kelly
0a98c74c1b Convert: Remove last uses of HOME enum value 2016-09-19 21:36:12 +02:00
Brad King
9353d991a4 cmTarget: Remove unused support for partial construction
We no longer need to support partial construction for cmTarget instances
of type GLOBAL_TARGET.  Require all constructor arguments up front.
2016-09-15 16:02:27 -04:00
Brad King
7a2e114dd8 cmTarget: Inline SetType method at only remaining call site 2016-09-14 14:50:40 -04:00
Brad King
00e78c1990 cmTarget: Construct with basic information up front
Avoid having partially constructed cmTarget instances around,
except for the special case of GLOBAL_TARGET construction.
2016-09-14 14:50:39 -04:00
Brad King
d97513d842 cmTarget: Add method to get a copy adapted for a directory
The "global" targets are built once for the top directory and then
copied into all directories.  Add a helper method to make the copy.
2016-09-14 14:50:39 -04:00
Stephen Kelly
563ac22a16 Convert: Replace trivial conversion with new method 2016-08-27 15:26:37 +02:00
Daniel Pfeifer
7b6349da4d CMake: don't use else after return 2016-08-18 20:36:29 +02:00
Daniel Pfeifer
a2af850ba6 fix a batch of include-what-you-use violations 2016-08-17 01:08:13 +02:00
Yury Zhuravlev
9da725cb00 Windows: Honor WINDOWS_EXPORT_ALL_SYMBOLS for executables with exports
For executables with ENABLE_EXPORTS set, export all symbols when
instructed to do so by WINDOWS_EXPORT_ALL_SYMBOLS.
2016-07-11 09:41:04 -04:00
Daniel Pfeifer
1d6909a287 use CM_NULLPTR 2016-06-28 09:02:26 -04:00
Daniel Pfeifer
09aa2c9418 Use <unordered_set> where available 2016-06-27 10:37:40 -04:00
Brad King
e4cb7d7609 Merge topic 'link_what_you_use'
a0902efa Help: Add notes for topic 'link_what_you_use'
96242f80 Add options to run `ldd -u -r` as a "link-what-you-use" tool
2016-06-17 11:06:44 -04:00
Bill Hoffman
96242f8022 Add options to run ldd -u -r as a "link-what-you-use" tool
Create a LINK_WHAT_YOU_USE target property and corresponding
CMAKE_LINK_WHAT_YOU_USE variable to enable this behavior.
Extend link commands by running `ldd -u -r` to detect shared
libraries that are linked but not needed.
2016-06-17 10:56:40 -04:00
Daniel Pfeifer
a16bf141bc Add missing braces around statements.
Apply fixits of clang-tidy's readability-braces-around-statements
checker.
2016-06-10 18:36:24 +02:00
Daniel Pfeifer
9f25fc4dbb Prefer std::ostream& over derivatives as parameters 2016-06-08 23:08:40 +02:00
Brad King
f500a784d0 Fix crash on $<TARGET_PROPERTY:...,LOCATION> genex (#16134)
Policy CMP0026 deprecated the LOCATION property, and we have long
provided a $<TARGET_FILE:...> generator expression.  However, if
a project tries to use $<TARGET_PROPERTY:...,LOCATION> we should
at least not crash.

The compatibility implementation of the LOCATION property uses
cmGlobalGenerator::CreateGenerationObjects to create the structures
needed to evaluate the property before generation starts.  The
implementation assumed that accessing the property could only be done
during configuration (via the typical get_property command use case).
The $<TARGET_PROPERTY:...,LOCATION> genex causes the LOCATION property
to be accessed during generation.  Calling CreateGenerationObjects
during generation blows away all the objects currently being used for
generation and is not safe.  Add a condition to call it only when
configuration is not finished.
2016-06-02 10:58:38 -04:00
Kitware Robot
d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Brad King
0ac18d40c8 Remove //------... horizontal separator comments
Modern editors provide plenty of ways to visually separate functions.
Drop the explicit comments that previously served this purpose.
Use the following command to automate the change:

    $ git ls-files -z -- \
        "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" |
      egrep -z -v "^Source/cmCommandArgumentLexer\." |
      egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmDependsJavaLexer\." |
      egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmExprLexer\." |
      egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmFortranLexer\." |
      egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmListFileLexer\." |
      egrep -z -v "^Source/cm_sha2" |
      egrep -z -v "^Source/(kwsys|CursesDialog/form)/" |
      egrep -z -v "^Utilities/(KW|cm).*/" |
      xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}'

This avoids modifying third-party sources and generated sources.
2016-05-09 09:41:43 -04:00