Commit Graph

112 Commits

Author SHA1 Message Date
Stephen Kelly d560bfd273 cmGeneratorTarget: Move GetInstallNameDir* from cmTarget. 2015-08-05 18:20:47 +02:00
Stephen Kelly e27d737e27 cmGeneratorTarget: Move IsChrPathUsed from cmTarget. 2015-08-05 18:20:47 +02:00
Stephen Kelly 8d2de00244 cmGeneratorTarget: Move NeedRelinkBeforeInstall from cmTarget. 2015-08-05 18:20:47 +02:00
Stephen Kelly 766839c56d cmGeneratorTarget: Move GetLibraryNames from cmTarget. 2015-08-05 18:20:46 +02:00
Stephen Kelly 47803e6f8e cmGeneratorTarget: Move GetExecutableNames 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
Stephen Kelly a23fcc9558 cmInstallTargetGenerator: Port to cmGeneratorTarget. 2015-07-30 08:28:32 +02:00
Stephen Kelly 4e41913f9a cmInstallCommand: Store only a targetName, not a cmTarget.
Compute the cmTarget at Compute() time.
2015-07-30 08:28:31 +02:00
Stephen Kelly 3ef8aaaa71 cmInstallCommand: Move the SetHaveInstallRule invocation.
Remove the call from cmInstallTargetGenerator because that is
to be ported away from cmTarget.
2015-07-30 08:28:31 +02:00
Stephen Kelly dd0417c7be cmInstallTargetGenerator: Re-arrange data layout.
Remove unused cmGeneratorTarget member.

