summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2009-04-30 17:16:06 +0000
committerAndrew Stitcher <astitcher@apache.org>2009-04-30 17:16:06 +0000
commit5af5eef7eeff6cb26e34b1755471b4ee621d5edd (patch)
treee4fd03b8f11f7ce932dea958516fd1eb5198d339 /cpp/src
parentcd5a790dcf32b692cedb82ef5d08549ce9a2d1b6 (diff)
downloadqpid-python-5af5eef7eeff6cb26e34b1755471b4ee621d5edd.tar.gz
Made cmake config more like the autotools version
- By default if it detects a dependency it will build the module that needs it, otherwise it won't - It can be forced to build modules so that automated builds that have required outputs can fail config git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@770330 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/CMakeLists.txt44
-rw-r--r--cpp/src/cluster.cmake50
-rw-r--r--cpp/src/rdma.cmake18
-rw-r--r--cpp/src/ssl.cmake18
4 files changed, 88 insertions, 42 deletions
diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt
index 09a97eeea4..ead289fff4 100644
--- a/cpp/src/CMakeLists.txt
+++ b/cpp/src/CMakeLists.txt
@@ -17,6 +17,12 @@
# under the License.
#
+# Option to require building optional plugins
+foreach (r ${REQUIRE})
+ set(${r}_force ON)
+ message(STATUS "Forcing ${r} to ${${r}_force}")
+endforeach(r)
+
include(CheckFunctionExists)
include(CheckIncludeFileCXX)
include(CheckIncludeFiles)
@@ -159,10 +165,16 @@ else (NOT CLOCK_GETTIME_IN_RT)
endif (NOT CLOCK_GETTIME_IN_RT)
# See if Cyrus SASL is desired and available
-option(QPID_HAS_SASL "Build with Cyrus SASL support" ON)
-if (QPID_HAS_SASL)
- CHECK_LIBRARY_EXISTS (sasl2 sasl_checkpass "" HAVE_SASL2)
- CHECK_INCLUDE_FILES (sasl/sasl.h HAVE_SASL_H)
+CHECK_LIBRARY_EXISTS (sasl2 sasl_checkpass "" HAVE_SASL2)
+CHECK_INCLUDE_FILES (sasl/sasl.h HAVE_SASL_H)
+
+set (sasl_default ${sasl_force})
+if (HAVE_SASL2 AND HAVE_SASL_H)
+ set (sasl_default ON)
+endif (HAVE_SASL2 AND HAVE_SASL_H)
+
+option(BUILD_SASL "Build with Cyrus SASL support" ${sasl_default})
+if (BUILD_SASL)
if (NOT HAVE_SASL2)
message(FATAL_ERROR "Cyrus SASL support requested but libsasl2 not found")
endif (NOT HAVE_SASL2)
@@ -176,21 +188,25 @@ if (QPID_HAS_SASL)
qpid/sys/cyrus/CyrusSecurityLayer.cpp
)
set(qpidcommon_sasl_lib sasl2)
-
-endif (QPID_HAS_SASL)
+endif (BUILD_SASL)
# See if XML Exchange is desired and prerequisites are available
+CHECK_LIBRARY_EXISTS (xerces-c _init "" HAVE_XERCES)
+CHECK_INCLUDE_FILE_CXX (xercesc/framework/MemBufInputSource.hpp HAVE_XERCES_H)
+CHECK_INCLUDE_FILE_CXX (xqilla/xqilla-simple.hpp HAVE_XQILLA_H)
+
+set (xml_default ${xml_force})
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
- set (xml_default OFF)
else (CMAKE_SYSTEM_NAME STREQUAL Windows)
- set (xml_default ON)
+ if (HAVE_XERCES AND HAVE_XERCES_H)
+ if (HAVE_XQILLA_H)
+ set (xml_default ON)
+ endif (HAVE_XQILLA_H)
+ endif (HAVE_XERCES AND HAVE_XERCES_H)
endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
-option(QPID_HAS_XML "Build with XML Exchange" ${xml_default})
-if (QPID_HAS_XML)
- CHECK_LIBRARY_EXISTS (xerces-c _init "" HAVE_XERCES)
- CHECK_INCLUDE_FILE_CXX (xercesc/framework/MemBufInputSource.hpp HAVE_XERCES_H)
- CHECK_INCLUDE_FILE_CXX (xqilla/xqilla-simple.hpp HAVE_XQILLA_H)
+option(BUILD_XML "Build with XML Exchange" ${xml_default})
+if (BUILD_XML)
if (NOT HAVE_XERCES)
message(FATAL_ERROR "XML Exchange support requested but xerces-c library not found")
endif (NOT HAVE_XERCES)
@@ -209,7 +225,7 @@ if (QPID_HAS_XML)
set_target_properties (xml PROPERTIES
PREFIX ""
LINK_FLAGS -Wl,--no-undefined)
-endif (QPID_HAS_XML)
+endif (BUILD_XML)
# Build the ACL plugin
set (acl_SOURCES
diff --git a/cpp/src/cluster.cmake b/cpp/src/cluster.cmake
index 9b357d3297..31d8b07208 100644
--- a/cpp/src/cluster.cmake
+++ b/cpp/src/cluster.cmake
@@ -26,28 +26,44 @@
include(CheckIncludeFiles)
include(CheckLibraryExists)
+set(LIBCPG_PATH /usr/lib/openais /usr/lib64/openais /usr/lib/corosync /usr/lib64/corosync CACHE STRING "Default locations for libcpg (cluster library)" )
+find_library(LIBCPG cpg ${LIBCPG_PATH})
+if (LIBCPG)
+ CHECK_LIBRARY_EXISTS (${LIBCPG} cpg_local_get "" HAVE_LIBCPG)
+ CHECK_INCLUDE_FILES (openais/cpg.h HAVE_OPENAIS_CPG_H)
+ CHECK_INCLUDE_FILES (corosync/cpg.h HAVE_COROSYNC_CPG_H)
+endif (LIBCPG)
+
+set (cluster_default ${cluster_force})
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
- set (cluster_default OFF)
else (CMAKE_SYSTEM_NAME STREQUAL Windows)
- set (cluster_default ON)
+ if (HAVE_LIBCPG)
+ if (HAVE_OPENAIS_CPG_H OR HAVE_COROSYNC_CPG_H)
+ set (cluster_default ON)
+ endif (HAVE_OPENAIS_CPG_H OR HAVE_COROSYNC_CPG_H)
+ endif (HAVE_LIBCPG)
endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
-option(BUILD_CPG "Build with CPG support for clustering" ${cluster_default})
-if (BUILD_CPG)
- FIND_LIBRARY(LIBCPG cpg /usr/lib/openais /usr/lib64/openais /usr/lib/corosync /usr/lib64/corosync)
- if (LIBCPG MATCHES ".*-NOTFOUND$")
- message(FATAL_ERROR "cpg library not found, install openais-devel or corosync-devel")
- endif (LIBCPG MATCHES ".*-NOTFOUND$")
- CHECK_INCLUDE_FILES (openais/cpg.h HAVE_OPENAIS_CPG_H)
- CHECK_INCLUDE_FILES (corosync/cpg.h HAVE_COROSYNC_CPG_H)
+option(BUILD_CLUSTER "Build with CPG support for clustering" ${cluster_default})
+if (BUILD_CLUSTER)
+
+ if (NOT HAVE_LIBCPG)
+ message(FATAL_ERROR "libcpg not found, install openais-devel or corosync-devel")
+ endif (NOT HAVE_LIBCPG)
if (NOT HAVE_OPENAIS_CPG_H AND NOT HAVE_COROSYNC_CPG_H)
message(FATAL_ERROR "cpg.h not found, install openais-devel or corosync-devel")
endif (NOT HAVE_OPENAIS_CPG_H AND NOT HAVE_COROSYNC_CPG_H)
- option(CPG_INCLUDE_CMAN "Include libcman quorum service integration" ON)
- if (CPG_INCLUDE_CMAN)
- CHECK_LIBRARY_EXISTS (cman cman_is_quorate "" HAVE_LIBCMAN)
- CHECK_INCLUDE_FILES (libcman.h HAVE_LIBCMAN_H)
+ CHECK_LIBRARY_EXISTS (cman cman_is_quorate "" HAVE_LIBCMAN)
+ CHECK_INCLUDE_FILES (libcman.h HAVE_LIBCMAN_H)
+
+ set(cluster_quorum_default ${cluster_quorum_force})
+ if (HAVE_LIBCMAN AND HAVE_LIBCMAN_H)
+ set(cluster_quorum_default ON)
+ endif (HAVE_LIBCMAN AND HAVE_LIBCMAN_H)
+
+ option(BUILD_CLUSTER_QUORUM "Include libcman quorum service integration" ${cluster_quorum_default})
+ if (BUILD_CLUSTER_QUORUM)
if (NOT HAVE_LIBCMAN)
message(FATAL_ERROR "libcman not found, install cman-devel or cmanlib-devel")
endif (NOT HAVE_LIBCMAN)
@@ -57,9 +73,9 @@ if (BUILD_CPG)
set (CMAN_SOURCES qpid/cluster/Quorum_cman.h qpid/cluster/Quorum_cman.cpp)
set (CMAN_LIB cman)
- else (CPG_INCLUDE_CMAN)
+ else (BUILD_CLUSTER_QUORUM)
set (CMAN_SOURCES qpid/cluster/Quorum_null.h)
- endif (CPG_INCLUDE_CMAN)
+ endif (BUILD_CLUSTER_QUORUM)
set (cluster_SOURCES
${CMAN_SOURCES}
@@ -110,7 +126,7 @@ if (BUILD_CPG)
set_target_properties (cluster PROPERTIES
PREFIX "")
-endif (BUILD_CPG)
+endif (BUILD_CLUSTER)
# Distribute all sources.
#EXTRA_DIST += qpid/cluster/Quorum_cman.h qpid/cluster/Quorum_cman.cpp qpid/cluster/Quorum_null.h
diff --git a/cpp/src/rdma.cmake b/cpp/src/rdma.cmake
index 30fbe9d279..ab8ed6303c 100644
--- a/cpp/src/rdma.cmake
+++ b/cpp/src/rdma.cmake
@@ -25,12 +25,20 @@
include(CheckIncludeFiles)
include(CheckLibraryExists)
-option(BUILD_RDMA "Build with support for Remote DMA protocols" OFF)
+CHECK_LIBRARY_EXISTS (ibverbs ibv_create_qp "" HAVE_IBVERBS)
+CHECK_LIBRARY_EXISTS (rdmacm rdma_create_id "" HAVE_RDMACM)
+CHECK_INCLUDE_FILES (infiniband/verbs.h HAVE_IBVERBS_H)
+CHECK_INCLUDE_FILES (rdma/rdma_cma.h HAVE_RDMACM_H)
+
+set (rdma_default ${rdma_force})
+if (HAVE_IBVERBS AND HAVE_IBVERBS_H)
+ if (HAVE_RDMACM AND HAVE_RDMACM_H)
+ set (rdma_default ON)
+ endif (HAVE_RDMACM AND HAVE_RDMACM_H)
+endif (HAVE_IBVERBS AND HAVE_IBVERBS_H)
+
+option(BUILD_RDMA "Build with support for Remote DMA protocols" ${rdma_default})
if (BUILD_RDMA)
- CHECK_LIBRARY_EXISTS (ibverbs ibv_create_qp "" HAVE_IBVERBS)
- CHECK_LIBRARY_EXISTS (rdmacm rdma_create_id "" HAVE_RDMACM)
- CHECK_INCLUDE_FILES (infiniband/verbs.h HAVE_IBVERBS_H)
- CHECK_INCLUDE_FILES (rdma/rdma_cma.h HAVE_RDMACM_H)
if (NOT HAVE_IBVERBS)
message(FATAL_ERROR "libibverbs not found, required for RDMA support")
endif (NOT HAVE_IBVERBS)
diff --git a/cpp/src/ssl.cmake b/cpp/src/ssl.cmake
index 4d42e04030..f7c155b24b 100644
--- a/cpp/src/ssl.cmake
+++ b/cpp/src/ssl.cmake
@@ -24,19 +24,25 @@
include(FindPkgConfig)
+# According to some cmake docs this is not a reliable way to detect
+# pkg-configed libraries, but it's no worse than what we did under
+# autotools
+pkg_check_modules(NSS nss)
+
+set (ssl_default ${ssl_force})
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
- set (ssl_default OFF)
else (CMAKE_SYSTEM_NAME STREQUAL Windows)
- set (ssl_default ON)
+ if (NSS_FOUND)
+ set (ssl_default ON)
+ endif (NSS_FOUND)
endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
option(BUILD_SSL "Build with support for SSL" ${ssl_default})
if (BUILD_SSL)
- # According to some cmake docs this is not a reliable way to detect
- # pkg-configed libraries, but it's no worse than what we did under
- # autotools
- pkg_check_modules(NSS REQUIRED nss)
+ if (NOT NSS_FOUND)
+ message(FATAL_ERROR "nss/nspr not found, required for ssl support")
+ endif (NOT NSS_FOUND)
foreach(f ${NSS_CFLAGS})
set (NSS_COMPILE_FLAGS "${NSS_COMPILE_FLAGS} ${f}")