summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
Commit message (Collapse)AuthorAgeFilesLines
* clang-tidy: fix warnings from version 7Regina Pfeifer2018-11-201-2/+1
| | | | | Fix some warnings that are new since clang-tidy version 4, and update `.clang-tidy` to suppress the rest.
* POSITION_INDEPENDENT_CODE: Manage link flags for executablesMarc Chevrier2018-11-111-12/+122
| | | | Fixes: #14983, #16561
* INTERFACE_POSITION_INDEPENDENT_CODE: add generator expressions supportMarc Chevrier2018-11-081-9/+28
| | | | Fixes: #16532
* Using front() and back() instead of calculationsCengizhan Pasaoglu2018-11-061-3/+2
|
* Merge topic 'fix-custom-target-with-csharp'Brad King2018-11-011-13/+15
|\ | | | | | | | | | | | | | | | | 9040df31e2 Merge branch 'backport-fix-custom-target-with-csharp' 1acd1c2b50 CSharp: Fix regression in VS project type selection for custom target a56edad6d6 CSharp: Fix regression in VS project type selection for custom target Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2549
| * CSharp: Fix regression in VS project type selection for custom targetBrad King2018-10-311-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A target created by `add_custom_target` should always be a `.vcxproj` file even if it has `.cs` sources involved in custom commands and such. The latter case was broken by refactoring in commit v3.12.0-rc1~160^2~7 (remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget, 2018-03-19). The reason is that the `HasLanguage` method added by commit v3.12.0-rc1~239^2~6 (cmGeneratorTarget: add HasLanguage() as wrapper for GetLanguages(), 2018-03-19) does not check the target type and so is not a suitable check for deciding the project file extension. The `HasLanguage` method was an attempt at an abstraction that turns out not to work very well. Replace it with a dedicated `IsCSharpOnly` method that considers the target type, sources, and non-transitive `LINKER_LANGUAGE`. Fixes: #18515
* | Add generator APIs to get build settings with backtracesBrad King2018-10-181-70/+197
| | | | | | | | | | | | In cmGeneratorTarget and cmLocalGenerator we offer several APIs to get build settings like include directories, compile definitions, source files, etc. Add corresponding APIs that include backtrace information.
* | add_dependencies: Track backtraces internallyBrad King2018-10-181-15/+6
| | | | | | | | | | Record backtraces for "utility" dependencies created by `add_dependencies` calls.
* | cmLinkItem: Add backtraceBrad King2018-10-181-11/+17
| | | | | | | | | | | | Carry a backtrace on every link item, not just link implementation items. For now the non-impl items will still have empty backtraces at runtime, but this will allow us to introduce values over time.
* | cmGeneratorTarget::GetExportMacro: return const std::string*Vitaly Stakhovsky2018-10-161-2/+2
|/
* Merge topic 'fix-csharp-target-type'Brad King2018-10-031-2/+6
|\ | | | | | | | | | | | | | | 375b420fdf CSharp: Fix regression in VS project type selection 8b21aa0af0 VS: Fix CSharp flag selection when linking to a static C++ library Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2427
| * CSharp: Fix regression in VS project type selectionBrad King2018-10-021-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A that target contains only `.cs` sources should be generated as a `.csproj` project even if it links to non-CSharp static libraries. The latter case was broken by refactoring in commit v3.12.0-rc1~160^2~7 (remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget, 2018-03-19). The reason is that the `HasLanguage` method added by commit v3.12.0-rc1~239^2~6 (cmGeneratorTarget: add HasLanguage() as wrapper for GetLanguages(), 2018-03-19) enforces its "exclusive" check on the combined set of source file languages and the link language. To restore the original `TargetIsCSharpOnly` semantics, update `HasLanguage` to enforce exclusiveness only on the list of sources. Fixes: #18239
* | LINK_DIRECTORIES target property: add policy for absolute paths check.Marc Chevrier2018-09-251-2/+26
| |
* | LINK_DIRECTORIES: Add new properties and commandsMarc Chevrier2018-09-251-5/+102
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge topic 'fix-getsafedef-stdstring'Brad King2018-09-191-9/+8
|\ \ | | | | | | | | | | | | | | | | | | | | | 2428422c02 Fix regression in target output file naming logic d686f81e58 Restore possibly regressed CMP0018 logic Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2402
| * | Fix regression in target output file naming logicBrad King2018-09-191-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactoring in commit f4ff60a803 (cmMakefile: Make GetSafeDefinition return std::string const&, 2018-09-05) accidentally changed the logic for target artifact prefix and suffix names such that setting a PREFIX or SUFFIX target property would cause an empty value to be used. Revert that part of the change and use a simpler alternative. Add a test case. Reported-by: Alan W. Irwin <irwin@beluga.phys.uvic.ca>
* | | Merge topic 'getsafedef-stdstring'Brad King2018-09-181-10/+10
|\ \ \ | |/ / | | | | | | | | | | | | | | | f4ff60a803 cmMakefile: Make GetSafeDefinition return std::string const& Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2350
| * | cmMakefile: Make GetSafeDefinition return std::string const&Vitaly Stakhovsky2018-09-181-10/+10
| | |
* | | target_link_libraries: Allow use with targets in other directoriesBrad King2018-09-121-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | cmGeneratorTarget: Factor target name resolution out of link item resolutionBrad King2018-09-121-10/+24
| | |
* | | Make internal TARGET_PROPERTY generator expressions more robustBrad King2018-09-121-2/+8
|/ / | | | | | | | | | | | | | | | | | | | | | | | | While collecting usage requirements from the `INTERFACE_*` properties of directly linked targets, we internally generate `TARGET_PROPERTY:` and `TARGET_OBJECTS:` generator expressions to refer to those properties on those targets. At the point we generate these expressions we already have a pointer to an exact `cmGeneratorTarget` instance. Switch from using the target name in these generator expressions to using an internal unique name generated for each `cmGeneratorTarget` instance to be referenced. This avoids depending on the user-facing target name to find the same target we already have.
* | Fix transitive usage requirements through same-name imported targetsBrad King2018-09-101-23/+22
| | | | | | | | | | | | | | | | | | | | If two imported targets in different directories have the same name we should still be able to propagate transitive usage requirements from both. Fix the DAG checker to work with target pointers instead of target names since the pointers will not be duplicated even if the names are. Fixes: #18345
* | Fix dependency propagation through same-name imported targetsBrad King2018-09-071-3/+3
| | | | | | | | | | | | | | | | | | | | If two imported targets in different directories have the same name we should still be able to propagate transitive link dependencies from both. Fix the target and link dependency analyzers to de-duplicate targets using target pointers rather than target names since the pointers will not be duplicated even if the names are. Issue: #18345
* | cmLinkItem: Convert to a "sum type" over a string and target pointerBrad King2018-09-071-19/+25
| | | | | | | | | | | | | | | | | | Avoid exposing the item name implicitly as std::string. When the item is a target, avoid storing a second copy of its name. Most link item construction is paired with calls to `FindTargetToLink` to get the possible target pointer. Rename these methods to `ResolveLinkItem` and refactor them to construct the entire item.
* | Remove unnecessary c_str() callsVitaly Stakhovsky2018-09-051-1/+1
| | | | | | | | Use the new IsOn(),IsOff() overloads.
* | Merge topic 'lg-directory'Brad King2018-08-281-2/+3
|\ \ | | | | | | | | | | | | | | | | | | 50fbfee3a0 cmLocalGenerator: return directories as const std::string& Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2309
| * | cmLocalGenerator: return directories as const std::string&Vitaly Stakhovsky2018-08-271-2/+3
| | |
* | | static library: add property STATIC_LIBRARY_OPTIONSMarc Chevrier2018-08-151-0/+41
|/ / | | | | | | issue: #18251
* | cmCompiledGeneratorExpression::Evaluate(): return const std::string&Vitaly Stakhovsky2018-08-091-1/+1
| |
* | Remove unnecessary c_str() in RegularExpression::find callsVitaly Stakhovsky2018-08-071-1/+1
| |
* | Return std::string from cmGeneratorTarget::ImportedGetLocationSebastian Holtermann2018-07-111-4/+2
| |
* | Merge topic 'safe_property'Brad King2018-07-031-0/+9
|\ \ | | | | | | | | | | | | | | | | | | | | | 42cc0644d5 Autogen: Use default and remove custom GetSafeProperty functions 127094f2f0 Add GetSafeProperty method to cmTarget, cmGeneratorTarget and cmSourceFile Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2185
| * | Add GetSafeProperty method to cmTarget, cmGeneratorTarget and cmSourceFileSebastian Holtermann2018-07-021-0/+9
| | |
* | | LINK_DEPENDS: add support of 'generator expressions'Marc Chevrier2018-06-271-5/+11
| | |
* | | LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDSMarc Chevrier2018-06-271-0/+36
|/ / | | | | | | Fixes: #17997
* | LINK_OPTIONS: Add support of "LINKER:" prefixMarc Chevrier2018-06-061-1/+95
| |
* | LINK_OPTIONS: Add new family of propertiesMarc Chevrier2018-06-061-11/+70
|/ | | | | | | | | | | | | | This family enable to manage link flags Three new properties: * directory property: LINK_OPTIONS * target properties: LINK_OPTIONS and INTERFACE_LINK_OPTIONS Two new commands * add_link_options(): to populate directory property * target_link_options(): to populate target properties Fixes: #16543
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-10/+15
| | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 6.0. * 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.
* Add generator expression support to PDB_OUTPUT_DIRECTORY target propertyMarian Klymov2018-05-211-2/+13
| | | | Fixes: #16365
* cmGeneratorTarget: make GetManagedType() return 'Native' for static targetsMichael Stürmer2018-05-071-3/+5
|
* cmGeneratorTarget: change GetManagedType() result if language is CSharpMichael Stürmer2018-04-231-3/+5
|
* cmGeneratorTarget: add handling of managed assemblies to HasImportLibrary()Michael Stürmer2018-04-051-1/+4
|
* cmGeneratorTarget: Make import library checks config-awareMichael Stürmer2018-04-051-5/+6
|
* cmGeneratorTarget: add GetManagedType() and CheckManagedType() methodsMichael Stürmer2018-04-051-0/+56
|
* cmGeneratorTarget: add HasLanguage() as wrapper for GetLanguages()Michael Stürmer2018-04-051-0/+12
|
* Merge topic 'compile-options-shell'Brad King2018-03-151-5/+17
|\ | | | | | | | | | | | | ce0b983216 target_compile_options: Add syntax to specify shell strings Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1841
| * target_compile_options: Add syntax to specify shell stringsBrad King2018-03-141-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Options specified via `COMPILE_OPTIONS` and `INTERFACE_COMPILE_OPTIONS` are deduplicated, but individual options can legitimately be duplicated when grouped with other options, e.g. -D A -D B After deduplication that becomes `-D A B`. Therefore we need a way to treat groups of options as units during deduplication. A simple approach is to specify each group as one option, e.g. "-D A" "-D B" However, that conflicts with options that legitimately have spaces. To break this ambiguity, add a `SHELL:` prefix syntax to specify that an option should be parsed like shell command line arguments after deduplication, e.g. "SHELL:-D A" "SHELL:-D B" These will survive deduplication intact, and then be parsed to produce `-D A -D B` on the final command line. Fixes: #15826
* | Merge topic 'genex-COMPILE_LANGUAGE-system-include'Brad King2018-03-131-6/+8
|\ \ | | | | | | | | | | | | | | | | | | | | | 1b5e52fd65 Genex: Fix COMPILE_LANGUAGE propagation through try_compile 2deb9b7f34 Genex: Fix COMPILE_LANGUAGE in SYSTEM include directories Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1844
| * | Genex: Fix COMPILE_LANGUAGE in SYSTEM include directoriesBrad King2018-03-121-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | When evaluating `INTERFACE_SYSTEM_INCLUDE_DIRECTORIES`, or evaluating `INTERFACE_INCLUDE_DIRECTORIES` on an imported target, thread the compile language through to the generator expression evaluator so that it can support `$<COMPILE_LANGUAGE:...>`. Fixes: #17811
* | | Identify DLL platforms via CMAKE_IMPORT_LIBRARY_SUFFIXStephan Szabo2018-03-091-2/+2
| |/ |/| | | | | | | | | | | Use `CMAKE_IMPORT_LIBRARY_SUFFIX` to identify platforms that have DLL import libraries rather than memorizing a list of platform names. Fixes: #16801