2014-08-22 17:10:24 +02:00
set ( TESTUNIT "${LIBNAME}-testrunner" )
# Sources
file ( GLOB SRCS_G "src/*.cpp" )
file ( GLOB SRCS_G_REMOVE
s r c / T e s t A p p . c p p
s r c / T e s t A p p _ W I N C E . c p p
s r c / T e s t L i b r a r y . c p p
s r c / T e s t P l u g i n . c p p
2012-06-26 14:37:02 +02:00
)
2014-08-22 17:10:24 +02:00
list ( REMOVE_ITEM SRCS_G ${ SRCS_G_REMOVE } )
POCO_SOURCES_AUTO ( TEST_SRCS ${ SRCS_G } )
# Headers
file ( GLOB_RECURSE HDRS_G "src/*.h" )
POCO_HEADERS_AUTO ( TEST_SRCS ${ HDRS_G } )
2012-06-26 14:37:02 +02:00
2014-08-22 17:10:24 +02:00
POCO_SOURCES_AUTO_PLAT ( TEST_SRCS WIN32
s r c / W i n D r i v e r . c p p
2012-06-26 14:37:02 +02:00
)
2014-08-22 17:10:24 +02:00
POCO_SOURCES_PLAT ( TEST_SRCS FoundationTest WINCE
s r c / W i n C E D r i v e r . c p p
)
2012-06-26 14:37:02 +02:00
add_executable ( ${ TESTUNIT } ${ TEST_SRCS } )
2014-08-22 17:10:24 +02:00
add_test ( NAME ${ LIBNAME } WORKING_DIRECTORY ${ CMAKE_RUNTIME_OUTPUT_DIRECTORY } COMMAND ${ TESTUNIT } -all )
2014-06-16 15:34:27 +02:00
set_tests_properties ( ${ LIBNAME } PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=." ) # The SharedLibaryTest has to look for shared libraries in the working directory
2012-06-26 14:37:02 +02:00
#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} )
2013-11-01 16:46:20 +01:00
target_link_libraries ( ${ TESTUNIT } PocoFoundation CppUnit )
2014-08-22 17:10:24 +02:00
if ( WIN32 )
add_definitions ( "-D_AFXDLL" )
target_link_libraries ( ${ TESTUNIT } WinTestRunner )
else ( )
target_link_libraries ( ${ TESTUNIT } pthread )
endif ( WIN32 )
2012-06-26 14:37:02 +02:00
2014-08-22 17:10:24 +02:00
# The test is run in the runtime directory. So the test data is copied there too
2014-06-16 15:34:27 +02:00
add_custom_command ( TARGET ${ TESTUNIT } POST_BUILD
2014-08-22 17:10:24 +02:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / d a t a $ { C M A K E _ R U N T I M E _ O U T P U T _ D I R E C T O R Y } / d a t a )
2014-06-16 15:34:27 +02:00
2014-08-22 17:10:24 +02:00
# TestApp
2012-06-26 14:37:02 +02:00
add_executable ( TestApp src/TestApp.cpp )
2014-08-22 17:10:24 +02:00
# The test is run in the runtime directory. So the TestApp is built there too because it is used by the tests
set_target_properties ( TestApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${ CMAKE_RUNTIME_OUTPUT_DIRECTORY } )
2012-06-26 14:37:02 +02:00
target_link_libraries ( TestApp PocoFoundation )
2014-08-22 17:10:24 +02:00
# TODO: Add TestApp_WINCE
2012-06-26 14:37:02 +02:00
2014-08-22 17:10:24 +02:00
# TestLibrary
add_library ( TestLibrary SHARED src/TestLibrary.cpp src/TestPlugin.cpp src/TestPlugin.h )
set_target_properties ( TestLibrary PROPERTIES PREFIX "" DEBUG_POSTFIX "" ) # The test requires the library named TestLibrary. By default it is prefixed with lib.
# The test is run in the runtime directory. So the TestLibrary is built there too because it is used by the tests
set_target_properties ( TestLibrary PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${ CMAKE_RUNTIME_OUTPUT_DIRECTORY } )
2012-06-26 14:37:02 +02:00
target_link_libraries ( TestLibrary PocoFoundation )