Commit Graph

447 Commits

Author SHA1 Message Date
Stephen Kelly bc1211fa7d cmLocalUnixMakefileGenerator3: Remove unused variable. 2015-06-13 08:38:19 +02:00
Stephen Kelly 59e21ffa13 Port static calls from cmLocalGenerator to cmOutputConverter. 2015-06-06 09:15:58 +02:00
Stephen Kelly 363caa2fa5 cmLocalGenerator: De-virtualize Configure().
The generators that override it do so in order to populate
data members which can instead be populated in Generate().
2015-06-04 09:06:40 -04:00
Stephen Kelly 3b880a0741 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
Refactor the local generator creation API to accept a
cmState::Snapshot.  Adjust MakeLocalGenerator to use the 'current'
snapshot in cases where there is no parent.  Create the snapshot
for subdirectories in cmMakefile::AddSubdirectory.

This means that snapshots are now created at the point of extending the tree,
as appropriate, and independently of the cmLocalGenerator and cmMakefile they
represent the state for.
2015-05-27 09:18:32 -04:00
Brad King 6fbd4cae0d Use cmSystemTools::GetCMakeCommand() to get path to cmake internally
This is much simpler than finding a way to lookup "CMAKE_COMMAND"
everywhere.
2015-05-20 11:20:42 -04:00
Brad King be248ab435 Merge topic 'refactor-cmLocalGenerator'
fa9eb814 cmLocalGenerator: Remove redundant path access.
1933f3d1 cmLocalGenerator: Remove redundant path conversions.
9e4b6cc2 cmState: Store computed relative paths to to current directories.
991f5e49 cmState::Snapshot: Store components for current directories.
57bdc1a2 cmState: Compute and store directory components.
2015-05-19 11:09:39 -04:00
Stephen Kelly 684e5cefb2 cmGlobalGenerator: Host the MakeSilentFlag. 2015-05-18 20:06:20 +02:00
Stephen Kelly 2047144f49 cmLocalGenerator: Remove unused IgnoreLibPrefix. 2015-05-18 20:06:20 +02:00
Stephen Kelly 333c1fa83b cmGlobalUnixMakefileGenerator3: Host the UnixCD. 2015-05-18 20:06:16 +02:00
Stephen Kelly a97df5e135 cmGlobalUnixMakefileGenerator3: Host the PassMakeflags. 2015-05-18 20:03:49 +02:00
Stephen Kelly 9e4b6cc2ce cmState: Store computed relative paths to to current directories. 2015-05-16 08:12:02 +02:00
Stephen Kelly cf7f03e522 cmGlobalUnixMakefileGenerator3: Host the DefineWindowsNULL. 2015-05-16 05:20:36 +02:00
Stephen Kelly e9b134b95d cmGlobalUnixMakefileGenerator3: Host the include directive.
There is no sense in copying this to each cmLocalGenerator.
2015-05-16 05:20:12 +02:00
Stephen Kelly b17686d2bb cmGlobalGenerator: Move some flags from cmLocalGenerator.
These flags are global, and so they belong here instead of being
set on each local generator.
2015-05-14 20:36:28 +02:00
Stephen Kelly 34c9ee2ed7 cmLocalGenerator: Require a global generator in the constructor.
Port generator factory methods to pass it.
2015-05-14 20:36:27 +02:00
Stephen Kelly 9486769866 Don't use a cmLocalGenerator instance to call static methods. 2015-05-14 20:30:09 +02:00
Stephen Kelly a48aebcb67 cmLocalGenerator: Require a parent in the constructor.
Pass the parent though cmGlobalGenerator::CreateLocalGenerator.

