2

In modern CMake one can specify a library as INTERFACE: it does not produce build output, but it can have properties associated to it, although not all properties can be set (for instance the FOLDER property is not supported). Say I have a generic CMake macro setting properties for a generic library target, is there a way to tell that the input target is an interface library, so that I can skip the unsupported properties only for that target?

squareskittles
  • 11,997
  • 7
  • 31
  • 48
Paolo Crosetto
  • 858
  • 3
  • 15

1 Answers1

3

You query the TYPE property of target....

get_target_property(type target TYPE)
if (${type} STREQUAL "INTERFACE_LIBRARY")
KamilCuk
  • 69,546
  • 5
  • 27
  • 60