diff options
author | Andrew Stitcher <astitcher@apache.org> | 2014-03-27 00:25:43 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2014-03-27 00:25:43 +0000 |
commit | 5c8d7a45e3747a9cd770b77776f98a9020dfa099 (patch) | |
tree | 54c1abbc8fe2e4462cd33fdf6ac6b1954d4a4b09 | |
parent | 2f4b36a7eb2398b8032b924e21e2c4d5590ce087 (diff) | |
download | qpid-python-5c8d7a45e3747a9cd770b77776f98a9020dfa099.tar.gz |
QPID-5646: Detect and build against earlier versions of Proton.
- This should detect any version of Proton that either uses
pkg-config or native cmake config files.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1582139 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/CMakeLists.txt | 2 | ||||
-rw-r--r-- | qpid/cpp/CMakeModules/FindProton.cmake | 61 |
2 files changed, 63 insertions, 0 deletions
diff --git a/qpid/cpp/CMakeLists.txt b/qpid/cpp/CMakeLists.txt index 837a71cd44..d057254d45 100644 --- a/qpid/cpp/CMakeLists.txt +++ b/qpid/cpp/CMakeLists.txt @@ -29,6 +29,8 @@ else() set (OPTIONAL_ARG OPTIONAL) endif() +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules) + # Parse the version from QPID_VERSION.txt. # Use the top level qpid/ file if we're in an SVN checkout, source dir otherwise. find_file(QPID_VERSION_FILE NAMES QPID_VERSION.txt PATHS ${PROJECT_SOURCE_DIR}/.. ${PROJECT_SOURCE_DIR} NO_DEFAULT_PATH) diff --git a/qpid/cpp/CMakeModules/FindProton.cmake b/qpid/cpp/CMakeModules/FindProton.cmake new file mode 100644 index 0000000000..caf836d69a --- /dev/null +++ b/qpid/cpp/CMakeModules/FindProton.cmake @@ -0,0 +1,61 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +include(FindPackageHandleStandardArgs) +include(FindPackageMessage) + +# First try to find the Installed Proton config (Proton 0.7 and later) +find_package(Proton CONFIG QUIET) +if (Proton_FOUND) + find_package_message(Proton "Found Proton: ${Proton_LIBRARIES} (found version \"${Proton_VERSION}\")" "$Proton_DIR ${Proton_LIBRARIES} $Proton_VERSION") + return() +endif () + +# Now look for the cooky Proton config installed with some earlier +# versions of Proton +find_package(proton CONFIG QUIET) +if (proton_FOUND) + include("${proton_DIR}/libqpid-proton.cmake") + set (Proton_VERSION ${PROTON_VERSION}) + set (Proton_INCLUDE_DIRS ${PROTON_INCLUDE_DIRS}) + set (Proton_LIBRARIES ${PROTON_LIBRARIES}) + set (Proton_FOUND true) + find_package_message(Proton "Found Proton: ${Proton_LIBRARIES} (found version \"${Proton_VERSION}\")" "$Proton_DIR ${Proton_LIBRARIES} $Proton_VERSION") + return() +endif () + +# Now look for any pkg-config configuration +find_package(PkgConfig QUIET) + +if (PKG_CONFIG_FOUND) + if (NOT Proton_FIND_VERSION) + pkg_check_modules(Proton libqpid-proton QUIET) + elseif(NOT Proton_FIND_VERSION_EXACT) + pkg_check_modules(Proton libqpid-proton>=${Proton_FIND_VERSION} QUIET) + else() + pkg_check_modules(Proton libqpid-proton=${Proton_FIND_VERSION} QUIET) + endif() + if (Proton_FOUND) + find_package_message(Proton "Found Proton: ${Proton_LIBRARIES} (found version \"${Proton_VERSION}\")" "$Proton_DIR ${Proton_LIBRARIES} $Proton_VERSION") + return() + endif () +endif() + +# Proton not found print a standard error message +find_package_handle_standard_args(Proton CONFIG_MODE) |