So this example demonstrates that cmake supports INTERFACE library installation in the same way as STATIC or SHARED library installation of its headers via install(TARGETS headergen…) without use of install(FILES…) is supported. However there is only one header file in headergen (and it is generated by cmake so it knows all its properties). So could you please advise on the following:
-
Should cmake support INTERFACE library install via install(TARGETS … PUBLIC_HEADER DESTINATION installIncludeDir) without direct FILES/DIRECTORIES install for libraries that have their header files under a) a Directory with sub-directories or b) a list of directories or c) a list of files. It seems documentation does not preclude such possibilities by using plurals “these headers” or “header files”. I assume in case of a) this would result in installation of library inlcude directory under installIncludeDir.
-
Could PUBLIC_HEADER be set to include all INTERFACE library files (cases above) not by explicit
set_property(TARGET headergen PROPERTY PUBLIC_HEADER..publicHdrDir)
or set_target_property listing all INTERFACE library files, but via other target properties since cmake gets all INTERFACE library files passed within the add_library or via INTERFACE_INCLUDE_DIRECTORIES and settings of"$<BUILD_INTERFACE:...." and "$<INSTALL_INTERFACE: ..."
? -
Does @brad.king example require 3.19 as minimum or 3.17 would support the above functionality? Why is the condition “if they have sources”? Which Sources? I assume interface library is a collection of source code /header files under 1 directory in simple case.
-
In @brad.king example, why the headeronly INTERFACE library headeronly_headers installed directly via FILES but not via TARGETS? `install(TARGETS headeronly…) ?