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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
From 5090d49d35f8699e6d2afefe94d62b4d803302c2 Mon Sep 17 00:00:00 2001
From: Andrew Stitcher <astitcher@apache.org>
Date: Thu, 12 Jan 2023 18:55:16 -0500
Subject: PROTON-2669: Update examples CMakefiles for cmake 3.16
---
c/examples/CMakeLists.txt | 20 +-------------------
cpp/examples/CMakeLists.txt | 32 +++-----------------------------
tests/share/CMakeLists.txt | 2 +-
3 files changed, 5 insertions(+), 49 deletions(-)
diff --git a/c/examples/CMakeLists.txt b/c/examples/CMakeLists.txt
index 04758e2f..c0a984c0 100644
--- a/c/examples/CMakeLists.txt
+++ b/c/examples/CMakeLists.txt
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-cmake_minimum_required (VERSION 2.8.12)
+cmake_minimum_required (VERSION 3.16)
project(ProtonCExamples C)
@@ -24,24 +24,6 @@ find_package(Proton REQUIRED Core Proactor)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
-# The following block is purely for CMake 2.8.12
-# Remove it when we no longer support CMake 2.8.12
-if(NOT TARGET Threads::Threads)
- add_library(Threads::Threads UNKNOWN IMPORTED)
-
- if(THREADS_HAVE_PTHREAD_ARG)
- set_target_properties(Threads::Threads PROPERTIES
- INTERFACE_COMPILE_OPTIONS "-pthread"
- )
- endif()
-
- if(CMAKE_THREAD_LIBS_INIT)
- set_target_properties(Threads::Threads PROPERTIES
- IMPORTED_LOCATION "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif()
-endif()
-
foreach (name broker send receive direct send-abort send-ssl raw_echo raw_connect)
add_executable(c-${name} ${name}.c)
target_link_libraries(c-${name} Proton::core Proton::proactor Threads::Threads)
diff --git a/cpp/examples/CMakeLists.txt b/cpp/examples/CMakeLists.txt
index 7c123ce3..df2333c8 100644
--- a/cpp/examples/CMakeLists.txt
+++ b/cpp/examples/CMakeLists.txt
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-cmake_minimum_required (VERSION 2.8.12)
+cmake_minimum_required (VERSION 3.16)
project(ProtonCppExamples C CXX)
@@ -24,34 +24,8 @@ find_package(ProtonCpp REQUIRED)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
-# The following block is purely for CMake 2.8.12
-# Remove it when we no longer support CMake 2.8.12
-if(NOT TARGET Threads::Threads)
- add_library(Threads::Threads UNKNOWN IMPORTED)
-
- if(THREADS_HAVE_PTHREAD_ARG)
- set_target_properties(Threads::Threads PROPERTIES
- INTERFACE_COMPILE_OPTIONS "-pthread"
- )
- endif()
-
- if(CMAKE_THREAD_LIBS_INIT)
- set_target_properties(Threads::Threads PROPERTIES
- IMPORTED_LOCATION "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif()
-endif()
-
-# This effectively checks for cmake version 3.1 or later
-if (DEFINED CMAKE_CXX_COMPILE_FEATURES)
- set(CMAKE_CXX_STANDARD 11)
- set(CMAKE_CXX_EXTENSIONS OFF)
-else ()
- # This can only be a fairly old version of Linux in practice
- set(CXX_STANDARD "-std=c++11")
- add_definitions(${CXX_STANDARD})
-endif()
-
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_EXTENSIONS OFF)
# Single-threaded examples
foreach(example
diff --git a/tests/share/CMakeLists.txt b/tests/share/CMakeLists.txt
index 88884145..68bffcc4 100644
--- a/tests/share/CMakeLists.txt
+++ b/tests/share/CMakeLists.txt
@@ -17,7 +17,7 @@
# under the License.
#
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.16)
project(ProtonExamples)
include(CTest)
--
2.30.2
|