-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
53 lines (45 loc) · 1.67 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
cmake_minimum_required(VERSION 3.18)
project(
igraph-cpp
VERSION 0.1.0
DESCRIPTION "C++ wrappers for igraph data structures"
LANGUAGES CXX
)
find_package(igraph 0.10.0 REQUIRED)
include(GNUInstallDirs)
include(CTest)
add_library(igraph-cpp INTERFACE)
target_include_directories(igraph-cpp INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/igraph-cpp>
)
target_compile_features(igraph-cpp INTERFACE cxx_std_14)
target_link_libraries(igraph-cpp INTERFACE igraph::igraph)
# Provide an igraph-cpp-config.cmake file in the installation directory so
# users can find the installed igraph library with FIND_PACKAGE(igraph-cpp)
# from their CMakeLists.txt files
include(CMakePackageConfigHelpers)
configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/igraph-cpp-config.cmake.in
${PROJECT_BINARY_DIR}/igraph-cpp-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/igraph-cpp
)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/igraph-cpp-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMinorVersion
)
install(TARGETS igraph-cpp
EXPORT igraph-cpp-targets)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/igraph-cpp)
install(FILES ${PROJECT_BINARY_DIR}/igraph-cpp-config.cmake
${PROJECT_BINARY_DIR}/igraph-cpp-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/igraph-cpp)
install(EXPORT igraph-cpp-targets
FILE igraph-cpp-targets.cmake
NAMESPACE igraph::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/igraph-cpp)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory(examples)
endif()