Commit Graph

228 Commits

Author SHA1 Message Date
Brad King e134e53b47 Add support for *.manifest source files with MSVC tools
Classify .manifest sources separately, add dependencies on them, and
pass them to the MS manifest tool to merge with linker-generated
manifest files.

Inspired-by: Gilles Khouzam <gillesk@microsoft.com>
2015-09-17 10:21:32 -04:00
Brad King 91c1b13d6e Merge topic 'ninja-LINK_DEPENDS'
43c94281 Ninja: Honor the LINK_DEPENDS target property (#14796)
2015-08-06 09:38:31 -04:00
Brad King 43c9428140 Ninja: Honor the LINK_DEPENDS target property (#14796) 2015-08-05 14:12:05 -04:00
Stephen Kelly ee26add4f4 cmGeneratorTarget: Move IsBundleOnApple from cmTarget. 2015-08-05 18:20:49 +02:00
Stephen Kelly 3df705681b cmGeneratorTarget: Move GetPDBName from cmTarget. 2015-08-05 18:20:46 +02:00
Stephen Kelly a45fed81e5 cmGeneratorTarget: Move GetCompilePDBPath from cmTarget. 2015-08-05 18:20:46 +02:00
Stephen Kelly 803a7982b4 cmGeneratorTarget: Move GetLinkInformation from cmTarget 2015-08-05 18:20:44 +02:00
Brad King 70c21301b2 cmCommonTargetGenerator: Store working directory for relative paths
The Makefile generators run tools with the current working directory set
to the subdirectory of the build tree for the each target.  The Ninja
generator runs tools with the current working directory set to the top
of the build tree.  Tell cmCommonTargetGenerator where the working
directory will be so it can compute proper relative paths.
2015-07-29 13:20:03 -04:00
Brad King 98d6e9ec2d Merge topic 'use-generator-target'
57f03e59 Port some of the cmExportFileGenerator API to cmGeneratorTarget.
57ab0f70 Port cmExportBuildFileGenerator to cmGeneratorTarget.
570938cb cmExportTryCompileFileGenerator: Create cmGeneratorTargets.
ec38e4c8 Move GetFullPath to cmGeneratorTarget
dfb025bf Move GetLocationForBuild to cmGeneratorTarget.
9f2dca80 Move GetLocation to cmGeneratorTarget.
c7a8e74b Always access target location from a cmGeneratorTarget instance.
5b60eaf6 cmTarget: Restore the ImportedGetLocation method.
50b17a61 cmIncludeCommand: Populate the cmGeneratorTargets in deprecated path.
ba266858 cmTarget: Create cmGeneratorTargets before reading deprecated LOCATION.
5ab3a946 cmTarget: Inline GetLocation into deprecated callers.
496f4cd0 cmGlobalGenerator: Create cmGeneratorTargets before QtAutomoc.
de80993a cmGlobalGenerator: Create cmGeneratorTargets earlier.
611220f7 cmTarget: Use reliable test for CMP0024 and CMP0026 OLD.
bbad6ba5 cmLocalGenerator: Remove unused AddCustomCommandToCreateObject method.
e4dc83ad cmLocalGenerator: Remove unused AddBuildTargetRule method.
...
2015-07-28 10:08:50 -04:00
Stephen Kelly d568eefe10 cmCustomCommandGenerator: Require cmLocalGenerator in API. 2015-07-27 20:09:38 +02:00
Brad King cd530df88f cmNinjaTargetGenerator: Factor out compile command exporter 2015-07-27 09:54:07 -04:00
Brad King ead29a4e3d Merge topic 'refactor-rule-var-includes'
c736de7b Factor an <INCLUDES> placeholder out of <FLAGS> in rule variables
6f94b03c Place <DEFINES> before <FLAGS> consistently across compilers
2015-07-14 10:34:28 -04:00
Brad King c736de7b28 Factor an <INCLUDES> placeholder out of <FLAGS> in rule variables
Teach the Makefile and Ninja generators to substitute for an <INCLUDES>
placeholder instead of putting -I in <FLAGS>.  Update our values for

  CMAKE_<LANG>_COMPILE_OBJECT,
  CMAKE_<LANG>_CREATE_ASSEMBLY_SOURCE, and
  CMAKE_<LANG>_CREATE_PREPROCESSED_SOURCE

to place <INCLUDES> just before <FLAGS>.
2015-07-13 10:49:46 -04:00
Brad King 80d75246d4 cmNinjaTargetGenerator: Restore addition of Fortran format flags
Restore call to AppendFortranFormatFlags accidentally dropped by
commit 0837538e (cmCommonTargetGenerator: Adopt GetFlags method,
2015-07-09).  It was added originally by commit 6a56740e
(cmNinjaTargetGenerator: Add Fortran flag generation, 2015-07-09).
2015-07-13 09:54:33 -04:00
Brad King fed5eb5b0e cmNinjaTargetGenerator: Use GetDefines method
Simplify the per-source ComputeDefines implementation by getting
target-wide defines from GetDefines.  Technically this changes behavior
by no-longer de-duplicating/sorting defines from both the target and the
source, but this makes it consistent with the Makefile generator.  It
may also later help move target-wide defines into per-target compilation
rules.
2015-07-09 10:15:08 -04:00
Brad King 0837538e46 cmCommonTargetGenerator: Adopt GetFlags method
De-duplicate per-target flag computation in Makefile and Ninja target
generators.
2015-07-09 10:06:24 -04:00
Brad King f4875bbdd6 cmNinjaTargetGenerator: Add OX X framework flags
Teach ComputeFlagsForObject to add -F flags just like the Makefile
generator does.
2015-07-09 10:04:10 -04:00
Brad King 73bfad72d3 cmNinjaTargetGenerator: Factor out AddIncludeFlags helper
Factor an AddIncludeFlags method out of ComputeFlagsForObject just like
cmMakefileTargetGenerator has already.
2015-07-09 09:59:25 -04:00
Brad King 6a56740e27 cmNinjaTargetGenerator: Add Fortran flag generation
Make ComputeFlagsForObject consistent with the Makefile generator
in regard to Fortran flags.
2015-07-09 09:54:56 -04:00
Brad King cdb5b65752 cmCommonTargetGenerator: Adopt ModuleDefinitionFile member
De-duplicate the ModuleDefinitionFile and AddModuleDefinitionFlag
members from the Makefile and Ninja target generators.
2015-07-09 09:50:06 -04:00
Brad King beee793732 cmCommonTargetGenerator: Adopt GetFeature and friends
De-duplicate the GetFeature, GetFeatureAsBool, and AddFeatureFlags
members from the Makefile and Ninja target generators.
2015-07-09 09:50:06 -04:00
Brad King abfa5f2d1f cmCommonTargetGenerator: Adopt ConfigName member
De-duplicate the member from the Makefile and Ninja target generators.
2015-07-09 09:50:06 -04:00
Brad King e7dcdd1011 cmCommonTargetGenerator: Adopt basic target generator members
De-duplicate the GeneratorTarget, Target, and Makefile members from the
local Makefile and Ninja generators.
2015-07-09 09:50:05 -04:00
Brad King 001f9b3617 Add common base classes to Makefile and Ninja generators
Provide a place to move functionality common to both.
2015-07-09 09:50:05 -04:00
Stephen Kelly bb88668add cmNinjaGenerator: Require cmGeneratorTarget. 2015-06-22 13:23:45 -04:00
Brad King c1113705d7 Merge topic 'compiler-launcher'
698f7597 Add options to launch the compiler through tools like ccache or distcc
2015-06-15 09:45:28 -04:00
Bill Hoffman 698f75971b Add options to launch the compiler through tools like ccache or distcc
Create a <LANG>_COMPILER_LAUNCHER target property (initialized by a
CMAKE_<LANG>_COMPILER_LAUNCHER variable) to specify a compiler launcher
tool.  This will supersede the CMAKE_<LANG>_COMPILER_ARG1 approach to
using such tools.  The old approach set CMAKE_<LANG>_COMPILER to the
launcher tool while the new approach leaves this variable set to the
actual compiler.

Implement this property for Makefile and Ninja generators.  It cannot be
implemented for VS or Xcode generators as the IDE build tools offer no
such hooks.
2015-06-15 09:36:48 -04:00
Stephen Kelly ccbc225913 cmGeneratorTarget: Move Feature API from cmTarget. 2015-06-06 15:44:16 +02:00
Brad King ada5ffce7b Add options to run include-what-you-use with the compiler
Create a <LANG>_INCLUDE_WHAT_YOU_USE target property (initialized by a
CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE variable) to specify an IWYU command
line to be run along with the compiler.
2015-05-19 13:16:29 -04:00
Brad King a390de65e0 Ninja: Generate separate compile and link rules for each target
Our <LANG>_COMPILER and <LANG>_<TARGET_TYPE>_LINKER rule generation has
access to a specific cmTarget so the results may depend on it.  Instead
generate separate rules for each target using an encoded target name.
In particular, this makes CTEST_USE_LAUNCHERS report proper target
information.
2015-05-18 15:01:06 -04:00
Thomas Herz b3de0dfe93 Ninja: Use forward slashes for any GCC on Windows (#15439)
Any GCC compiler on a Windows host needs forward slashes, not just
those built for MinGW.
2015-05-07 14:07:20 -04:00
Brad King 378c2a0e86 Ninja: Refactor detection of MinGW tools on Windows
Check for CMAKE_COMPILER_IS_MINGW only after enabling a language when it
might actually be set.  Previously this worked by accident because the
check for working compiler or a second language enabled would cause the
code path to be taken.

Store UsingMinGW as an instance member of cmGlobalNinjaGenerator so that
it is reset on each reconfigure.  Otherwise cmake-gui cannot switch
between build trees for MinGW or non-MinGW tools.
2015-05-07 14:02:44 -04:00
Stephen Kelly 32b8f03acc cmMakefile: Port users of GetStart* methods to new names. 2015-04-21 00:15:20 +02: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 8a93d3ea18 Ninja: Use "deps = msvc" only for C and CXX (#15253)
The "/showIncludes" flag is only available with MS C and C++ compilers,
and on compilers that "simulate" them (like Intel for Windows).  Fix our
logic to choose this type only for MS tools with these languages.  All
other cases need to use "deps = gcc" and define DEP_FILE in the build
rule.
2015-01-29 15:34:24 -05:00
Brad King abec4213d6 Merge topic 'fix-OBJECT_DEPENDS-after-path-normalization'
9259d778 Normalize OBJECT_DEPENDS paths to match custom commands (#15366)
2015-01-29 09:13:53 -05:00
Brad King 9259d77881 Normalize OBJECT_DEPENDS paths to match custom commands (#15366)
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
2015-01-28 09:06:21 -05:00
Stephen Kelly ee38062be8 IncludeDirectories: Respect SYSTEM flag when using CONFIG genex.
Update the Makefile and Ninja generators to use the config when
requesting the include flags.
2015-01-23 00:08:18 +01: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
Brad King 90b015a0ba Merge topic 'ninja-fix-crash-on-error'
9a13fcbf Ninja: Do not crash when CMAKE_<LANG>_COMPILE_OBJECT is empty (#15325)
2014-12-23 08:53:59 -05:00
Brad King 9a13fcbf02 Ninja: Do not crash when CMAKE_<LANG>_COMPILE_OBJECT is empty (#15325) 2014-12-22 18:36:07 -05:00
Brad King e15a7075b5 Add an option for explicit BYPRODUCTS of custom commands (#14963)
A common idiom in CMake-based build systems is to have custom commands
that generate files not listed explicitly as outputs so that these
files do not have to be newer than the inputs.  The file modification
times of such "byproducts" are updated only when their content changes.
Then other build rules can depend on the byproducts explicitly so that
their dependents rebuild when the content of the original byproducts
really does change.

This "undeclared byproduct" approach is necessary for Makefile, VS, and
Xcode build tools because if a byproduct were listed as an output of a
rule then the rule would always rerun when the input is newer than the
byproduct but the byproduct may never be updated.

Ninja solves this problem by offering a 'restat' feature to check
whether an output was really modified after running a rule and tracking
the fact that it is up to date separately from its timestamp.  However,
Ninja also stats all dependencies up front and will only restat files
that are listed as outputs of rules with the 'restat' option enabled.
Therefore an undeclared byproduct that does not exist at the start of
the build will be considered missing and the build will fail even if
other dependencies would cause the byproduct to be available before its
dependents build.

CMake works around this limitation by adding 'phony' build rules for
custom command dependencies in the build tree that do not have any
explicit specification of what produces them.  This is not optimal
because it prevents Ninja from reporting an error when an input to a
rule really is missing.  A better approach is to allow projects to
explicitly specify the byproducts of their custom commands so that no
phony rules are needed for them.  In order to work with the non-Ninja
generators, the byproducts must be known separately from the outputs.

Add a new "BYPRODUCTS" option to the add_custom_command and
add_custom_target commands to specify byproducts explicitly.  Teach the
Ninja generator to specify byproducts as outputs of the custom commands.
In the case of POST_BUILD, PRE_LINK, and PRE_BUILD events on targets
that link, the byproducts must be specified as outputs of the link rule
that runs the commands.  Activate 'restat' for such rules so that Ninja
knows it needs to check the byproducts, but not for link rules that have
no byproducts.
2014-11-14 16:16:00 -05:00
Brad King 67bd514adc Ninja: Refactor restat to be a string internally
This will allow values other than "" and "1" to be generated in
the rules.ninja file.
2014-11-14 16:16:00 -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
Adam Strzelecki 93371ed592 Ninja: Skip generating empty phony rules
Ninja generator ensures that all custom commands being target
dependencies are run before other source compilations. However in case
there are no such dependencies it currently generates empty phony rules
which clutter the build graph.

Teach the Ninja generator to produce such rules only when necessary.
2014-06-30 09:33:37 -04:00
Brad King 8256ccb78c Add OBJECT_FILE_DIR rule placeholder for compilation lines
Some compilers do not offer an option to specify the path to the object
file, but rather only to the directory in which to place the object
file.  See issue 14876 for some examples.  Add a new OBJECT_FILE_DIR
placeholder to specify the directory containing the object file for the
current compilation.  This may differ from the main target OBJECT_DIR
when the object corresponds to a source in a subdirectory.
2014-06-05 08:58:29 -04:00
Brad King c2eeb08b06 cmTarget: Add GetFeatureAsBool method
Return the GetFeature method result converted to a boolean value.
2014-05-21 09:38:22 -04:00
Brad King 68f6460f66 Merge topic 'ninja-intel-linux'
54535f47 Ninja: Fix deptype for Intel compiler on Linux
2014-05-12 09:31:04 -04:00
Brad King 54535f4730 Ninja: Fix deptype for Intel compiler on Linux
Since commit v3.0.0-rc1~305^2 (Ninja: deptype msvc for Intel's compiler
on Windows, 2013-11-25) we used "deps = msvc" for the Intel compiler.
This is correct only on Windows.  On Linux we still want "deps = gcc".

Fix the logic to use "deps = msvc" when the compiler id or the "simulate
id" is "MSVC".  This will preserve the behavior on Intel for Windows and
fix the behavior on Intel for Linux.  In the future this should be
converted to a platform information module variable.
2014-05-09 15:11:54 -04:00
Ben Boeckel 2583eff6fe ninja: Factor out custom command order-only depends
This makes WebKitGTK's CMake build.ninja file go from 165M to 11M and
configure/generate in 5 seconds.
2014-05-07 14:30:31 -04:00
Ben Boeckel 18e478a860 ninja: Factor out target-level order-only dependencies
This reduces ninja file output even more for projects with lots of
libraries with entangled transitive dependencies. ParaView goes from the
previous 58M to about 45M.
2014-05-07 14:30:31 -04:00
Ben Boeckel 6fa6bedf78 LocalGenerator: Add a string overload for AppendFlags 2014-05-07 14:30:31 -04:00
Ben Boeckel 3c64089117 ninja: Use string parameters 2014-05-02 13:05:44 -04:00
Stephen Kelly 19b7c22d02 Ninja: Query custom commands once per target, not once per file.
Computing the source files is now more expensive, so the Ninja
generator became very slow with a large number of files.
2014-04-05 14:22:48 +02: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
Stephen Kelly e5da9e51d0 cmTarget: Allow any generator expression in SOURCES property.
Remove use of UseObjectLibraries from Makefile and Ninja generators. It
is not needed now because those generators use GetExternalObjects
which already contains the objects from object libraries.

The VS10 generator calls both the UseObjectLibraries and the GetExternalObjects
methods. Ensure that duplicates are not created by skipping objects
from object libraries in handling of GetExternalObjects.

Similarly, fix VS6, VS7 and Xcode object handling by skipping
external objects from OBJECT_LIBRARY usage as appropriate.

The error message in the BadSourceExpression1 test is now reported
by the generator expression evaluator, so it has different text.
2014-04-02 23:12:56 +02:00
Ben Boeckel 9523d2a55c ninja: Add support for custom depfile formats
Not everything that isn't MSVC is GCC. I have support for LDC's depfile
format on its way upstream[1], but its future is uncertain. CMake should
at least support this for future depfile formats.

[1]https://github.com/martine/ninja/pull/721
2014-03-23 23:54:13 -04: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 c725bb3cbd Constify some APIs in generators. 2014-03-13 15:27:23 +01:00
Stephen Kelly 04cf50ff62 cmOSXBundleGenerator: Make MacOSXContentGeneratorType arg const. 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
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
Ben Boeckel 3def29da3c stringapi: Use strings for feature arguments 2014-03-08 13:05:37 -05:00
Ben Boeckel acb116e3b5 stringapi: Return a string reference for the configuration 2014-03-08 13:05:36 -05:00
Ben Boeckel ce5114354c stringapi: Use strings for the languages 2014-03-08 13:05:30 -05:00
Brad King 6223621e9a Merge topic 'msvc-compiler-pdb-files'
fba51b09 MSVC: Add properties to configure compiler PDB files (#14762)
3737860a cmTarget: Add per-config compilation info
718a9532 cmTarget: Refactor ComputePDBOutputDir interface
aae5184c Help: Refactor PDB_NAME and PDB_OUTPUT_DIRECTORY docs
b4aac0ca Makefile: Fix per-config linker PDB output directory
2014-02-26 09:38:51 -05:00
Brad King fba51b096e MSVC: Add properties to configure compiler PDB files (#14762)
Since commit v2.8.12~437^2~2 (VS: Separate compiler and linker PDB files
2013-04-05) we no longer set /Fd with the PDB_NAME or PDB_OUTPUT_DIRECTORY
properties.  Those properties now exclusively handle linker PDB files.
Since STATIC libraries do not link their compiler PDB file becomes more
important.  Add new target properties "COMPILE_PDB_NAME[_<CONFIG>]" and
"COMPILE_PDB_OUTPUT_DIRECTORY[_<CONFIG>]" to specify the compiler PDB
file location and pass the value to the MSVC /Fd option.
2014-02-26 09:34:38 -05:00
Stephen Kelly d3682d8647 cmGeneratorTarget: Use a method to access the definition file. 2014-02-24 16:43:25 +01:00
Ben Boeckel 26762e1681 Ninja: Cache target-level flags
Instead of figuring out target flags per-source file, cache the flags
that are being used. This results in a *much* faster generate time for
Ninja.
2014-02-13 10:20:56 -05:00
Stephen Kelly 38de54cf6f cmGeneratorTarget: Add methods to access source file groups.
These methods and others will be able to get a config parameter
later to implement the INTERFACE_SOURCES feature.
2014-01-09 19:38:07 +01:00
Brad King 7a63192074 Merge topic 'fix-compile-OBJECT_DIR'
03f3b4e Replace <OBJECT_DIR> rule placeholder consistently (#14667)
2014-01-02 14:23:52 -05:00
Brad King 03f3b4e727 Replace <OBJECT_DIR> rule placeholder consistently (#14667)
The <OBJECT_DIR> placeholder is supposed to be the base intermediate
files directory for the current target.  This is how it gets replaced
during link line generation.  However, during compile line generation
we replace it with the directory containing the current object file
which may be a subdirectory.  Fix replacement of <OBJECT_DIR> in the
generated compile lines to be the base intermediate files directory.

This was expoxed by commit 42ba1b08 (VS: Separate compiler and linker
PDB files, 2013-04-05) when we added a "/Fd<OBJECT_DIR>/" flag to the
MSVC compile line in order to match the VS IDE default compiler program
database location in the intermediate files directory.  For source files
in a subdirectory relative to the current target this caused the wrong
location to be used for the compiler program database.  This becomes
particularly important when using precompiled headers.

While at it, use the cmTarget::GetSupportDirectory method to compute the
intermediate files directory for the current target instead of repeating
the logic in a few places.
2014-01-02 13:45:41 -05:00
Brad King b80ef72b4d Merge topic 'ninja-compile-link-pool'
7605e37 Ninja: job pool support for compiling and linking
2013-11-26 09:52:35 -05:00
Brad King e1fd64837d Merge topic 'ninja-msvc-deps-for-intel'
76a8888 Ninja: deptype msvc for Intel's compiler on Windows
2013-11-26 09:35:41 -05:00
Peter Kümmel 7605e37aab Ninja: job pool support for compiling and linking
Could be tested by setting the environment
variable NINJA_STATUS=[%r]
2013-11-25 22:23:24 +01:00
Peter Kümmel 76a88888bc Ninja: deptype msvc for Intel's compiler on Windows 2013-11-25 09:08:40 +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
Peter Kümmel f212615d3e Ninja: don't parse empty string 2013-11-04 13:20:27 +01:00
Peter Kümmel eeb4aece1c Ninja: use deps = gcc/msvc feature
cmcldeps is now only used for .rc file processing
2013-10-24 19:48:18 +02:00
Brad King 41a2fb5ba0 Merge topic 'tid-system-argument'
9cf3547 Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
1925cff Add a SYSTEM parameter to target_include_directories (#14180)
286f227 Extend the cmTargetPropCommandBase interface property handling.
83498d4 Store system include directories in the cmTarget.
f1fcbe3 Add Target API to determine if an include is a system include.
2679a34 Remove unused variable.
2013-07-16 13:59:07 -04:00
Brad King d5d54b4629 Merge topic 'compile-defs-debugging'
d7dd010 Add target property debugging for COMPILE_DEFINITIONS
1841215 Refactor cmTarget::GetCompileDefinitions to use an out-vector, not a string.
afc9243 Add an overload of cmIDEOptions::AddDefines taking a vector of strings.
d95651e Overload cmLocalGenerator::AppendDefines to add a list.
2013-07-15 09:34:00 -04:00
Stephen Kelly 0416c94f64 Revert "Use --sysroot when cross compiling."
This reverts commit de4da665d3.

This feature is not yet ready for release. It needs to be
merged with the CMAKE_OSX_SYSROOT feature.
2013-07-12 15:44:38 +02: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
Stephen Kelly f1fcbe3fde Add Target API to determine if an include is a system include.
The implementation can be modified later so that system includes
can be determined on a per-target basis.
2013-07-02 16:40:02 +02:00
Brad King 62428f5e72 Merge topic 'ninja_phony_targets'
539356f Ninja: Custom Command file depends don't need to exist before building
874e171 Ninja: GlobalNinjaGenerator WriteBuild and WritePhonyBuild non static
88d27ad Add a test to expose a bug with add_custom_command and ninja.
2013-07-01 09:15:09 -04:00
Robert Maynard 874e17120d Ninja: GlobalNinjaGenerator WriteBuild and WritePhonyBuild non static
To properly track the usage of dependencies that are generated at
compile time as the side effect of other build steps we need
to make the WriteBuild and WritePhonyBuild commands non static
2013-07-01 08:59:38 -04:00
Brad King d221eac812 Refactor target COMPILE_OPTIONS and COMPILE_FLAGS handling
Replace the cmLocalGenerator GetCompileOptions method with an
AddCompileOptions method since all call sites of the former simply
append the result to a flags string anyway.

Add a "lang" argument to AddCompileOptions and move the
CMAKE_<LANG>_FLAGS_REGEX filter into it.  Move the call sites in each
generator to a location that has both the language and configuration
available.  In the Makefile generator this also moves the flags from
build.make to flags.make where they belong.
2013-06-27 12:57:32 -04:00
Stephen Kelly de4da665d3 Use --sysroot when cross compiling.
As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is
introduced, which is never a list.

The contents of this variable is passed to supporting compilers
as --sysroot. It is also accounted for when processing implicit
link directories reported by the compiler, and when generating
RPATH information.
2013-06-07 13:32:52 +02:00
Brad King ff8917fdd2 Merge topic 'VISIBILITY_PRESET-property'
cd1fa53 Add a COMPILE_OPTION for a VISIBILITY_INLINES_HIDDEN target property.
0e9f4bc Introduce target property <LANG>_VISIBILITY_PRESET
2013-06-05 09:38:59 -04:00
Brad King e57b6a2521 Merge topic 'target-COMPILE_OPTIONS'
24466f2 Add target_compile_options command.
80ca9c4 Add COMPILE_OPTIONS target property.
7cb2308 cmTarget: Rename LinkInterfaceIncludeDirectoriesEntries
47f80d9 cmTarget: Rename struct to be more re-usable.
1319a14 Add <LANG>_COMPILER_ID generator expressions.
3549676 Add cmLocalGenerator::GetCompileOptions.
f3ad863 VS6: Rename some variables to correspond to config values.
2013-06-03 09:57:44 -04:00
Brad King b0759da303 Merge topic 'framework-refactor'
373faae Refactor how bundles and frameworks are supported.
2013-06-03 09:56:32 -04:00
Stephen Kelly 0e9f4bc00c Introduce target property <LANG>_VISIBILITY_PRESET
This is initialized by CMAKE_<LANG>_VISIBILITY_PRESET. The target
property is used as the operand to the -fvisibility= compile option
with GNU compilers and clang.
2013-06-02 12:00:51 +02:00
Stephen Kelly 35496761a5 Add cmLocalGenerator::GetCompileOptions.
Currently it only adds the contents of the COMPILE_FLAGS target
property, but it can be extended to handle a new COMPILE_OPTIONS
generator expression enabled property.
2013-06-02 11:56:36 +02:00
Clinton Stimpson 373faae5e1 Refactor how bundles and frameworks are supported.
Make handling of directory separators consistent between
non-bundle and bundle code.

Remove xcode specific flag from cmTarget when getting install_name.

Add (more) consistent convenience functions in cmTarget to get
directories inside of bundles and frameworks to add files to.

This refactor also fixes bug #12263 where frameworks
had the wrong install name when SKIP_BUILD_RPATH.

Also make install_name for frameworks consistent between Makefile
and Xcode generator.
2013-05-23 10:42:49 -04:00
Brad King 87c0d16ab7 Ninja: Fix OBJECT_DIR placeholder path conversion
Transform the path using ConvertToNinjaPath just as we do for all other
paths.  This fixes the OutOfSource test for objects in the ../OutOfBinary
directory by computing the proper full path for the /Fd option.
2013-04-11 10:23:33 -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
Peter Kümmel bbea30eec8 Ninja: remove implicit dependency on custom command outputs
Revert aa2e1e9cae
With this commit all files are rebuild when only one moc file has changed.

BUG 0013874
2013-02-16 13:45:28 +01:00
Stephen Kelly 0e10782ba7 Move GetCompileDefinitions to cmTarget. 2013-01-29 14:11:49 -05:00
Stephen Kelly 3581b96caa Process the INTERFACE_PIC property from linked dependencies
This allows a dependee to inform a target that it should have its
POSITION_INDEPENDENT_CODE property set to ON, or OFF. The value of
the POSITION_INDEPENDENT_CODE property, if set, must be consistent
with any INTERFACE_POSITION_INDEPENDENT_CODE properties on dependees.

Add a test covering the consistency checks on platforms where they run.
2013-01-10 09:54:52 -05:00
Mathias Gaunard 9fc2e20244 Ninja: fix usage of cldeps with ctest launchers 2012-11-30 03:46:55 +01:00