diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index 6ccd0f528..bf45aa70c 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -51,7 +51,7 @@ add_library(testcore SHARED testconnections.cpp mariadb_nodes.cpp sql_t1.cpp test_binlog_fnc.cpp get_my_ip.cpp big_load.cpp get_com_select_insert.cpp different_size.cpp fw_copy_rules maxinfo_func.cpp config_operations.cpp rds_vpc.cpp execute_cmd.cpp blob_test.cpp) -target_link_libraries(testcore ${MYSQL_CLIENT} z crypt nsl m pthread ssl crypto dl rt ${CDC_CONNECTOR_LIBRARIES} jansson) +target_link_libraries(testcore ${MYSQL_CLIENT} z crypt nsl m pthread ssl crypto dl rt ${CDC_CONNECTOR_LIBRARIES} ${JANSSON_LIBRARIES}) install(TARGETS testcore DESTINATION system-test) add_dependencies(testcore connector-c cdc_connector) diff --git a/maxscale-system-test/cdc_connector/CMakeLists.txt b/maxscale-system-test/cdc_connector/CMakeLists.txt index 6164df48b..ecf1b8e9b 100644 --- a/maxscale-system-test/cdc_connector/CMakeLists.txt +++ b/maxscale-system-test/cdc_connector/CMakeLists.txt @@ -1,21 +1,14 @@ project(cdc_connector) cmake_minimum_required(VERSION 2.8) -enable_testing() - -include(ExternalProject) -include(cmake/BuildJansson.cmake) +include(GNUInstallDirs) set(CMAKE_CXX_FLAGS "-fPIC -std=c++0x") set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -std=c++0x -ggdb") set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -std=c++0x -O2") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-fPIC -std=c++0x -O2") -include_directories(${JANSSON_INCLUDE_DIR}) -add_library(cdc_connector SHARED cdc_connector.cpp) -target_link_libraries(cdc_connector ${JANSSON_LIBRARIES} crypto) -add_dependencies(cdc_connector jansson) -install(TARGETS cdc_connector DESTINATION lib) -install(FILES cdc_connector.h DESTINATION include) +add_library(cdc_connector STATIC cdc_connector.cpp) -include(CTest) +install(TARGETS cdc_connector DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES cdc_connector.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/maxscale-system-test/cdc_connector/cmake/BuildJansson.cmake b/maxscale-system-test/cdc_connector/cmake/BuildJansson.cmake deleted file mode 100644 index 78e038a01..000000000 --- a/maxscale-system-test/cdc_connector/cmake/BuildJansson.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# If the Jansson library is not found, download it and build it from source. - -set(JANSSON_REPO "https://github.com/akheron/jansson.git" CACHE STRING "Jansson Git repository") - -# Release 2.9 of Jansson -set(JANSSON_TAG "v2.9" CACHE STRING "Jansson Git tag") - -ExternalProject_Add(jansson - GIT_REPOSITORY ${JANSSON_REPO} - GIT_TAG ${JANSSON_TAG} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/jansson/install -DCMAKE_C_FLAGS=-fPIC -DJANSSON_BUILD_DOCS=OFF - BINARY_DIR ${CMAKE_BINARY_DIR}/jansson - INSTALL_DIR ${CMAKE_BINARY_DIR}/jansson/install - UPDATE_COMMAND "") - -set(JANSSON_FOUND TRUE CACHE INTERNAL "") -set(JANSSON_STATIC_FOUND TRUE CACHE INTERNAL "") -set(JANSSON_INCLUDE_DIR ${CMAKE_BINARY_DIR}/jansson/install/include CACHE INTERNAL "") -set(JANSSON_STATIC_LIBRARIES ${CMAKE_BINARY_DIR}/jansson/install/lib/libjansson.a CACHE INTERNAL "") -set(JANSSON_LIBRARIES ${JANSSON_STATIC_LIBRARIES} CACHE INTERNAL "") diff --git a/maxscale-system-test/utilities.cmake b/maxscale-system-test/utilities.cmake index c284958c7..fae7464ac 100644 --- a/maxscale-system-test/utilities.cmake +++ b/maxscale-system-test/utilities.cmake @@ -94,6 +94,8 @@ add_test_executable_notest(sysbench_example.cpp sysbench_example replication) set(CONNECTOR_C_VERSION "3.0" CACHE STRING "The Connector-C version to use") include(ExternalProject) +include(GNUInstallDirs) + ExternalProject_Add(connector-c GIT_REPOSITORY "https://github.com/MariaDB/mariadb-connector-c.git" GIT_TAG ${CONNECTOR_C_VERSION} @@ -103,13 +105,18 @@ ExternalProject_Add(connector-c include_directories(${CMAKE_BINARY_DIR}/include) set(MYSQL_CLIENT ${CMAKE_BINARY_DIR}/lib/mariadb/libmariadbclient.a CACHE INTERNAL "") +# Build Jansson +include(cmake/BuildJansson.cmake) +include_directories(${JANSSON_INCLUDE_DIR}) + # Build the CDC connector ExternalProject_Add(cdc_connector SOURCE_DIR ${CMAKE_SOURCE_DIR}/cdc_connector/ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/cdc_connector/ BUILD_COMMAND make INSTALL_COMMAND make install) +add_dependencies(cdc_connector jansson) set(CDC_CONNECTOR_INCLUDE ${CMAKE_BINARY_DIR}/cdc_connector/include/ CACHE INTERNAL "") -set(CDC_CONNECTOR_LIBRARIES ${CMAKE_BINARY_DIR}/cdc_connector/lib/libcdc_connector.so CACHE INTERNAL "") +set(CDC_CONNECTOR_LIBRARIES ${CMAKE_BINARY_DIR}/cdc_connector/${CMAKE_INSTALL_LIBDIR}/libcdc_connector.a CACHE INTERNAL "") include_directories(${CMAKE_BINARY_DIR}/cdc_connector/include)