@@ -88,13 +88,13 @@ endmacro()
8888# CassOptionalDependencies
8989#
9090# Configure enabled optional dependencies if found or if Windows use an
91- # external project to build Boost, OpenSSL, zlib.
91+ # external project to build OpenSSL and zlib.
9292#
9393# Output: CASS_INCLUDES and CASS_LIBS
9494#------------------------
9595macro (CassOptionalDependencies)
9696 # Boost
97- if (CASS_USE_BOOST_ATOMIC OR CASS_BUILD_INTEGRATION_TESTS )
97+ if (CASS_USE_BOOST_ATOMIC)
9898 CassUseBoost()
9999 endif ()
100100
@@ -147,22 +147,22 @@ macro(CassConfigureShared prefix)
147147 set_target_properties (${PROJECT_LIB_NAME} PROPERTIES
148148 COMPILE_PDB_NAME "${PROJECT_LIB_NAME} "
149149 COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} " )
150- set (STATIC_COMPILE_FLAGS "-D${prefix} _BUILDING" )
150+ set (SHARED_COMPILE_FLAGS "-D${prefix} _BUILDING" )
151151 if ("${prefix} " STREQUAL "DSE" )
152- set (STATIC_COMPILE_FLAGS "${STATIC_COMPILE_FLAGS } -DCASS_BUILDING" )
152+ set (SHARED_COMPILE_FLAGS "${SHARED_COMPILE_FLAGS } -DCASS_BUILDING" )
153153 endif ()
154154 if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "Clang" )
155155 set_property (
156156 TARGET ${PROJECT_LIB_NAME}
157- APPEND PROPERTY COMPILE_FLAGS "${STATIC_COMPILE_FLAGS } -Wconversion -Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-undefined-var-template -Werror" )
157+ APPEND PROPERTY COMPILE_FLAGS "${SHARED_COMPILE_FLAGS } -Wconversion -Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-undefined-var-template -Werror" )
158158 elseif ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "GNU" ) # To many superfluous warnings generated with GCC when using -Wconversion (see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40752)
159159 set_property (
160160 TARGET ${PROJECT_LIB_NAME}
161- APPEND PROPERTY COMPILE_FLAGS "${STATIC_COMPILE_FLAGS } -Werror" )
161+ APPEND PROPERTY COMPILE_FLAGS "${SHARED_COMPILE_FLAGS } -Werror" )
162162 elseif ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "MSVC" )
163163 set_property (
164164 TARGET ${PROJECT_LIB_NAME}
165- APPEND PROPERTY COMPILE_FLAGS "${STATIC_COMPILE_FLAGS } /we4800" )
165+ APPEND PROPERTY COMPILE_FLAGS "${SHARED_COMPILE_FLAGS } /we4800" )
166166 endif ()
167167endmacro ()
168168
@@ -204,8 +204,8 @@ macro(CassConfigureStatic prefix)
204204
205205 # Update the CXX flags to indicate the use of the static library
206206 if (${prefix} _USE_STATIC_LIBS)
207- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${STATIC_COMPILE_FLAGS} " )
208- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${STATIC_COMPILE_FLAGS} " )
207+ set (TEST_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${STATIC_COMPILE_FLAGS} " ) # Unit and integration test executables
208+ set (EXAMPLE_CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${STATIC_COMPILE_FLAGS} " ) # Example executables
209209 endif ()
210210endmacro ()
211211
@@ -383,15 +383,8 @@ endmacro()
383383# Input: CASS_BUILD_INTEGRATION_TESTS, CASS_BUILD_UNIT_TESTS, CASS_ROOT_DIR
384384#------------------------
385385macro (CassConfigureTests)
386- if (CASS_BUILD_INTEGRATION_TESTS)
387- # Add CCM bridge as a dependency for integration tests
388- set (CCM_BRIDGE_INCLUDES "${CASS_ROOT_DIR} /test/ccm_bridge/src" )
389- add_subdirectory (${CASS_ROOT_DIR} /test /ccm_bridge)
390- add_subdirectory (${CASS_ROOT_DIR} /test /integration_tests)
391- endif ()
392-
393386 if (CASS_BUILD_INTEGRATION_TESTS OR CASS_BUILD_UNIT_TESTS)
394- add_subdirectory (${CASS_ROOT_DIR} /gtests )
387+ add_subdirectory (${CASS_ROOT_DIR} /tests )
395388 endif ()
396389endmacro ()
397390
@@ -427,20 +420,32 @@ macro(CassUseLibuv)
427420 message (FATAL_ERROR "Unable to Locate libuv: libuv v1.0.0+ is required" )
428421 endif ()
429422
430- if (LIBUV_VERSION VERSION_LESS "1.0" )
423+ if (LIBUV_VERSION VERSION_LESS "1.0" )
431424 message (FATAL_ERROR "Libuv version ${LIBUV_VERSION} is not "
432425 " supported. Please updgrade to libuv version 1.0 or greater in order to "
433426 "utilize the driver." )
434427 endif ()
435428
436- if (LIBUV_VERSION VERSION_LESS "1.6" )
429+ if (LIBUV_VERSION VERSION_LESS "1.6" )
437430 message (WARNING "Libuv version ${LIBUV_VERSION} does not support custom "
438431 "memory allocators (version 1.6 or greater required)" )
439432 endif ()
440433
441434 # Assign libuv include and libraries
442435 set (CASS_INCLUDES ${CASS_INCLUDES} ${LIBUV_INCLUDE_DIRS} )
443436 set (CASS_LIBS ${CASS_LIBS} ${LIBUV_LIBRARIES} )
437+
438+ # libuv and gtests require thread library
439+ set (CMAKE_THREAD_PREFER_PTHREAD 1)
440+ set (THREADS_PREFER_PTHREAD_FLAG 1)
441+ find_package (Threads REQUIRED)
442+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_THREAD_LIBS_INIT} " )
443+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_THREAD_LIBS_INIT} " )
444+ if (NOT WIN32 AND ${CMAKE_VERSION} VERSION_LESS "3.1.0" )
445+ # FindThreads in CMake versions < v3.1.0 do not have the THREADS_PREFER_PTHREAD_FLAG to prefer -pthread
446+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread" )
447+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread" )
448+ endif ()
444449endmacro ()
445450
446451#------------------------
@@ -515,38 +520,13 @@ macro(CassHttpParser)
515520 include_directories (${HTTP_PARSER_INCLUDE_DIR} )
516521endmacro ()
517522
518- #------------------------
519- # CassSimulacron
520- #
521- # Set up Simulacron for use in tests.
522- #
523- # Input: TESTS_SIMULACRON_SERVER_DIR
524- # Output: SIMULACRON_SERVER_JAR
525- #------------------------
526- macro (CassSimulacron)
527- # Determine if Simulacron server can be executed (Java runtime is available)
528- find_package (Java COMPONENTS Runtime)
529- if (Java_Runtime_FOUND)
530- # Determine the Simulacron jar file
531- file (GLOB SIMULACRON_SERVER_JAR
532- ${TESTS_SIMULACRON_SERVER_DIR} /simulacron-standalone-*.jar)
533- endif ()
534-
535- # Determine if the Simulacron server will be available for the tests
536- if (NOT EXISTS ${SIMULACRON_SERVER_JAR} )
537- message (WARNING "Simulacron Not Found: Simulacron support will be disabled" )
538- endif ()
539- endmacro ()
540-
541-
542523#------------------------
543524# CassUseBoost
544525#
545- # Add includes, libraries, define flags required for using Boost if found or if
546- # Windows use an external project to build Boost.
526+ # Add includes and define flags required for using Boost if found.
547527#
548- # Input: CASS_USE_STATIC_LIBS, CASS_USE_BOOST_ATOMIC, CASS_INCLUDES, CASS_LIBS
549- # Output: CASS_INCLUDES and CASS_LIBS
528+ # Input: CASS_USE_BOOST_ATOMIC, CASS_INCLUDES
529+ # Output: CASS_INCLUDES
550530#------------------------
551531macro (CassUseBoost)
552532 # Allow for boost directory to be specified on the command line
@@ -568,64 +548,15 @@ macro(CassUseBoost)
568548 add_definitions (-DBOOST_ALL_NO_LIB)
569549 endif ()
570550
571- # Determine if shared or static boost libraries should be used
572- if (CASS_USE_STATIC_LIBS OR
573- (WIN32 AND CASS_BUILD_INTEGRATION_TESTS)) # Force the use of Boost static libraries for Windows (e.g. executables)
574- set (Boost_USE_STATIC_LIBS ON )
575- else ()
576- set (Boost_USE_STATIC_LIBS OFF )
577- add_definitions (-DBOOST_ALL_DYN_LINK)
578- endif ()
579- set (Boost_USE_STATIC_RUNTIME OFF )
580- set (Boost_USE_MULTITHREADED ON )
581- add_definitions (-DBOOST_THREAD_USES_MOVE)
582-
583551 # Check for general Boost availability
584552 find_package (Boost ${CASS_MINIMUM_BOOST_VERSION} QUIET )
585- if ((WIN32 AND NOT Boost_FOUND) AND
586- (CASS_USE_BOOST_ATOMIC OR CASS_BUILD_INTEGRATION_TESTS))
587- message (STATUS "Unable to Locate Boost: Third party build step will be performed" )
588- include (ExternalProject-Boost)
589- else ()
590- message (STATUS "Boost version: v${Boost_MAJOR_VERSION} .${Boost_MINOR_VERSION} .${Boost_SUBMINOR_VERSION} " )
591- # Ensure the driver components exist (optional)
592- if (CASS_USE_BOOST_ATOMIC)
593- if (NOT Boost_INCLUDE_DIRS)
594- message (FATAL_ERROR "Boost headers required to build driver because of -DCASS_USE_BOOST_ATOMIC=On" )
595- endif ()
596-
597- # Assign Boost include for atomics
598- set (CASS_INCLUDES ${CASS_INCLUDES} ${Boost_INCLUDE_DIRS} )
553+ if (CASS_USE_BOOST_ATOMIC)
554+ if (NOT Boost_INCLUDE_DIRS)
555+ message (FATAL_ERROR "Boost headers required to build driver because of -DCASS_USE_BOOST_ATOMIC=On" )
599556 endif ()
600557
601- # Determine if Boost components are available for test executables
602- if (CASS_BUILD_INTEGRATION_TESTS)
603- # Handle new required version of CMake for Boost v1.66.0 (Windows only)
604- if (WIN32 )
605- if (Boost_FOUND)
606- if (Boost_VERSION GREATER 106600 OR Boost_VERSION EQUAL 106600)
607- # Ensure CMake version is v3.11.0+
608- if (CMAKE_VERSION VERSION_LESS 3.11.0)
609- message (FATAL_ERROR "Boost v${Boost_MAJOR_VERSION} .${Boost_MINOR_VERSION} .${Boost_SUBMINOR_VERSION} requires CMake v3.11.0+."
610- "Updgrade CMake or downgrade Boost to v${CASS_MINIMUM_BOOST_VERSION} - v1.65.1." )
611- endif ()
612- endif ()
613- endif ()
614- endif ()
615-
616- # Ensure Boost components are available
617- find_package (Boost ${CASS_MINIMUM_BOOST_VERSION} COMPONENTS chrono system thread unit_test_framework)
618- if (NOT Boost_FOUND)
619- # Ensure Boost was not found due to minimum version requirement
620- set (CASS_FOUND_BOOST_VERSION "${Boost_MAJOR_VERSION} .${Boost_MINOR_VERSION} .${Boost_SUBMINOR_VERSION} " )
621- if ((CASS_FOUND_BOOST_VERSION VERSION_GREATER "${CASS_MINIMUM_BOOST_VERSION} " )
622- OR (CASS_FOUND_BOOST_VERSION VERSION_EQUAL "${CASS_MINIMUM_BOOST_VERSION} " ))
623- message (FATAL_ERROR "Boost [chrono, system, thread, and unit_test_framework] are required to build tests" )
624- else ()
625- message (FATAL_ERROR "Boost v${CASS_FOUND_BOOST_VERSION} Found: v${CASS_MINIMUM_BOOST_VERSION} or greater required" )
626- endif ()
627- endif ()
628- endif ()
558+ # Assign Boost include for atomics
559+ set (CASS_INCLUDES ${CASS_INCLUDES} ${Boost_INCLUDE_DIRS} )
629560 endif ()
630561
631562 # Determine if additional Boost definitions are required for driver/executables
0 commit comments