0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Merge pull request #15 from elfring/Complete_quoting_for_parameters_of_some_CMake_commands

Complete quoting for parameters of some CMake commands.
This commit is contained in:
rbock 2014-09-02 08:50:09 +02:00
commit e6e561ff04
3 changed files with 19 additions and 20 deletions

View File

@ -38,8 +38,8 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
endif ()
set(include_dir "${PROJECT_SOURCE_DIR}/include")
file(GLOB_RECURSE sqlpp_headers ${include_dir}/*.h)
include_directories(${include_dir})
file(GLOB_RECURSE sqlpp_headers "${include_dir}/*.h")
include_directories("${include_dir}")
add_subdirectory(tests)
add_subdirectory(test_constraints)

View File

@ -1,26 +1,26 @@
include_directories(${CMAKE_SOURCE_DIR}/tests)
include_directories("${CMAKE_SOURCE_DIR}/tests")
add_custom_target(test_sqlpp_constraints COMMAND true)
function(test_constraint name pattern)
add_executable(
${name}
"${name}"
EXCLUDE_FROM_ALL
${name}.cpp
"${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
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_custom_target("test_${name}" DEPENDS "${name}.out" COMMAND true)
add_dependencies(test_sqlpp_constraints test_${name})
add_dependencies(test_sqlpp_constraints "test_${name}")
endfunction(test_constraint)

View File

@ -1,9 +1,9 @@
macro (build_and_run arg)
# Add headers to sources to enable file browsing in IDEs
include_directories(${CMAKE_BINARY_DIR}/tests)
add_executable(${arg} ${arg}.cpp ${sqlpp_headers} ${CMAKE_CURRENT_LIST_DIR}/Sample.h)
add_test(${arg} ${arg})
include_directories("${CMAKE_BINARY_DIR}/tests")
add_executable("${arg}" "${arg}.cpp" ${sqlpp_headers} "${CMAKE_CURRENT_LIST_DIR}/Sample.h")
add_test("${arg}" "${arg}")
endmacro ()
build_and_run(BooleanExpressionTest)
@ -21,8 +21,7 @@ build_and_run(ResultTest)
# if you want to use the generator, you can do something like this:
#find_package(PythonInterp REQUIRED)
#add_custom_command(
# OUTPUT ${CMAKE_CURRENT_LIST_DIR}/Sample.h
# COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/ddl2cpp ${CMAKE_CURRENT_LIST_DIR}/sample.sql Sample test
# DEPENDS ${CMAKE_CURRENT_LIST_DIR}/sample.sql
# )
# OUTPUT "${CMAKE_CURRENT_LIST_DIR}/Sample.h"
# COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/scripts/ddl2cpp" "${CMAKE_CURRENT_LIST_DIR}/sample.sql" Sample test
# DEPENDS "${CMAKE_CURRENT_LIST_DIR}/sample.sql"
# VERBATIM)