-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
134 lines (116 loc) · 3.49 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
#
# File generated by CMakeBuilder
#
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
#####################################
## Option part
#####################################
option(thrpool_build_samples "Build thread pool sample programs." OFF)
option(compile_with_debug "Build library with debug." 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()
IF( EXISTS ${INSTALL_LIBS}/libJPThreadPool.a )
return()
ENDIF()
SET(LIBRARY_OUTPUT_PATH .)
SET(EXECUTABLE_OUTPUT_PATH .)
#####################################
## Project name
#####################################
PROJECT ( thrpool CXX )
#####################################
## Include directories
INCLUDE_DIRECTORIES( include lib ${INSTALL_LIBS} ${INSTALL_INCS})
#####################################
## Folders to be build
#####################################
ADD_SUBDIRECTORY( src lib )
#ADD_SUBDIRECTORY( exampleProgram bin )
#####################################
## Samples to be build
#####################################
if( thrpool_build_samples)
ADD_SUBDIRECTORY( exampleProgram bin )
endif()
#####################################
# Search for needed lib
#####################################
FIND_LIBRARY(JPLoggerStatic REQUIRED)
FIND_LIBRARY(JPSemaphoresStatic REQUIRED)
FIND_LIBRARY( LOGGER_LIBRARY NAMES JPLoggerStatic
PATHS ${LOCAL_LIBS} ${INSTALL_LIBS} )
SET( LIBS ${LIBS} ${LOGGER_LIBRARY})
FIND_LIBRARY( JPSEMAPHORES_LIBRARY NAMES JPSemaphoresStatic
PATHS ${LOCAL_LIBS} ${INSTALL_LIBS} )
SET( LIBS ${LIBS} ${JPSEMAPHORES_LIBRARY})
message(${LIBS})
message(${INSTALL_LIBS})
#include_directories(${logger_INCLUDE_DIRS} ${JPSemaphore_INCLUDE_DIRS})
#####################################
# Instalation section
#####################################
INSTALL( FILES include/libJPThreadPool.hpp
DESTINATION ${INSTALL_INCS} )
INSTALL( FILES lib/libJPThreadPoolStatic.a
DESTINATION ${INSTALL_LIBS} )
INSTALL( FILES lib/libJPThreadPool.so
DESTINATION ${INSTALL_LIBS} )
#####################################
# 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/
doc/semaphore.dox
)
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/thrpool.dox.in ${CMAKE_CURRENT_BINARY_DIR}/doc/thrpool.dox @ONLY)
add_custom_target(docs
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/thrpool.dox
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating Semaphore documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)