Statistics
| Branch: | Revision:

gazetk / Protocol / CMakeLists.txt @ fba08427

History | View | Annotate | Download (3.021 KB)

1
cmake_minimum_required (VERSION 3.0)
2

    
3
project (GazeTkProtocol)
4

    
5
# Versioning
6
set (GazeTkProtocol_VERSION_MAJOR 0)
7
set (GazeTkProtocol_VERSION_MINOR 1)
8

    
9
# configure the header of the library
10
configure_file (
11
  "${PROJECT_SOURCE_DIR}/src_cpp/Protocol.h.in"
12
  "${PROJECT_BINARY_DIR}/Protocol.h"
13
  )
14

    
15
# add the binary tree to the search path for include files
16
# so that the generated files are found
17
include_directories("${PROJECT_BINARY_DIR}")
18

    
19
#SET(CMAKE_INSTALL_PREFIX "../../" CACHE PATH "Install path prefix" FORCE INTERNAL )
20

    
21
# add the Google protobuf parts
22
find_package(Protobuf REQUIRED)
23
include_directories(${PROTOBUF_INCLUDE_DIRS})
24
include_directories(${CMAKE_CURRENT_BINARY_DIR})
25
set (PROTOBUF_IMPORT_DIRS specification)
26
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS specification/basic_types.proto specification/eye_data.proto specification/gaze2d_data.proto specification/gaze3d_data.proto specification/messages.proto)
27

    
28
#this dummy list will make all header files appear if you use qtcreator to open the cmake project
29
#file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_BINARY_DIR}/ *.h  )
30

    
31
# add the library
32
add_library(GazeTkProtocol STATIC src_cpp/protocol.cc ${PROTO_SRCS} ${PROTO_HDRS})
33
target_link_libraries(GazeTkProtocol ${PROTOBUF_LIBRARIES})
34

    
35
install(TARGETS GazeTkProtocol
36
     RUNTIME DESTINATION debug/bin COMPONENT libraries
37
     LIBRARY DESTINATION debug/lib COMPONENT libraries
38
     PUBLIC_HEADER DESTINATION debug/include COMPONENT libraries
39
     ARCHIVE DESTINATION debug/lib/static COMPONENT libraries
40
     CONFIGURATIONS Debug)
41

    
42
install(TARGETS GazeTkProtocol
43
     RUNTIME DESTINATION release/bin COMPONENT libraries
44
     LIBRARY DESTINATION release/lib COMPONENT libraries
45
     PUBLIC_HEADER DESTINATION release/include COMPONENT libraries
46
     ARCHIVE DESTINATION release/lib/static COMPONENT libraries 
47
     CONFIGURATIONS Release)
48

    
49
install(DIRECTORY src_cpp/ DESTINATION release/include/GazeTkProtocol
50
				CONFIGURATIONS Release
51
        FILES_MATCHING PATTERN "*.h"
52
        )
53

    
54
install(DIRECTORY src_cpp/ DESTINATION debug/include/GazeTkProtocol
55
				CONFIGURATIONS Debug
56
        FILES_MATCHING PATTERN "*.h"
57
        )
58
        
59
#
60
# Installing the header files.
61
# Looks a little bit complicated, the headers are generated, so we have to search
62
# for them. However, if we do so, the install command creates empty subdirs according
63
# to initial structure. By excluding them, this is prohibited. Nicer solutions welcome!
64
#
65
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION release/include/GazeTkProtocol
66
        CONFIGURATIONS Release
67
				FILES_MATCHING PATTERN "*.h"
68
				PATTERN "Win32" EXCLUDE
69
				PATTERN "GazeTkProtocol.dir" EXCLUDE
70
				PATTERN "Debug" EXCLUDE
71
				PATTERN "Release" EXCLUDE
72
				PATTERN "CMakeFiles" EXCLUDE
73
)
74
        
75
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION debug/include/GazeTkProtocol
76
        CONFIGURATIONS Debug
77
        FILES_MATCHING PATTERN "*.h"
78
				PATTERN "Win32" EXCLUDE
79
				PATTERN "GazeTkProtocol.dir" EXCLUDE
80
				PATTERN "Debug" EXCLUDE
81
				PATTERN "Release" EXCLUDE
82
				PATTERN "CMakeFiles" EXCLUDE
83
)