From c07cd40234431126a8fcae8b5256a1433fa9dedf Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Sat, 28 Oct 2017 18:23:09 +0100 Subject: [PATCH] Fix #263 - Install only the headers which are enabled. (#264) * Fix #263 - Install only the headers which are enabled. * Fix #263 - Install only the headers which are enabled. Fix clumsy typo! --- CMakeLists.txt | 8 -------- src/CMakeLists.txt | 11 +++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0f1d213..8db81b15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -342,11 +342,3 @@ INSTALL( DESTINATION CMake COMPONENT dev ) - -# Install all headers in include/ -INSTALL( - DIRECTORY ${CMAKE_SOURCE_DIR}/include/ - DESTINATION include - COMPONENT Headers - FILES_MATCHING PATTERN "*.h*" -) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bc892a0c..da877f80 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -223,3 +223,14 @@ INSTALL( ARCHIVE DESTINATION lib COMPONENT dev ) + +MACRO(INSTALL_HEADERS_WITH_DIRECTORY HEADER_LIST) + FOREACH(HEADER ${HEADERS}) + # Extract directory name and remove leading '../' + get_filename_component(DIR ${HEADER} PATH) + STRING(REGEX REPLACE "^\\.\\.\\/" "" DIR ${DIR}) + INSTALL(FILES ${HEADER} DESTINATION ${DIR}) + ENDFOREACH(HEADER) +ENDMACRO() + +INSTALL_HEADERS_WITH_DIRECTORY(${HEADERS}) \ No newline at end of file