summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'fix-OBJECT_DEPENDS-after-path-normalization'Brad King2015-01-291-0/+8
|\ | | | | | | | | 9259d778 Normalize OBJECT_DEPENDS paths to match custom commands (#15366)
| * Normalize OBJECT_DEPENDS paths to match custom commands (#15366)Brad King2015-01-281-0/+8
| | | | | | | | | | | | | | | | | | | | Custom command path normalization added in commit v3.1.0-rc1~471^2 (add_custom_command: Normalize OUTPUT and DEPENDS paths, 2014-05-28) broke use of OBJECT_DEPENDS to bring in custom commands because the latter paths were not normalized too. Normalize them and add a test case. Reported-by: Daniel v. Gerpen
* | Merge topic 'drop-ancient-workarounds'Brad King2015-01-121-2/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0f7bdd61 Remove VS 6 special case. 5e92c826 Remove some obsolete stuff. 15e42bb2 cmStandardIncludes: Remove obsolete cmOStringStream. 931e055d Port all cmOStringStream to std::ostringstream. f194a009 Remove unused cmIStringStream class. 3ec1bb15 cmStandardIncludes: Remove std namespace hack. bb3bce70 cmStandardIncludes: Remove ANSI_FOR_SCOPE hack. 28fa4923 cmStandardIncludes: Remove iostreams workaround for obsolete Compaq compiler. 837a8a63 cmStandardIncludes: Drop Comeau-related workaround. 4030ddfd Remove Borland-related undef. 17d6a6fd cmStandardIncludes: Remove comment about Borland. 26fb5011 Drop SGI as a CMake host compiler.
| * | Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-2/+2
| | | | | | | | | | | | All compilers hosting CMake support the std class.
* | | Use two-iterator std::set::insert where appropriate.Stephen Kelly2015-01-111-5/+1
| | |
* | | Use insert instead of a loop in some cases.Stephen Kelly2015-01-111-5/+1
|/ / | | | | | | | | | | Limit this change to inserting into a vector from a vector. A follow up change can use insert for inserting into a set.
* | cmGeneratorTarget: Remove MSVC7 workaroundStephen Kelly2014-11-201-20/+0
| | | | | | | | Use partial specialization everywhere.
* | file(GENERATE): Evaluate early to allow generating source filesStephen Kelly2014-11-121-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The evaluation files must be known before cmTargetTraceDependencies attempts to find them, but we must actually generate the files after cmTargetTraceDependencies, as that can add to target SOURCES. The limitation is that the generated output name must not depend on the SOURCES of a target if the generated file is used by that target. Mark the output files as GENERATED so that trace dependencies does not expect them to already exist in the filesystem. Move the invokation of ForceLinkerLanguage in the Generate logic to after the generated file names are known. ForceLinkerLanguage tries to determine the sources of a target (in order to determine an already-known language) and otherwise fails to get information about the generated file. Test that the output of file(GENERATE) can be used as a target source file and that accessing the target SOURCES in the name of the output file is an error. Accessing the TARGET_OBJECTS would be a similar error if it was legal to use that generator expression in this context. That is not currently possible and is a different error condition, so test the current error output as a reminder to change the expected output if that becomes possible in the future. Test that generated rule files resulting from cmTargetTraceDependencies appear in the SOURCES generated in the output file.
* | strings: Remove redundant calls to std::string::c_str()Nils Gladitz2014-10-151-2/+2
|/ | | | | Replacements were detected and performed by the clang tool remove-cstr-calls on a linux build.
* Simplify use of binary_search.Stephen Kelly2014-09-171-3/+1
| | | | | A local string was created when dir was a const char*. Now dir is a std::string already so the dirString is vestigal.
* VS: Handle .pfx files explicitly in generatorGilles Khouzam2014-08-211-0/+14
| | | | | | | | Teach cmGeneratorTarget to classify .pfx files as package certificate key files. Teach cmVisualStudio10TargetGenerator to write them as PackageCertificateKeyFile in .vcxproj files. Inspired-by: Minmin Gong <minmin.gong@gmail.com>
* VS: Handle AppxManifest sources explicitly in generatorGilles Khouzam2014-08-211-0/+14
| | | | | | | Teach cmGeneratorTarget to extract .appxmanifest sources separately. Teach cmVisualStudio10TargetGenerator to write them with the AppxManifest tool in .vcxproj files. This will allow us to detect whether the project provides an application manfiest explicitly.
* Refactor system include annotation propagationBrad King2014-07-161-34/+7
| | | | | | | | Since commit v3.0.0-rc1~174^2~1 (cmTarget: Fix system include annotation propagation, 2014-01-01) the cmGeneratorTarget::IsSystemIncludeDirectory method needs to collect all targets that might provide INTERFACE_(|SYSTEM)_INCLUDE_DIRECTORIES for the current target. We now have cmTarget::GetLinkImplementationClosure to provide this, so use it.
* add_library: Allow arbitrary non-linked sources in OBJECT librariesBrad King2014-07-091-5/+2
| | | | | | | | | | | Loosen this restriction on OBJECT libraries to allow source files of any name to be generated by custom commands or listed for reference in IDE projects so long as they would not affect linking of a normal library. Update the rejection message to be more specific about the looser restriction. Extend the ObjectLibrary test to cover a ".cmake" file generated by a custom command in an OBJECT library.
* cmTarget: Refactor LinkImplementation to allow more informationBrad King2014-07-071-2/+2
| | | | | | | Create a cmLinkImplItem class derived from cmLinkItem so more information can be added to link implementation entries than link interface entries. Convert the LinkImplementation Libraries member to hold it. Update client sites accordingly.
* cmTarget: Lookup targets in LinkInterface and LinkImplementationBrad King2014-06-231-2/+2
| | | | | | | | | | | | | | | Instead of storing just the string names in these structures, lookup any target associated with each item and store its cmTarget pointer. Use the cmLinkItem class to hold the name and pointer together. Update client sites to use the pre-stored lookup result instead of looking up the target name again. Create a cmTarget::LookupLinkItems helper method to handle the lookup. Since lookups are now moving from cmComputeLinkDepends::AddLinkEntries to cmTarget::LookupLinkItems, move use of CheckCMP0004 to the latter. This drops use of CheckCMP0004 from entries added for _LIB_DEPENDS variables by cmComputeLinkDepends::AddVarLinkEntries, but I do not think that use was intentional originally anyway.
* Fix scope of transitive target name lookupsBrad King2014-06-231-1/+1
| | | | | | | | | | | In cmTarget, cmGeneratorTarget, and cmGeneratorExpressionEvaluator, fix target name lookups to occur in the cmMakefile context of the target that referenced the name, not the current 'head' target. The context matters for imported targets because they are directory-scoped instead of globally unique. We already do this in cmComputeLinkDepends and cmComputeTargetDepends. Extend the InterfaceLibrary test with an example covering this behavior.
* cmTarget: Constify GetTransitivePropertyTargets resultsBrad King2014-06-231-5/+5
| | | | Populate a vector of "cmTarget const*" instead of "cmTarget*".
* cmTarget: Remove 'head' argument from GetLinkImplementationBrad King2014-06-231-1/+1
| | | | | | | | | | | | | Many of the 'head' arguments added by commit v2.8.11~289^2~1 (Make linking APIs aware of 'head' target, 2013-01-04) turned out not to be needed. The "link implementation" of a target never needs to be computed with anything but itself as the 'head' target (except for CMP0022 OLD behavior because then it is the link interface). Remove the unused 'head' target paths. Add "internal" versions of cmTarget::GetDirectLinkLibraries and GetLinkImplementationLibraries to support the CMP0022 OLD behavior without otherwise exposing the 'head' target option of these methods.
* genex: remove the need for backtracesBen Boeckel2014-06-051-8/+5
| | | | | Rather than making dummy backtraces and passing them around, just make backtraces optional.
* Ninja: Fix Intel interprocedural optimization with static librariesBrad King2014-05-211-2/+14
| | | | | Teach cmGeneratorTarget::GetCreateRuleVariable about the IPO variant. Return the static library IPO rule when the feature is enabled.
* cmGeneratorTarget: Improve GetCreateRuleVariable APIBrad King2014-05-211-5/+7
| | | | | Pass the language and configuration to the method so it can return the complete rule variable name.
* cmTarget: Add all sources traced from custom commands at once.Stephen Kelly2014-04-091-2/+5
| | | | | | | | | | | | | | | | The AddSource method accepts one file and tries to avoiding adding it to the sources-list of the target if it already exists. This involves creating many cmSourceFileLocation objects for matching on existing files, which is an expensive operation. Avoid the searching algorithm by appending the new sources as one group. Generate-time processing of source files will ensure uniqueness. Add a new AddTracedSources for this purpose. The existing AddSources method must process the input for policy CMP0049, but as these source filenames come from cmSourceFile::GetFullPath(), we can forego that extra processing.
* cmGeneratorTarget: Trace cmSourceFile objects instead of strings.Stephen Kelly2014-04-061-16/+15
| | | | | | | | This reverses the decision in commit d38423ec (cmTarget: Add a method to obtain list of filenames for sources., 2014-03-17). The cmSourceFile based API is preferred because that avoids creation of many cmSourceFileLocation objects for matching strings, and the result is cached by cmTarget.
* cmTarget: Cache the cmSourceFiles in GetSourceFiles.Stephen Kelly2014-04-061-9/+9
| | | | | | Avoid calling GetSourceFiles with the same result container multiple times when tracing target dependencies. The result from the previous configuration is cached and used later otherwise.
* cmTarget: Make the source files depend on the config.Stephen Kelly2014-04-021-19/+52
| | | | | | | | | | | | | | | | | Disallow the use of config-specific source files with the Visual Studio and Xcode generators. They don't have any way to represent the condition currently. Use the same common-config API in cmQtAutoGenerators. While it accepts config-specific files, it doesn't have to support multiple configurations yet. Loop over the configs in cmTargetTraceDependencies and cmGlobalGenerator::WriteSummary and consume all source files. Loop over the configs in cmComputeTargetDepends and compute the object library dependencies for each config.
* cmGeneratorTarget: Don't add computed sources to the target.Stephen Kelly2014-04-021-1/+5
| | | | | | | | | | | | | | | When config-specifig generator expressions are supported, a target may have SOURCES: src1.cpp $<$<CONFIG:Debug>:src2.cpp> $<$<CONFIG:Release>:src3.cpp> and computation in cmTargetTraceDependencies would add each of the src2.cpp and src3.cpp sources back to the target without a config-guard. That would make the sources be used later when generating the buildsystem, regardless of the configuration. Avoid calling AddSource on the target with the result of the GetSourceFiles call.
* cmGeneratorTarget: Compute target objects on demandStephen Kelly2014-04-021-6/+25
| | | | | | | | | | | | | | | | | | | | | Add a ComputeObjectMapping method to compute the object names. It takes mapping to populate as an out-parameter so that it can be extended in the future with parameters relevant to generator expression evaluation. Remove the supporting cmGeneratorTarget::AddObject method. It is no longer needed as the container member is populated directly. The ComputeObjectMapping method is called whenever objects are requested from the cmGeneratorTarget. Because the Xcode generator makes no such request, explicitly invoke the method from that generator so that the logic of checking for bad sources in object libraries is executed. In a follow-up, the UseObjectLibraries usage may be replaced by a true generator expression evaluator for TARGET_OBJECTS. That will require generators to use cmGeneratorTarget::GetExternalObjects which is not currently the case for Xcode and VS generators.
* cmGeneratorTarget: Compute consumed object libraries on demand.Stephen Kelly2014-04-021-53/+19
| | | | | | | Remove up-front object library computation from cmGlobalGenerator. Adjust tests for message coming from the generator expression evaluation.
* cmComputeTargetDepends: Track object library depends.Stephen Kelly2014-04-021-1/+0
| | | | Relieve cmGeneratorTarget of that responsibility.
* cmTarget: Add a method to obtain list of filenames for sources.Stephen Kelly2014-03-311-12/+12
|
* add_custom_command: Evaluate generator expressions in DEPENDSStephen Kelly2014-03-201-5/+34
| | | | | | | Rely on evaluation in cmCustomCommandGenerator for the generators. When tracing target dependencies, depend on the union of dependencies for all configurations.
* cmGeneratorTarget: Don't store ObjectSources for object libraries.Stephen Kelly2014-03-151-6/+4
| | | | Compute them on demand instead.
* cmGeneratorTarget: Constify cmSourceFile* in containers.Stephen Kelly2014-03-131-10/+17
| | | | | Some of them will be used with other APIs which require value_type to be cmSourceFile const*.
* cmGeneratorTarget: Make GetSourceDepends const.Stephen Kelly2014-03-131-1/+1
|
* cmGeneratorTarget: Constify the AddExplicitObjectName API.Stephen Kelly2014-03-131-1/+1
| | | | The storage is already const.
* cmGeneratorTarget: Constify the AddObject API.Stephen Kelly2014-03-131-1/+2
| | | | The storage is already const.
* Remove some c_str() calls.Stephen Kelly2014-03-111-8/+8
| | | | | | Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
* stringapi: Pass configuration names as stringsBen Boeckel2014-03-081-14/+16
|
* cmTarget: Refactor GetLocation APIBrad King2014-03-081-1/+1
| | | | | | | | | When given a non-NULL configuration the GetLocation returned the location for the given configuration. When given a NULL configuration the GetLocation method returned a location with the build-system placeholder for the configuration name. Split the latter use case out into a separate GetLocationForBuild method and update call sites accordingly.
* strings: Remove cmStdString referencesBen Boeckel2014-03-081-4/+4
| | | | | | | | | | | Casts from std::string -> cmStdString were high on the list of things taking up time. Avoid such implicit casts across function calls by just using std::string everywhere. The comment that the symbol name is too long is no longer relevant since modern debuggers alias the templates anyways and the size is a non-issue since the underlying methods are generated since it's inherited.
* stringapi: Use strings in target nameBen Boeckel2014-03-081-2/+2
|
* stringapi: Use strings for the languagesBen Boeckel2014-03-081-1/+1
|
* stringapi: Use strings for property namesBen Boeckel2014-03-081-2/+2
| | | | Property names are always generated by CMake and should never be NULL.
* Handle Mac OSX source flags for individual files lazily.Stephen Kelly2014-02-241-26/+17
| | | | | The actual list of files will become config dependent in a follow-up commit.
* cmGeneratorTarget: Classify sources on demand, not up front.Stephen Kelly2014-02-241-114/+235
| | | | | | | | | | Implement a Visitor to hold the sequence of source file tests for populating outputs. Use VS 6 and 7 workaround from Brad King for lack of partial template specialization and function template specialization capabilities. This will make it possible to use context dependent generator expressions to determine the sources of a target.
* cmGeneratorTarget: Use a method to access the definition file.Stephen Kelly2014-02-241-0/+6
|
* cmTarget: Change GetTransitivePropertyLinkLibraries to output targets.Stephen Kelly2014-02-241-20/+12
| | | | | | | The callers already skip non-targets, so unify the target search. Change supporting functions to accept a container of targets instead of strings where possible.
* cmTarget: Move SourceFileFlags to cmGeneratorTarget.Stephen Kelly2014-02-241-1/+105
|
* cmTarget: Don't try to get sources of an INTERFACE_LIBRARY.Stephen Kelly2014-02-141-4/+7
| | | | An an assert to ensure this.