[CMake] install(TARGETS ... INCLUDES) has no effect.

Dmitry Igrishin dmitigr at gmail.com
Thu Jun 21 04:58:04 EDT 2018


Hello,

The documentation of the INCLUDES option of install(TARGETS)
<https://cmake.org/cmake/help/latest/command/install.html#targets>
 command says:
"This option specifies a list of directories which will be added to the
INTERFACE_INCLUDE_DIRECTORIES target property of the <targets> when
exported by the install(EXPORT) command." But using it has no effect, for
example:

install(TARGETS foo
  EXPORT foo_export
  ARCHIVE DESTINATION bin
  LIBRARY DESTINATION lib
  RUNTIME DESTINATION lib
  INCLUDES include)

install(EXPORT foo_export
  DESTINATION cmake)
  FILE foo-config.cmake)

The installed foo-config.cmake doesn't set INTERFACE_INCLUDE_DIRECTORIES.

The only way to achieve the described above behaviour is using
target_include_directories()
<https://cmake.org/cmake/help/latest/command/target_include_directories.html>,
like this:

target_include_directories(foo PUBLIC $<INSTALL_INTERFACE:include>)

I'm using CMake 3.11.4 on Windows. Am I missing something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180621/e691c345/attachment-0001.html>


More information about the CMake mailing list