-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
70 lines (56 loc) · 1.79 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
cmake_minimum_required(VERSION 3.16...3.30)
# Set a name and a version number for your project:
project(
pybind11-numpy-example
VERSION 1.0.1
LANGUAGES CXX)
# Initialize some default paths
include(GNUInstallDirs)
# Define the minimum C++ standard that is required
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Configuration options
option(BUILD_CPP "Enable building of C++ interface" ON)
option(BUILD_PYTHON "Enable building of Python interface" ON)
option(BUILD_DOCS "Enable building of documentation" ON)
# Build the core c++ library
add_subdirectory(lib)
# Build the c++ tests
include(CTest)
if(BUILD_TESTING)
add_subdirectory(ext/Catch2)
include(./ext/Catch2/extras/Catch.cmake)
add_subdirectory(tests/cpp)
endif()
# Build the documentation
if(BUILD_DOCS)
add_subdirectory(doc)
endif()
# Build the python interface
if(BUILD_PYTHON)
add_subdirectory(src)
endif()
# Install c++ interface
if(BUILD_CPP)
# Add an alias target for use if this project is included as a subproject in
# another project
add_library(pybind11_numpy_example::pybind11_numpy_example ALIAS
pybind11_numpy_example)
# Install targets and configuration
install(
TARGETS pybind11_numpy_example
EXPORT pybind11_numpy_example_config
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(
EXPORT pybind11_numpy_example_config
NAMESPACE pybind11_numpy_example::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pybind11_numpy_example)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
# This prints a summary of found dependencies
include(FeatureSummary)
feature_summary(WHAT ALL)