Skip to content

Commit 1ddfa87

Browse files
committed
[cmake] Setup installs for headers and Python module targets
1 parent cd8a438 commit 1ddfa87

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

CMakeLists.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(PROJECT_NAME nanoeigenpy)
44
set(PROJECT_URL https://github.com/ManifoldFR/nanoeigenpy)
55
set(PROJECT_DESCRIPTION "Tools for using Eigen with nanobind")
66
set(PROJECT_CUSTOM_HEADER_EXTENSION "hpp")
7+
set(PROJECT_USE_CMAKE_EXPORT True)
78

89
include(cmake/base.cmake)
910

@@ -15,7 +16,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
1516
find_package(Eigen3 REQUIRED)
1617

1718
add_library(nanoeigenpy_headers INTERFACE)
18-
target_include_directories(nanoeigenpy_headers INTERFACE ./src)
1919
target_link_libraries(nanoeigenpy_headers INTERFACE Eigen3::Eigen)
2020

2121
find_package(Python REQUIRED COMPONENTS Interpreter Development)
@@ -43,3 +43,22 @@ target_link_libraries(nanoeigenpy PUBLIC nanoeigenpy_headers)
4343
if(BUILD_TESTING)
4444
add_subdirectory(tests)
4545
endif()
46+
47+
install(
48+
TARGETS nanoeigenpy_headers
49+
EXPORT ${TARGETS_EXPORT_NAME}
50+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
51+
)
52+
53+
install(
54+
DIRECTORY include/nanoeigenpy
55+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
56+
FILES_MATCHING
57+
PATTERN "*.hpp"
58+
)
59+
60+
install(
61+
TARGETS nanoeigenpy
62+
EXPORT ${TARGETS_EXPORT_NAME}
63+
LIBRARY DESTINATION ${Python_SITELIB}
64+
)

0 commit comments

Comments
 (0)