-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
42 lines (33 loc) · 1.24 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
# CMakeLists.txt
cmake_minimum_required(VERSION 3.4...3.18)
project(reqboost LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Find Python interpreter and libraries using the new FindPython module
find_package(Python 3.10 REQUIRED COMPONENTS Interpreter Development)
# Get the pybind11 installation path using Python
execute_process(
COMMAND python -m pybind11 --cmakedir
OUTPUT_VARIABLE pybind11_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Use the obtained pybind11_DIR
find_package(pybind11 REQUIRED)
# Find required packages
find_package(CURL REQUIRED)
find_package(Poco REQUIRED Foundation Net)
# Find brew install nlohmann-json
find_package(nlohmann_json REQUIRED)
# Include directories
include_directories(${CMAKE_SOURCE_DIR}/include/reqboost ${CMAKE_SOURCE_DIR}/include/reqboost/bindings ${CURL_INCLUDE_DIRS} ${Poco_INCLUDE_DIRS})
# Collect all source files
file(GLOB_RECURSE SOURCES "src/*.cpp")
# Define the Python extension module
pybind11_add_module(reqboost ${SOURCES})
# Link libraries
target_link_libraries(reqboost PRIVATE ${CURL_LIBRARIES} Poco::Foundation Poco::Net nlohmann_json::nlohmann_json)
# Set C++ standard
set_target_properties(reqboost PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)