Commit Graph

1189 Commits

Author SHA1 Message Date
Luca Cappa 2a9ff9703e MSVC: Add support for /JMC (Just My Code) 2019-05-14 13:27:18 -04:00
Brad King fb3370b6a1 MSVC: Add abstraction for runtime library selection
Replace our hard-coded defaults for `/MD` and `/MDd` with a first-class
abstraction to select the runtime library from an enumeration of logical
names.  We've long hesitated to do this because the idea of "runtime
library selection" touches on related concepts on several platforms.
Avoid that scope creep by simply defining an abstraction that applies
only when targeting the MSVC ABI on Windows.

Removing the old default flags requires a policy because existing
projects may rely on string processing to edit them and choose a runtime
library under the old behavior.  Add policy CMP0091 to provide
compatibility.

Fixes: #19108
2019-04-17 11:00:44 -04:00
Sebastian Holtermann 735c6f39d9 Fix invalid ///! doxygen comment line starts
In various places `///!` was used to start a comment line.  This is not valid
Doygen syntax.  This patch replaces `///!` comment starts with `//!`.
2019-03-31 11:27:12 +02:00
Sebastian Holtermann de0d57c97a cmTarget: Use std::unique_ptr instead of custom smart pointer
To manage the lifetime of `cmTargetInternals`, the private implementation of
`cmTarget`, use `std::unique_ptr<cmTargetInternals>` instead of
`cmTargetInternalPointer`, which is removed.

`cmTarget` is made non-copyable but movable.
2019-03-23 22:22:34 +01:00
Sebastian Holtermann be2764a657 cmTarget: Make private SetPropertyDefault an in code lambda InitProperty 2019-03-23 22:22:34 +01:00
Sebastian Holtermann a65a404186 cmTarget: Inline private HasImportLibrary method 2019-03-23 22:22:34 +01:00
Sebastian Holtermann ff91071a14 cmTarget: Move member method CheckImportedLibName to impl 2019-03-23 22:22:34 +01:00
Sebastian Holtermann afc4612fa5 cmTarget: Move member method ProcessSourceItemCMP0049() to impl 2019-03-23 22:22:34 +01:00
Sebastian Holtermann 72b0eeeb21 cmTarget: Move member booleans to impl 2019-03-23 22:22:34 +01:00
Sebastian Holtermann db182eb160 cmTarget: Move member *Commands to impl 2019-03-23 22:22:34 +01:00
Sebastian Holtermann 30495bb1c2 cmTarget: Move member RuntimeInstallPath to impl 2019-03-23 21:45:10 +01:00
Sebastian Holtermann 0dcef68cd8 cmTarget: Move member InstallPath to impl 2019-03-23 21:45:10 +01:00
Sebastian Holtermann 5db17e9d81 cmTarget: Move member Name to impl 2019-03-23 21:45:10 +01:00
Sebastian Holtermann ccf76c6e4c cmTarget: Move member TLLCommands to impl 2019-03-23 21:45:10 +01:00
Sebastian Holtermann 7742bf4ff5 cmTarget: Move member Backtrace to impl 2019-03-23 21:45:09 +01:00
Sebastian Holtermann 2c14eb4852 cmTarget: Move member PolicyMap to impl 2019-03-23 21:45:09 +01:00
Sebastian Holtermann f6241db3e0 cmTarget: Move member OriginalLinkLibraries to impl 2019-03-23 21:45:09 +01:00
Sebastian Holtermann 3c09bf0fa7 cmTarget: Move member Utilities to impl 2019-03-23 21:45:09 +01:00
Sebastian Holtermann 856a271fb7 cmTarget: Move member SystemIncludeDirectories to impl 2019-03-23 21:45:09 +01:00
Sebastian Holtermann 46075091d5 cmTarget: Move member Properties to impl class 2019-03-23 21:15:32 +01:00
Sebastian Holtermann 2cd4104600 cmTarget: Move member Makefile to impl 2019-03-23 15:10:50 +01:00
Sebastian Holtermann fa8e2dfc7b cmTarget: Move member TargetType to impl 2019-03-23 15:04:56 +01:00
Sebastian Holtermann c9bd2e941f cmTarget: Rename member Internal to impl 2019-03-23 15:04:42 +01:00
Brad King fb05b6a8f5 Merge topic 'cmTarget_micro_fixes'
965da8d787 cmTarget: Acquire data only when needed
03d17a35b5 cmTarget: Use helper function to append to lists

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3135
2019-03-22 09:19:09 -04:00
Harry Mallon 413b71485a Xcode: Create Xcode schemes per target 2019-03-21 16:50:41 +00:00
Sebastian Holtermann 965da8d787 cmTarget: Acquire data only when needed 2019-03-21 16:58:29 +01:00
Sebastian Holtermann 03d17a35b5 cmTarget: Use helper function to append to lists 2019-03-21 16:57:27 +01:00
Regina Pfeifer 9eb0e73f46 cmRange: Move to dedicated header file 2019-02-21 08:24:25 -05:00
Artur Ryt 706b93fa55 Modernize: C-arrays and loops over them
It replaces C arrays with deduced std::initializer_lists
or std::array what makes enables for-loop over them.
2019-02-15 23:40:30 +01:00
Artur Ryt 01b2d6ab74 Modernize: Use ranged for-loops when possible
Replaced most manual `const_iterator`-based loops and some
reverse-iterator loops with range loops.

