0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 12:51:13 +08:00

Remove option to compile tests with different standard

The library is header only. It makes no sense to distinuish
between the standard the library is compiled with and the
standard the tests are compiled with. The library does not
get compiled on its own.
This commit is contained in:
Roland Bock 2024-08-03 10:29:20 +02:00
parent a7ee6e5d3b
commit 4a9f9c384c
14 changed files with 4 additions and 94 deletions

View File

@ -27,12 +27,6 @@ function(test_compile name)
set(target sqlpp11_compat_${name}) set(target sqlpp11_compat_${name})
add_executable(${target} ${name}.cpp) add_executable(${target} ${name}.cpp)
target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing)
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_compat_${name} PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_compat_${name} PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_compat_${name} PROPERTY CXX_EXTENSIONS no)
endif()
endfunction() endfunction()
test_compile(make_unique) test_compile(make_unique)

View File

@ -31,12 +31,6 @@ function(test_constraint name pattern)
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${target} COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${target}
) )
set_property(TEST ${test} PROPERTY PASS_REGULAR_EXPRESSION ${pattern}) set_property(TEST ${test} PROPERTY PASS_REGULAR_EXPRESSION ${pattern})
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET ${target} PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS no)
endif()
endfunction() endfunction()
# Compiling these is required to fail (testing some static_assert) # Compiling these is required to fail (testing some static_assert)
@ -44,4 +38,4 @@ test_constraint(count_of_count "count\\(\\) cannot be used on an aggregate funct
test_constraint(max_of_max "max\\(\\) cannot be used on an aggregate function") test_constraint(max_of_max "max\\(\\) cannot be used on an aggregate function")
test_constraint(require_insert "required column is missing") test_constraint(require_insert "required column is missing")
test_constraint(must_not_insert "one assignment is prohibited") test_constraint(must_not_insert "one assignment is prohibited")
test_constraint(must_not_update "one assignment is prohibited") test_constraint(must_not_update "one assignment is prohibited")

View File

@ -60,13 +60,6 @@ create_test_sourcelist(test_sources test_serializer_main.cpp ${test_files})
add_executable(sqlpp11_core_serialize ${test_sources}) add_executable(sqlpp11_core_serialize ${test_sources})
target_link_libraries(sqlpp11_core_serialize PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) target_link_libraries(sqlpp11_core_serialize PRIVATE sqlpp11::sqlpp11 sqlpp11_testing)
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_core_serialize PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_core_serialize PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_core_serialize PROPERTY CXX_EXTENSIONS no)
endif()
foreach(test_file IN LISTS test_files) foreach(test_file IN LISTS test_files)
get_filename_component(test ${test_file} NAME_WLE) get_filename_component(test ${test_file} NAME_WLE)
add_test(NAME sqlpp11.core.serialize.${test} add_test(NAME sqlpp11.core.serialize.${test}

View File

@ -26,12 +26,6 @@ function(test_compile name)
set(target sqlpp11_assert_${name}) set(target sqlpp11_assert_${name})
add_executable(${target} ${name}.cpp) add_executable(${target} ${name}.cpp)
target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing)
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_assert_${name} PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_assert_${name} PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_assert_${name} PROPERTY CXX_EXTENSIONS no)
endif()
endfunction() endfunction()
test_compile(aggregates) test_compile(aggregates)
@ -47,4 +41,4 @@ test_compile(date)
test_compile(date_time) test_compile(date_time)
test_compile(text) test_compile(text)
test_compile(no_self_compare) test_compile(no_self_compare)
test_compile(unwrapped_bool) test_compile(unwrapped_bool)

View File

@ -27,11 +27,6 @@ function(test_compile name)
add_executable(${target} ${name}.cpp) add_executable(${target} ${name}.cpp)
target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing)
# conditionally bump to a higher C++ standard to test compatibility # conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_${name} PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_${name} PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_${name} PROPERTY CXX_EXTENSIONS no)
endif()
endfunction() endfunction()
add_subdirectory(operator) add_subdirectory(operator)

View File

@ -23,15 +23,9 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
function(test_compile name) function(test_compile name)
set(target sqlpp11_${name}) set(target sqlpp11_types_operator_${name})
add_executable(${target} ${name}.cpp) add_executable(${target} ${name}.cpp)
target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing)
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_${name} PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_${name} PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_${name} PROPERTY CXX_EXTENSIONS no)
endif()
endfunction() endfunction()
test_compile(any) test_compile(any)

View File

@ -57,12 +57,6 @@ endif()
create_test_sourcelist(test_sources test_main.cpp ${test_files}) create_test_sourcelist(test_sources test_main.cpp ${test_files})
add_executable(sqlpp11_core_tests ${test_sources}) add_executable(sqlpp11_core_tests ${test_sources})
target_link_libraries(sqlpp11_core_tests PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) target_link_libraries(sqlpp11_core_tests PRIVATE sqlpp11::sqlpp11 sqlpp11_testing)
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_core_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_core_tests PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_core_tests PROPERTY CXX_EXTENSIONS no)
endif()
foreach(test_file IN LISTS test_files) foreach(test_file IN LISTS test_files)
get_filename_component(test ${test_file} NAME_WLE) get_filename_component(test ${test_file} NAME_WLE)

View File

