I am building a shared library written in C++. It is made of 2 classes hence 2 source files and 2 header files. In addition, a 3rd header file includes the 2 others for simplicity of use. So I want to install 3 public headers.
The problem is that the PUBLIC_HEADER property is set to the 1st file only, instead of a list of 3 files (comma separated string). I checked it with get_target_property(). As a consequence, only this file is copied. The FRAMEWORK property doesn't seem to change anything.
Eventually, I managed to copy them all with install(FILES), but it does not seem to be very clean. How can I improve this ?
CMake version: 3.16.
set(RST_PUBLIC_HEADERS
"rst.hpp"
"CPrbs.hpp"
"CRstController.hpp"
)
set_target_properties( ${PROJECT_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
FRAMEWORK TRUE
PUBLIC_HEADER ${RST_PUBLIC_HEADERS}
)
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include/lib${PROJECT_NAME}
)