forked from axiak/pyre2
-
Notifications
You must be signed in to change notification settings - Fork 34
/
CMakeLists.txt
55 lines (40 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
43
44
45
46
47
48
49
50
51
52
53
54
55
cmake_minimum_required(VERSION 3.15...3.28)
project(re2 LANGUAGES CXX C)
option(PY_DEBUG "Set if python being linked is a Py_DEBUG build" OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CLANG_DEFAULT_CXX_STDLIB libc++)
set(CLANG_DEFAULT_RTLIB compiler-rt)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Default build type: RelWithDebInfo" FORCE)
endif()
include(GNUInstallDirs)
# get rid of FindPython old warnings, refactor FindCython module
set(CMP0148 NEW)
set(PYBIND11_FINDPYTHON ON)
find_package(pybind11 CONFIG)
if(pybind11_FOUND)
message(STATUS "System pybind11 found")
else()
message(STATUS "Fetching pybind11 from github")
# Fetch pybind11
include(FetchContent)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.12.0
)
FetchContent_MakeAvailable(pybind11)
endif()
find_package(Threads REQUIRED)
if (${PYTHON_IS_DEBUG})
set(PY_DEBUG ON)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${PROJECT_SOURCE_DIR}/cmake/modules/)
include_directories(${PROJECT_SOURCE_DIR}/src)
add_subdirectory(src)