Debian Codegraph @

cpp/examples/CMakeLists.txt

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements. See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership. The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License. You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied. See the License for the
16 # specific language governing permissions and limitations
17 # under the License.
18 #
19 cmake_minimum_required (VERSION 2.8.12)
20
21 project(ProtonCppExamples C CXX)
22
23 find_package(ProtonCpp REQUIRED)
24 set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
25 find_package(Threads REQUIRED)
26
27 # The following block is purely for CMake 2.8.12
28 # Remove it when we no longer support CMake 2.8.12
29 if(NOT TARGET Threads::Threads)
30 add_library(Threads::Threads UNKNOWN IMPORTED)
31
32 if(THREADS_HAVE_PTHREAD_ARG)
33 set_target_properties(Threads::Threads PROPERTIES
34 INTERFACE_COMPILE_OPTIONS "-pthread"
35 )
36 endif()
37
38 if(CMAKE_THREAD_LIBS_INIT)
39 set_target_properties(Threads::Threads PROPERTIES
40 IMPORTED_LOCATION "${CMAKE_THREAD_LIBS_INIT}"
41 )
42 endif()
43 endif()
44
45 # This effectively checks for cmake version 3.1 or later
46 if (DEFINED CMAKE_CXX_COMPILE_FEATURES)
47 set(CMAKE_CXX_STANDARD 11)
48 set(CMAKE_CXX_EXTENSIONS OFF)
49 else ()
50 # This can only be a fairly old version of Linux in practice
51 set(CXX_STANDARD "-std=c++11")
52 add_definitions(${CXX_STANDARD})
53 endif()
54
55
56 # Single-threaded examples
57 foreach(example
58 broker
59 helloworld
60 simple_connect
61 simple_recv
62 simple_send
63 reconnect_client
64 message_properties
65 scheduled_send_03
66 direct_recv
67 direct_send
68 client
69 server
70 server_direct
71 connection_options
72 queue_browser
73 colour_send
74 selected_recv
75 flow_control
76 ssl
77 ssl_client_cert
78 encode_decode
79 scheduled_send
80 service_bus)
81 add_executable(${example} ${example}.cpp)
82 target_link_libraries(${example} Proton::cpp)
83 endforeach()
84
85 # Examples that use threads directly
86 foreach(example
87 multithreaded_client
88 multithreaded_client_flow_control)
89 add_executable(${example} ${example}.cpp)
90 target_link_libraries(${example} Proton::cpp Threads::Threads)
91 endforeach()