|
@@ -7,12 +7,14 @@ file(GLOB ${MODULE_PREFIX}_TESTS "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
|
|
|
#Google Test
|
|
|
include_directories(${GTEST_ROOT})
|
|
|
include_directories(${GMOCK_ROOT})
|
|
|
-list(APPEND comm_test_libraries gtest)
|
|
|
-list(APPEND comm_test_libraries gtest_main)
|
|
|
+
|
|
|
list(APPEND comm_test_libraries spbase_a)
|
|
|
|
|
|
-list(APPEND addin_libs gmock)
|
|
|
-list(APPEND addin_libs gmock_main)
|
|
|
+list(APPEND GTEST_LIBS gtest)
|
|
|
+list(APPEND GTEST_LIBS gtest_main)
|
|
|
+
|
|
|
+list(APPEND GMOCK_LIBS gmock)
|
|
|
+list(APPEND GMOCK_LIBS gmock_main)
|
|
|
|
|
|
if(NOT MSVC)
|
|
|
set(TEST_AREA "${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME}_area")
|
|
@@ -31,10 +33,21 @@ set(TEST_CFG_AREA "${TEST_VERSION}/cfg")
|
|
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
|
|
get_filename_component(test_name ${test} NAME_WE)
|
|
|
add_executable(${test_name} ${test})
|
|
|
- target_link_libraries(${test_name} ${comm_test_libraries} ${addin_libs})
|
|
|
+ if(${test_name} STREQUAL SpSecureClientTest)
|
|
|
+ target_link_libraries(${test_name} ${comm_test_libraries} ${GMOCK_LIBS})
|
|
|
+ else()
|
|
|
+ target_link_libraries(${test_name} ${comm_test_libraries} ${GTEST_LIBS})
|
|
|
+ endif()
|
|
|
+
|
|
|
+ if (BUILD_SHARED_LIBS)
|
|
|
+ set_target_properties(${test_name} PROPERTIES COMPILE_DEFINITIONS
|
|
|
+ "GTEST_LINKED_AS_SHARED_LIBRARY=1;SPABASE_LINKED_AS_STATIC_LIBRARY=1")
|
|
|
+ else()
|
|
|
+ set_target_properties(${test_name} PROPERTIES COMPILE_DEFINITIONS "SPABASE_LINKED_AS_STATIC_LIBRARY=1")
|
|
|
+ endif()
|
|
|
set_property(TARGET ${test_name} PROPERTY FOLDER "test/spbase")
|
|
|
set_target_properties(${test_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
|
|
- set_target_properties(${test_name} PROPERTIES COMPILE_DEFINITIONS "SPABASE_LINKED_AS_STATIC_LIBRARY=1")
|
|
|
+ message(STATUS "add test case: ${test_name}...")
|
|
|
add_test(NAME ${test_name} COMMAND ${TESTING_OUTPUT_DIRECTORY}/${test_name})
|
|
|
set_tests_properties(${teset_name} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED;ERROR;Failed;error")
|
|
|
endforeach()
|