Fixes: #18858
2019-02-07 22:39:05 +01:00
Bruno Manganelli b6a957c969 cmOutputConverter: move ConvertToRelativePath to cmStateDirectory. 2019-01-27 15:48:57 +00:00
Brad King 1fba410ecf Merge topic 'autogen_mocs_compilation_first'
1ed4d48dcf Autogen: Prepend instead of append `mocs_compilation.cpp` to the sources list
a42b700cc2 cmTarget,cmGeneratorTarget: Add optional `before` parameter to AddSource

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Peter Wu <peter@lekensteyn.nl>
Merge-request: !2815
2019-01-21 07:53:23 -05:00
Sebastian Holtermann a42b700cc2 cmTarget,cmGeneratorTarget: Add optional before parameter to AddSource
The new optional `before` parameter in `cmTarget::AddSource` and
`cmGeneratorTarget::AddSource` allows to prepend a source file
to the sources list instead of appending it.
2019-01-18 13:47:23 +01:00
Regina Pfeifer ef61997b1b clang-tidy: Use emplace 2019-01-17 13:12:02 -05:00
Bruno Manganelli cc2a5261f8 Factor out enum MessageType into dedicated header
Reduce the number of files relying on `cmake.h`.
2019-01-16 08:16:31 -05:00
Artur Ryt ecf6fc8dc1 cmTarget: Remove unused classes cmTargetSet and cmTargetManifest 2018-12-06 11:40:13 -05:00
Cengizhan Pasaoglu c67ab22cdc Using front() and back() instead of calculations 2018-11-06 21:43:33 +03:00
Sebastian Holtermann b5e895b5d4 Autogen: Add (CMAKE_)AUTOGEN_ORIGIN_DEPENDS support
This adds

- the variable ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` which initializes
- the target property ``AUTOGEN_ORIGIN_DEPENDS``

which controls whether or not the origin target dependencies
should be forwarded to the corresponding ``_autogen`` target.

The default value of ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` is ``ON``
which corresponds to the behavior that is in place since CMake 3.9.

Closes: #18493
2018-11-03 12:14:40 +01:00
Peter Wu 6114d85a7d RPATH: Add option for using $ORIGIN in build tree
This makes binaries independent of the build directory by not embedding
the build directory via RPATH.  The tests are partially based on the
existing RuntimePath test, but with the check moved into a POST_BUILD
command such that it can be skipped when the platform lacks support.

Fixes: #18413
2018-10-26 09:25:51 -04:00
Brad King a6e02f881d add_dependencies: Track backtraces internally
Record backtraces for "utility" dependencies created by
`add_dependencies` calls.
2018-10-18 08:10:55 -04:00
Brad King 4e98203c6c Merge topic 'vs-global-props-for-all-targets'
36489b85aa VS: Add test for CMAKE_VS_GLOBALS
22e670a306 VS: Add option to set VS_GLOBAL_* for all targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2345
2018-09-28 11:13:59 -04:00
Marc Chevrier a71caab46b LINK_DIRECTORIES: Add new properties and commands
These new capabilities enable to manage link directories

Two new properties:
* target properties: LINK_DIRECTORIES and INTERFACE_LINK_DIRECTORIES

One new command
* target_link_directories(): to populate target properties

Fixes: #17215
2018-09-25 23:59:58 +10:00
Marc Chevrier 5ca130e223 Refactoring: introduce function to check if a string is a generator expression 2018-09-25 23:46:56 +10:00
Mikhail Korolev 22e670a306 VS: Add option to set VS_GLOBAL_* for all targets
Fixes: #18287
2018-09-25 09:20:25 -04:00
Brad King a8f628c0a4 Merge topic 'getsafedef-stdstring'
f4ff60a803 cmMakefile: Make GetSafeDefinition return std::string const&

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2350
2018-09-18 11:18:00 -04:00
Vitaly Stakhovsky f4ff60a803 cmMakefile: Make GetSafeDefinition return std::string const& 2018-09-18 11:16:46 -04:00
Brad King a1ad0a699b target_link_libraries: Allow use with targets in other directories
Previously the command did not allow naming targets on the LHS that
were not created in the calling directory.  Lift this restriction to
enable more flexible use by projects.

Targets named on the RHS will need to be looked up during generation in
the scope of the call site rather than the scope of the LHS target.
Introduce an internal syntax in `[INTERFACE_]LINK_LIBRARIES` properties
to specify target names that need to be looked up in a directory other
than that containing the target on which the property is set.  Add
minimal documentation of the syntax to help users that encounter it.

Unfortunately CMake previously did allow such calls in the case that
only `INTERFACE` libraries are specified, but those libraries would be
looked up in the target's directory rather than the caller's.  Add
policy `CMP0079` to enable the new behavior with new lookup scope in a
compatible way.

Fixes: #17943
2018-09-12 13:06:36 -04:00
Brad King 9bbae5ae28 cmTarget: Future-proof AddLinkLibrary target lookup scope
The `AddLinkLibrary` method takes a `cmMakefile` pointer to represent
the scope of the caller that wants to link to the named library.
Currently in all call sites this is the same as the target's `Makefile`
member, but in principle the library named by the caller is visible in
its scope so we should use the `cmMakefile` it provided to look up the
library target.
2018-09-12 12:46:51 -04:00
Vitaly Stakhovsky c8fd23ec6f cmMakefile: return directories as const std::string& 2018-08-27 14:07:43 -04:00
Vitaly Stakhovsky ada121e573 cmStateDirectory: use const std::string& for return values 2018-08-12 18:59:21 +10:00