summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkInformation.cxx
Commit message (Collapse)AuthorAgeFilesLines
* stringapi: Use strings for generator namesBen Boeckel2014-03-081-2/+3
|
* stringapi: Pass configuration names as stringsBen Boeckel2014-03-081-3/+4
|
* strings: Remove cmStdString referencesBen Boeckel2014-03-081-4/+4
| | | | | | | | | | | 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.
* stringapi: Use strings in target nameBen Boeckel2014-03-081-1/+1
|
* stringapi: Use strings for the languagesBen Boeckel2014-03-081-2/+2
|
* Merge topic 'rpath-default'Brad King2014-01-021-1/+1
|\ | | | | | | | | d25ad48 OS X: Add CMP0042 to enable MACOSX_RPATH by default
| * OS X: Add CMP0042 to enable MACOSX_RPATH by defaultClinton Stimpson2014-01-021-1/+1
| | | | | | | | | | Also adding documentation for CMAKE_MACOSX_RPATH, and improving documentation for MACOSX_RPATH.
* | Constify handling of link targets.Stephen Kelly2013-12-111-8/+9
|/
* Introduce CMAKE_STAGING_PREFIX variable.Stephen Kelly2013-11-211-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | This variable can be useful in cross-compiling contexts where the sysroot is read-only or where the sysroot should otherwise remain pristine. If the new CMAKE_STAGING_PREFIX variable is set, it is used instead of CMAKE_INSTALL_PREFIX when generating the installation rules in cmake_install.cmake. This way, the CMAKE_INSTALL_PREFIX variable always refers to the installation prefix on the target device, regardless of whether host==target. If any -rpath paths passed to the linker contain the CMAKE_STAGING_PREFIX, the matching path fragments are replaced with the CMAKE_INSTALL_PREFIX. Matching paths in the -rpath-link are not transformed. The cross-prefix usr-move workaround is assumed not to require extension regarding CMAKE_STAGING_PREFIX. The staging area is a single prefix, so there is no scope for cross-prefix symlinks. The CMAKE_INSTALL_PREFIX is still used to determine the workaround path, and that variable remains the relevant one even if CMAKE_STAGING_PREFIX is used. If the generated export files are deployed to the target, the workaround will still be in place, and still be employed if required.
* Add CMAKE_SYSROOT variable to set --sysroot when cross compiling.Stephen Kelly2013-11-191-4/+16
| | | | | | | | | | 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.
* cmTarget: Make GetProperty() const.Stephen Kelly2013-10-311-2/+2
| | | | | | This has follow-on effects for other methods and classes. Further work on making the use of const cmTarget pointers common can be done, particularly with a view to generate-time methods.
* Add the INTERFACE_LIBRARY target type.Stephen Kelly2013-10-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* OS X: Enable rpath support on Mac OS X when find_library() is used.Clinton Stimpson2013-07-161-4/+16
|
* Revert "Use --sysroot when cross compiling."Stephen Kelly2013-07-121-9/+2
| | | | | | | This reverts commit de4da665d3205afa239749c41513a315c3831f51. This feature is not yet ready for release. It needs to be merged with the CMAKE_OSX_SYSROOT feature.
* Merge topic 'set-sysroot'Brad King2013-06-241-2/+9
|\ | | | | | | | | de4da66 Use --sysroot when cross compiling.
| * Use --sysroot when cross compiling.Stephen Kelly2013-06-071-2/+9
| | | | | | | | | | | | | | | | | | | | 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.
* | Add whitespace after colons in error messages.Stephen Kelly2013-06-211-1/+1
|/
* Merge topic 'rpath-on-mac'Brad King2013-06-031-7/+53
|\ | | | | | | | | | | | | | | dc1d025 OS X: Add test for rpaths on Mac. 8576b3f OS X: Add support for @rpath in export files. 00d71bd Xcode: Add rpath support in Xcode generator. 94e7fef OS X: Add RPATH support for Mac.
| * OS X: Add RPATH support for Mac.Clinton Stimpson2013-06-031-7/+53
| | | | | | | | | | | | | | | | | | 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.
* | Recognize shared library files with a numerical suffixStephen Kelly2013-05-211-4/+10
|/ | | | | | When processing link line entries we check for matches with known naming patterns for static and shared libraries. Teach this logic to recognize numerical suffixes after shared library names such as "libfoo.so.1".
* Fix RPATH information when only a genex is used as a link library.Stephen Kelly2013-02-281-1/+1
| | | | | | | | As of commit 1da75022 (Don't include generator expressions in old-style link handling., 2012-12-23), such entries are not included in the LinkLibraries member. Generator expressions in LinkLibraries are not processed anyway, so port to the new way of getting link information.
* Merge topic 'rpath-use-implicit-link-dirs'Brad King2013-02-151-4/+49
|\ | | | | | | | | | | | | 95a9c80 Merge topic 'LINK_LIBRARIES-property' into rpath-use-implicit-link-dirs baa33ac AIX-GNU: Put implicit link directories in runtime libpath (#13909) 171b099 Avoid duplicate RPATH entries
| * Merge topic 'LINK_LIBRARIES-property' into rpath-use-implicit-link-dirsBrad King2013-02-141-6/+17
| |\ | | | | | | | | | Resolve a logical conflict in the signature of cmTarget::GetLinkClosure.
| * | AIX-GNU: Put implicit link directories in runtime libpath (#13909)Brad King2013-02-141-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GNU compiler front-ends on AIX invoke the linker with flags of the form "-L/path/to/gnu/runtime/lib" to tell ld where to find the language runtime libraries. They depend on the default libpath behavior documented in "man ld" to add the -L paths also to the runtime libpath so the dynamic loader can find the language runtime libraries. This differs from platforms whose linkers have distinct -rpath flags that non-system compilers can use to tell the dynamic loader where to find their language runtime libraries. Since commit 96fd5909 (Implement linking with paths to library files, 2008-01-22) CMake always passes "-Wl,-blibpath:" followed by any project-defined RPATH plus "/usr/lib:/lib" in order to explicitly set the runtime libpath and avoid getting all the project -L paths in the runtime libpath. The explicit libpath prevents the GNU compiler runtime library -L paths from being placed in the libpath and then the dynamic loader fails to find the language runtime libraries. CMake already detects the implicit link directories for each language since commit 07ea19ad (Implicit link info for C, CXX, and Fortran, 2009-07-23). Add the implicit link directories to the explicit runtime libpath for GNU compilers on AIX to fix this use case.
| * | Avoid duplicate RPATH entriesBrad King2013-02-141-4/+27
| | | | | | | | | | | | | | | Teach cmComputeLinkInformation::GetRPath to avoid adding the same directory to the output runtime path more than once.
* | | Merge topic 'LINK_LIBRARIES-property'Brad King2013-01-081-4/+7
|\ \ \ | | |/ | |/| | | | | | | | | | 7653862 Add LINK_LIBRARIES property for direct target link dependencies 40cf3fb Make linking APIs aware of 'head' target
| * | Make linking APIs aware of 'head' targetStephen Kelly2013-01-081-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'head' is the dependent target to be linked with the current target. It will be used to evaluate generator expressions with proper handling of mapped configurations and is used as the source target of properties. This requires that memoization is done with a key of a pair of target and config, instead of just config, because now the result also depends on the target. Removing the memoization entirely is not an option because it slows cmake down considerably.
* | | OS X: Detect implicit linker framework search pathsBrad King2012-12-111-4/+25
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we hard-coded a list of implicit framework directories but did not account for CMAKE_OSX_SYSROOT or for changes to the list across OS X versions. Instead we should automatically detect the framework directories for the active toolchain. The parent commit added the "-Wl,-v" option to ask "ld" to print its implicit directories. It displays a block such as: Framework search paths: /... Parse this block to extract the list of framework directories. Detection may fail on toolchains that do not list their framework directories, such as older OS X linkers. Always treat the paths <sdk>/Library/Frameworks <sdk>/System/Library/Frameworks <sdk>/Network/Library/Frameworks # Older OS X only /System/Library/Frameworks as implicit. Note that /System/Library/Frameworks should always be considered implicit so that frameworks CMake finds there will not override the SDK copies.
* | Optionally skip link dependencies on shared library filesBrad King2012-10-261-1/+9
|/ | | | | | | Add target property LINK_DEPENDS_NO_SHARED and initialization variable CMAKE_LINK_DEPENDS_NO_SHARED to enable this behavior. Suggested-by: Leif Walsh <leif.walsh@gmail.com>
* Remove trailing whitespace from most CMake and C/C++ codeKitware Robot2012-08-131-1/+1
| | | | | | | | | | | | | | | | | Our Git commit hooks disallow modification or addition of lines with trailing whitespace. Wipe out all remnants of trailing whitespace everywhere except third-party code. Run the following shell code: git ls-files -z -- \ bootstrap doxygen.config '*.readme' \ '*.c' '*.cmake' '*.cpp' '*.cxx' \ '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \ '*.mm' '*.pike' '*.py' '*.txt' '*.vim' | egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' | egrep -z -v '^(Modules/CPack\..*\.in)' | xargs -0 sed -i 's/ \+$//'
* Merge topic 'skip-install-rpath'David Cole2012-03-061-0/+1
|\ | | | | | | | | 635bf50 Add an option to skip RPATH during installation.
| * Add an option to skip RPATH during installation.Stephen Kelly2012-03-051-0/+1
| |
* | Recognize OpenBSD versioned .so names (#12954)Brad King2012-02-131-1/+13
|/ | | | | | OpenBSD shared library names end in a ".#.#" version number suffix. Teach cmComputeLinkInformation to tolerate the extra suffix after the normal library name suffixes when parsing library names.
* Do not link private dependent shared libraries on OS X > 10.4Brad King2011-12-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default OS X 10.4 linker incorrectly searches for dependencies of linked shared libraries only under the -isysroot location. It fails to find dependencies of linked shared libraries in cases such as the ExportImport test. It produces errors like: /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library: libtestLib3Imp.dylib referenced from: /.../ExportImport/Root/lib/libtestLib3lib.1.2.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2) /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols: _testLib3Imp referenced from libtestLib3lib expected to be defined in libtestLib3Imp.dylib or with CMAKE_SKIP_RPATH off to enable install_name in the Export side: /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library: /Developer/SDKs/MacOSX10.4u.sdk/.../ExportImport/Export/impl/libtestLib3Imp.dylib referenced from: /.../ExportImport/Export/libtestLib3lib.1.2.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2) /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:_testLib3Imp referenced from libtestLib3lib expected to be defined in /.../ExportImport/Export/impl/libtestLib3Imp.dylib Note how "/Developer/SDKs/MacOSX10.4u.sdk" is prepended to the dependent library path. Commit 2cff26fa (Support linking to shared libs with dependent libs, 2008-01-31) and commit 82fcaebe (Pass dependent library search path to linker on some platforms, 2008-02-01) worked around the problem by defining platform variable CMAKE_LINK_DEPENDENT_LIBRARY_FILES. It tells CMake to link to dependent libraries explicitly by their path thus telling the linker where to find them. Unfortunately the workaround had the side effect of linking dependent libraries and defeats most benefits of LINK_INTERFACE_LIBRARIES. Fortunately OS X 10.5 and above do not need to find transitive dependencies at all so we can avoid the workaround on Modern OS X.
* Fix linking to OS X Frameworks named with spaces (#12550)Brad King2011-11-021-2/+3
| | | | | | | | | | | | | | | | Teach cmComputeLinkInformation to generate the "-framework" option as a separate link item preceding the actual framework name. Then escape the framework name to pass as an argument through a shell. This fixes the link line for frameworks with spaces in the name. The build system generators that call cli.GetItems() and generate the final list of items on the link line already handle escaping correctly for items that are paths. However, for raw link items like "-lfoo" they just pass through to the command line verbatim. This is incorrect. The generators should escape these items too. Unfortunately we cannot fix that without introducing a new CMake Policy because projects may already be passing raw link flags with their own escapes to work around this bug. Therefore we punt on this bug for now and go with the above fix.
* multiarch: Treat lib/<arch> as implicit link dir (#12326)Modestas Vainius2011-07-271-0/+12
| | | | | Add multiarch library directories to the set of implicit link directories. In particular, this keeps lib/<arch> out of R(UN)PATH.
* Add target property LINK_SEARCH_START_STATIC to aid static linkingBrad King2011-03-031-3/+3
| | | | | | | | | Commit afd7d4ca (Add target property LINK_SEARCH_END_STATIC, 2008-01-31) defined a property to ensure that static runtime libraries get selected. Add a property to specify that all libraries whose type is unknown, such as "-lm", should be assumed static. Furthermore it assumes that an option such as "-static" is also used so that no initial -Bstatic is needed.
* Prefer non-empty prefixes when matching lib names (#11468)Brad King2010-11-181-1/+1
| | | | | | | | | In cmComputeLinkInformation we match library names with a regular expression, possibly extracting the 'lib' prefix. The regex component to match the prefix always allows an empty prefix to be matched, as in "(lib|)". Avoid every adding an empty prefix option earlier in the regex, as in "(|lib|)", because it will be preferred and 'lib' will never match.
* -fix bad check for Apple in AddDirectoryItem() introduced recentlyAlex Neundorf2010-04-271-4/+2
| | | | Alex
* -fix linking to frameworks when crosscompiling from Linux to iPhone (#10526)Alex Neundorf2010-04-211-2/+3
| | | | Alex
* OpenBSD: Work-around static/runtime linker inconsistencyChuck Atkins2010-03-261-0/+10
| | | | | | | Detect the runtime linker's search path and add to the compile time linker's search path. This is needed because OpenBSD's static linker does not search for shared library dependencies in the same places as the runtime linker.
* Fix warnings in CMake source code. Suppress warnings in Lexer and Parser ↵David Cole2009-09-301-2/+2
| | | | files that are 'too hard' to fix.
* Convert CMake to OSI-approved BSD LicenseBrad King2009-09-281-14/+9
| | | | | | | 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.
* Factor implicit link info addition into methodsBrad King2009-08-241-28/+41
| | | | | | | In cmComputeLinkInformation::Compute we add implicit link information from languages other than the linker language to the end of the link line. This factors out that code into separate methods to improve readability and organization.
* BUG: Do not filter non-library implicit link itemsBrad King2009-07-281-1/+7
| | | | | | | We list implicit link items of languages linked into a target but filter them by the implicit libraries known to be passed by the main linker language. Implicit link flags like "-z..." should not be filtered out because they are not libraries.
* BUG: Always pass linker flags untouchedBrad King2009-07-281-21/+23
| | | | | | | | In cmComputeLinkInformation we recognize link options that look like library file names, but pass flags starting in '-' through untouched. This fixes the ordering of the check to recognize '-' flags first in case the rest of the option looks like a library file name, as in the case of "-l:libfoo.a".
* BUG: Do not recognize ':' in a library nameBrad King2009-07-281-1/+1
| | | | | | In cmComputeLinkInformation we construct regular expressions to recognize library file names. This fixes the expressions to not allow a colon (':') in the file name so that "-l:libfoo.a" is left alone.
* ENH: Link runtime libraries of all languagesBrad King2009-07-271-0/+69
| | | | | | | | | | | | | | | | | | This adds implicit libraries and search directories for languages linked into a target other than the linker language to its link line. For example, when linking an executable containing both C++ and Fortran code the C++ linker is used but we need to add the Fortran libraries. The variables CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES contain the implicit libraries and directories for each language. Entries for the linker language are known to be implicit in the generated link line. Entries for other languages that do not appear in the known implicit set are listed explicitly at the end of the link line.
* STYLE: Factor cmComputeLinkInformation constructorBrad King2009-07-141-15/+24
| | | | | This factors some code out of the constructor into a new method cmComputeLinkInformation::LoadImplicitLinkInfo for readability.
* ENH: Pass config to cmTarget::GetLinkerLanguageBrad King2009-07-081-1/+1
| | | | | | This passes the build configuration to most GetLinkerLanguage calls. In the future the linker language will account for targets linked in each configuration.