52 lines
1.8 KiB
CMake
52 lines
1.8 KiB
CMake
CPMAddPackage("gh:catchorg/Catch2@3.7.1")
|
|
|
|
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
|
|
|
set(POSTGRES_CONNECTION_STRING "postgres://news:news@127.0.0.1:15432/matador")
|
|
#set(POSTGRES_CONNECTION_STRING "postgres://test:test123!@127.0.0.1:15432/matador")
|
|
|
|
configure_file(Connection.hpp.in ${PROJECT_BINARY_DIR}/backends/postgres/test/connection.hpp @ONLY IMMEDIATE)
|
|
|
|
message(STATUS "postgresql connection string: ${POSTGRES_CONNECTION_STRING}")
|
|
|
|
set(TEST_SOURCES
|
|
../../../test/models/coordinate.hpp
|
|
../../../test/models/location.hpp
|
|
../../../test/models/types.hpp
|
|
../../../test/backends/ColorEnumTraits.cpp
|
|
../../../test/backends/ColorEnumTraits.hpp
|
|
../../../test/backends/ConnectionTest.cpp
|
|
../../../test/backends/QueryBasicTest.cpp
|
|
../../../test/backends/QueryFixture.cpp
|
|
../../../test/backends/QueryFixture.hpp
|
|
../../../test/backends/QueryRecordTest.cpp
|
|
../../../test/backends/QueryStatementTests.cpp
|
|
../../../test/backends/QueryTest.cpp
|
|
../../../test/backends/SessionFixture.cpp
|
|
../../../test/backends/SessionFixture.hpp
|
|
../../../test/backends/SessionTest.cpp
|
|
../../../test/backends/StatementCacheTest.cpp
|
|
../../../test/backends/StatementTest.cpp
|
|
../../../test/backends/TypeTraitsTest.cpp
|
|
)
|
|
|
|
set(LIBRARY_TEST_TARGET PostgresTests)
|
|
|
|
add_executable(${LIBRARY_TEST_TARGET} ${TEST_SOURCES})
|
|
|
|
target_link_libraries(${LIBRARY_TEST_TARGET} PRIVATE
|
|
Catch2::Catch2WithMain
|
|
matador-core
|
|
matador-orm
|
|
${CMAKE_DL_LIBS}
|
|
${PostgreSQL_LIBRARY})
|
|
|
|
add_dependencies(${LIBRARY_TEST_TARGET} matador-postgres)
|
|
|
|
target_include_directories(${LIBRARY_TEST_TARGET}
|
|
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>/include
|
|
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>/test
|
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
#catch_discover_tests(${LIBRARY_TEST_TARGET} TEST_SUFFIX " (PostgreSQL)")
|