Add Connector CMake Logic (#394)

Add Connector Cmake logic

* Also install date when used with fetch content
* Install everything always
* Update documentation
* Add option to control dependency searching
* Adjust travis
This commit is contained in:
Leon De Andrade
2021-12-02 07:45:38 +01:00
committed by GitHub
parent 2fecf6b6f1
commit d17bce9644
25 changed files with 307 additions and 179 deletions

View File

@@ -26,11 +26,10 @@ function(test_constraint name pattern)
set(test sqlpp11.postgresql.constraints.${name})
set(target sqlpp11_postgresql_${name})
add_executable(${target} EXCLUDE_FROM_ALL ${name}.cpp)
target_link_libraries(${target} PRIVATE sqlpp11 sqlpp11_testing)
target_link_libraries(${target} PRIVATE PostgreSQL::PostgreSQL)
target_link_libraries(${target} PRIVATE sqlpp11::postgresql sqlpp11_testing)
add_test(NAME ${test}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${target}
)
)
set_property(TEST ${test} PROPERTY PASS_REGULAR_EXPRESSION ${pattern})
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)

View File

@@ -28,7 +28,7 @@ target_include_directories(sqlpp11_postgresql_testing INTERFACE ${CMAKE_CURRENT_
set(test_names
Basic
Blob
Blob
Constructor
Date
DateTime
@@ -38,28 +38,25 @@ set(test_names
Select
Transaction
Type
)
)
create_test_sourcelist(test_sources test_main.cpp ${test_names})
add_executable(sqlpp11_postgresql_tests ${test_sources})
target_link_libraries(sqlpp11_postgresql_tests PRIVATE sqlpp11 sqlpp11_testing sqlpp11_postgresql_testing)
target_link_libraries(sqlpp11_postgresql_tests PRIVATE sqlpp11::sqlpp11)
target_link_libraries(sqlpp11_postgresql_tests PRIVATE PostgreSQL::PostgreSQL)
target_link_libraries(sqlpp11_postgresql_tests PRIVATE date::date)
target_link_libraries(sqlpp11_postgresql_tests PRIVATE sqlpp11::postgresql sqlpp11_testing sqlpp11_postgresql_testing)
if(NOT MSVC)
target_compile_options(sqlpp11_postgresql_tests PRIVATE -Wall -Wextra -pedantic)
endif()
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_postgresql_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_postgresql_tests PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_postgresql_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_postgresql_tests PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_postgresql_tests PROPERTY CXX_EXTENSIONS no)
endif()
foreach(test IN LISTS test_names)
add_test(NAME sqlpp11.postgresql.usage.${test}
COMMAND sqlpp11_postgresql_tests ${test}
)
)
endforeach()