summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
Commit message (Collapse)AuthorAgeFilesLines
* cmGeneratorTarget: remove dead codeMatthias Maennich2017-10-051-1/+1
| | | | explicitLibraries can never be nullptr at this point
* Retire std::auto_ptr and its macro CM_AUTO_PTRMatthias Maennich2017-09-251-22/+25
| | | | Signed-off-by: Matthias Maennich <matthias@maennich.net>
* Meta: replace empty-string assignments with `clear()`.Pavel Solodovnikov2017-09-151-9/+9
|
* Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-287/+175
| | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* Merge topic 'fix-genex-SOURCES'Brad King2017-09-011-1/+1
|\ | | | | | | | | | | | | 068cc545 Genex: Fix TARGET_PROPERTY value of SOURCES Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1218
| * Genex: Fix TARGET_PROPERTY value of SOURCESBrad King2017-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Refactoring in commit v3.8.0-rc1~445^2~2 (cmTarget: Move sanity checks and computed property access to callers, 2016-10-13) exposed a typo in commit v3.8.0-rc1~445^2~3 (cmGeneratorTarget: Implement cmTargetPropertyComputer interface, 2016-10-13). Together they broke the `$<TARGET_PROPERTY:mytgt,SOURCES>` generator expression in the case that the `SOURCES` target property is populated in part by the `target_sources` command. Add the missing `;`-separator. Fixes: #17243
| * Merge branch 'objlib-own-target-objs' into release-3.9Brad King2017-07-171-0/+11
| |\
* | | clang-format: format all code as Cpp11Daniel Pfeifer2017-08-301-1/+1
| | |
* | | Use C++11 nullptrDaniel Pfeifer2017-08-241-65/+65
| | |
* | | Use C++11 unordered containersDaniel Pfeifer2017-08-221-18/+19
| | |
* | | Autogen: Clear sources meta data cacheSebastian Holtermann2017-08-101-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds cmGeneratorTarget::clearSourcesCache() which clears the cache of precomputed sources lists and object names. The cache gets recomputed on demand. Clearing the cache is necessary in case an OBJECT library gets a source added after a target (ORIGIN) that includes it computed it's external sources cache. This may happen in AUTOMOC when ORIGIN is processed before the OBJECT library which gets a mocs_compilation.cpp file added. Closes #17152 Closes #17139 Closes #17085 Closes #15967
* | | Merge topic 'objlib-own-target-objs'Brad King2017-07-181-0/+11
|\ \ \ | |/ / |/| / | |/ | | | | | | d89e10cd Diagnose object library self-reference Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1053
| * Diagnose object library self-referenceBrad King2017-07-141-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code add_library(A OBJECT a.c) target_sources(A PRIVATE $<TARGET_OBJECTS:A>) used to crash CMake via infinite recursion while evaluating the generator expression. Then the change in commit v3.9.0-rc1~266^2~1 (cmGeneratorTarget: Replace source classifier implementation, 2017-04-07) avoided the infinite recursion because GetKindedSources now creates a map entry and initializes it once. If it is called again on the same target during that initialization, the partially computed results are returned. This is still wrong but does not crash. Detect and diagnose this case instead. Co-Author: Ben Boeckel <ben.boeckel@kitware.com> Fixes: #16578
* | Android: Always add standard include directories lastBrad King2017-07-131-12/+0
|/ | | | | | | | | | | | | | | | | | | | | | | | | | The logic added in commit v3.6.0-rc1~30^2 (Add a variable to specify language-wide system include directories, 2016-05-24) to use `CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES` incorrectly filters them by `CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES`. Rather than recognizing this, commit v3.8.0-rc1~60^2 (Android: Pass sysroot include directory explicitly, 2017-01-20) worked around the problem by incorrectly removing `/usr/include` from `CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` so it worked in `CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES`. By not filtering out `/usr/include` from user-specified include directories, we allow the code include_directories(${CMAKE_SYSROOT}/usr/include) to place the include directory too early on the command line. Fix support for standard include directories to not be filtered by implicit include directories, and do not remove `/usr/include` from the list of implicit include directories for Android builds. Add a test case to verify that an explicit `/usr/include` is ignored in favor of the standard directory at the end. Fixes: #17059
* IPO: Consider support for each language separatelyBrad King2017-06-141-8/+15
| | | | | | | | | We only define `INTERPROCEDURAL_OPTIMIZATION` behavior for C, CXX, and Fortran languages. Do not try to enable support for other languages. Furthermore, each language builds with a different compiler, so check for support by CMake and the compiler for each language independently. Fixes: #16944
* Merge topic 'lint-function-args'Brad King2017-06-051-1/+1
|\ | | | | | | | | | | | | b1ec5dea Pass large types by const&, small types by value Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !927
| * Pass large types by const&, small types by valueDaniel Pfeifer2017-06-031-1/+1
| |
* | Provide and use CM_FALLTHROUGHDaniel Pfeifer2017-06-031-3/+8
|/
* Remove second arg: npos in substr usagesPavel Solodovnikov2017-06-011-1/+1
|
* Access string npos without instancePavel Solodovnikov2017-06-011-3/+3
|
* CMP0069: Suppress warning if we are in 'try_compile'Ruslan Baratov2017-05-101-1/+3
| | | | Fixes: #16855
* Features: Refactor <LANG>_STANDARD updateBrad King2017-05-011-0/+13
| | | | | | | | | In order to support generator expressions in target COMPILE_FEATURES we apply them at generate time. Move this step to the beginning of generation instead of doing it on demand while collecting flags. This avoids repeating the process unnecessarily, and will then allow `cmLocalGenerator::AddCompilerRequirementFlag` to be used any time during generation.
* Merge topic 'clang-tidy'Brad King2017-04-241-37/+29
|\ | | | | | | | | | | | | | | | | | | 73020305 clang-tidy: avoid copy b432e933 clang-tidy: use .empty() to check emptyness 012972a9 clang-tidy: remove reduntant .data() calls b26577c9 clang-tidy: remove else after break and continue Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !734
| * clang-tidy: remove else after break and continueDaniel Pfeifer2017-04-211-37/+29
| |
* | Merge topic 'enable_ptx_compilation'Brad King2017-04-211-0/+12
|\ \ | | | | | | | | | | | | | | | | | | 23691d78 CUDA: Allow sources to be compiled to .ptx files Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !725
| * | CUDA: Allow sources to be compiled to .ptx filesRobert Maynard2017-04-201-0/+12
| |/ | | | | | | | | When the target property `CUDA_PTX_COMPILATION` is enabled CUDA OBJECT libraries will generate ptx files instead of object files.
* | Replace boolean `implib` parameters with enumGregor Jasny2017-04-201-95/+131
|/ | | | | Named enumeration values are much clearer at call sites and add more type safety.
* Merge topic 'objlib-extend'Brad King2017-04-191-0/+40
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | eec93bce Allow OBJECT libraries to be installed, exported, and imported 93c89bc7 Genex: Allow TARGET_OBJECTS to be used everywhere ac0cf7ff Genex: Reject TARGET_OBJECTS on non-object libraries earlier 8577978c Tests: ExportImport C code should use explicit (void) in prototypes 26cfd039 cmInstallTargetGenerator: Re-order GenerateScriptForConfig logic 25f3f22a cmGlobalGenerator: Add method to check if object file location is known d596c550 cmGeneratorTarget: Add method to get the object file directory 930042f2 cmGeneratorTarget: Factor out a GetTargetObjectNames method ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !712
| * cmGeneratorTarget: Add method to get the object file directoryBrad King2017-04-181-0/+13
| | | | | | | | | | Add a `GetObjectDirectory` method to get the target's object file directory for a specific configuration.
| * cmGeneratorTarget: Factor out a GetTargetObjectNames methodBrad King2017-04-181-0/+27
| |
* | Merge topic 'fix-CMP0026-old'Brad King2017-04-181-0/+20
|\ \ | |/ |/| | | | | | | | | 5e616fcf CMP0026: Fix OLD behavior with file written during configure step Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !710
| * CMP0026: Fix OLD behavior with file written during configure stepBrad King2017-04-171-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | cmGeneratorTarget: Drop obj libs from GetConfigCommonSourceFilesBrad King2017-04-131-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | 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).
* | cmGeneratorTarget: Add method to collect all sources for all configsBrad King2017-04-131-0/+37
| | | | | | | | | | | | 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.
* | Merge topic 'xcode-remove-UseObjectLibraries'Brad King2017-04-131-35/+0
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | cmGeneratorTarget: Drop unused UseObjectLibraries methodBrad King2017-04-121-35/+0
| | |
* | | Merge topic 'include-style'Brad King2017-04-131-1/+1
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | 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
| * | Use quotes for non-system includesDaniel Pfeifer2017-04-111-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | 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'
* | cmGeneratorTarget: Drop unused GetIDLSources methodBrad King2017-04-111-6/+0
|/
* cmGeneratorTarget: Replace source classifier implementationBrad King2017-04-071-259/+145
| | | | | Compute and memoize the list of sources with their kinds for each configuration just once.
* cmGeneratorTarget: Remove unnecessary conditionBrad King2017-04-071-2/+0
| | | | Remove a condition where the "then" and "else" cases do the same thing.
* Merge topic '16733-bundle-genex'Brad King2017-03-311-29/+35
|\ | | | | | | | | | | | | | | | | | | | | 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
| * Genex: Add `TARGET_BUNDLE_[CONTENT_]_DIR` generator expressionsGregor Jasny2017-03-301-2/+8
| | | | | | | | Closes #16733
| * cmGeneratorTarget: Call GetFrameworkDirectory in GetFullNameInternalGregor Jasny2017-03-301-7/+1
| |
| * cmGeneratorTarget: Use enum to describe bundle directory query levelGregor Jasny2017-03-301-20/+26
| |
* | Merge topic 'ipo-policy-CMP0069'Brad King2017-03-311-10/+75
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | 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
| * Implement interprocedural optimization for GNU compilersRuslan Baratov2017-03-301-7/+16
| | | | | | | | | | Honor the `INTERPROCEDURAL_OPTIMIZATION` target property for GNU compilers by activating their link-time-optimization (LTO) flags.
| * Add policy CMP0069 to enforce INTERPROCEDURAL_OPTIMIZATIONRuslan Baratov2017-03-301-1/+57
| | | | | | | | | | | | | | | | | | 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.
| * Refactoring: s,GetFeatureAsBool,IsIPOEnabled,Ruslan Baratov2017-03-301-3/+3
| | | | | | | | | | Method 'GetFeatureAsBool' is used only with 'INTERPROCEDURAL_OPTIMIZATION' feature. Substituting 'GetFeatureAsBool' with 'IsIPOEnabled'.
* | Apple: Fix Resources location for all generatorsGregor Jasny2017-03-231-1/+9
| | | | | | | | Issue: #16680