gazetk / Protocol / CMakeLists.txt @ cf5923cc
History | View | Annotate | Download (2.149 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 bin COMPONENT libraries |
37 |
LIBRARY DESTINATION lib COMPONENT libraries |
38 |
PUBLIC_HEADER DESTINATION include COMPONENT libraries |
39 |
ARCHIVE DESTINATION lib/static COMPONENT libraries) |
40 |
|
41 |
install(DIRECTORY src_cpp/ DESTINATION include/GazeTkProtocol |
42 |
FILES_MATCHING PATTERN "*.h") |
43 |
|
44 |
# |
45 |
# Installing the header files. |
46 |
# Looks a little bit complicated, the headers are generated, so we have to search |
47 |
# for them. However, if we do so, the install command creates empty subdirs according |
48 |
# to initial structure. By excluding them, this is prohibited. Nicer solutions welcome! |
49 |
# |
50 |
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION include/GazeTkProtocol |
51 |
FILES_MATCHING PATTERN "*.h" |
52 |
PATTERN "Win32" EXCLUDE |
53 |
PATTERN "GazeTkProtocol.dir" EXCLUDE |
54 |
PATTERN "Debug" EXCLUDE |
55 |
PATTERN "Release" EXCLUDE |
56 |
PATTERN "CMakeFiles" EXCLUDE |
57 |
) |
58 |
|