forked from OpenDDS/OpenDDS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (55 loc) · 1.96 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
# Distributed under the OpenDDS License. See accompanying LICENSE
# file or http://www.opendds.org/license.html for details.
#
# This file is setup the way it is for testing purposes. For a cleaner example
# see DevGuideExamples/DCPS/Messenger/CMakeLists.txt
project(opendds_messenger_2 CXX)
cmake_minimum_required(VERSION 3.8.2)
enable_testing()
find_package(OpenDDS REQUIRED)
if (NOT OPENDDS_OWNERSHIP_PROFILE)
message(FATAL_ERROR "This test requires OpenDDS to be built with Ownership Profile enabled")
endif()
set(target_prefix "${PROJECT_NAME}_")
set(publisher "${target_prefix}publisher")
set(subscriber "${target_prefix}subscriber")
set(messenger "${target_prefix}messenger")
set(src "${CMAKE_CURRENT_SOURCE_DIR}/../../../DCPS/Messenger")
set(dst ${CMAKE_CURRENT_BINARY_DIR})
set(all_targets ${publisher} ${subscriber} ${messenger})
foreach(file
Messenger.idl subscriber.cpp publisher.cpp Args.h
DataReaderListener.cpp DataReaderListener.h pub.ini sub.ini)
configure_file(${src}/${file} ${dst}/${file} COPYONLY)
endforeach()
# Messenger library
add_library(${messenger})
set_target_properties(${messenger}
PROPERTIES OUTPUT_NAME messenger
)
OPENDDS_TARGET_SOURCES(${messenger} PUBLIC "${dst}/Messenger.idl")
target_link_libraries(${messenger} PUBLIC OpenDDS::Dcps)
# Publisher
add_executable(${publisher}
"${dst}/publisher.cpp"
)
set_target_properties(${publisher}
PROPERTIES OUTPUT_NAME publisher
)
target_include_directories(${publisher} PRIVATE "${src}/../../../")
target_link_libraries(${publisher} ${messenger} OpenDDS::OpenDDS)
# Subscriber
add_executable(${subscriber}
"${dst}/subscriber.cpp"
"${dst}/DataReaderListener.h"
"${dst}/DataReaderListener.cpp"
)
set_target_properties(${subscriber}
PROPERTIES OUTPUT_NAME subscriber
)
target_link_libraries(${subscriber} ${messenger} OpenDDS::OpenDDS)
# Testing
configure_file("${src}/run_test.pl" . COPYONLY)
add_test(NAME "${target_prefix}test"
COMMAND perl run_test.pl $<$<BOOL:$<CONFIG>>:-ExeSubDir> $<CONFIG>
)