-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
86 lines (71 loc) · 2.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
cmake_minimum_required(VERSION 3.0)
# SOCP project
project(SOCP)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
set(SOCP_VERSION 0.1.0)
set(SOCP_INCLUDE_INSTALL_DIR "include/${PROJECT_NAME_LOWER}")
set(SOCP_LIB_INSTALL_DIR "lib")
if(POLICY CMP0078)
cmake_policy(SET CMP0078 NEW)
endif()
if(POLICY CMP0086)
cmake_policy(SET CMP0086 NEW)
endif()
# Set the CMake module path
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# type for real numbers (default is double)
#add_definitions(-DdoubleType)
#add_definitions(-DfloatType)
# Set the various project paths
set(BINARIES_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/binaries)
set(EXECUTABLE_OUTPUT_PATH ${BINARIES_OUTPUT_PATH}/${CMAKE_BUILD_TYPE})
set(LIBRARY_OUTPUT_PATH ${BINARIES_OUTPUT_PATH}/${CMAKE_BUILD_TYPE})
# To disable PkgConfig
set(CMAKE_DISABLE_FIND_PACKAGE_PkgConfig "ON")
macro( pkg_check_modules ) # a macro to replace pkg_check_modules (error otherwise since PkgConfig is disabled)
endmacro()
if (WIN32)
add_definitions(-D_USE_MATH_DEFINES)
endif (WIN32)
if(UNIX)
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE )
endif()
SET(GCC_11_COMPILE_FLAGS "-std=gnu++11")
SET(ENABLE_MULTITHREADING_COMPILE_FLAGS "-pthread")
#SET(GCC_FPERMISSIVE_COMPILE_FLAGS "-fpermissive")
SET(GCC_POSITION_INDEPENDENT_CODE "-fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_FPERMISSIVE_COMPILE_FLAGS} ${GCC_POSITION_INDEPENDENT_CODE} ${GCC_11_COMPILE_FLAGS} ${ENABLE_MULTITHREADING_COMPILE_FLAGS}" )
endif(UNIX)
# By default all wrappers are disabled
option(BUILD_PYTHON "Build Python Package" OFF)
if(BUILD_PYTHON)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(SWIG REQUIRED)
if(${SWIG_FOUND})
add_subdirectory(python)
endif(${SWIG_FOUND})
endif()
# Add boost
option(Boost_USE "Use Boost" OFF)
if (${Boost_USE})
add_definitions(-D_USE_BOOST)
find_package(Boost REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif(Boost_FOUND)
endif()
# Add sources
add_subdirectory(src)
# Add tests
option(BUILD_TESTING "Build Tests" OFF)
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
# Add documentation
add_subdirectory(documentation)
# configuration file
add_subdirectory(cmake)