-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
39 lines (32 loc) · 1.16 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
cmake_minimum_required(VERSION 3.2)
set (CMAKE_CXX_STANDARD 11)
option(BUILD_BINDINGS "Build python bindings" OFF)
macro(subdirlist result curdir)
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
set(dirlist "")
foreach(child ${children})
if(IS_DIRECTORY ${curdir}/${child} AND NOT (${child} MATCHES "[.]"))
list(APPEND dirlist ${curdir}/${child})
endif()
endforeach()
set(${result} ${dirlist})
endmacro()
set(PROJECT_NAME_STR go_problems)
subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}/go-problems)
set(PROBLEMS_LIBS "")
foreach(subdir ${SUBDIRS})
add_subdirectory(${subdir})
endforeach()
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(GO_INTERFACE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/go-problems)
else()
set(GO_INTERFACE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/go-problems PARENT_SCOPE)
endif()
if (${BUILD_BINDINGS})
if (NOT TARGET pybind11)
add_subdirectory(3rd-party/pybind11)
endif()
pybind11_add_module(go_problems ${CMAKE_CURRENT_SOURCE_DIR}/go-problems/bindings.cpp)
target_include_directories(go_problems PUBLIC ${GO_INTERFACE_INCLUDE_DIR}/)
target_link_libraries(go_problems PUBLIC ${PROBLEMS_LIBS})
endif()