-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
executable file
·78 lines (65 loc) · 2.4 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
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
project(RobustFLA)
######## Cplex Dependency
find_package(CPLEX REQUIRED)
if(CPLEX_FOUND)
include_directories(${CPLEX_INCLUDE_DIR})
link_directories(${CPLEX_LIBRARY})
endif()
if(CPLEX_CONCERT_FOUND)
include_directories(${CPLEX_CONCERT_INCLUDE_DIR})
link_directories(${CPLEX_CONCERT_LIBRARY})
endif()
if(CPLEX_ILOCPLEX_FOUND)
include_directories(${CPLEX_ILOCPLEX_INCLUDE_DIR})
link_directories(${CPLEX_ILOCPLEX_LIBRARY})
endif()
######## Boost dependency
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED OFF)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost ${Boost_VERSION} COMPONENTS system REQUIRED)
if(Boost_FOUND)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_LIBRARIES(${Boost_LIBRARIES})
endif()
######## Python dependency
#FIND_PACKAGE(PythonInterp)
#FIND_PACKAGE(PythonLibs)
#INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
#LINK_LIBRARIES(${PYTHON_LIBRARIES})
######## Complier message
set(CMAKE_BUILD_TYPE Release)
message(STATUS "System: ${CMAKE_SYSTEM}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Compiler version: ${CMAKE_CXX_COMPILER_VERSION}")
######## Set C++ 11 standard
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11)
if (COMPILER_SUPPORTS_CXX11)
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif ()
else ()
fatalerror("Your compiler doesn't support c++11, please install it!")
endif ()
###### OpenMp Package
#find_package(OpenMP)
#if (OPENMP_FOUND)
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
#endif()
######## Set output directories.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../build/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../build/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../build/lib)
######## find all the source files.
file(GLOB HEADER_FILES include/*.h)
file(GLOB SOURCE_FILES src/*.cpp)
######## Set executable file name, and add the source files for it.
add_executable(RobustFLA ${HEADER_FILES} ${SOURCE_FILES})
######## Add Dependency Library
target_link_libraries(RobustFLA cplex-library cplex-concert ilocplex)