diff --git a/CMakeLists.txt b/CMakeLists.txt index fab7a11fb..956f5c993 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,31 +1,32 @@ cmake_minimum_required(VERSION 2.6) + +include(macros.cmake) enable_testing() project(MaxScale) -set(MAXSCALE_VERSION_MAJOR "1") -set(MAXSCALE_VERSION_MINOR "0.0-beta") -set(MAXSCALE_VERSION "${MAXSCALE_VERSION_MAJOR}.${MAXSCALE_VERSION_MINOR}") +set_maxscale_version() +set_testing_variables() configure_file(${CMAKE_SOURCE_DIR}/server/include/version.h.in ${CMAKE_SOURCE_DIR}/server/include/version.h) find_path(MYSQL_DIR mysql.h PATH_SUFFIXES mysql mariadb) if(MYSQL_DIR_NOT_FOUND) -message(FATAL_ERROR "Fatal Error: MySQL headers were not found.") + message(FATAL_ERROR "Fatal Error: MySQL headers were not found.") endif(MYSQL_DIR_NOT_FOUND) find_file(ERRMSG errmsg.sys PATHS /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english) if(ERRMSG_NOT_FOUND) -message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found.") + message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found.") endif(ERRMSG_NOT_FOUND) set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -fPIC) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fPIC) if(GCOV) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov") endif(GCOV) @@ -58,7 +59,7 @@ add_subdirectory(server) add_subdirectory(client) if(BUILD_RABBITMQ) -add_subdirectory(rabbitmq_consumer) + add_subdirectory(rabbitmq_consumer) endif(BUILD_RABBITMQ) file(GLOB DOCS Documentation/*.pdf) @@ -73,13 +74,14 @@ install(FILES ${DOCS} DESTINATION Documentation) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MaxScale") set(CPACK_PACKAGE_NAME "MaxScale") set(CPACK_GENERATOR "RPM") -set(CPACK_PACKAGE_VERSION_MAJOR "1") -set(CPACK_PACKAGE_VERSION_MINOR "0") -set(CPACK_PACKAGE_VERSION_PATCH "0") +set(CPACK_PACKAGE_VERSION_MAJOR "${MAXSCALE_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${MAXSCALE_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${MAXSCALE_VERSION_PATCH}") set(CPACK_PACKAGE_CONTACT "SkySQL Ab") set(CPACK_PACKAGE_FILE_NAME "maxscale-${MAXSCALE_VERSION}") set(CPACK_RPM_SPEC_INSTALL_POST "/sbin/ldconfig") set(CPACK_RPM_PACKAGE_NAME "maxscale-${MAXSCALE_VERSION}") set(CPACK_RPM_PACKAGE_VENDOR "SkySQL Ab") set(CPACK_RPM_PACKAGE_AUTOREQPROV " no") -include(CPack) \ No newline at end of file +include(CPack) + diff --git a/server/modules/routing/readwritesplit/CMakeLists.txt b/server/modules/routing/readwritesplit/CMakeLists.txt index 9c4f3e7e3..1deb361d3 100644 --- a/server/modules/routing/readwritesplit/CMakeLists.txt +++ b/server/modules/routing/readwritesplit/CMakeLists.txt @@ -1,4 +1,5 @@ add_library(readwritesplit SHARED readwritesplit.c) set_target_properties(readwritesplit PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib) target_link_libraries(readwritesplit utils ssl pthread log_manager query_classifier mysqld) -install(TARGETS readwritesplit DESTINATION modules) \ No newline at end of file +install(TARGETS readwritesplit DESTINATION modules) +add_subdirectory(test) \ No newline at end of file diff --git a/server/modules/routing/readwritesplit/test/CMakeLists.txt b/server/modules/routing/readwritesplit/test/CMakeLists.txt new file mode 100644 index 000000000..607fbe6d0 --- /dev/null +++ b/server/modules/routing/readwritesplit/test/CMakeLists.txt @@ -0,0 +1,2 @@ +add_test(NAME ReadWriteSplitTest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/rwsplit.sh test.log ${TEST_HOST} ${TEST_PORT} ${TEST_MASTER_ID} ${TEST_USER} ${TEST_PASSWORD}) +set_tests_properties(ReadWriteSplitTest PROPERTIES DEPENDS ExecutableTest) \ No newline at end of file diff --git a/server/test/CMakeLists.txt b/server/test/CMakeLists.txt index e69de29bb..3a07ab1ee 100644 --- a/server/test/CMakeLists.txt +++ b/server/test/CMakeLists.txt @@ -0,0 +1,5 @@ +add_test(NAME ExecutableTest COMMAND maxscale) +add_test(NAME WaitForExecutable COMMAND sleep 5) +add_test(NAME KillExecutable COMMAND killall maxscale) +set_tests_properties(WaitForExecutable PROPERTIES DEPENDS ExecutableTest) +set_tests_properties(KillExecutable PROPERTIES DEPENDS ReadWriteSplitTest DEPENDS WaitForExecutable)