-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
90 lines (68 loc) · 1.82 KB
/
CMakeLists.txt
File metadata and controls
90 lines (68 loc) · 1.82 KB
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
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT(JSonParser)
# Check if the boost library has been set
SET ( BOOST $ENV{BOOST_DIR} )
IF (NOT BOOST)
MESSAGE ("Boost library has not been set")
ENDIF (NOT BOOST)
# Define the boost envrionment so we don't get system libraries
set ( BOOST_ROOT $ENV{BOOST_DIR} )
set ( BOOST_INCLUDEDIR $ENV{BOOST_INC} )
set ( BOOST_LIBRARYDIR $ENV{BOOST_LIB} )
# Boost version
SET ( BOOST_VER1 1 )
SET ( BOOST_VER2 42 )
SET ( BOOST_VER3 0 )
FIND_PACKAGE ( Boost ${BOOST_VER1}.${BOOST_VER2} REQUIRED )
# Project include directory
INCLUDE_DIRECTORIES (
${JSonParser_SOURCE_DIR}/interface
${Boost_INCLUDE_DIR}
)
# Add source files in the src/ diretory
INCLUDE (src/CMakeLists.txt)
FOREACH (FILE ${FILES})
SET (srcFiles ${srcFiles} src/${FILE})
ENDFOREACH (FILE)
ADD_LIBRARY (JSonParser SHARED ${srcFiles})
SET_TARGET_PROPERTIES (JSonParser
PROPERTIES OUTPUT_NAME jsoncpp
)
# Check if the install prefix is set
IF (NOT CMAKE_INSTALL_PREFIX)
SET ( CMAKE_INSTALL_PREFIX
${JSonParser_SOURCE_DIR}/install
)
ENDIF(NOT CMAKE_INSTALL_PREFIX)
# Install files
SET ( CMAKE_INSTALL_PREFIX
${JSonParser_BINARY_DIR}/install
)
FILE (GLOB includeFiles
${JSonParser_SOURCE_DIR}/interface/*.h
)
LIST (APPEND srcFiles
src/CMakeLists.txt
)
FILE (GLOB cmakeFiles
${JSonParser_SOURCE_DIR}/CMakeLists.txt
)
INSTALL (FILES ${includeFiles}
DESTINATION include/
)
INSTALL (FILES ${includeFiles}
DESTINATION src/JSONParser/interface
)
INSTALL (FILES ${srcFiles}
DESTINATION src/JSONParser/src
)
INSTALL (FILES ${cmakeFiles}
DESTINATION src/JSONParser
)
INSTALL (TARGETS JSonParser
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
# Add subdirectories
ADD_SUBDIRECTORY (test)