Commit Graph

258 Commits

Author SHA1 Message Date
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
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
Nils Gladitz 3a8f34b98c Makefile: Remove "forbidden" flags only as a whole
Fix CMAKE_<LANG>_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS implementation to
only remove whole flags.  Without this n the Mac we were incorrectly
removing -w from -Wno-write-strings.
2013-11-19 09:39:50 -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 2e13c36211 OS X: Encode -F framework search flag in per-language platform variable
Compilers for languages other than C and C++ on OS X may not understand
the -F framework search flag.  Create a new platform information
variable CMAKE_<LANG>_FRAMEWORK_SEARCH_FLAG to hold the flag, and set it
for C and CXX lanugages in the Platform/Darwin module.

Reported-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2013-10-10 08:33:25 -04:00
Brad King f8241136b4 Merge topic 'INTERFACE_LIBRARY-target-type'
ce0c303 install: Teach EXPORT option to handle INTERFACE_LIBRARY targets
435c912 export: Add support for INTERFACE_LIBRARY targets
fe73226 Add the INTERFACE_LIBRARY target type.
2013-10-08 10:58:40 -04:00
Stephen Kelly fe732264e9 Add the INTERFACE_LIBRARY target type.
This target type only contains INTERFACE_* properties, so it can be
used as a structural node. The target-specific commands enforce
that they may only be used with the INTERFACE keyword when used
with INTERFACE_LIBRARY targets. The old-style target properties
matching LINK_INTERFACE_LIBRARIES_<CONFIG> are always ignored for
this target type.

The name of the INTERFACE_LIBRARY must match a validity generator
expression. The validity is similar to that of an ALIAS target,
but with the additional restriction that it may not contain
double colons. Double colons will carry the meaning of IMPORTED
or ALIAS targets in CMake 2.8.13.

An ALIAS target may be created for an INTERFACE library.

At this point it can not be exported and does not appear in the
buildsystem and project files are not created for them. That may
be added as a feature in a later commit.

The generators need some changes to handle the INTERFACE_LIBRARY
targets returned by cmComputeLinkInterface::GetItems. The Ninja
generator does not use that API, so it doesn't require changes
related to that.
2013-10-07 19:56:31 -04:00
Brad King 3e2e060999 Merge topic 'generate-modern-style'
027a020 Merge branch 'test-property-genex' into generate-modern-style
33055c4 Generate modern-style cmake code.
2013-10-07 15:44:33 -04:00
Stephen Kelly d26594f390 Genex: Evaluate genexes for additional make clean files.
This is necessary because custom commands and targets may create
custom files whose names are determined by generator expressions.

For example, clang should be using $<TARGET_FILE> and $<TARGET_FILE_DIR>
instead of reverse engineering the output file name:

 http://thread.gmane.org/gmane.comp.compilers.clang.scm/80523

However, that can only be done when ADDITIONAL_MAKE_CLEAN_FILES
also accepts and evaluates generator expressions.

Similarly, KDE uses the LOCATION property where $<TARGET_FILE>
would also be better in KDE4_HANDLE_RPATH_FOR_EXECUTABLE but
also appends the result to ADDITIONAL_MAKE_CLEAN_FILES.

