install(TARGETS ... INCLUDES) has no effect.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

install(TARGETS ... INCLUDES) has no effect.

Dmitry Igrishin
Hello,

The documentation of the INCLUDES option of install(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(), like this:

target_include_directories(foo PUBLIC $<INSTALL_INTERFACE:include>)

I'm using CMake 3.11.4 on Windows. Am I missing something?

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: install(TARGETS ... INCLUDES) has no effect.

Dmitry Igrishin

Hello!

Did you try INCLUDES DESTINATION?

install (TARGETS foo
  EXPORT foo_export
  ARCHIVE DESTINATION bin
  LIBRARY DESTINATION lib
  RUNTIME DESTINATION lib
  INCLUDES DESTINATION include)
Oops! It works!
I have no idea how I miss the DESTINATION keyword. And sadly CMake was silent.
A hour of my life I spent on such a stupid mistake :-(. You make my day, Innokentiy. Thanks!

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake