If ComputeLinkImplementationLanguages were ever to cause
GetLinkImplementationLibraries to be invoked then a LinkImplMap entry
may appear in the middle of computing it in GetLinkInformation. Instead
create the map entry up front and store in it boolean values indicating
which pieces of the LinkImplementation structure have been populated.
This approach leads to shorter code that is easier to follow too.
Members of the cmTargetInternals structure do not need to be made
'mutable' even to cache data because there is no reason for the
internal methods to be 'const'.
Teach GetTransitivePropertyTargets to use the GetLinkInterfaceLibraries
method with usage_requirements_only==true instead of evaluating the
INTERFACE_LINK_LIBRARIES property directly. This avoids duplicate
evaluations and makes use of the caching done by
GetLinkInterfaceLibraries.
Add a 'usage_requirements_only' parameter to GetLinkInterfaceLibraries
and supporting internal APIs to pass through to ExpandLinkItems so it
knows whether to use SetTransitivePropertiesOnly while evaluating
generator expressions.
Simplify the implementation of GetTransitivePropertyTargets by using
ExpandLinkItems with usage_requirements_only==true to evaluate the
generator expressions in the link interface for us.
Add a 'usage_requirements_only' parameter to ExpandLinkItems so that it
knows whether to use SetTransitivePropertiesOnly while evaluating
generator expressions. Update existing call sites to pass 'false' since
they are for linking and not usage requirements.
Since commit 6557382d (stringapi: Use strings for program
paths, 2014-02-24), cmGlobalGenerator::GenerateBuildCommand
takes the make program path as a std::string. Fix the lookup
in cmCPackGenerator::InstallProjectViaInstallCMakeProjects to
use GetSafeDefinition for CMAKE_MAKE_PROGRAM to avoid possible
construction of std::string from a NULL.
Reported-by: Richard Wirth <richard@califax.de>
Since commit v2.8.12~436^2 (VS 10: Escape ; as %3B in preprocessor
definitions, 2013-04-11) the Tests/Preprocessor/CMakeLists.txt file no
longer uses the PP_VS1XX values, so stop setting them.
Installing large directories, e.g., the output of a doxygen run, prints
one line per file resulting in too much noise in the build output. Add
an option to the install(DIRECTORY) command to not print anything upon
make install.
Extend the RunCMake.install test with cases covering MESSAGE_NEVER
behavior of the install(DIRECTORY) command.
Suggested-by: Stefan Eilemann <Stefan.Eilemann@epfl.ch>
Create a variable to allow users to control which installation
messages are printed. In particular, provide a "LAZY" setting
that prints "Installing" messages but not "Up-to-date" messages.
This is desirable for incremental re-installations.
Suggested-by: J Decker <d3ck0r@gmail.com>
Create a cmInstallGenerator::MessageLevel enumeration for future use in
specifying install message verbosity. Thread values of the type through
constructors and save the value as a member of cmInstallGenerator.
Use only a "MessageDefault" value for now.
Create options "MESSAGE_ALWAYS", "MESSAGE_LAZY", and "MESSAGE_NEVER" to
specify whether to print the "Installing" and "Up-to-date" messages.
Extend the RunCMake.file test with cases covering these options.
Teach cmFileCopier::InstallDirectory to detect whether the destination
directory exists. If so, report it as "Up-to-date" instead of
"Installing". This resolves message asymmetry with file installations.
Extend the RunCMake.file and RunCMake.install tests to check the
installation output on both the first and second run.
Suggested-by: J Decker <d3ck0r@gmail.com>
When installing a DIRECTORY, do not pre-create the DESTINATION. The
cmFileCopier::InstallDirectory method will create the directory anyway.
Give it a chance to detect whether the directory already exists or not.
Extend the cmake command-line interface to support
cmake -E env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...
This will be useful to run processes with modified environments
without using a shell or a full "cmake -P" script to wrap it.
Extend the RunCMake.CommandLine test to cover success and failure cases.
Inspired-by: Jonathan Bohren <jbo@jhu.edu>
From the GCC 4.9 release notes for Fortran:
https://gcc.gnu.org/gcc-4.9/changes.html
"Module files: The version of the module files (.mod) has been
incremented; additionally, module files are now compressed."
Teach cmDependsFortran::ModulesDiffer to look for the gzip magic numbers
at the beginning of the module file. If found, assume the module was
produced by gfortran >= 4.9. The modules do not appear to contain the
date as earlier versions did so we can compare the content directly
and do not actually need to decompress.
Since commit 84fdc9921 (stringapi: Pass configuration names as strings,
2014-02-09), it is not safe to use GetDefinition("CMAKE_BUILD_TYPE")
without checking the return value. Use GetSafeDefinition instead so
that a missing definition is treated as an empty string like code paths
did prior to the above commit.
Reported-by: Richard Wirth <richard@califax.de>
Use GetLinkImplementationLibraries instead of GetDirectLinkLibraries
because it tells us whether there will be any libraries to link after
evaluating generator expressions. Also GetDirectLinkLibraries will be
dropped soon.
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.
Add a method like GetUtilities but that provides the target names
already looked up and resolved to cmTarget pointers internally. Update
call site in cmComputeTargetDepends::AddTargetDepend to use the
already-found target instead of looking it up again.
Many items named in target_link_libraries calls are targets, but not
all. Create a cmLinkItem type that acts like std::string so it can name
an item but also has a pointer to a cmTarget that is the result of
looking up the item name in the referencing target's scope. This will
be useful to avoid duplicate lookup operations later.
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.
Move generator expression evaluation for imported library lists out of
GetImportInfo and into a new GetImportLinkInterface helper. This avoids
duplicating the computation and storage of all imported target info just
because some of it is parameterized on the 'head' target.
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.