After this patch, both can be ported to generator expressions.
2013-08-28 00:49:29 +02: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 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 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
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 0261bdfc1d Merge topic 'fix-COMPILE_DEFINITIONS-config'
1703b00 Test evaluation of per-config COMPILE_DEFINITIONS (#14037)
a6286e9 Fix the evaluation of per-config COMPILE_DEFINITIONS (#14037)
2013-03-26 14:36:07 -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
Brad King 0b7ad3f091 Replace <TARGET> in CMAKE_<LANG>_COMPILE_OBJECT rule variables
In some languages the compiler may need to know the path of the final
target file for which an object is being compiled.  Honor the <TARGET>
placeholder for compilation rules to support such cases.

Note that this cannot work with OBJECT library targets because the final
target path is not known during compilation (there can even be more than
one final target).

Suggested-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2013-03-22 07:52:54 -04: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
Brad King f0d938549e Makefile: Use modern link information for framework search paths
Use cmComputeLinkInformation::GetFrameworkPaths to get the list of
framework paths needed by the linker.  Drop the now unused framework
information from the old-style cmTarget link dependency analysis.
2012-12-07 15:29:21 -05:00
Stephen Kelly 0bbae6f95f Revert "Move GetLinkInformation to cmGeneratorTarget"
As we can't move all linking related code from cmTarget, it makes
sense to reverse the move in some cases.

This reverts commit 4f5384e75c.
2012-11-21 15:49:37 +01:00
Stephen Kelly 2a6bd96c13 Fix config-specific INCLUDE_DIRECTORIES in multi-config generators
Commit 08cb4fa4 (Process generator expressions in the
INCLUDE_DIRECTORIES property, 2012-09-18) contained an incorrect
assumption that CMAKE_BUILD_TYPE was set on the makefile for each
generated configuration in multi-config generators. Fix that by making
the GetIncludeDirectories API depend on the config.
2012-10-17 16:24:14 -04:00
Brad King 7dce31f3d0 Merge topic 'vs-pdb-output'
2ccca05 Run PDBDirectoryAndName test on MSVC and Intel
efc83b3 Document that PDB_(NAME|OUTPUT_DIRECTORY) are ignored for VS 6
b294457 Verify that PDB_(NAME|OUTPUT_DIRECTORY) are honored in test
3f60dbf Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830)
2012-10-01 14:05:11 -04:00
Yuchen Deng 3f60dbf148 Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830)
This enables changing the name and output folder of the debug symbol
files produced by MS compilers.

Inspired-by: Thomas Bernard <thomas.bernard@ipetronik.com>
2012-09-25 15:23:35 -04:00
Stephen Kelly c31f3d99f8 Add a wrapper for accessing config-specific compile-definitions. 2012-09-19 15:32:19 +02:00
Stephen Kelly d1446ca7a0 Append the COMPILE_DEFINITIONS from the Makefile to all targets.
This way we don't need to check the definitions from the Makefile when
generating later, and can more easily add generator expressions.

Duplication is not a problem as the definitions are de-duplicated before
generating.
2012-09-19 15:32:13 +02:00
Stephen Kelly 290e92ada8 Move GetIncludeDirectories to cmGeneratorTarget. 2012-09-19 15:32:09 +02:00
Stephen Kelly 78bfee35d5 Make cmLocalGenerator::AddArchitectureFlags take a cmGeneratorTarget. 2012-09-19 15:31:29 +02:00
Stephen Kelly 4f5384e75c Move GetLinkInformation to cmGeneratorTarget 2012-09-19 15:30:57 +02:00
Stephen Kelly 3dae652b4e Don't duplicate -D defines sent to the compiler.
There is no need to do so. Be consistent with include directories and
ensure uniqueness.

This requires changing the API of the cmLocalGenerator::AppendDefines
method, and changing the generators to match.

The test unfortunately can't test for uniqueness, but it at least verifies
that nothing gets lost.
2012-08-20 22:30:11 +02:00
Peter Kümmel 44ba4cfdb6 Ninja: remove warnings 2012-07-18 12:17:39 +02:00
Nicolas Despres c3988ee871 Re-factor OS X content generator start up. 2012-07-17 14:03:12 +02:00
Nicolas Despres 5d885db416 Re-factor bundle content copying rules generation. 2012-07-17 14:03:10 +02:00
David Cole 91d945a4e9 Remove unused ivars to eliminate compiler warnings 2012-06-20 17:44:10 -04:00
Stephen Kelly bd34963002 Refactor generation of shared library flags
CMAKE_SHARED_LIBRARY_<lang>_FLAGS has flags on various platforms for a
variety of purposes that are correlated with shared libraries but not
exclusive to them.  Refactor generation of these flags to use new
purpose-specific platform variables

  CMAKE_<lang>_COMPILE_OPTIONS_DLL
  CMAKE_<lang>_COMPILE_OPTIONS_PIC
  CMAKE_<lang>_COMPILE_OPTIONS_PIE

Activate the DLL flags specifically for shared libraries.  Add a new
POSITION_INDEPENDENT_CODE target property to activate PIC/PIE flags, and
default to true for shared libraries to preserve default behavior.
Initialize the new property from CMAKE_POSITION_INDEPENDENT_CODE to
allow easy global configuration in projects.

Although the default behavior is unchanged by this refactoring, the new
approach ignores CMAKE_SHARED_LIBRARY_<lang>_FLAGS completely.  We must
leave it set in case projects reference the value.  Furthermore, if a
project modifies CMAKE_SHARED_LIBRARY_<lang>_FLAGS it expects the new
value to be used.  Add policy CMP0018 to handle compatibility with
projects that modify this platform variable.

