Commit Graph

81 Commits

Author SHA1 Message Date
Stephen Kelly 830246e841 Export the COMPATIBLE_INTERFACE_BOOL content properties 2013-01-21 09:05:03 +01:00
Stephen Kelly 1d74ba21f6 Test evaluation target via export for generator expressions 2013-01-15 14:36:22 -05:00
Stephen Kelly 522bdac149 Export the INTERFACE_PIC property. 2013-01-15 14:36:22 -05:00
Stephen Kelly 4ee872cb99 Make the BUILD_INTERFACE of export()ed targets work.
The existing BUILD_INTERFACE code is executed at generate time, which
is too late for export().
2013-01-15 14:36:22 -05:00
Stephen Kelly 1d47cd94f3 Add a test for the interfaces in targets exported from the build tree. 2013-01-15 14:36:22 -05:00
Stephen Kelly 77d2646784 Allow generator expressions in LINK_INTERFACE_LIBRARIES.
The Config and IMPORTED_ variants may also contain generator
expressions.

If 'the implementation is the interface', then the result of
evaluating the expressions at generate time is used to populate
the IMPORTED_LINK_INTERFACE_LIBRARIES property.

1) In the case of non-static libraries, this is fine because the
  user still has the option to populate the LINK_INTERFACE_LIBRARIES
  with generator expressions if that is what is wanted.

2) In the case of static libraries, this prevents a footgun,
  enforcing that the interface and the implementation are really
  the same.

  Otherwise, the LINK_LIBRARIES could contain a generator
  expression which is evaluated with a different context at build
  time, and when used as an imported target. That would mean that the
  result of evaluating the INTERFACE_LINK_LIBRARIES property for
  a static library would not necessarily be the 'link implementation'.

  For example:

    add_library(libone STATIC libone.cpp)
    add_library(libtwo STATIC libtwo.cpp)
    add_library(libthree STATIC libthree.cpp)

    target_link_libraries(libtwo
      $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>:libone>)
    target_link_libraries(libthree libtwo)

  If the LINK_LIBRARIES content was simply copied to the
  IMPORTED_LINK_INTERFACE_LIBRARIES, then libthree links to libone, but
  executables linking to libthree will not link to libone.

3) As the 'implementation is the interface' concept is to be
  deprecated in the future anyway, this should be fine.
2013-01-10 23:04:06 +01:00
Stephen Kelly 894f52f32d Handle INTERFACE properties transitively for includes and defines.
Contextually, the behavior is as if the properties content from another
target is included in the string and then the result is evaluated.
2013-01-05 01:18:37 +01:00
Alex Neundorf 955b96629e exports: add a test for exporting dependent targets
The test exports two libraries into two separate exports,
and then include()s the generated export files. This must not fail.

Alex
2012-09-30 10:27:02 -04:00
Kitware Robot 9db3116226 Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

Run the following shell code:

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Brad King 183b95098e Follow all dependencies of shared library private dependencies
In cmComputeLinkDepends we compute the transitive closure of private
shared library dependencies.  When a shared library is added to this
closure we must follow all of its dependencies whether they are private
or public.  Previously we only followed the private dependencies.  Fix
the implementation to follow the public dependencies too.  Also extend
the ExportImport test to cover this case.
2011-12-14 11:33:01 -05:00
Brad King d259128894 Test link multiplicity export/import
We test that LINK_INTERFACE_MULTIPLICITY propagates through export() and
install(EXPORT) into dependent projects.  A simple cycle of two archives
that need to be scanned three times ensures that the importing project
uses the multiplicity correctly.
2009-09-01 10:38:36 -04:00
Brad King 61367c69d7 COMP: Fix ExportImport testLib6 on VS6
The compiler does not support multiple source files differing only by
extension in one target.  This renames the C source file in the test.
2009-07-13 09:20:36 -04:00
Brad King 3621e073a8 ENH: Test export/import of link interface languages
This extends the ExportImport test.  The Export project creates a C++
static library and exports it.  Then the Import project links the
library into a C executable.  On most platforms the executable will link
only if the C++ linker is chosen correctly.
2009-07-11 10:10:51 -04:00
Brad King d1aa17a7b0 ENH: Remove CMAKE_ANSI_CFLAGS from tests
As of CMake 2.6 this variable is not defined, and the ANSI flags for the
HP compiler are simply hard-coded in the default C flags.
2009-07-08 11:41:48 -04:00
Brad King 2740db5ede ENH: Allow more specification of target file names
This creates target properties ARCHIVE_OUTPUT_NAME, LIBRARY_OUTPUT_NAME,
and RUNTIME_OUTPUT_NAME, and per-configuration equivalent properties
ARCHIVE_OUTPUT_NAME_<CONFIG>, LIBRARY_OUTPUT_NAME_<CONFIG>, and
RUNTIME_OUTPUT_NAME_<CONFIG>.  They allow specification of target output
file names on a per-type, per-configuration basis.  For example, a .dll
and its .lib import library may have different base names.

