[CMake] Inherited Build Properties: Is this the intent of add_library Interface Libraries?

Brian Davis bitminer at gmail.com
Sat Aug 26 12:21:28 EDT 2017


The answer to what parameters can be specified the "whitelist" as it is
refereed to is documented (thanks to Raul's help):

https://cmake.org/cmake/help/v3.9/command/add_library.html?highlight=interface_#interface-libraries

with these key bits:

"Details about the imported library are specified by setting properties
whose names begin in IMPORTED_ and INTERFACE_. The most important such
property is IMPORTED_LOCATION
<https://cmake.org/cmake/help/v3.9/prop_tgt/IMPORTED_LOCATION.html#prop_tgt:IMPORTED_LOCATION>
(and its per-configuration variant IMPORTED_LOCATION_<CONFIG>
<https://cmake.org/cmake/help/v3.9/prop_tgt/IMPORTED_LOCATION_CONFIG.html#prop_tgt:IMPORTED_LOCATION_%3CCONFIG%3E>)
which specifies the location of the main library file on disk. See
documentation of the IMPORTED_* and INTERFACE_* properties for more
information."

Then searching
https://cmake.org/cmake/help/v3.9/manual/cmake-properties.7.html?highlight=property

grep'in for IMPORTED_ or INTERFACE_ yields the full white list.  What I
have found to be:

    IMPORTED_CONFIGURATIONS
    IMPORTED_IMPLIB_<CONFIG>
    IMPORTED_IMPLIB
    IMPORTED_LIBNAME_<CONFIG>
    IMPORTED_LIBNAME
    IMPORTED_LINK_DEPENDENT_LIBRARIES_<CONFIG>
    IMPORTED_LINK_DEPENDENT_LIBRARIES
    IMPORTED_LINK_INTERFACE_LANGUAGES_<CONFIG>
    IMPORTED_LINK_INTERFACE_LANGUAGES
    IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG>
    IMPORTED_LINK_INTERFACE_LIBRARIES
    IMPORTED_LINK_INTERFACE_MULTIPLICITY_<CONFIG>
    IMPORTED_LINK_INTERFACE_MULTIPLICITY
    IMPORTED_LOCATION_<CONFIG>
    IMPORTED_LOCATION
    IMPORTED_NO_SONAME_<CONFIG>
    IMPORTED_NO_SONAME
    IMPORTED_OBJECTS_<CONFIG>
    IMPORTED_OBJECTS
    IMPORTED
    IMPORTED_SONAME_<CONFIG>
    IMPORTED_SONAME

    INTERFACE_AUTOUIC_OPTIONS
    INTERFACE_COMPILE_DEFINITIONS
    INTERFACE_COMPILE_FEATURES
    INTERFACE_COMPILE_OPTIONS
    INTERFACE_INCLUDE_DIRECTORIES
    INTERFACE_LINK_LIBRARIES
    INTERFACE_POSITION_INDEPENDENT_CODE
    INTERFACE_SOURCES
    INTERFACE_SYSTEM_INCLUDE_DIRECTORIES


Read -> as maps to and X as nothing, zip, zilch, nadahey, bubkis, etc.  So:

SUFFIX to -> X
INSTALL_RPATH -> X
LINK_FLAGS -> X

I am sure this is useful for some use case I an quite baffled as to what it
is and I have request clarification from devs at:

https://gitlab.kitware.com/cmake/cmake/issues/17216

I clearly don't get something here.  I am interested to figure out what it
is designed for.

I have also asked that the error:

CMake Error at CMakeLists.txt:45 (set_target_properties):
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "SUFFIX" is not allowed.

provide better direction to user.

https://gitlab.kitware.com/cmake/cmake/issues/17217

Possibly:

e << "INTERFACE_LIBRARY targets may only have properties beginning with
INTERFACE_* or IMPORTED_*.  See cmake-properties for more information."
"The property \""
<< prop << "\" is not allowed.";
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170826/282a7694/attachment.html>


More information about the CMake mailing list