forked from martinWANG2014/CplexCPlusPlusDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·45 lines (36 loc) · 1.41 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
cmake_minimum_required(VERSION 3.7)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
project(CplexC++Demo)
######## 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 ()
######## 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 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)
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O2")
endif ()
######## find all the source files.
file(GLOB SOURCE_FILES *.cpp)
######## Set executable file name, and add the source files for it.
add_executable(CplexC++Demo ${SOURCE_FILES})
######## Add Dependency Library
target_link_libraries(CplexC++Demo cplex-library cplex-concert ilocplex)