Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Place all relevant headers in /include during installation #489

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions metagraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,28 @@ 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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that this collects everything specified in include_directories. I suppose on Mac it can as well collect include_directories(SYSTEM /usr/local/include), which we probably do not want? I'm not sure what's the best course of action to avoid this situation here.


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})
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)

#-------------------
Expand Down
Loading