Feature Request: Inheritable Build Properteis
Feature request for the ability of full inheritable build properties which are outside the normal directory inheritance of CMake
As:
clarifies that on INTERFACE libraries (add_library( targ INTERFACE) the following is currently not possible.
The goal it to create a "template" of build properties that can then be inherited by targets. Example provided here is MATLAB mex library build properties that can then be inherited by mex lib targets:
add_library( mex_interface INTERFACE )
set_target_properties(
mex_interface
PROPERTIES
SUFFIX ".mex64"
LINK_FLAGS /export:mex_function
)
add_library(
targ
SHARED
main.cpp
)
add_library(
targ2
SHARED
main2.cpp
)
target_link_libraries(
targ1
mex_interface
)
target_link_libraries(
targ2
mex_interface
)
with error:
CMake Error at CMakeLists.txt:45 (set_target_properties):
INTERFACE_LIBRARY targets may only have whitelisted properties. The
property "SUFFIX" is not allowed.
CMake Error at CMakeLists.txt:45 (set_target_properties):
INTERFACE_LIBRARY targets may only have whitelisted properties. The
property "LINK_FLAGS" is not allowed.
I ask that either CMake support more properties as INTERFACE properties or if this is not acceptable (as I currently do not understand yet the intended goal of INTERFACE) possibly add to add_library the INHERITED concept with INHERITED_* vars with SUFFIX, LINK_FLAGS, COMPILE_FLAGS, and other useful target, source, and directory properties. Such as:
INHERITED_SUFFIX INHERITED_LINK_FLAGS etc.