CMake: PUBLIC PRIVATE And INTERFACE Headers
There are 3 keywords in CMake
PRIVATE: header files with this keyword will be add to current target’s include directories. We use this if header will be used by current target only.
INTERFACE: header files with this keyword will not be add to current target’s include directories, but will be treated as public headers of this library. We use it when headers are external only, current target will not use those during compiling.
PUBLIC: header files with this keyword will be performed with both
INTERFACE. In this case, both current target and external public header lists will be modified.
To combine with
INTERFACE headers should be installed to user. Taking
PUBLIC as an example:
We need to manually set
PUBLIC_HEADER property for public headers, and install it with keyword