added core tests to cmake

This commit is contained in:
Markus Makela 2014-09-11 20:08:28 +03:00
parent 19ca28d8bd
commit 7a069ecdf7
3 changed files with 33 additions and 4 deletions

View File

@ -2,12 +2,26 @@ cmake_minimum_required(VERSION 2.6)
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}")
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.")
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.")
endif(ERRMSG_NOT_FOUND)
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -fPIC)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fPIC)
message(STATUS "cflags: ${CMAKE_C_FLAGS}")
if(NOT EMBEDDED_LIB)
find_library(EMBEDDED_LIB libmysqld.a PATHS /usr/lib /usr/lib64 PATH_SUFFIXES mysql)
if(EMBEDDED_LIB_NOT_FOUND)

View File

@ -1,5 +1,6 @@
#file(GLOB FULLCORE_SRC *.c) #Not used, might be useful somewhere
#add_library(fullcore ${FULLCORE_SRC})
file(GLOB FULLCORE_SRC *.c)
add_library(fullcore STATIC ${FULLCORE_SRC})
target_link_libraries(fullcore utils log_manager aio pthread crypt dl mysqld crypto inih)
add_executable(maxscale atomic.c buffer.c spinlock.c gateway.c
gw_utils.c utils.c dcb.c load_utils.c session.c service.c server.c
poll.c config.c users.c hashtable.c dbusers.c thread.c gwbitmask.c
@ -16,4 +17,6 @@ install(TARGETS maxkeys DESTINATION bin)
add_executable(maxpasswd maxpasswd.c secrets.c utils.c)
set_target_properties(maxpasswd PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib)
target_link_libraries(maxpasswd utils log_manager aio pthread crypt dl mysqld crypto inih)
install(TARGETS maxpasswd DESTINATION bin)
install(TARGETS maxpasswd DESTINATION bin)
add_subdirectory(test)

View File

@ -0,0 +1,12 @@
add_executable(test_hash testhash.c)
add_executable(test_spinlock testspinlock.c)
add_executable(test_filter testfilter.c)
add_executable(test_adminusers testadminusers.c)
target_link_libraries(test_hash crypto ssl pthread log_manager fullcore)
target_link_libraries(test_spinlock crypto ssl pthread log_manager fullcore)
target_link_libraries(test_filter crypto ssl pthread log_manager fullcore)
target_link_libraries(test_adminusers crypto crypt mysqld ssl fullcore)
add_test(TestHash test_hash)
add_test(TestSpinlock test_spinlock)
add_test(TestFilter test_filter)
add_test(TestAdminUsers test_adminusers)