gazetk / Protocol / CMakeLists.txt @ 6b3a8f8f
History | View | Annotate | Download (3.007 KB)
1 | 81eb8e16 | Thies Pfeiffer | 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 | cf5923cc | Thies Pfeiffer | #SET(CMAKE_INSTALL_PREFIX "../../" CACHE PATH "Install path prefix" FORCE INTERNAL ) |
20 | |||
21 | 81eb8e16 | Thies Pfeiffer | # 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 | 0cee33d5 | Thies Pfeiffer | 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 | 81eb8e16 | Thies Pfeiffer | |
28 | cf5923cc | Thies Pfeiffer | #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 | 81eb8e16 | Thies Pfeiffer | # add the library |
32 | add_library(GazeTkProtocol STATIC src_cpp/protocol.cc ${PROTO_SRCS} ${PROTO_HDRS}) |
||
33 | target_link_libraries(GazeTkProtocol ${PROTOBUF_LIBRARIES}) |
||
34 | cf5923cc | Thies Pfeiffer | |
35 | install(TARGETS GazeTkProtocol |
||
36 | 2eb54f9d | Thies Pfeiffer | RUNTIME DESTINATION debug/bin COMPONENT libraries |
37 | LIBRARY DESTINATION debug/lib COMPONENT libraries |
||
38 | PUBLIC_HEADER DESTINATION debug/include COMPONENT libraries |
||
39 | 6b3a8f8f | Thies Pfeiffer | ARCHIVE DESTINATION debug/lib COMPONENT libraries |
40 | 2eb54f9d | Thies Pfeiffer | 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 | 6b3a8f8f | Thies Pfeiffer | ARCHIVE DESTINATION release/lib COMPONENT libraries |
47 | 2eb54f9d | Thies Pfeiffer | 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 | cf5923cc | Thies Pfeiffer | |
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 | 2eb54f9d | Thies Pfeiffer | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION release/include/GazeTkProtocol |
66 | CONFIGURATIONS Release |
||
67 | cf5923cc | Thies Pfeiffer | 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 | 2eb54f9d | Thies Pfeiffer | ) |
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 | ) |