summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2013-07-05 20:34:42 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2013-07-05 20:34:42 +0000
commit88c521cc70189673c259cbccd2f7ea7732a8588a (patch)
tree8785767931761f24e86b878ff5de78ba86a8bad2
parent8b2a8b4cb5da09da2be300eb0ed925f5b1bfca71 (diff)
downloadqpid-python-88c521cc70189673c259cbccd2f7ea7732a8588a.tar.gz
NO-JIRA: add the QMFv2 C++ examples build to cmake
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1500121 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/bindings/CMakeLists.txt2
-rw-r--r--qpid/cpp/bindings/qmf2/examples/cpp/CMakeLists.txt97
2 files changed, 99 insertions, 0 deletions
diff --git a/qpid/cpp/bindings/CMakeLists.txt b/qpid/cpp/bindings/CMakeLists.txt
index bab4db0bda..14e30ed6ca 100644
--- a/qpid/cpp/bindings/CMakeLists.txt
+++ b/qpid/cpp/bindings/CMakeLists.txt
@@ -107,3 +107,5 @@ if (SWIG_FOUND)
add_subdirectory(qpid/perl)
endif (PERLLIBS_FOUND)
endif (SWIG_FOUND)
+
+add_subdirectory(qmf2/examples/cpp)
diff --git a/qpid/cpp/bindings/qmf2/examples/cpp/CMakeLists.txt b/qpid/cpp/bindings/qmf2/examples/cpp/CMakeLists.txt
new file mode 100644
index 0000000000..d946a61e61
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/examples/cpp/CMakeLists.txt
@@ -0,0 +1,97 @@
+#
+# 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.
+#
+project(qmf2_examples)
+cmake_minimum_required(VERSION 2.4.0 FATAL_ERROR)
+if(COMMAND cmake_policy)
+ cmake_policy(SET CMP0003 NEW)
+endif(COMMAND cmake_policy)
+
+include_directories(${CMAKE_BINARY_DIR}/include)
+include_directories(${CMAKE_SOURCE_DIR}/include)
+
+# Shouldn't need this... but there are still client header inclusions
+# of Boost. When building examples at an install site, the Boost files
+# should be locatable aside from these settings.
+# So set up to find the headers, find the libs at link time, but dynamically
+# link them all and clear the CMake Boost library names to avoid adding them to
+# the project files.
+include_directories( ${Boost_INCLUDE_DIR} )
+link_directories( ${Boost_LIBRARY_DIRS} )
+
+# Visual Studio needs some Windows-specific simplifications.
+# Linux needs to reference the boost libs, even though they should be
+# resolved via the Qpid libs.
+if (MSVC)
+ add_definitions( /D "NOMINMAX" /D "WIN32_LEAN_AND_MEAN" /D "BOOST_ALL_DYN_LINK" )
+ # On Windows, prevent the accidental inclusion of Boost headers from
+ # autolinking in the Boost libs. There should be no direct references to
+ # Boost in the examples, and references via qpidclient/qpidcommon are
+ # resolved in the Qpid libs.
+ add_definitions( /D "BOOST_ALL_NO_LIB" )
+else (MSVC)
+ set(_boost_libs_needed ${Boost_PROGRAM_OPTIONS_LIBRARY}
+ ${Boost_FILESYSTEM_LIBRARY})
+endif (MSVC)
+
+# There are numerous duplicate names within the examples. Since all target
+# names must be unique, define a macro to prepend a prefix and manage the
+# actual names.
+# There can be an optional arguments at the end: libs to include
+macro(add_example subdir example)
+ add_executable(${subdir}_${example} ${example}.cpp)
+ set_target_properties(${subdir}_${example} PROPERTIES OUTPUT_NAME ${example})
+ if (${ARGC} GREATER 2)
+ target_link_libraries(${subdir}_${example} ${ARGN} qpidclient
+ ${_boost_libs_needed})
+ else (${ARGC} GREATER 2)
+ target_link_libraries(${subdir}_${example} qpidclient
+ ${_boost_libs_needed})
+ endif (${ARGC} GREATER 2)
+endmacro(add_example)
+
+macro(add_installed_example subdir example)
+ add_example(${subdir} ${example} ${ARGN})
+
+ # For installs, don't install the built example; that would be pointless.
+ # Install the things a user needs to build the example on-site.
+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${example}.cpp
+ DESTINATION ${QPID_INSTALL_EXAMPLESDIR}/${subdir}
+ COMPONENT ${QPID_COMPONENT_EXAMPLES})
+ if (MSVC)
+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}_${example}.vcproj
+ DESTINATION ${QPID_INSTALL_EXAMPLESDIR}/${subdir}
+ COMPONENT ${QPID_COMPONENT_EXAMPLES})
+ endif (MSVC)
+
+endmacro(add_installed_example)
+
+install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.txt
+ DESTINATION ${QPID_INSTALL_EXAMPLESDIR}
+ COMPONENT ${QPID_COMPONENT_EXAMPLES})
+if (MSVC)
+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/examples.sln
+ DESTINATION ${QPID_INSTALL_EXAMPLESDIR}
+ COMPONENT ${QPID_COMPONENT_EXAMPLES})
+endif (MSVC)
+
+add_installed_example(qmf2 agent qmf2)
+add_installed_example(qmf2 event_driven_list_agents qmf2)
+add_installed_example(qmf2 list_agents qmf2)
+add_installed_example(qmf2 print_events qmf2)
+