-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
executable file
·159 lines (138 loc) · 4.57 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
#####################################
## Option part
#####################################
option(compile_with_debug "Build library with debug." OFF)
option(compile_with_tests "Build tests for application." OFF)
option(force_boost "Force BOOST usage instead of C++11." OFF)
#####################################
## Definition of environment
#####################################
IF( DEFINED ENV{INSTALL_LIB_DIR} )
SET(INSTALL_LIBS $ENV{INSTALL_LIB_DIR}/ )
ELSE()
SET(INSTALL_LIBS ${CMAKE_HOME_DIRECTORY}/lib )
ENDIF()
IF( DEFINED ENV{INSTALL_INC_DIR} )
SET(INSTALL_INCS $ENV{INSTALL_INC_DIR}/ )
ELSE()
SET(INSTALL_INCS ${CMAKE_HOME_DIRECTORY}/include )
ENDIF()
SET(LIBRARY_OUTPUT_PATH .)
SET(EXECUTABLE_OUTPUT_PATH .)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_FIND_LIBRARY_PREFIXES Find)
set(CMAKE_FIND_LIBRARY_SUFFIXES cmake)
message("Before searching for LoggerLib")
#FIND_LIBRARY(JPLoggerStatic REQUIRED)
#FIND_LIBRARY( LOGGER_LIBRARY NAMES JPLoggerStatic
# PATHS ${LOCAL_LIBS} ${INSTALL_LIBS} )
#message("Library at: ${LOGGER_LIBRARY}")
#message("Before searching for LoggerLib")
#include_directories(${logger_INCLUDE_DIRS})
# build dependencies.
#set(logger_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/modules/logger
#)
#find_package(JPLogger)
#####################################
## Project name
#####################################
PROJECT ( Tunnelier CXX )
#####################################
## Include directories
INCLUDE_DIRECTORIES( include modules/logger/include lib ${INSTALL_LIBS} ${INSTALL_INCS})
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT force_boost)
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (NOT (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7))
message("GCC Without c++11")
FIND_PACKAGE( Boost 1.40 COMPONENTS program_options REQUIRED )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
ADD_DEFINITIONS( -DUSE_BOOST_INSTEAD_CXX11 ${CMAKE_THREAD_LIBS_INIT} )
SET(ADDITIONAL_LINK_LIBS boost_system boost_thread)
else()
message("GCC With c++11")
ADD_DEFINITIONS( -std=c++11 ${CMAKE_THREAD_LIBS_INIT} )
SET(ADDITIONAL_LINK_LIBS )
endif ()
else ()
message("Force Boost")
FIND_PACKAGE( Boost 1.40 COMPONENTS program_options REQUIRED )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
ADD_DEFINITIONS( -DUSE_BOOST_INSTEAD_CXX11 ${CMAKE_THREAD_LIBS_INIT} )
SET(ADDITIONAL_LINK_LIBS boost_system boost_thread)
endif ()
#set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
#####################################
# Search for needed lib
#####################################
FIND_PACKAGE(Event REQUIRED)
SET( LIBS ${Event_LIBRARIES})
#FIND_PACKAGE(SSH REQUIRED)
#SET( LIBS ${LIBS} ${SSH_LIBRARIES})
message("Writting the libs")
message("${LIBS}")
message("Writting the install libs")
message(${INSTALL_LIBS})
#####################################
## Folders to be build
#####################################
ADD_SUBDIRECTORY( src/jsoncpp lib )
ADD_SUBDIRECTORY( src/tunnels lib )
ADD_SUBDIRECTORY( modules/logger lib )
ADD_SUBDIRECTORY( src bin )
#ADD_SUBDIRECTORY( exampleProgram bin )
if( compile_with_tests )
ADD_SUBDIRECTORY( tests bin/tests)
endif()
#####################################
# Instalation section
#####################################
#####################################
# Others
#####################################
IF( UNIX )
#ADD_CUSTOM_TARGET( distclean @@echo cleaning for source distribution)
SET(DISTCLEANED
cmake.depends
cmake.check_depends
CMakeCache.txt
cmake.check_cache
cmake*.cmake
Makefile
core core.*
gmon.out
*~
lib
CMakeFiles
bin
install_*
cmake_install.cmake
doc/docs/
)
ADD_CUSTOM_COMMAND(
DEPENDS clean
COMMENT "distribution clean"
COMMAND rm
ARGS -Rf CMakeTmp ${DISTCLEANED}
TARGET distclean
)
ENDIF( UNIX )
if( compile_with_debug )
set(CMAKE_CXX_FLAGS "-DDEBUG=1")
set(CMAKE_BUILD_TYPE Debug)
endif()
#####################################
# add a target to generate API documentation with Doxygen
#####################################
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/tunnelier.dox.in ${CMAKE_CURRENT_BINARY_DIR}/doc/tunnelier.dox @ONLY)
add_custom_target(docs_tunnelier
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/thrpool.dox
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating Tunnelier documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
#