For consistency and to avoid ambiguity, the old <CONFIG>_OUTPUT_NAME
property is now also available as OUTPUT_NAME_<CONFIG>.

See issue #8920.
2009-05-01 09:45:43 -04:00
Brad King d05e98f8d7 ENH: Allow IMPORTED_IMPLIB w/o IMPORTED_LOCATION
Linking to a Windows shared library (.dll) requires only its import
library (.lib).  This teaches CMake to recognize SHARED IMPORTED library
targets that set only IMPORTED_IMPLIB and not IMPORTED_LOCATION.
2009-04-08 16:29:04 -04:00
Brad King 3c5cf1bb8c ENH: Allow a custom list of debug configurations
Create a DEBUG_CONFIGURATIONS global property as a way for projects to
specify which configuration names are considered to be 'debug'
configurations.
2008-09-04 17:34:25 -04:00
Brad King 94c1fe83fd ENH: Make link interface mode more distinct
Rename the recently added INTERFACE mode of the target_link_libraries()
command to LINK_INTERFACE_LIBRARIES.  This makes it much more distinct
from a normal call to the command, and clearly states its connection to
the property of the same name.  Also require the option to appear
immediately after the target name to make it a mode rather than an
option.
2008-08-18 10:11:29 -04:00
Brad King 1712cd0a98 BUG: Fix ExportImport test on VS6
Visual Studio 6 does not support per-target object files, so just use two
separate source file names in this case.
2008-08-12 17:27:48 -04:00
Brad King 7b873cd951 ENH: Test target_link_libraries INTERFACE option 2008-08-11 16:23:10 -04:00
Ken Martin ce8810c4e7 ENH: preclean some warnings 2008-03-25 11:27:18 -04:00
Brad King 9e64d5b272 ENH: Improve exporting/importing of targets
- Use real name instead of link for location of versioned targets
  - Error when a target is exported multiple times
2008-02-06 14:20:36 -05:00
Brad King 16186ec18c BUG: Remove InstallNameFixupPath from cmTarget and cmInstallTargetGenerator.
- Motivation:
    - It depended on the order of installation
    - It supported only a single destination for each target
    - It created directory portions of an install name without user request
  - Updated ExportImport test to install targets in an order that expoed
    this bug
2008-02-01 13:08:12 -05:00
Brad King 587419db83 ENH: Update ExportImport test to enforce dependent library paths
- Build without rpaths
  - Place implementation libs in separate directories
2008-02-01 09:57:47 -05:00
Brad King 2cff26fa52 ENH: Support linking to shared libs with dependent libs
- Split IMPORTED_LINK_LIBRARIES into two parts:
      IMPORTED_LINK_INTERFACE_LIBRARIES
      IMPORTED_LINK_DEPENDENT_LIBRARIES
  - Add CMAKE_DEPENDENT_SHARED_LIBRARY_MODE to select behavior
  - Set mode to LINK for Darwin (fixes universal binary problem)
  - Update ExportImport test to account for changes
2008-01-31 15:45:31 -05:00
Brad King 109b5fc7a2 ENH: Updated ExportImport test to try LINK_INTERFACE_LIBRARIES. 2008-01-30 17:26:09 -05:00
Brad King e3b1bdb058 ENH: Support exporting/importing of AppBundle targets.
- Imported bundles have the MACOSX_BUNDLE property set
  - Added cmTarget::IsAppBundleOnApple method to simplify checks
  - Document BUNDLE keyword in INSTALL command
  - Updated IMPORTED_LOCATION property documentation for bundles
  - Updated ExportImport test to test bundles
2008-01-28 14:46:16 -05:00
Brad King 437043bb04 BUG: Fix export/import file generation to not store link dependencies of executables or modules. 2008-01-28 13:37:59 -05:00
Brad King 6388ebceb1 ENH: Restored APPEND option to EXPORT() command in new implementation. 2008-01-28 13:21:42 -05:00
Brad King 611bff2c1b ENH: Added framework to ExportImport test. 2008-01-28 13:06:17 -05:00
Brad King 976b426b2d ENH: Added ExportImport test to test new export/import features. 2008-01-28 08:40:21 -05:00