Add a PositionIndependentCode test on platforms where we can get
meaningful results.
2012-06-12 15:38:48 -04:00
Brad King 470f39cf4e VS: Restore header files marked as OS X Framework content (#13196)
Header files listed in a target's PUBLIC_HEADER or similar properties
are marked as OS X Framework content.  Refactoring performed by

 commit 11d9b211 (Add cmGeneratorTarget to represent a target during generation, 2012-03-07)
 commit 45c2f932 (Simplify cmMakefileTargetGenerator using cmGeneratorTarget, 2012-03-07)
 commit 328c0f65 (Simplify cmVisualStudio10TargetGenerator source classification, 2012-03-19)

and related commits accidentally removed such files from treatment as
normal header files by the VS generator (generators other than Makefiles
and Xcode).  Move handling of such files out of cmGeneratorTarget and
back to cmMakefileTargetGenerator.  The central cmGeneratorTarget
classification will always treat them as header or extra sources.
2012-05-07 15:28:19 -04:00
Brad King c403f27a2d Add $<TARGET_OBJECTS:...> expression to use an object library
For now do not allow an OBJECT library to reference other object
libraries.  Teach cmTarget::ComputeLinkImplementation to include the
languages of object libraries used by a target.
2012-03-16 10:12:15 -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
Brad King 3baaf6ccec Pre-compute object file names before Makefile generation
Add a virtual cmGlobalGenerator::ComputeTargetObjects method invoked
during cmGeneratorTarget construction.  Implement it in the Makefile
generator to pre-compute all object file names for each target.  Use
the results during generation instead of re-computing it later.
2012-03-09 15:16:02 -05:00
Brad King 45c2f93240 Simplify cmMakefileTargetGenerator using cmGeneratorTarget
Replace the classification of source files in this generator
using that computed by cmGeneratorTarget.
2012-03-09 15:16:02 -05:00
Brad King 51b67366ed Merge branch 'cleanup-object-file-names' into object-library 2012-03-09 15:15:37 -05:00
Brad King 0996f2a228 Hide Makefile local object info inside local generator
Make cmLocalUnixMakefileGenerator3::LocalObjectInfo private and add
cmLocalUnixMakefileGenerator3::AddLocalObjectFile to create entries.
2012-03-08 07:58:52 -05:00
Stephen Kelly 9106b564ae Extract and use the INCLUDE_DIRECTORIES target properties.
Eliminate callers of cmMakefile::GetIncludeDirectories.

All callers of GetIncludeDirectories should go through the local generator
object.

Only the local generator calls cmTarget::GetIncludeDirectories directly.
2012-02-22 06:31:50 -05:00
Stephen Kelly edd5303949 Refactor GetIncludeFlags to take includes instead of fetching them 2012-02-22 06:31:49 -05:00
Brad King afb00fef19 Add CMAKE_GNUtoMS option to convert GNU .dll.a to MS .lib
Teach the Windows-GNU.cmake platform file to look for Visual Studio
tools matching the target ABI.  Add an extra step to the link command
for shared libraries and executables that export symbols and on which a
new GNUtoMS property is set (initialized by the CMAKE_GNUtoMS option).
Tell the GNU linker to output a module definition (.def) file listing
exported symbols in addition to the GNU-format import library (.dll.a).
Pass the .def file to the MS "lib" tool to construct a MS-format DLL
import library (.lib).

Teach the install(TARGETS) command to install the MS import library next
to the GNU one.  Teach the install(EXPORT) and export() command to set
the IMPORTED_IMPLIB property pointing at the import library to use the
import library matching the tools in the importing project.
2011-12-05 18:13:49 -05:00
Brad King 61e862986a Factor makefile generator link rule lookup into helper function
This provides a place in the makefile generators to adjust the link
rules for both libraries and executables.
2011-12-05 16:37:43 -05:00
Brad King 5c0c635a09 Fortran: Add support for free- and fixed-form flags
Define a "Fortran_FORMAT" target and source file property.  Initialize
the target property from a "CMAKE_Fortran_FORMAT" variable.  Interpret
values "FIXED" and "FREE" to indicate the source file format.  Append
corresponding flags to the compiler command line.
2011-08-31 10:24:43 -04:00
Brad King 4e2185cbd0 Make std::map usage more portable in language=>flags/defines maps
Older versions of GCC, the HP compiler, and the SGI MIPSpro compiler do
not like the use of make_pair in this case and the conversions it
requires:

  a value of type "const char *" cannot be used to initialize an entity
  of type "char [1]"

  /usr/include/g++-3/stl_pair.h:68: assignment of read-only location

Instead use a map lookup pattern already used throughout the rest of our
source tree.
2011-05-17 08:50:55 -04:00
Manuel Klimek 5674844de4 make compile command output optional 2011-04-25 13:27:58 -04:00
Manuel Klimek fe07b0557b implement cxx command output 2011-04-25 13:27:58 -04:00
Manuel Klimek 65c0c24a29 cache flags and defines 2011-04-25 13:27:58 -04:00
Manuel Klimek 3f064efe40 refactor flags and defines 2011-04-25 13:27:58 -04:00
Brad King 9a0b9bc8b7 Optionally pass include directories with response files
Create platform option CMAKE_<lang>_USE_RESPONSE_FILE_FOR_INCLUDES to
enable use of response files for passing the list of include directories
to compiler command lines.
2011-03-17 17:56:13 -04:00
Brad King d099546450 Factor old-style -D flags out from -I flag generation
Move the GetDefineFlags call from cmLocalGenerator::GetIncludeFlags to
all call sites so that the method exclusively constructs a string of
include search path flags.
2011-03-15 13:09:06 -04:00
Brad King ed9979f931 Merge topic 'link-depend-def-file'
3e27997 Make link rule depend on ".def" file (#11014)
2010-12-16 14:00:17 -05:00
Brad King 4f769d18d1 Merge topic 'cray-compiler'
ab9ebb0 Fix Fortran .mod timestamps with Cray compiler
2010-12-16 13:59:57 -05:00
Brad King 3e279971fb Make link rule depend on ".def" file (#11014)
When the link command line references a ".def" file the rule should
depend on it.

Inspired-By: Eric Huhtala
2010-12-15 11:30:57 -05:00
Brad King 5622a16f1f Make Fortran $obj.provides.build targets not .PHONY
Commit 60cd72d0 (Cleaned up generation of symbolic rules, 2006-02-15)
incorrectly made these Makefile targets .PHONY even though the build
rule touches an actual file.  Correct it so that the copy_f90_mod and
touch steps do not happen on every "make".
2010-12-06 16:43:04 -05:00
Brad King ab9ebb017e Fix Fortran .mod timestamps with Cray compiler
Commit 34e1ac24 (Create Fortran info variables for .mod behavior,
2010-11-12) incorrectly taught GetFortranModuleDirectory to return a
relative path.  We really want to use "." as the module directory only
as a workaround for compilers that do not do so by default.  Therefore
we need this default only when generating the compiler command line and
not when scanning dependencies.

Revert the previous change to GetFortranModuleDirectory and apply the
change only at one of its call sites.
2010-12-06 10:35:25 -05:00
Brad King 34e1ac2489 Create Fortran info variables for .mod behavior
Define CMAKE_Fortran_MODDIR_DEFAULT and CMAKE_Fortran_MODOUT_FLAG
variables to help some Fortran compilers generate .mod files in the
current working directory.
2010-11-12 09:03:49 -05:00
Brad King 95f149e61f Define LINK_DEPENDS target property (#11406)
Custom Makefile link rules may need to depend on linker scripts.  Define
this property to allow user-specified link-time dependencies.
2010-11-05 09:05:08 -04:00
Brad King 07cfa57ec5 Consolidate duplicate link rule make dependency code
Factor code previously duplicated for library and executable rules into
a common method.
2010-11-05 08:33:47 -04:00
Brad King 5444bd6ca3 Merge branch 'tru64-make-includes' 2010-06-15 14:03:26 -04:00
Brad King d9b2da139d Merge branch 'mingw-response-files' 2010-06-15 13:58:58 -04:00
Brad King c592df8377 Tru64: Use full-path include directives in Makefiles (#10569)
Tru64's make(1) resolves relative paths in "include" directives with
respect to the includer.  This is inconsistent with all other known make
tools.  Note that this make tool treats the path literally so we cannot
use our standard FULL path code which escapes spaces.  Instead qualify
the paths with $(CMAKE_BINARY_DIR) to avoid the problem.
2010-06-14 13:06:39 -04:00
Alex Neundorf d7ceb75e8a -fix GetFrameworkFlags() for Mac, which was broken with my last commit
Alex
2010-05-03 21:28:44 +02:00
Alex Neundorf 3901e0408c -improve crosscompiling from Linux to iphone (#10526)
Patch by Karol Krizka

Alex
2010-05-01 20:38:28 +02:00
Brad King f9268c9c81 Use platform variable for response file flag
Create platform variable "CMAKE_<LANG>_RESPONSE_FILE_LINK_FLAG" to
specify an alternative to "@" for referencing response files.  It
applies specifically to response files with linker options.

See issue #10401.
2010-03-11 09:43:33 -05:00
Brad King 87f0853941 Use forward slashes for objects in response files
Response files are parsed by tools, not by shells.  We teach
cmLocalGenerator::Convert() a new "RESPONSE" output format and use it
for objects listed in response files.  It does not do special slash or
MSYS root translation like the "SHELL" format does.  This is necessary
for GNU tools on Windows to understand response file content.

See issue #10401.
2010-03-11 09:40:24 -05:00
Brad King 867a1cc12c Fix line-too-long style violations
The commit "Define per-target OSX_ARCHITECTURES property" introduced
some long lines.  This wraps them into multiple shorter lines.
2009-10-23 08:02:24 -04:00
Brad King 2dc39b8c32 Define per-target OSX_ARCHITECTURES property
The CMAKE_OSX_ARCHITECTURES variable works only as a global setting.
This commit defines target properties

  OSX_ARCHITECTURES
  OSX_ARCHITECTURES_<CONFIG>

to specify OS X architectures on a per-target and per-configuration
basis.  See issue #8725.
2009-10-21 13:00:49 -04:00
Alexander Neundorf eb91859d6f remove unused variables, reported by icpc
Alex
2009-10-03 08:35:57 -04:00
Brad King c513962701 Create INTERPROCEDURAL_OPTIMIZATION build feature
This commit creates target and directory properties to enable the Intel
interprocedural optimization support on Linux.  Enabling it adds the
compiler option '-ipo' and uses 'xiar' to create archives.

See issue #9615.
2009-10-02 13:52:13 -04:00
Brad King 1e48243591 Introduce "build feature" lookup framework
This creates cmTarget::GetFeature and cmMakefile::GetFeature methods to
query "build feature" properties.  These methods handle local-to-global
scope and per-configuration property lookup.  Specific build features
will be defined later.
2009-10-02 13:52:01 -04:00
Brad King 57df2abca8 Centralize language flag addition for Makefiles
We create cmMakefileTargetGenerator::AddFeatureFlags to consolidate
addition of language flags.  Currently it just adds the flags from
generic per-language flag variables (AddLanguageFlags).
2009-10-02 13:51:49 -04:00
Brad King 67530409a9 Fix module definition file reference for VS6 NMake
When building through NMake with VS 6, the module definition file must
be passed without spaces in the path.  This is because 'cl -link' does
not escape the spaces when passing the value on to the linker.
2009-09-30 10:12:54 -04:00
Brad King 024d05adad Fix use of module .def files for MS tools
We recognize .def source files and map them to the /DEF:<file> option in
the MSVC tools.  Previously this worked only for shared libraries.  This
commit cleans up the implementation and makes it work for executables
too.  See issue #9613.
2009-09-29 16:39:07 -04:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
This converts the CMake license to a pure 3-clause OSI-approved BSD
License.  We drop the previous license clause requiring modified
versions to be plainly marked.  We also update the CMake copyright to
cover the full development time range.
2009-09-28 11:43:28 -04:00
Brad King c87a35a326 Do not call CollapseFullPath for PDB file names
Some vendor tools convert PDB file names given on the command line to
lower-case before creating the file.  When CMake places a mixed-case PDB
file name into the build system, the file does not exist the first time
and it is written with mixed case.  After the first build though the
native tool has created a lower-case version of the file.  If CMake does
CollapseFullPath again, the file exists so the actual-case lookup gets
the lower-case name.  This causes the build files to change so the
project rebuilds.

The solution is to avoid calling CollapseFullPath for files generated by
the build.  In the case of PDB files we already construct them from
paths that have been collapsed, so we can just skip the call altogether.
See issue #9350.
2009-09-17 08:42:31 -04:00
Brad King bde145a212 ENH: Pass config to cmTarget::GetDirectory()
This teaches the makefile generators to always pass the configuration
name to the cmTarget::GetDirectory method.  Later this will allow
per-configuration target output directories, and it cleans up use of the
current API.
2009-07-03 10:34:10 -04:00
Brad King 11d1063452 ENH: Create cmMakefileTargetGenerator::ConfigName
This member stores the build configuration for which Makefiles are being
generated.  It saves repeated lookup of the equivalent member from
cmLocalUnixMakefileGenerator3, making code shorter and more readable.
2009-07-03 08:41:10 -04:00
Brad King cd83f1979d ENH: Cleanup make progress rule generation code
This cleans up the Makefile generator's progress rule code.  Instead of
keeping every cmMakefileTargetGenerator instance alive to generate
progress, we keep only the information necessary in a single table.
This approach keeps most of the code in cmGlobalUnixMakefileGenerator3,
thus simplifying its public interface.
2009-06-25 09:58:51 -04:00
Brad King 493f88ce55 ENH: Allow projects to disable per-rule echo lines
This creates global property RULE_MESSAGES which can be set to disbale
per-rule progress and action reporting.  On Windows, these reports may
cause a noticable delay due to the cost of starting extra processes.
This feature will allow scripted builds to avoid the cost since they do
not need detailed information anyway.  This replaces the RULE_PROGRESS
property created earlier as it is more complete.  See issue #8726.
2009-03-16 16:55:58 -04:00
Brad King 2f651c2e59 ENH: Allow projects to disable per-rule progress
This creates global property RULE_PROGRESS which can be set to disbale
per-rule progress reporting.  On Windows, progress reports may cause a
noticable delay due to the cost of starting an extra process.  This
feature will allow scripted builds to avoid the cost since they do not
need detailed progress anyway.  See issue #8726.
2009-03-16 16:22:19 -04:00
Brad King 741ae600c4 ENH: Factor out makefile progress rule commands
This factors duplicate progress rule code into a common method.
2009-03-16 16:22:13 -04:00
Brad King b41c8fe23e BUG: Pass shared library export symbol in DEFINES
The <target>_EXPORTS macro defined for object files when built in a
shared library <target> should be put in the <DEFINES> make rule
replacement and not <FLAGS>.  Also, it should honor the platform
variable CMAKE_<LANG>_DEFINE_FLAG.  See issue #8107.
2009-02-27 12:59:52 -05:00
Brad King b604b98c56 ENH: Define RULE_LAUNCH_* properties
This defines global, directory, and target properties
RULE_LAUNCH_COMPILE, RULE_LAUNCH_LINK, and RULE_LAUNCH_CUSTOM.  Their
values specify 'launcher' command lines which are prefixed to compile,
link, and custom build rules by Makefile generators.
2009-02-10 08:51:15 -05:00
Brad King c895d9f2e0 ENH: Give target in which custom commands build
This gives the cmTarget instance for which custom command rules are
being generated to cmLocalUnixMakefileGenerator3::AppendCustomCommands.
It will be useful in the future.
2009-02-10 08:50:33 -05:00
Brad King 084e5a5e9e BUG: Fix preprocess and assembly rule expansion
The recent change to avoid expanding rule variables in informational and
'cd' commands broke the logical order in generation of preprocess and
assembly rules.  This corrects the order.
2009-02-02 14:36:53 -05:00
Brad King 496c203a0b BUG: Do not expand rule variables in info rules
Previously the makefile generator would expand rule variables even on
its progress and echo commands for object compilation rules (but not for
link rules).  This fixes the implementation to only expand rule
variables on user-specified rules.
2009-02-02 13:28:17 -05:00
Brad King ac9b7ec155 ENH: Refactor custom command rule hashing
This simplifies computation of custom command rule hashes to hash
content exactly chosen as the custom commands are generated.
Unfortunately this will change the hashes of existing build trees from
earlier CMake versions, but this is not a big deal.  The change is
necessary so that in the future we can make optional adjustments to
custom command lines at generate time without changing the hashes every
time the option is changed.
2009-02-02 13:28:12 -05:00
Brad King 690121f098 BUG: Fix color check for dependency scanning
Generation of color rules for dependency scanning messages did not
account for disabling color at generation time.  See issue #7814.
2008-10-15 10:40:57 -04:00