Skip to content

Commit

Permalink
Make it possible to control the host used for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andras Mantia committed Jul 10, 2013
1 parent 5810ba5 commit 4b828d5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ site_name(HOSTNAME)
string(REPLACE "-" "_" HOSTNAME ${HOSTNAME})
string(REPLACE "." "_" HOSTNAME ${HOSTNAME})

include_directories(${CMAKE_BINARY_DIR}/tests ${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR}/tests
${CMAKE_CURRENT_SOURCE_DIR}/foo
${CMAKE_SOURCE_DIR} )

if (NOT SQLATE_DATABASE_HOST)
set(SQLATE_DATABASE_HOST "sqlate-postgres")
endif()

set(testcommon_srcs testbase.cpp testschema.cpp )
add_library(testcommon STATIC ${testcommon_srcs})
Expand All @@ -23,7 +29,7 @@ macro(add_sql_unittest_testbase _source)
add_executable(${_name} ${_source})

add_test(NAME sql-${_name} COMMAND ${_name})
set_tests_properties(sql-${_name} PROPERTIES ENVIRONMENT "SQLATE_DATABASE_HOST=sqlate-postgres;SQLATE_DATABASE_NAME=sqlate_test_${HOSTNAME}")
set_tests_properties(sql-${_name} PROPERTIES ENVIRONMENT "SQLATE_DATABASE_HOST=${SQLATE_DATABASE_HOST};SQLATE_DATABASE_NAME=sqlate_test_${HOSTNAME}")
target_link_libraries(${_name} ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY}
${QT_QTSQL_LIBRARY} sqlate testcommon)
endmacro()
Expand Down

0 comments on commit 4b828d5

Please sign in to comment.