diff options
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/CMakeLists.txt | 121 | ||||
| -rw-r--r-- | qpid/cpp/src/config.h.cmake | 2 | ||||
| -rw-r--r-- | qpid/cpp/src/tests/CMakeLists.txt | 29 | ||||
| -rw-r--r-- | qpid/cpp/src/tests/legacystore/CMakeLists.txt | 47 | ||||
| -rwxr-xr-x | qpid/cpp/src/tests/sasl_test_setup.sh | 2 | ||||
| -rw-r--r-- | qpid/cpp/src/tests/test_env.sh.in | 1 |
6 files changed, 98 insertions, 104 deletions
diff --git a/qpid/cpp/src/CMakeLists.txt b/qpid/cpp/src/CMakeLists.txt index 6d05fe8165..6daac70273 100644 --- a/qpid/cpp/src/CMakeLists.txt +++ b/qpid/cpp/src/CMakeLists.txt @@ -42,16 +42,25 @@ include(CheckIncludeFiles) include(CheckIncludeFileCXX) include(CheckLibraryExists) include(CheckSymbolExists) -include(FindBoost) -include(FindDoxygen) -include(FindRuby) -include(FindPkgConfig) -include(FindPythonInterp) + +find_package(PkgConfig) +find_package(Ruby) +find_package(PythonInterp REQUIRED) + +find_package(Doxygen) find_program(VALGRIND_EXECUTABLE valgrind DOC "Location of the valgrind program") mark_as_advanced(VALGRIND_EXECUTABLE) find_package_handle_standard_args(VALGRIND DEFAULT_MSG VALGRIND_EXECUTABLE) +find_program(SASLPASSWD2_EXECUTABLE saslpasswd2 DOC "Location of the saslpasswd2 program") +mark_as_advanced(SASLPASSWD2_EXECUTABLE) + +# See if Cyrus SASL is desired and available +CHECK_LIBRARY_EXISTS (sasl2 sasl_checkpass "" FOUND_SASL_LIB) +CHECK_INCLUDE_FILES (sasl/sasl.h FOUND_SASL_H) +find_package_handle_standard_args(SASL DEFAULT_MSG FOUND_SASL_LIB FOUND_SASL_H) + #set (CMAKE_VERBOSE_MAKEFILE ON) # for debugging # @@ -261,11 +270,11 @@ else (EXISTS ${AMQP_SPEC}) endif (EXISTS ${AMQP_SPEC}) # FindDoxygen module tries to locate doxygen and Graphviz dot -if (DOXYGEN_EXECUTABLE) - option(GEN_DOXYGEN "Use doxygen to generate user documentation" ON) -else (DOXYGEN_EXECUTABLE) +if (DOXYGEN_FOUND) + option(BUILD_DOCS "Build user documentation" ON) +else (DOXYGEN_FOUND) message(STATUS "Can't locate the doxygen command; user documentation cannot be generated") -endif (DOXYGEN_EXECUTABLE) +endif (DOXYGEN_FOUND) if (VALGRIND_FOUND) option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON) @@ -363,9 +372,9 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS} ${WARNING_FLAGS}") # Expand a bit from the basic Find_Boost; be specific about what's needed. # Boost.system is sometimes needed; it's handled separately, below. if (CMAKE_SYSTEM_NAME STREQUAL Windows) - set (Boost_components program_options date_time thread unit_test_framework regex) + set (Boost_components program_options date_time thread chrono) else (CMAKE_SYSTEM_NAME STREQUAL Windows) - set (Boost_components program_options unit_test_framework) + set (Boost_components program_options) endif (CMAKE_SYSTEM_NAME STREQUAL Windows) # Visual Studio 2010 requires boost 1.45 or better. @@ -379,35 +388,28 @@ if (NOT DEFINED Boost_ADDITIONAL_VERSIONS) "1.51" "1.51.0" "1.52" "1.52.0" "1.53" "1.53.0") endif (NOT DEFINED Boost_ADDITIONAL_VERSIONS) -find_package(Boost 1.33 REQUIRED COMPONENTS ${Boost_components}) -if(NOT Boost_FOUND) - message(FATAL_ERROR "Boost C++ libraries not found. Please install or try setting BOOST_ROOT") -endif(NOT Boost_FOUND) +# Discover Boost version +find_package(Boost 1.33 QUIET REQUIRED) # Boost.system was introduced at Boost 1.35; it's needed secondarily by other # Boost libs Qpid needs, so be sure it's there. if (Boost_VERSION GREATER 103499) - find_package(Boost COMPONENTS system) - - # Allow for cmake pre 2.6 and boost post 1.35 - if (NOT Boost_SYSTEM_LIBRARY) - set(Boost_SYSTEM_LIBRARY boost_system) - endif (NOT Boost_SYSTEM_LIBRARY) + list(APPEND Boost_components system) endif (Boost_VERSION GREATER 103499) -# Versions of cmake pre 2.6 don't set the Boost_*_LIBRARY variables correctly -# these values are correct for Linux -if (NOT Boost_PROGRAM_OPTIONS_LIBRARY) - set(Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options) -endif (NOT Boost_PROGRAM_OPTIONS_LIBRARY) - -if (NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY) - set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY boost_unit_test_framework) -endif (NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY) +find_package(Boost 1.33 REQUIRED COMPONENTS ${Boost_components}) +if(NOT Boost_FOUND) + message(FATAL_ERROR "Required Boost C++ libraries not found. Please install or try setting BOOST_ROOT") +endif(NOT Boost_FOUND) -if (NOT Boost_REGEX_LIBRARY) - set(Boost_REGEX_LIBRARY boost_regex) -endif (NOT Boost_REGEX_LIBRARY) +if (BUILD_TESTING) + set (BUILD_TESTING_UNITTESTS ON) + find_package(Boost 1.33 QUIET COMPONENTS unit_test_framework) + if(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY) + message(STATUS "Could not find unit testing library - will not build unit tests") + set (BUILD_TESTING_UNITTESTS OFF) + endif(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY) +endif (BUILD_TESTING) # The Windows install also wants the Boost DLLs, libs and headers that the # release is built with. The DLLs enable everything to run, and the headers @@ -423,6 +425,8 @@ endif (NOT Boost_REGEX_LIBRARY) # Boost libs based on compile-time touching of the headers. Since we don't # really need to add them to the link lines, set the names to blanks. option(QPID_LINK_BOOST_DYNAMIC "Link with dynamic Boost libs (OFF to link static)" ON) +mark_as_advanced(QPID_LINK_BOOST_DYNAMIC) + if (MSVC) install (PROGRAMS ${Boost_DATE_TIME_LIBRARY_DEBUG} ${Boost_DATE_TIME_LIBRARY_RELEASE} @@ -572,39 +576,27 @@ if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows) if (HAVE_EPOLL) set(poller_default epoll) endif (HAVE_EPOLL) - set(POLLER ${poller_default} CACHE STRING "Poller implementation (poll/epoll)") + set(QPID_POLLER ${poller_default} CACHE STRING "Poller implementation (poll/epoll)") + mark_as_advanced(QPID_POLLER) endif (NOT CMAKE_SYSTEM_NAME STREQUAL Windows) -# See if Cyrus SASL is desired and available -CHECK_LIBRARY_EXISTS (sasl2 sasl_checkpass "" HAVE_SASL) -CHECK_INCLUDE_FILES (sasl/sasl.h HAVE_SASL_H) - -set (sasl_default ${sasl_force}) -if (HAVE_SASL AND HAVE_SASL_H) - set (sasl_default ON) -endif (HAVE_SASL AND HAVE_SASL_H) - -option(BUILD_SASL "Build with Cyrus SASL support" ${sasl_default}) - +option(BUILD_SASL "Build with Cyrus SASL support" ${SASL_FOUND}) if (BUILD_SASL) - if (NOT HAVE_SASL) - message(FATAL_ERROR "Cyrus SASL support requested but libsasl2 not found") - endif (NOT HAVE_SASL) - if (NOT HAVE_SASL_H) - message(FATAL_ERROR "Cyrus SASL support requested but sasl.h not found") - endif (NOT HAVE_SASL_H) - - find_program(SASLPASSWD2 saslpasswd2 DOC "Location of the saslpasswd2 program") - set(BROKER_SASL_NAME "qpidd" CACHE STRING "SASL app name for the qpid broker") + if (NOT SASL_FOUND) + message(FATAL_ERROR "Cyrus SASL support requested but libsasl2 libraryor headers not found") + endif (NOT SASL_FOUND) + set(qpidcommon_sasl_source qpid/sys/cyrus/CyrusSecurityLayer.h qpid/sys/cyrus/CyrusSecurityLayer.cpp ) set(sasl_LIB sasl2) + set(HAVE_SASL 1) else (BUILD_SASL) - set(HAVE_SASL OFF) - set(BROKER_SASL_NAME "qpidd" CACHE STRING "SASL app name for the qpid broker") + set(HAVE_SASL 0) endif (BUILD_SASL) +set(QPID_BROKER_SASL_NAME "qpidd" CACHE STRING "SASL app name for the qpid broker") +mark_as_advanced(QPID_BROKER_SASL_NAME) # Optional SSL/TLS support. Requires Netscape Portable Runtime on Linux. @@ -887,15 +879,15 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows) # POSIX (Non-Windows) platforms have a lot of overlap in sources; the only # major difference is the poller module. - if (POLLER STREQUAL poll) + if (QPID_POLLER STREQUAL poll) set (qpid_poller_module qpid/sys/posix/PosixPoller.cpp ) - elseif (POLLER STREQUAL epoll) + elseif (QPID_POLLER STREQUAL epoll) set (qpid_poller_module qpid/sys/epoll/EpollPoller.cpp ) - endif (POLLER STREQUAL poll) + endif (QPID_POLLER STREQUAL poll) # Set default System Info module set (qpid_system_module @@ -1402,11 +1394,6 @@ if (CPACK_GENERATOR STREQUAL "NSIS") "qpidd" "Start Qpid Broker") endif (CPACK_GENERATOR STREQUAL "NSIS") -if (UNIX) - install (CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}/${QPID_LOCALSTATE_DIR}/lib/qpidd)") - install (CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}/${QPID_LOCALSTATE_DIR}/spool/qpidd)") -endif (UNIX) - if (NOT WIN32) set (qmf2_platform_headers ../include/qmf/posix/EventNotifier.h @@ -1518,8 +1505,8 @@ add_subdirectory(tests/legacystore) # Compatible variable names used in the pkg config files also for autoconf set (prefix ${CMAKE_INSTALL_PREFIX}) set (exec_prefix ${CMAKE_INSTALL_PREFIX}) -set_absolute_install_path (libdir ${LIB_INSTALL_DIR}) -set_absolute_install_path (includedir ${INCLUDE_INSTALL_DIR}) +set_absolute_install_path (libdir ${QPID_INSTALL_LIBDIR}) +set_absolute_install_path (includedir ${QPID_INSTALL_INCLUDEDIR}) set (VERSION ${QPID_VERSION}) #add_custom_target(pkgconfig ALL echo DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/qpid.pc) @@ -1527,5 +1514,5 @@ set (VERSION ${QPID_VERSION}) configure_file(qpid.pc.in ${CMAKE_CURRENT_BINARY_DIR}/qpid.pc @ONLY) configure_file(qmf2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/qmf2.pc @ONLY) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/qpid.pc ${CMAKE_CURRENT_BINARY_DIR}/qmf2.pc - DESTINATION ${LIB_INSTALL_DIR}/pkgconfig + DESTINATION ${QPID_INSTALL_LIBDIR}/pkgconfig COMPONENT ${QPID_COMPONENT_COMMON}) diff --git a/qpid/cpp/src/config.h.cmake b/qpid/cpp/src/config.h.cmake index 5c8c56c749..0f095f4fbf 100644 --- a/qpid/cpp/src/config.h.cmake +++ b/qpid/cpp/src/config.h.cmake @@ -52,7 +52,7 @@ #cmakedefine QPID_HAS_CLOCK_GETTIME -#cmakedefine BROKER_SASL_NAME "${BROKER_SASL_NAME}" +#define BROKER_SASL_NAME "${QPID_BROKER_SASL_NAME}" #cmakedefine HAVE_SASL ${HAVE_SASL} #cmakedefine HAVE_OPENAIS_CPG_H ${HAVE_OPENAIS_CPG_H} diff --git a/qpid/cpp/src/tests/CMakeLists.txt b/qpid/cpp/src/tests/CMakeLists.txt index 72ab6ae0d6..c5ea0a89e5 100644 --- a/qpid/cpp/src/tests/CMakeLists.txt +++ b/qpid/cpp/src/tests/CMakeLists.txt @@ -131,9 +131,15 @@ endif (CMAKE_SYSTEM_NAME STREQUAL Windows) # Copy qpidd-p0 script to build directory so tests can find it. configure_file (${CMAKE_CURRENT_SOURCE_DIR}/qpidd-p0 ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) -# Like this to work with cmake 2.4 on Unix -set (qpid_test_boost_libs - ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY}) +if (CMAKE_SYSTEM_NAME STREQUAL Windows) + set (ENV{OUTDIR} ${EXECUTABLE_OUTPUT_PATH}) + set (test_script_suffix ".ps1") + set (shell "powershell") +endif (CMAKE_SYSTEM_NAME STREQUAL Windows) + +set(test_wrap ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_test${test_script_suffix}) + +if (BUILD_TESTING_UNITTESTS) # # Unit test program @@ -142,6 +148,10 @@ set (qpid_test_boost_libs # when running the tests. If you want to build a subset of the tests run # ccmake and set unit_tests_to_build to the set you want to build. +# Like this to work with cmake 2.4 on Unix +set (qpid_test_boost_libs + ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY}) + set(all_unit_tests AccumulatedAckTest Array @@ -217,6 +227,10 @@ target_link_libraries (unit_test set_target_properties (unit_test PROPERTIES COMPILE_DEFINITIONS _IN_QPID_BROKER) remember_location(unit_test) +add_test (unit_test ${test_wrap} ${unit_test_LOCATION}) + +endif (BUILD_TESTING_UNITTESTS) + add_library (shlibtest MODULE shlibtest.cpp) if (BUILD_SASL) @@ -296,15 +310,6 @@ if (PYTHON_EXECUTABLE) WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/../python) endif (PYTHON_EXECUTABLE) -if (CMAKE_SYSTEM_NAME STREQUAL Windows) - set (ENV{OUTDIR} ${EXECUTABLE_OUTPUT_PATH}) - set (test_script_suffix ".ps1") - set (shell "powershell") -endif (CMAKE_SYSTEM_NAME STREQUAL Windows) - -set(test_wrap ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_test${test_script_suffix}) - -add_test (unit_test ${test_wrap} ${unit_test_LOCATION}) if (BUILD_SASL) add_test (sasl_fed ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed${test_script_suffix}) add_test (sasl_fed_ex_dynamic ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed_ex_dynamic${test_script_suffix}) diff --git a/qpid/cpp/src/tests/legacystore/CMakeLists.txt b/qpid/cpp/src/tests/legacystore/CMakeLists.txt index ab0eb55922..3b4f50327d 100644 --- a/qpid/cpp/src/tests/legacystore/CMakeLists.txt +++ b/qpid/cpp/src/tests/legacystore/CMakeLists.txt @@ -21,16 +21,15 @@ if(BUILD_LEGACYSTORE AND BUILD_TESTING) message(STATUS "Building legacystore tests") -# Make sure that everything get built before the tests -# Need to create a var with all the necessary top level targets - -# If we're linking Boost for DLLs, turn that on for the unit test too. +# If we're linking Boost for DLLs, turn that on for the tests too. if (QPID_LINK_BOOST_DYNAMIC) add_definitions(-DBOOST_TEST_DYN_LINK) endif (QPID_LINK_BOOST_DYNAMIC) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) +if (BUILD_TESTING_UNITTESTS) + # Like this to work with cmake 2.4 on Unix set (qpid_test_boost_libs ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY}) @@ -99,25 +98,6 @@ define_journal_test (_ut_lpmgr LONG) define_journal_test (_st_basic LONG) define_journal_test (_st_read LONG) -add_executable(jtt - jrnl/jtt/args.cpp - jrnl/jtt/data_src.cpp - jrnl/jtt/jrnl_init_params.cpp - jrnl/jtt/jrnl_instance.cpp - jrnl/jtt/main.cpp - jrnl/jtt/read_arg.cpp - jrnl/jtt/test_case.cpp - jrnl/jtt/test_case_result.cpp - jrnl/jtt/test_case_result_agregation.cpp - jrnl/jtt/test_case_set.cpp - jrnl/jtt/test_mgr.cpp) - -target_link_libraries (jtt - ${Boost_PROGRAM_OPTIONS_LIBRARY} - ${clock_gettime_LIB} legacystore_shared) - -add_test(journal_jtt ${CMAKE_CURRENT_BINARY_DIR}/jtt -c ${CMAKE_CURRENT_SOURCE_DIR}/jrnl/jtt/jtt.csv) - add_executable (jtt__ut jrnl/jtt/_ut_data_src.cpp jrnl/jtt/_ut_jrnl_init_params.cpp @@ -145,10 +125,31 @@ target_link_libraries (jtt__ut add_test(NAME journal_jtt_ut WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/jrnl/jtt COMMAND ${CMAKE_CURRENT_BINARY_DIR}/jtt__ut) +endif (BUILD_TESTING_UNITTESTS) + # # Other test programs # +add_executable(jtt + jrnl/jtt/args.cpp + jrnl/jtt/data_src.cpp + jrnl/jtt/jrnl_init_params.cpp + jrnl/jtt/jrnl_instance.cpp + jrnl/jtt/main.cpp + jrnl/jtt/read_arg.cpp + jrnl/jtt/test_case.cpp + jrnl/jtt/test_case_result.cpp + jrnl/jtt/test_case_result_agregation.cpp + jrnl/jtt/test_case_set.cpp + jrnl/jtt/test_mgr.cpp) + +target_link_libraries (jtt + ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${clock_gettime_LIB} legacystore_shared) + +add_test(journal_jtt ${CMAKE_CURRENT_BINARY_DIR}/jtt -c ${CMAKE_CURRENT_SOURCE_DIR}/jrnl/jtt/jtt.csv) + add_test (legacystore_python_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_python_tests${test_script_suffix}) endif (BUILD_LEGACYSTORE AND BUILD_TESTING) diff --git a/qpid/cpp/src/tests/sasl_test_setup.sh b/qpid/cpp/src/tests/sasl_test_setup.sh index 3947986517..28ea97e117 100755 --- a/qpid/cpp/src/tests/sasl_test_setup.sh +++ b/qpid/cpp/src/tests/sasl_test_setup.sh @@ -18,8 +18,8 @@ # specific language governing permissions and limitations # under the License. # +source ./test_env.sh -SASL_PW=/usr/sbin/saslpasswd2 test -x $SASL_PW || { echo Skipping SASL test, saslpasswd2 not found; exit 0; } mkdir -p sasl_config diff --git a/qpid/cpp/src/tests/test_env.sh.in b/qpid/cpp/src/tests/test_env.sh.in index c85e1d651a..2247469cc3 100644 --- a/qpid/cpp/src/tests/test_env.sh.in +++ b/qpid/cpp/src/tests/test_env.sh.in @@ -35,6 +35,7 @@ enable_valgrind=${enable_valgrind-@ENABLE_VALGRIND@} if [ "$enable_valgrind" = "ON" ] ; then export VALGRIND=@VALGRIND_EXECUTABLE@ fi +export SASL_PW=@SASLPASSWD2_EXECUTABLE@ # Python paths and directories export PYTHON_DIR=$builddir/python |
