• Stephen Kelly's avatar
    Allow generator expressions in LINK_INTERFACE_LIBRARIES. · 77d26467
    Stephen Kelly authored
    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.
    77d26467
Name
Last commit
Last update
Docs Loading commit data...
Example Loading commit data...
Modules Loading commit data...
Source Loading commit data...
Templates Loading commit data...
Tests Loading commit data...
Utilities Loading commit data...
.gitattributes Loading commit data...
.hooks-config.bash Loading commit data...
CMakeCPack.cmake Loading commit data...
CMakeCPackOptions.cmake.in Loading commit data...
CMakeGraphVizOptions.cmake Loading commit data...
CMakeLists.txt Loading commit data...
CMakeLogo.gif Loading commit data...
CTestConfig.cmake Loading commit data...
CTestCustom.cmake.in Loading commit data...
CTestCustom.ctest.in Loading commit data...
ChangeLog.manual Loading commit data...
ChangeLog.txt Loading commit data...
CompileFlags.cmake Loading commit data...
Copyright.txt Loading commit data...
DartConfig.cmake Loading commit data...
DartLocal.conf.in Loading commit data...
Readme.txt Loading commit data...
bootstrap Loading commit data...
cmake_uninstall.cmake.in Loading commit data...
configure Loading commit data...
doxygen.config Loading commit data...