Size goes from 238 to 232 bytes.
2015-06-07 10:24:27 +02:00
Stephen Kelly a0836ed978 Port to cmMakefile::GetGlobalGenerator. 2015-05-03 11:42:00 +02:00
Stephen Kelly 32b8f03acc cmMakefile: Port users of GetStart* methods to new names. 2015-04-21 00:15:20 +02:00
Brad King f30022eb07 install: Allow generator expressions in TARGETS DESTINATION (#14317)
This will allow per-config destinations for targets in EXPORT sets.
Using multiple install(TARGETS) with separate CONFIGURATIONS is
rejected as a target appearing more than once in an export set.
Now instead one can write

 install(TARGETS foo EXPORT exp DESTINATION lib/$<CONFIG>)

to get a single logical membership of the target in the export set
while still having a per-config destination.
2015-02-11 15:15:33 -05:00
Brad King 7607c3d16a cmInstallGenerator: Pass destination explicitly to AddInstallRule
This will allow specific invocations to transform the destination
before AddInstallRule uses it.
2015-02-11 15:14:01 -05:00
Brad King 290ca8e2d0 cmInstallGenerator: Refactor computation of absolute install dest
Replace the GetInstallDestination method, which looked up the
Destination ivar, with a new ConvertToAbsoluteDestination method that
takes the nominal destination as an argument.  Update call sites
accordingly.  This will allow some clients to transform the install
destination before calling the method.
2015-02-11 15:12:16 -05:00
Stephen Kelly aa773035b7 Replace !foo.size() pattern with foo.empty(). 2015-01-18 14:25:24 +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
Sean McBride 2e92570bda Fix some Clang -Wstring-conversion warnings
Some false positives, but some flagged faulty asserts
where the ! was inside the string instead of outside.
2014-12-12 14:38:23 -05:00
Clinton Stimpson 50e261ddb6 OSX: Warn when attempting to change runtime paths on OS X 10.5
Even though 10.5 supports @rpath, the support is not complete
enough for CMake.  For instance, install_name_tool doesn't support
adding and removing rpaths.

Also modifying BundleUtilities test to remove an undesirable cmake
generated runtime path.  The intent was to build with the install
rpath as is done with the other cases in this test.
2014-10-10 10:17:27 -04:00
Brad King 5fc50479bf Merge topic 'install-cfbundle-directory'
a3ac67cc OS X: Install CFBundles as complete directories
2014-07-14 09:37:54 -04:00
Tim Blechmann a3ac67cc3f OS X: Install CFBundles as complete directories
Install CFBundles as directories just like frameworks and application
bundles.
2014-07-10 12:54:10 -04:00
Brad King ec7cf7ea13 install: Thread message level setting through internal API
Create a cmInstallGenerator::MessageLevel enumeration for future use in
specifying install message verbosity.  Thread values of the type through
constructors and save the value as a member of cmInstallGenerator.
Use only a "MessageDefault" value for now.
2014-06-24 13:12:02 -04:00
Ben Boeckel 84fdc9921c stringapi: Pass configuration names as strings 2014-03-08 13:05:36 -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
Clinton Stimpson 028a5285d8 OS X: Make sure RPATHs are unique to avoid possible corruption.
When using link_directories() and including CMAKE_CFG_INTDIR,
one can end up with duplicate RPATHs in the binary which
install_name_tool cannot fix without corrupting the binary.
Also, the cmake_install.cmake file has been fixed to correctly
handle these generator specific variables.
2014-02-03 07:04:54 -07:00
Stephen Kelly 9edee62f28 Constify handling of link targets. 2013-12-11 15:30:11 +01: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
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
Alex Neundorf ae8e6543a5 install: do not strip dll import libraries (#14123)
DLL import libraries exist specifically to have symbols.
2013-07-01 08:56:03 -04:00
Clinton Stimpson 94e7fef226 OS X: Add RPATH support for Mac.
RPATH support is activated on targets that have the MACOSX_RPATH
property turned on.
For install time, it is also useful to set INSTALL_RPATH to help
find dependent libraries with an @rpath in their install name.

Also adding detection of rpath conflicts when using frameworks.
2013-06-03 09:42:05 -04: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
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 4f5384e75c Move GetLinkInformation to cmGeneratorTarget 2012-09-19 15:30:57 +02:00
Brad King b87d7a60a0 Add OBJECT_LIBRARY target type
This library type can compile sources to object files but does not link
or archive them.  It will be useful to reference from executable and
normal library targets for direct inclusion of object files in them.

Diagnose and reject the following as errors:

* An OBJECT library may not be referenced in target_link_libraries.

* An OBJECT library may contain only compiling sources and supporting
  headers and custom commands.  Other source types that are not normally
  ignored are not allowed.

* An OBJECT library may not have PRE_BUILD, PRE_LINK, or POST_BUILD
  commands.

* An OBJECT library may not be installed, exported, or imported.

Some of these cases may be supported in the future but are not for now.

Teach the VS generator that OBJECT_LIBRARY targets are "linkable" just
like STATIC_LIBRARY targets for the LinkLibraryDependencies behavior.
2012-03-13 14:37:32 -04:00
Brad King 573fa3bf13 Factor cmInstallType out of cmTarget::TargetType
The purpose of the TargetType enumeration was overloaded for install
type because install rules were once recorded as targets.  Factor the
install types out into their own enumeration.
2012-02-27 13:19:57 -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 7a6db286c8 Tweak all files during target installation
During installation of a target we generate "tweak" rules to update the
installed file (RPATH, strip, ranlib, etc.).  However, some targets
install multiple files, such as the versioned names of a shared library.

Previously the extra files for a target have always been symbolic links,
but for cross-compiling from Windows to UNIX they may need to be copies.
This commit teaches the generated install scripts to loop over all files
installed for the target to apply tweaks to those that are not symlinks.

See issue #9171.
2009-10-21 13:11:42 -04:00
Brad King a52fd03a2a Compute install destination for all target files
In cmInstallTargetGenerator::GenerateScriptForConfig we were computing
the full 'from' paths for all target files to be installed, but only
computing a 'to' path for the "main" target file.  This commit teaches
the method to compute both 'from' and 'to' paths for every target file
to be installed.  The result is cleaner, easier to follow, and will
allow installation tweaks to be added later on all target files.
2009-10-21 13:10:51 -04:00
Brad King 3c326476ee Simplify 'strip' and 'ranlib' install tweak code
The cmInstallTargetGenerator methods AddStripRule and AddRanlibRule do
not need the target type argument.  They can simply use the type of the
target for which the generator instance was created.
2009-10-21 13:09:55 -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 a3a046643a ENH: Pass config to cmTarget RPATH install methods
This passes the build configuration to cmTarget methods IsChrpathUsed
and NeedRelinkBeforeInstall.  Later these methods will use the value.
2009-07-08 13:03:47 -04:00
Brad King 789eaf157c ENH: Cleanup per-config target install generation
This cleans up cmInstallTargetGenerator's code that computes the build
tree location of a target under each configuration.
2009-07-03 08:40:28 -04:00
Brad King da993b64ce ENH: Remove unused PROPERTIES from file(INSTALL)
The undocumented file(INSTALL) command used to support a PROPERTIES
option, but no install code still uses it.  This removes the option.
2009-04-27 13:20:57 -04:00
Brad King e67f5138b8 ENH: Refactor cmInstallGenerator for re-use
A new cmScriptGenerator base class factors out the non-install-specific
part of cmInstallGenerator.  This will be useful for other generators
that want per-configuration functionality.
2009-03-16 10:39:56 -04:00
Brad King 0e03bd1ab4 BUG: Do not map install_name of imported targets
When we install a target on Mac, we generate a call to install_name_tool to fix
install_name entries in the target for shared libraries it links.  This change
makes the step ignore entries for imported targets since their install_name
will not change and cmTarget cannot produce a mapping for them.  This fixes the
error

  GetLibraryNamesInternal called on imported target: kdelibs

seen by kde folks.
2008-11-25 16:50:48 -05:00
Brad King 7f819903ed BUG: Fix config test for target install rules
In single-configuration generators a target installation rule should
apply to all configurations for which the INSTALL command was specified.
The configuration in which the target is built does not matter.

In multi-configuration generators each installation rule must be
associated with a particular build configuration to install the proper
file.  The set of configurations for which rules are generated is the
intersection of the build configurations and those for which the INSTALL
command was specified.
2008-10-03 10:11:47 -04:00
Brad King 852242e56b BUG: RPATH adjustment of versioned executables should operate on the file and not the symlink. 2008-05-27 10:21:21 -04:00
Brad King fdc3bfff7c ENH: Improve RPATH behavior during installation.
- If new RPATH is empty then remove the entry completely
  - Preserve file modification time so installation is not repeated
  - If installed file already exists remove it if its RPATH
    does not match that expected
2008-04-14 15:02:44 -04:00
Brad King 67834f2d53 BUG: Correct Mac OS X framework behavior
- Place the built library in foo.framework/Versions/A/foo
  - Do not create unused content symlinks (like PrivateHeaders)
  - Do not use VERSION/SOVERSION properties for frameworks
  - Make cmTarget::GetDirectory return by value
  - Remove the foo.framework part from cmTarget::GetDirectory
  - Correct install_name construction and conversion on install
  - Fix MACOSX_PACKAGE_LOCATION under Xcode to use the
    Versions/<version> directory for frameworks
  - Update the Framework test to try these things
2008-04-08 00:06:47 -04:00