-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·30 lines (24 loc) · 1.04 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
# CMakeLists.txt
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(lic_manager)
find_package(pybind11 REQUIRED)
add_subdirectory(license_manager)
set(LIB ${LIB} license_manager)
message(STATUS "sources: ${SRC}")
message(STATUS "includes: ${INC}")
pybind11_add_module(${PROJECT_NAME} main.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC ${INC})
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIB} Python::Python)
find_package(Python REQUIRED COMPONENTS Interpreter Development)
# Get the dist-packages or site-packages directory
execute_process(
COMMAND
${Python_EXECUTABLE} -c
"from distutils.sysconfig import get_python_lib; print(get_python_lib())"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "python_site_packages: ${PYTHON_SITE_PACKAGES}")
# Install the pybind11 project and its subdirectory to the Python site-packages
# directory
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION LIBRARY ${PYTHON_SITE_PACKAGES})
install(DIRECTORY license_manager DESTINATION ${PYTHON_SITE_PACKAGES})