This will make it easy to initialize state scopes independent of
cmMakefile.
2015-04-28 07:50:52 +02:00
Stephen Kelly 32b8f03acc cmMakefile: Port users of GetStart* methods to new names. 2015-04-21 00:15:20 +02:00
Stephen Kelly 54d6a9187f cmMakefile: Rename GetCurrent{Output,Binary}Directory.
Match names used in CMake code.
2015-04-21 00:12:52 +02:00
Stephen Kelly 6e23a4bddd cmMakefile: Remove always-null first parameter to ReadListFile. 2015-04-18 15:31:18 +02:00
Stephen Kelly 7916d7bac6 Include cmAlgorithms where it is used. 2015-03-11 00:17:29 +01:00
Brad King ad6fbb88bb Merge topic 'target-language-genex'
232a6883 Help: Add release notes for target-language-genex.
9e168941 File(GENERATE): Process genex evaluation files for each language.
b734fa44 Genex: Allow COMPILE_LANGUAGE when processing include directories.
0b945ea9 Genex: Allow COMPILE_LANGUAGE when processing compile definitions.
5c559f11 Genex: Enable use of COMPILE_LANGUAGE for compile options.
e387ce7d Genex: Add a COMPILE_LANGUAGE generator expression.
4a0128f4 VS6: Compute CMAKE_*_FLAGS and COMPILE_DEFINITIONS* only when needed
2015-03-10 09:12:34 -04:00
Stephen Kelly b734fa4471 Genex: Allow COMPILE_LANGUAGE when processing include directories.
Issue an error if this is encountered by an IDE generator.
2015-03-09 20:49:17 +01:00
Stephen Kelly 0b945ea9a6 Genex: Allow COMPILE_LANGUAGE when processing compile definitions.
Issue an error if this is encountered by an IDE generator.
2015-03-09 20:49:16 +01:00
Brad King 387466dd95 Merge topic 'custom-command-multiple-outputs'
66a9c90c Makefile: Fix multiple custom command outputs regression (#15116)
2015-03-09 09:45:51 -04:00
Brad King 66a9c90c4b Makefile: Fix multiple custom command outputs regression (#15116)
In commit v3.2.0-rc1~272^2~2 (Makefile: Fix rebuild with multiple custom
command outputs, 2014-12-05) we changed the generated makefile pattern
for multiple outputs from

  out1: depends...
          commands...
  out2: out1

to

  out1 out2: depends...
          commands...

This was based on the incorrect assumption that make tools would treat
this as a combined output rule and run the command(s) exactly once for
them.  It turns out that instead this new pattern is equivalent to

  out1: depends...
          commands...
  out2: depends...
          commands...

so the commands may be run more than once.

Some documents suggest using a "dedicated witness" stamp file:

  stamp: depends...
          rm -f stamp
          touch stamp.tmp
          commands...
          mv stamp.tmp stamp
  out1 out2: stamp

However, if the commands fail the error message will refer to the stamp
instead of any of the real outputs, which may be confusing to readers.
Also, this approach seems to have the same behavior of the original
approach that motiviated the above commit: multiple invocations are
needed to bring consumers of the outputs up to date.

Instead we can return to the original approach but add an explicit
touch to each extra output rule:

  out1: depends...
          commands...
  out2: out1
          touch -c out2

This causes make tools to recognize that all outputs have changed and
therefore to execute any commands that consume them.
2015-03-06 19:58:30 -05:00
Stephen Kelly 37b88d348a cmAlgorithms: Add cmWrap.
Port some existing cmJoin to use it.

cmJoin is cumbersome to use in cases where the objective is to
somehow 'quote' each item and then join it with a separator.  In that
case, the joiner string is harder to read and reason about.  cmWrap
aims to solve that.

Provide an overload taking char wrappers to simplify the case
of surrounding every element in quotes without needing to escape
the quote character.
2015-02-20 21:35:58 +01:00
Stephen Kelly a281809384 Use cmJoin where possible. 2015-02-20 21:26:18 +01:00
Brad King e6ae3c6ae0 Merge topic 'use-cmRange'
7c3f6376 Convert loop into two algorithms.
8a399c8c Convert loop to the common pattern.
abfca975 Move loop inside of condition.
0b61b86d Handle last element outside of the loop.
e21f7829 cmTarget: Use a sorted vector in place of a set.
559dc155 cmSet: Replace loop with cmJoin.
0ea71932 cmFindBase: Replace loop with cmJoin on range.
9380e85f Convert loops to cmJoin algorithm with cmRange.
bb10012f cmStringCommand: Accumulate with cmJoin and range adaptors.
0c12f1ea cmAlgorithms: Add a range adaptor and API for adjusting a range.
27c6f017 Use cmJoin to accumulate string ranges.
4e78ebbd cmAlgorithms: Add a Range container and adaptor method.
89102249 Replace common loop pattern with cmJoin
7b8725bf Convert loops populating maybe-empty content into the common pattern.
7ee56f03 Convert loops into the commonly used pattern.
0a4e5674 cmMacroCommand: Remove counting variable.
...
2015-02-12 11:53:04 -05:00
Stephen Kelly 7c3f637680 Convert loop into two algorithms. 2015-02-11 22:58:09 +01:00
Stephen Kelly 8a399c8c9f Convert loop to the common pattern. 2015-02-11 22:58:09 +01:00
Stephen Kelly abfca97525 Move loop inside of condition.
The loop is only executed if the condition is true.
2015-02-11 22:58:09 +01:00
Stephen Kelly 0b61b86df8 Handle last element outside of the loop.
There is no point in checking on each loop iteration whether
it is the last element.
2015-02-11 22:58:08 +01:00
Brad King 939167a65c Merge topic 'makefile-missing-comment'
eeb2831b Makefile: Fix regression in target-bound custom command COMMENT output
2015-02-11 09:59:18 -05:00
Brad King 001cd08187 Merge branch 'makefile-missing-comment' into release 2015-02-10 09:46:23 -05:00
Brad King e2619c13f7 Merge topic 'use-algorithms'
d8639733 cmSystemTools: Remove unnecessary comparison.
803317aa cmSystemTools: Early return if size makes later comparison false.
11093a03 Replace temporary bool by inlining warning condition.
6cd2ee95 Replace loop with member algorithm.
94e993a0 cmComputeLinkDepends: Remove temporary iterator copy.
69dbe51b Replace loop with algorithm.
683fafea Replace a loop with std::transform.
63f584b6 Replace while loop with member insert.
74c4d9d2 Take a size check outside of an inner loop.
71d47115 Use insert member instead of back_inserter.
39622c99 Convert while loop to member insert.
a7fcc148 Convert loop to algorithm.
d46c4f07 Extract a prefix variable from loop.
d59913f0 Take computation out of loop.
3f3db744 cmMakefile: Remove ExpandSourceListArguments.
bd990c80 Remove use of ExpandSourceListArguments.
...
2015-02-10 09:37:57 -05:00
Nils Gladitz eeb2831b5f Makefile: Fix regression in target-bound custom command COMMENT output
Fix a logic typo introduced by commit v3.1.0-rc1~781^2 (Generalize
cmCustomCommandGenerator to more fields, 2014-03-10).
2015-02-10 09:22:05 -05:00
Brad King ae775fe804 Makefile: Change link step message color to bold green
Avoid displaying red messages when no error has occurred.
2015-02-06 19:07:56 -05:00
Stephen Kelly a7fcc148bd Convert loop to algorithm. 2015-02-06 19:04:09 +01:00
Stephen Kelly d46c4f0727 Extract a prefix variable from loop. 2015-02-06 19:04:08 +01:00
Stephen Kelly d59913f001 Take computation out of loop. 2015-02-06 19:04:08 +01:00
Brad King 8521fdf56e Makefile: Fix output during parallel builds (#12991)
Replace use of separate "cmake -E cmake_progress_report" and "cmake -E
cmake_echo_color" commands to report the progress and message portions
of build output lines with --progress-* options to the latter to print
everything with a single command.  The line buffering of the stdout FILE
stream should cause the whole line to be printed with one atomic write.
This will avoid inter-mixing of line-wise messages from different
processes during a parallel build.
2015-02-06 08:36:51 -05:00
Brad King 69ac6d2755 bootstrap: Enable color Makefile output
Build the needed infrastructure during bootstrap in order to allow
"cmake -E cmake_echo_color" to be used unconditionally during
generation.
2015-02-05 16:44:56 -05:00
Brad King 3cec0c75f7 Makefile: Generate .NOTPARALLEL without .PHONY (#14312)
In commit v3.0.0-rc1~222^2 (Makefile: Allow "gmake target1 target2 -j",
2013-12-18) we added generation of a .NOTPARALLEL rule and told the
generator it is "symbolic" because the file will never be created.
This causes ".PHONY" to be used.  However, "clearmake" does not support
parsing of .PHONY specifically for .NOTPARALLEL, so simply drop it.
This should not affect the role of the .NOTPARALLEL rule for GNU make.
2015-01-30 09:50:09 -05:00
Brad King 9de2ab7fce Merge topic 'consistent-empty-method'
5f69314e Replace foo.length() pattern with !foo.empty().
fd0c036c Replace 'foo.length() >= 1' pattern with !foo.empty()
f09fde2d Replace 'foo.length() > 0' pattern with !foo.empty().
86b5bdfa Replace 'foo.length() == 0' pattern with foo.empty().
fd7b3712 Replace foo.size() pattern with !foo.empty().
aa773035 Replace !foo.size() pattern with foo.empty().
64592633 cmListCommand: Use empty() and expand whitespace.
607e1938 Replace 'foo.size() != 0' pattern with !foo.empty().
930bd478 Replace 'foo.size() == 0' pattern with foo.empty().
d92887ef Replace 'foo.size() > 0' pattern with !foo.empty().
2015-01-19 09:43:28 -05:00
Stephen Kelly aac44e71e6 Convert raw loops to vector member insert. 2015-01-18 15:14:36 +01:00
Stephen Kelly f09fde2d21 Replace 'foo.length() > 0' pattern with !foo.empty(). 2015-01-18 14:25:25 +01:00
Stephen Kelly fd7b371293 Replace foo.size() pattern with !foo.empty(). 2015-01-18 14:25:24 +01:00
Brad King b5a467262b Merge topic 'drop-ancient-workarounds'
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.
2015-01-12 08:57:39 -05:00
Stephen Kelly 931e055d8c Port all cmOStringStream to std::ostringstream.
All compilers hosting CMake support the std class.
2015-01-11 17:06:03 +01:00
Stephen Kelly 238dd2fbab Use insert instead of a loop in some cases.
Limit this change to inserting into a vector from a vector.

A follow up change can use insert for inserting into a set.
2015-01-11 17:00:55 +01:00
Brad King 6c67b8168c Makefile: Workaround Borland Make bug with multiple outputs
Given a rule of the form

  out1 out2: dep1
  out1 out2: dep2

Borland Make complains that there are multiple rules for "out1"
even though this works when there is only one output.  Instead
generate

  out1 out2: dep1 dep2

for Borland Make, but only when there are multiple outputs.
2014-12-06 07:36:52 -05:00
Brad King 644b4688d7 Makefile: Fix rebuild with multiple custom command outputs (#15116)
Fix the generated makefiles for custom commands with multiple outputs to
list all the outputs on the left hand side of the build rule.  This is
much simpler and more reliable than the old multiple-output-pair
infrastructure.
2014-12-05 09:55:49 -05:00
Tim Gallagher b6b37e3037 Makefile: Add assembly and preprocessed targets for Fortran
Extend the FortranOnly test to cover "make <src>.i" targets.
2014-11-10 10:24:53 -05:00
Tim Gallagher 0842b08463 Makefile: Refactor checks for lang-specific targets and export compile cmds
The checks are now split into languages that are able to generate
assembly listings, languages that are able to generate preprocessed
listings, and languages that are able to export the compile commands.
2014-11-05 14:50:16 -05:00
Nils Gladitz cc1139cc30 strings: Remove redundant calls to std::string::c_str()
Replacements were detected and performed by the clang tool
remove-cstr-calls on a linux build.
2014-10-15 14:54:05 +02:00
Brad King 9f92a78be2 cmLocalGenerator: Rename 'MAKEFILE' to 'MAKERULE'
Rename the internal enumeration value for converting paths destined
for use in Makefile rule syntax.
2014-07-22 12:27:57 -04:00
Ben Boeckel 6fa6bedf78 LocalGenerator: Add a string overload for AppendFlags 2014-05-07 14:30:31 -04:00
Brad King 5376151aa1 Merge topic 'target-transitive-sources'
9407174b target_sources: New command to add sources to target.
81ad69e0 Make the SOURCES target property writable.
6e636f2e cmTarget: Make the SOURCES origin tracable.
3676fb49 cmTarget: Allow transitive evaluation of SOURCES property.
e6971df6 cmTarget: Make the source files depend on the config.
df753df9 cmGeneratorTarget: Don't add computed sources to the target.
869328aa cmComputeTargetDepends: Use valid config to compute target depends.
2014-04-03 12:51:53 -04:00
Stephen Kelly e6971df6ab cmTarget: Make the source files depend on the config.
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.
2014-04-02 23:14:02 +02:00
Jiri Malak 423009c17f Makefile: Generate single-quoted object lists for Watcom
Drop the CMAKE_NO_QUOTED_OBJECTS internal variable from the Makefile
generators.  The underlying problem is with the Watcom linker, not with
WMake.  The Watcom linker wants object files to be single-quoted.  Add
<LINK-RULE>_USE_WATCOM_QUOTE platform information variables to tell the
generators to use Watcom-style single quotes for object files on link
lines.

On Windows, Watcom uses the GetCommandLine API to get the original
command-line string and do custom parsing that expects single quotes.
On POSIX systems, Watcom approximates the original command line by
joining all argv[] entries separated by a single space.  Therefore we
need to double-quote the single-quoted arguments so that the shell does
not consume them and they are available for the parser to see.
2014-03-27 13:45:29 -04:00
Jiri Malak a863a8fecd cmLocalUnixMakefileGenerator3: Re-organize ConvertToQuotedOutputPath
Use one code path whether the components list is empty or not.
Fix indentation accordingly.
2014-03-27 13:45:27 -04:00
Brad King d8fb08a391 Merge topic 'watcom-updates'
64c2342a Watcom: Enable 'WMake Makefiles' generator on Linux
5d9aa66c Watcom: Introduce OpenWatcom compiler id and fix compiler version
9292d3b8 Watcom: Detect compiler target architecture and platform
fbc883c9 Watcom: Add one blank line to Makefile for better readability
2014-03-20 09:22:30 -04:00
Stephen Kelly d83ef53a12 Rename local 'dir_max' variables to 'dir'
The code is not computing the maximum length directory, as is the
case in cmLocalVisualStudioGenerator::ComputeLongestObjectDirectory.
2014-03-17 15:27:01 +01:00
Jiri Malak fbc883c942 Watcom: Add one blank line to Makefile for better readability 2014-03-17 10:23:52 -04:00
Stephen Kelly f6da044080 cmLocalGenerator: Add ComputeObjectFilenames interface.
Implement it in the local generators and use it in the global
generators.
2014-03-13 15:28:02 +01:00
Stephen Kelly 9ad804ac7b cmGeneratorTarget: Constify cmSourceFile* in containers.
Some of them will be used with other APIs which require value_type
to be cmSourceFile const*.
2014-03-13 15:27:23 +01:00
Stephen Kelly d5b2e33be2 Makefiles: Compute local object files on demand.
Don't compute them up front.
2014-03-13 15:27:23 +01:00
Brad King bc993f277e Generalize cmCustomCommandGenerator to more fields
Until now the cmCustomCommandGenerator was used only to compute the
command lines of a custom command.  Generalize it to get the comment,
working directory, dependencies, and outputs of custom commands.  Update
use in all generators to support this.
2014-03-12 10:44:01 -04:00
Brad King d45e7f3461 cmCustomCommand: Return std::string from GetWorkingDirectory 2014-03-12 10:44:00 -04:00
Brad King cb8f87f622 Merge topic 'remove-c_str-calls'
3be265b3 Workaround Sun C++ 5.9 compiler crash
af8a1643 Remove c_str calls when using stream APIs.
21c573f6 Remove some c_str() calls.
2014-03-12 10:42:38 -04:00
Stephen Kelly af8a1643c1 Remove c_str calls when using stream APIs.
Use an ad-hoc clang tool for matching the calls which should be
ported.
2014-03-11 15:03:50 +01:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
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.
2014-03-11 15:03:50 +01:00
Jiri Malak f1b689b64a Makefile: Improve handling of WMake verbose output and errors
* The '-e' option has nothing to do with verbose output.
  It is now properly handled by .ERASE directive in make file

* The '-s' option sets silent output globally, it cannot be switched off.
  It is now handled only by .SILENT directive in make file directive
  is simply controlled by a conditonal block.

Remove SilentNoColon member variable as it is no longer needed.
2014-03-10 11:15:12 -04:00
Ben Boeckel b3bf31a548 stringapi: Miscellaneous char* parameters 2014-03-08 13:05:37 -05:00
Ben Boeckel 270eb96df0 strings: Remove cmStdString references
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.
2014-03-08 13:05:35 -05:00
Ben Boeckel fabf1fbabb stringapi: Use strings in target name 2014-03-08 13:05:31 -05:00
Ben Boeckel ce5114354c stringapi: Use strings for the languages 2014-03-08 13:05:30 -05:00
Clinton Stimpson 5730710c86 Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
2014-01-07 09:27:44 -05:00
Brad King 7974dced73 Merge topic 'make-entry-no-parallel'
bd11de0 Makefile: Allow "gmake target1 target2 -j" (#14312)
2013-12-20 09:41:32 -05:00
Brad King bd11de0857 Makefile: Allow "gmake target1 target2 -j" (#14312)
Add the .NOTPARALLEL target to each local Makefile command-line
interface entry point file so that even with -j we launch only
one "make -f Makefile2" at a time.  The actual build rules
in Makefile2 and lower will still run in parallel.

Do not add .NOTPARALLEL for Borland or Watcom make tools because
they do not tolerate it.  Other make tools that do not understand
.NOTPARALLEL will not be hurt.

Suggested-by: Robert Luberda <robert-cmake@debian.org>
2013-12-20 09:35:20 -05:00
Stephen Kelly 97fae68b81 Remove INTERFACE build targets.
Commit b04f3b9a (Create make rules for INTERFACE_LIBRARY
targets., 2013-08-21) extended the makefile generator to create
build targets for INTERFACE_LIBRARY targets. No other generators
were extended with this feature.

This conflicts with the feature of whitelisting of target properties
read from INTERFACE_LIBRARY targets. The INTERFACE_* properties
of the INTERFACE_LIBRARY may legitimately contain TARGET_PROPERTY
generator expressions for reading properties from the 'head target'.
The 'head target' would be the INTERFACE_LIBRARY itself when creating
the build rules for it, which means that non-whitelisted properties
would be read.
2013-12-10 17:58:36 +01:00
Brad King fab69a3db9 Merge topic 'use-generator-target'
02a545c Don't generate subdir convenience rules for IMPORTED targets.
2013-12-02 12:07:41 -05:00
Stephen Kelly 02a545c534 Don't generate subdir convenience rules for IMPORTED targets.
This was missing from commit c34968a9 (Port some of the generator
API to cmGeneratorTarget., 2012-10-10). The generator targets
stored with the cmMakefile include IMPORTED targets, unlike the
accessor for resgular targets. Before this patch, rules would
be generated for Qt5::Core for example, which result in broken
makefiles.
2013-11-29 12:57:24 +01:00
Stephen Kelly 0bfcb450e6 INTERFACE_LIBRARY: Avoid codepaths which set unneeded properties.
As an INTERFACE_LIBRARY has no direct link dependencies, we can
short-circuit in cmGeneratorExpressionEvaluator and
in cmGlobalGenerator::CheckLocalGenerators.

As they do not generate any output directly, any generate- or install-
related code acn also be short-circuited. Many of the local generators
already do this.

Because only INTERFACE related properties make sense on INTERFACE_LIBRARY
targets, avoid setting other properties, for example via defaults.
2013-11-25 16:17:50 +01:00
Stephen Kelly c34968a9aa Port some of the generator API to cmGeneratorTarget.
Just enough to reach the BuildMacContentDirectory method and the
NeedRelinkBeforeInstall methods.

In the future, those methods can be moved to cmGeneratorTarget.
2013-11-22 15:06:25 +01:00
Brad King 684063c036 Refactor tool selection for edit_cache (#14544)
Refactor edit_cache tool selection to ask each global generator for its
preference.  Teach the Ninja generator to always use cmake-gui because
Ninja by design cannot run interactive terminal dialogs like ccmake.
Teach the Makefile generator to use cmake-gui when also using an "extra"
generator whose IDE has no terminal to run ccmake, and otherwise fall
back to CMAKE_EDIT_COMMAND selection for normal Makefile build systems.
2013-11-12 08:47:19 -05:00
Stephen Kelly b04f3b9a2a Create make rules for INTERFACE_LIBRARY targets.
The result is that the depends of the target are created.

So,

 add_library(somelib foo.cpp)
 add_library(anotherlib EXCLUDE_FROM_ALL foo.cpp)
 add_library(extra EXCLUDE_FROM_ALL foo.cpp)
 target_link_libraries(anotherlib extra)

 add_library(iface INTERFACE)
 target_link_libraries(iface INTERFACE anotherlib)

Executing 'make iface' will result in the anotherlib and extra targets
being made.

Adding a regular executable to the INTERFACE of an INTERFACE_LIBRARY
will not result in the executable being built with 'make iface' because
of the logic in cmComputeTargetDepends::AddTargetDepend.

So far, this is implemented only for the Makefile generator. Other
generators will follow if this feature is possible for them.

Make INTERFACE_LIBRARY targets part of the all target by default.
Test this by building the all target and making the expected library
EXCLUDE_FROM_ALL.
2013-10-21 09:46:27 -04:00
Brad King dba4962b86 Makefile: Always create clean target command
Borland Make complains if the phony clean target has no rule to build it.
If there are no files to clean, generate and run an empty clean script.
2013-10-16 10:43:24 -04:00
Stephen Kelly 33055c405e Generate modern-style cmake code.
The commits 9db31162 (Remove CMake-language block-end command
arguments, 2012-08-13) and 77543bde (Convert CMake-language
commands to lower case, 2012-08-13) changed most cmake code
to use lowercase commands and no parameters in termination
commands. However, those changes excluded cmake code generated
in c++ by cmake.

Make a similar style change to code generated by cmake.
2013-08-22 12:06:58 +02:00
Brad King ff6de6d325 Merge topic 'drop-old-vs-dependency'
4bb6e24 VS,Xcode: Drop incorrect legacy dependency trace (#14291)
2013-07-16 13:59:35 -04:00
Brad King 4bb6e24809 VS,Xcode: Drop incorrect legacy dependency trace (#14291)
Drop the "vsProjectFile" argument from cmTarget::TraceDependencies.  It
appears to be the modern equivalent to a hunk added in commit ba68f771
(...added new custom command support, 2003-06-03):

 +  name = libName;
 +  name += ".dsp.cmake";
 +  srcFilesToProcess.push(name);

but was broken by refactoring at some point.  The current behavior tries
to trace dependencies on a source file named the same as a target, which
makes no sense.  Furthermore, in code of the form

 add_executable(foo foo.c)
 add_custom_command(OUTPUT "${somewhere}/foo" ... DEPENDS foo)

the "vsProjectFile" value "foo" matches source "${somewhere}/foo.rule"
generated to hold the custom command and causes the command to be added
to the "foo" target incorrectly.

Simply drop the incorrect source file trace and supporting logic.
2013-07-15 13:17:29 -04:00
Stephen Kelly 184121538c Refactor cmTarget::GetCompileDefinitions to use an out-vector, not a string.
Refactor to create AddCompileDefinitions.
2013-07-11 08:23:56 +02:00
Andreas Mohr bf019d765d Fix spelling and typos (non-binary) 2013-05-07 08:39:19 -04:00
Stephen Kelly a6286e92c9 Fix the evaluation of per-config COMPILE_DEFINITIONS (#14037)
The API for retrieving per-config COMPILE_DEFINITIONS has long
existed because of the COMPILE_DEFINITIONS_<CONFIG> style
properties. Ensure that the provided configuration being generated
is also used to evaluate the generator expressions
in cmTarget::GetCompileDefinitions.

Both the generic COMPILE_DEFINITIONS and the config-specific
variant need to be evaluated with the requested configuration. This
has the side-effect that the COMPILE_DEFINITIONS does not need to
be additionally evaluated with no configuration, so the callers can
be cleaned up a bit too.
2013-03-25 10:49:22 -04:00
Stephen Kelly 3a298c0bf4 Fix generation of COMPILE_DEFINITIONS in DependInfo.cmake.
As INTERFACE_COMPILE_DEFINITIONS are now possible, we can have
situations like this:

 add_library(foo ...)
 add_library(bar ...)
 target_link_libraries(foo bar)

 target_compile_definitions(bar INTERFACE SOME_DEF)

The INTERFACE_COMPILE_DEFINITIONS of bar determine how foo should be
compiled, and if they change, foo should be rebuilt.

Additionally, as of commit d1446ca7 (Append the COMPILE_DEFINITIONS
from the Makefile to all targets., 2012-09-17), we don't need to
read definitions from the makefile if we read them from the target,
so also de-duplicate the cached info.

The DependInfo for INTERFACE_INCLUDE_DIRECTORIES is already handled
correctly.
2013-02-07 16:21:09 +01:00
Stephen Kelly ddc052052b Always use the auto_ptr from cmsys.
This is for consistency throughout cmake. The cmsys version exists
becaues uses of auto_ptr types as return types does not work with
some implementations in ancient compilers.
2012-11-21 00:56:36 +01:00
Alex Neundorf 05f162ce95 AddCustomCommand: Handle multiple IMPLICIT_DEPENDS files (#10048)
The code handling IMPLICIT_DEPENDS was only able to track a single file,
the latest file replaced earlier files in the list.

The documentation now mentions that the language has to be prefixed to
every file and the test now uses two implicit dependencies, where only
the second is modified to trigger re-running of the custom command.

Alex

Inspired-by: Michael Wild <themiwi@users.sourceforge.net>
2012-11-06 11:54:58 -05:00
Brad King ee6c1b8aca Makefile: Support directory names containing '=' (#12934)
Since commit c8ef6430 (Allow directory names containing '=' and warn if
necessary, 2012-02-06) we allow directories with '=' instead of
rejecting them as was previously done since commit 8704525f (Reject
directory names containing '=', 2011-01-14).  However, we did not warn
in all cases that '=' may cause failure, such as when it appears on the
right-hand side of a dependency line.

Both commits above were made assuming that '=' cannot be escaped in Make
syntax, but it can be achieved with a variable:

  EQUALS = =
  left$(EQUALS)side : right$(EQUALS)side

Use this approach to escape '=' in dependency lines, thus supporting
the character in paths.

All our tests now pass when CMake is built in source and build trees
both containing '=', except for the "OutOfSource" test.  It fails in
its coverage of the obscure "OutOfBinary" test case where part of the
build tree is located outside the main build tree of the test.  The
reason is that CMake must invoke a command like

  $(MAKE) -f /path/with=sign/build.make /path/with=sign/somefile

but the make tool interprets the last argument as a variable assignment.
This is an acceptable limitation, since the case is so obscure, in
exchange for supporting '=' cleanly otherwise.
2012-06-06 08:30:54 -04:00
Brad King 3aa741acb6 Build object library targets in Makefiles
Treat OBJECT libraries as STATIC libraries but leave out the archive
step.  The object files will be left behind for reference by other
targets later.
2012-03-13 14:38:02 -04:00