@ -36,13 +36,6 @@ if(NOT MSVC)
target_compile_options(sqlpp11_mysql_serialize_tests PRIVATE -Wall -Wextra -pedantic) target_compile_options(sqlpp11_mysql_serialize_tests PRIVATE -Wall -Wextra -pedantic)
endif() endif()
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_mysql_serialize_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_mysql_serialize_tests PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_mysql_serialize_tests PROPERTY CXX_EXTENSIONS no)
endif()
foreach(test_file IN LISTS test_files) foreach(test_file IN LISTS test_files)
get_filename_component(test ${test_file} NAME_WLE) get_filename_component(test ${test_file} NAME_WLE)
add_test(NAME sqlpp11.mysql.serialize.${test} add_test(NAME sqlpp11.mysql.serialize.${test}

View File

@ -52,13 +52,6 @@ if(NOT MSVC)
target_compile_options(sqlpp11_mysql_tests PRIVATE -Wall -Wextra -pedantic) target_compile_options(sqlpp11_mysql_tests PRIVATE -Wall -Wextra -pedantic)
endif() endif()
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_mysql_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_mysql_tests PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_mysql_tests PROPERTY CXX_EXTENSIONS no)
endif()
foreach(test_file IN LISTS test_files) foreach(test_file IN LISTS test_files)
get_filename_component(test ${test_file} NAME_WLE) get_filename_component(test ${test_file} NAME_WLE)
add_test(NAME sqlpp11.mysql.usage.${test} add_test(NAME sqlpp11.mysql.usage.${test}

View File

@ -31,12 +31,6 @@ function(test_constraint name pattern)
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${target} COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${target}
) )
set_property(TEST ${test} PROPERTY PASS_REGULAR_EXPRESSION ${pattern}) set_property(TEST ${test} PROPERTY PASS_REGULAR_EXPRESSION ${pattern})
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET ${target} PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS no)
endif()
endfunction() endfunction()
# Compiling these is required to fail (testing some static_assert) # Compiling these is required to fail (testing some static_assert)
@ -48,4 +42,4 @@ test_constraint(OnConflictMissingAction "either do_nothing\\(\\) or do_update\\(
test_constraint(OnConflictMissingAssignmentsDoUpdate "conflict_target specification is required with do_update") test_constraint(OnConflictMissingAssignmentsDoUpdate "conflict_target specification is required with do_update")
test_constraint(OnConflictMissingParameterDoUpdate "conflict_target specification is required with do_update") test_constraint(OnConflictMissingParameterDoUpdate "conflict_target specification is required with do_update")
test_constraint(ReturningEmptyAssert "at least one returnable expression") test_constraint(ReturningEmptyAssert "at least one returnable expression")
test_constraint(ReturningInvalidArgument "at least one returning column requires a table which is otherwise not known in the statement") test_constraint(ReturningInvalidArgument "at least one returning column requires a table which is otherwise not known in the statement")

View File

@ -33,13 +33,6 @@ if(NOT MSVC)
target_compile_options(sqlpp11_postgresql_serialize_tests PRIVATE -Wall -Wextra -pedantic) target_compile_options(sqlpp11_postgresql_serialize_tests PRIVATE -Wall -Wextra -pedantic)
endif() endif()
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_postgresql_serialize_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_postgresql_serialize_tests PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_postgresql_serialize_tests PROPERTY CXX_EXTENSIONS no)
endif()
foreach(test_file IN LISTS test_files) foreach(test_file IN LISTS test_files)
get_filename_component(test ${test_file} NAME_WLE) get_filename_component(test ${test_file} NAME_WLE)
add_test(NAME sqlpp11.postgresql.serialize.${test} add_test(NAME sqlpp11.postgresql.serialize.${test}

View File

@ -50,13 +50,6 @@ if(NOT MSVC)
target_compile_options(sqlpp11_postgresql_tests PRIVATE -Wall -Wextra -pedantic) target_compile_options(sqlpp11_postgresql_tests PRIVATE -Wall -Wextra -pedantic)
endif() 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_EXTENSIONS no)
endif()
foreach(test_file IN LISTS test_files) foreach(test_file IN LISTS test_files)
get_filename_component(test ${test_file} NAME_WLE) get_filename_component(test ${test_file} NAME_WLE)
add_test(NAME sqlpp11.postgresql.usage.${test} add_test(NAME sqlpp11.postgresql.usage.${test}

View File

@ -39,13 +39,6 @@ else()
target_link_libraries(sqlpp11_sqlite3_serialize_tests PRIVATE sqlpp11::sqlite3) target_link_libraries(sqlpp11_sqlite3_serialize_tests PRIVATE sqlpp11::sqlite3)
endif() endif()
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_sqlite3_serialize_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_sqlite3_serialize_tests PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET sqlpp11_sqlite3_serialize_tests PROPERTY CXX_EXTENSIONS OFF)
endif()
foreach(test_file IN LISTS test_files) foreach(test_file IN LISTS test_files)
get_filename_component(test ${test_file} NAME_WLE) get_filename_component(test ${test_file} NAME_WLE)
add_test(NAME sqlpp11.sqlite3.serialize.${test} add_test(NAME sqlpp11.sqlite3.serialize.${test}

View File

@ -56,13 +56,6 @@ else()
target_link_libraries(sqlpp11_sqlite3_tests PRIVATE sqlpp11::sqlite3) target_link_libraries(sqlpp11_sqlite3_tests PRIVATE sqlpp11::sqlite3)
endif() endif()
# conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_sqlite3_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_sqlite3_tests PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET sqlpp11_sqlite3_tests PROPERTY CXX_EXTENSIONS OFF)
endif()
foreach(test_file IN LISTS test_files) foreach(test_file IN LISTS test_files)
get_filename_component(test ${test_file} NAME_WLE) get_filename_component(test ${test_file} NAME_WLE)
add_test(NAME sqlpp11.sqlite3.usage.${test} add_test(NAME sqlpp11.sqlite3.usage.${test}