From 1dd0eed7dcf5232747ebc57f0432a518f7371f95 Mon Sep 17 00:00:00 2001 From: Oleksandr Kulkov Date: Thu, 20 Jun 2024 18:17:43 +0200 Subject: [PATCH 1/3] Install all included headers --- metagraph/CMakeLists.txt | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/metagraph/CMakeLists.txt b/metagraph/CMakeLists.txt index b1e170bcf0..6a7229268a 100644 --- a/metagraph/CMakeLists.txt +++ b/metagraph/CMakeLists.txt @@ -493,14 +493,22 @@ add_dependencies(metagraph link_target) # install library #------------------- -file(GLOB header_files - "src/*.hpp" - "src/*/*.hpp" - "src/*/*/*.hpp" -) +get_property(INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) + +foreach(dir ${INCLUDE_DIRS}) + file(GLOB_RECURSE subdirs LIST_DIRECTORIES true "${dir}/*") + list(APPEND subdirs ${dir}) + foreach(subdir ${subdirs}) + file(GLOB headers "${subdir}/*.h" "${subdir}/*.hpp") + if(headers) + file(RELATIVE_PATH rel_path ${dir} ${subdir}) + install(FILES ${headers} + DESTINATION include/${rel_path}) + endif() + endforeach() +endforeach() install(TARGETS metagraph-core DESTINATION lib) -install(FILES ${header_files} DESTINATION include/metagraph) install(TARGETS metagraph DESTINATION bin) #------------------- From 5feea0ce7b562d9ee4e8fc27c4b2bb96307c61ae Mon Sep 17 00:00:00 2001 From: Oleksandr Kulkov Date: Thu, 20 Jun 2024 18:28:08 +0200 Subject: [PATCH 2/3] Collect include dirs from subdirs --- metagraph/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/metagraph/CMakeLists.txt b/metagraph/CMakeLists.txt index 6a7229268a..ef3d7cc586 100644 --- a/metagraph/CMakeLists.txt +++ b/metagraph/CMakeLists.txt @@ -495,6 +495,12 @@ add_dependencies(metagraph link_target) get_property(INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) +get_property(SUBDIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY SUBDIRECTORIES) +foreach(subdir ${SUBDIRS}) + get_property(SUBDIR_INCLUDE_DIRS DIRECTORY ${subdir} PROPERTY INCLUDE_DIRECTORIES) + list(APPEND INCLUDE_DIRS ${SUBDIR_INCLUDE_DIRS}) +endforeach() + foreach(dir ${INCLUDE_DIRS}) file(GLOB_RECURSE subdirs LIST_DIRECTORIES true "${dir}/*") list(APPEND subdirs ${dir}) From e9e1b85ab0c43b73f1d1b4cb299aabf93814c7e4 Mon Sep 17 00:00:00 2001 From: Oleksandr Kulkov Date: Thu, 20 Jun 2024 19:05:21 +0200 Subject: [PATCH 3/3] Ignore PROJECT_SOURCE_DIR --- metagraph/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metagraph/CMakeLists.txt b/metagraph/CMakeLists.txt index ef3d7cc586..0d01cdbffe 100644 --- a/metagraph/CMakeLists.txt +++ b/metagraph/CMakeLists.txt @@ -502,6 +502,9 @@ foreach(subdir ${SUBDIRS}) endforeach() foreach(dir ${INCLUDE_DIRS}) + if("${dir}" STREQUAL ${PROJECT_SOURCE_DIR}) + continue() + endif() file(GLOB_RECURSE subdirs LIST_DIRECTORIES true "${dir}/*") list(APPEND subdirs ${dir}) foreach(subdir ${subdirs})