Hello!
After some look into target installation, I've devised the following
abomination
<https://gitlab.com/UtilityToolKit/utk.cmake/blob/master/utk_cmake_install.cmake#L357>
. It is ugly and not the way it should be done, but it works and only
requires some discipline at copying and pasting header files listing code.
The function expects the files that are to be installed to be listed with
BUILD_INTERFACE and INSTALL_INTERFACE generator expressions.
I only use it for headers because I don't know how to separate file lists
into components (i.e. Dev for headers and Runtime for resource files
required at runtime). I use the following code for listing target header
files:
set (HEADERS
# List of files here
)
file(RELATIVE_PATH PREFIX
${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_LIST_DIR})
foreach (HEADER IN LISTS HEADERS)
target_sources (my_target(s)
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${HEADER}>
$<INSTALL_INTERFACE:${PREFIX}/${HEADER}>)
endforeach (HEADER IN HEADERS)
Hope that will somewhat help and won't hurt anyone's fillings and mind.
Best regards,
Innokentiy Alaytsev
--
Sent from: http://cmake.3232098.n2.nabble.com/
--
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