<div dir="ltr"><div><div><div><br></div>Is the goal of add_library interface libraries to add the concept of inherited build properties not dependent on the directory project inheritance structure of CMake?<br><br></div>This is to say attach any and all cmake properties, flags, etc to a "dummy" target that can then be used by other target to "inherit" the build config of the "dummy" target. <br><br></div><div></div>Can it be used to get around the inherent folder inheritance mechanism in CMake?<br><div><br></div><div>Does it support all properties, flags, defs?  Say for example:<br><br>from: <a href="https://cmake.org/pipermail/cmake/2017-August/066122.html">https://cmake.org/pipermail/cmake/2017-August/066122.html</a><br><br>add_library(blah INTERFACE)<br>set_property(TARGET blah PROPERTY SUFFIX ".mxe")<br>set_property(TARGET blah PROPERTY CXX_STANDARD 14)<br>set_property(TARGET blah PROPERTY INSTALL_RPATH "@loader_path/whatever")</div><div><br></div><div>without:<br></div><div><br><span style="color:rgb(255,0,0)">CMake Error at CMakeLists.txt:4 (set_property):<br>  INTERFACE_LIBRARY targets may only have whitelisted properties.  The<br>  property "SUFFIX" is not allowed.<br></span></div><div><span style="color:rgb(255,0,0)"><br></span></div><div><div><div>oh... I know my bad... lets try set_target_properties:<br><br>set_target_properties( <br>    blah <br>    PROPERTIES <br>    SUFFIX ".mxe"<br>    CXX_STANDARD 14<br>    INSTALL_RPATH "@loader_path/whatever"<br>)<br><br></div><div>without say:<br><br><br><span style="color:rgb(255,0,0)">CMake Error at CMakeLists.txt:20 (set_target_properties):<br>  INTERFACE_LIBRARY targets may only have whitelisted properties.  The<br>  property "SUFFIX" is not allowed.<br><br></span>
<p style="margin:0px;text-indent:0px"><span style="color:rgb(255,0,0)">CMake Error at CMakeLists.txt:20 (set_target_properties):<br>  INTERFACE_LIBRARY targets may only have whitelisted properties.  The<br>  property "CXX_STANDARD" is not allowed.<br><br></span></p>
<p style="margin:0px;text-indent:0px"><span style="color:rgb(255,0,0)">CMake Error at CMakeLists.txt:20 (set_target_properties):<br>  INTERFACE_LIBRARY targets may only have whitelisted properties.  The<br>  property "INSTALL_RPATH" is not allowed.</span></p></div><div><br></div><div>One might want to say create a template (add_project Interface Library) for all MATLAB mex libraries where say SUFFIX is .mex (above is example from others) but I would like same functionality for MATLAB Mex plugins then have plugin target inherit build props via  say:<br><br></div><div>add_library( mex_interface INTERFACE )<br>set_target_properties( <br>    mex_interface  <br>    PROPERTIES <br>    SUFFIX ".mex64"<br>    LINK_FLAGS /export:mex_function<br>)<br></div><div><br>target_link_libraries(<br>   targ <br>   mex_interface).   <br><br>But what do I get:<br></div><div><br><span style="color:rgb(255,0,0)">CMake Error at CMakeLists.txt:31 (set_target_properties):<br>  INTERFACE_LIBRARY targets may only have whitelisted properties.  The<br>  property "SUFFIX" is not allowed.<br><br></span>
<p style="margin:0px;text-indent:0px"><span style="color:rgb(255,0,0)">CMake Error at CMakeLists.txt:31 (set_target_properties):<br>  INTERFACE_LIBRARY targets may only have whitelisted properties.  The<br>  property "LINK_FLAGS" is not allowed.<br></span></p><br></div><div><br></div><div>Hmmm I know lets look up whitelisted in CMake doc surely that will tell me something about INTERFACE whitlisted properties.<br></div><div><br><a href="https://cmake.org/cmake/help/latest/search.html?q=whitelisted&check_keywords=yes&area=default">https://cmake.org/cmake/help/latest/search.html?q=whitelisted&check_keywords=yes&area=default</a><br><br></div><div>Yep... bubkis as expected... in true CMake style.<br></div><div><br></div><div>Since I have the CMake 3.9 source checkout as it is the only way these days to figure out what CMake does/does not..  I search that for whitelist and I'll certainly report back on how that goes.<br><br></div><br><div>In reading: <br><div><div><br></div><a href="https://cmake.org/cmake/help/latest/command/add_library.html?highlight=interface">https://cmake.org/cmake/help/latest/command/add_library.html?highlight=interface</a><br><br>"An
 INTERFACE library target does not directly create build output, though 
it may have properties set on it and it may be installed, exported and 
imported. Typically the INTERFACE_* properties are populated on the 
interface target using the commands:"<br><br></div><div>correction: "it may have WHITELISTED properties that we are not going to document what they are cuz it's like super secret ... good luck!, but if you can figure out what they are by trial and error and using eclipse ide search on the checked out source tree and set on it and it may be installed, exported and 
imported."<br><br></div>Huh a library 
that is just a interface which is not actually a library and is not a 
build output... could a worse term "library" been used.  how about 
add_interface or add_config or some such not library which I can 
understand as an easy hack as libs are consumable by both exe's and 
libs, but really... library?  Are command name additions at a premium in
 CMake?<br><br></div>So I'll ask again what is the intent of add_project interface libraries?  <br><br>I am getting a pretty good idea what it's not... well i guess better idea what it isn't once find that whitelist.<br></div><div><br><br><br></div></div></div>