91 lines
2.4 KiB
CMake
91 lines
2.4 KiB
CMake
###############################################################################
|
|
cmake_minimum_required(VERSION 3.20.0)
|
|
project(cruft-db CXX)
|
|
|
|
find_package(range-v3 REQUIRED)
|
|
|
|
###############################################################################
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
|
###############################################################################
|
|
add_library(cruft-db
|
|
fixed/types.cpp
|
|
fixed/types.hpp
|
|
|
|
runtime/fwd.hpp
|
|
runtime/column.cpp
|
|
runtime/column.hpp
|
|
runtime/constraint.cpp
|
|
runtime/constraint.hpp
|
|
runtime/index.cpp
|
|
runtime/index.hpp
|
|
runtime/ostream.cpp
|
|
runtime/ostream.hpp
|
|
runtime/schema.cpp
|
|
runtime/schema.hpp
|
|
runtime/table.cpp
|
|
runtime/table.hpp
|
|
|
|
query/fwd.hpp
|
|
query/binary.hpp
|
|
query/bind.hpp
|
|
query/cast.hpp
|
|
query/expression.hpp
|
|
query/function.hpp
|
|
query/insert.hpp
|
|
query/label.hpp
|
|
query/literal.hpp
|
|
query/schema.hpp
|
|
query/select.hpp
|
|
query/traits.hpp
|
|
query/types.hpp
|
|
query/update.hpp
|
|
|
|
util/quote.hpp
|
|
util/tuple.hpp
|
|
util/traits.hpp
|
|
|
|
introspection/information_schema.hpp
|
|
introspection/information_schema.cpp
|
|
introspection/postgresql.hpp
|
|
introspection/postgresql.cpp
|
|
)
|
|
|
|
target_link_libraries(cruft-db cruft-pq range-v3::range-v3)
|
|
|
|
|
|
###############################################################################
|
|
add_executable(dump tools/dump.cpp)
|
|
target_link_libraries(dump cruft-db)
|
|
|
|
|
|
add_executable (db_scratch tools/scratch.cpp)
|
|
target_link_libraries(db_scratch cruft-db cruft)
|
|
|
|
|
|
option (TESTS "enable unit testing" ON)
|
|
|
|
if (TESTS)
|
|
include (CTest)
|
|
enable_testing ()
|
|
|
|
list (APPEND TEST_BIN
|
|
query/insert
|
|
query/select
|
|
query/update
|
|
)
|
|
|
|
add_custom_target(cruft_db_test)
|
|
|
|
foreach(t ${TEST_BIN})
|
|
string(REPLACE "/" "_" name "test/${t}")
|
|
add_executable(cruft_db_${name} test/${t}.cpp)
|
|
target_link_libraries(cruft_db_${name} PRIVATE cruft-db cruft)
|
|
target_include_directories(cruft_db_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
target_include_directories(cruft_db_${name} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}")
|
|
add_test(NAME cruft_db_${name} COMMAND cruft_db_${name})
|
|
set_tests_properties(cruft_db_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -")
|
|
add_dependencies(cruft_db_test cruft_db_${name})
|
|
endforeach(t)
|
|
endif() |