-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
53 lines (42 loc) · 1.63 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
cmake_minimum_required (VERSION 3.8)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include (read_version)
configure_version(VERSION_FILE "${CMAKE_SOURCE_DIR}/version.in")
project (GaspiCxx ${GaspiCxx_VERSION})
include(GNUInstallDirs)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(GPI2 REQUIRED)
option (ENABLE_TESTS "Compile tests [default: disabled]" off)
option (BUILD_SHARED_LIBS "Create shared libraries [default: disabled (creates static libraries)]" off)
option (BUILD_PYTHON_BINDINGS "Build Python bindings [default: disabled]" off)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Werror")
# Set a default build type if none was specified
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting default build type to '${default_build_type}'.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Define build type." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
set(INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include")
add_subdirectory (src)
add_subdirectory (examples)
if(BUILD_PYTHON_BINDINGS)
find_package(PythonModules REQUIRED)
find_package(pybind11 CONFIG REQUIRED)
add_subdirectory (src/python)
endif()
if(ENABLE_TESTS)
enable_testing()
find_package(GTest REQUIRED)
include(GoogleTest)
add_subdirectory (tests)
if(BUILD_PYTHON_BINDINGS)
find_package(PythonModules COMPONENTS pytest)
add_subdirectory (tests/python)
endif()
endif()