-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
33 lines (27 loc) · 1.29 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
cmake_minimum_required(VERSION 2.8)
project(hello)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs)
find_package(PythonExtensions REQUIRED)
function(locate_boost_python boost_python_library_target)
foreach(Boost_PYTHON_VERSION_TAG "-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}"
"-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}"
"${PYTHON_VERSION_MAJOR}" "")
message("Locating python${Boost_PYTHON_VERSION_TAG}")
find_package(Boost COMPONENTS "python${Boost_PYTHON_VERSION_TAG}")
if(TARGET Boost::python${Boost_PYTHON_VERSION_TAG})
message("Found target ${boost_python_library_target}")
set(boost_python_library_target Boost::python${Boost_PYTHON_VERSION_TAG} PARENT_SCOPE)
break()
endif()
endforeach()
endfunction()
find_package(Boost COMPONENTS python)
locate_boost_python(boost_python_library_target)
message("${boost_python_library_target}")
function(link_boost_python target)
target_include_directories(${target} PUBLIC ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIR})
message("Linking against ${boost_python_library_target}")
target_link_libraries(${target} ${boost_python_library_target})
endfunction()
add_subdirectory(hello/cpp)