mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
c227d46cf4
A wiki article pointed out that whitespace will only be preserved for parameters in CMake commands if passed strings will be appropriately quoted or escaped. http://cmake.org/Wiki/CMake/Language_Syntax#CMake_splits_arguments_unless_you_use_quotation_marks_or_escapes. Quoting was added so that more places should also handle file names correctly which contain space characters or semicolons eventually. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
32 lines
965 B
CMake
32 lines
965 B
CMake
include_directories("${CMAKE_SOURCE_DIR}/tests")
|
|
|
|
add_custom_target(test_sqlpp_constraints COMMAND true)
|
|
|
|
function(test_constraint name pattern)
|
|
|
|
add_executable(
|
|
"${name}"
|
|
EXCLUDE_FROM_ALL
|
|
"${name}.cpp"
|
|
)
|
|
|
|
add_custom_command(OUTPUT "${name}.out"
|
|
COMMAND "${CMAKE_MAKE_PROGRAM}" "${name}" > "${CMAKE_CURRENT_BINARY_DIR}/${name}.out" 2>&1 || true
|
|
COMMAND grep "${pattern}" "${CMAKE_CURRENT_BINARY_DIR}/${name}.out" > /dev/null
|
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp"
|
|
COMMENT "${name}"
|
|
VERBATIM)
|
|
|
|
add_custom_target("test_${name}" DEPENDS "${name}.out" COMMAND true)
|
|
|
|
|
|
add_dependencies(test_sqlpp_constraints "test_${name}")
|
|
|
|
endfunction(test_constraint)
|
|
|
|
test_constraint(no_conversion_operator_if_null_not_trivial "int i = row.alpha")
|
|
test_constraint(require_insert "required column is missing")
|
|
test_constraint(must_not_insert "one assignment is prohibited")
|
|
test_constraint(must_not_update "one assignment is prohibited")
|
|
|