-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
30 lines (25 loc) · 941 Bytes
/
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
cmake_minimum_required (VERSION 3.21)
option(PythonExe "PythonExe")
project(PyDpapi)
find_package(Python COMPONENTS Interpreter Development REQUIRED)
if( PYTHON_FOUND )
message(STATUS "python executable: " ${Python_EXECUTABLE})
execute_process(
COMMAND ${PythonExe} -c "from distutils import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))"
OUTPUT_VARIABLE PYTHON_INCLUDE_DIRECTORY
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "python include directory: " ${PYTHON_INCLUDE_DIRECTORY})
else()
message( FATAL_ERROR "A valid Python interpreter is required for finding Python's site-packages directory!" )
endif()
message(STATUS "Python version: ${PYTHONLIBS_VERSION_STRING}")
include_directories(${PYTHON_INCLUDE_DIRECTORY})
add_library(pydpapi pydpapi.c)
set_target_properties(
pydpapi
PROPERTIES
PREFIX ""
OUTPUT_NAME "pydpapi"
LINKER_LANGUAGE C
)