@ -1,5 +1,7 @@
option ( protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF )
option ( protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF )
option ( protobuf_TEST_XML_OUTDIR "Output directory for XML logs from tests." "" )
option ( protobuf_ABSOLUTE_TEST_PLUGIN_PATH
option ( protobuf_ABSOLUTE_TEST_PLUGIN_PATH
" U s i n g a b s o l u t e t e s t _ p l u g i n p a t h i n t e s t s " O N )
" U s i n g a b s o l u t e t e s t _ p l u g i n p a t h i n t e s t s " O N )
mark_as_advanced ( protobuf_ABSOLUTE_TEST_PLUGIN_PATH )
mark_as_advanced ( protobuf_ABSOLUTE_TEST_PLUGIN_PATH )
@ -239,6 +241,13 @@ if(MINGW)
endif ( )
endif ( )
if ( protobuf_TEST_XML_OUTDIR )
if ( NOT "${protobuf_TEST_XML_OUTDIR}" MATCHES "[/\\]$" )
string ( APPEND protobuf_TEST_XML_OUTDIR "/" )
endif ( )
set ( protobuf_GTEST_ARGS "--gtest_output=xml:${protobuf_TEST_XML_OUTDIR}" )
endif ( )
add_executable ( tests ${ tests_files } )
add_executable ( tests ${ tests_files } )
if ( MSVC )
if ( MSVC )
target_compile_options ( tests PRIVATE
target_compile_options ( tests PRIVATE
@ -263,17 +272,23 @@ set(lite_test_files
add_executable ( lite-test ${ lite_test_files } )
add_executable ( lite-test ${ lite_test_files } )
target_link_libraries ( lite-test protobuf-lite-test-common libprotobuf-lite GTest::gmock_main )
target_link_libraries ( lite-test protobuf-lite-test-common libprotobuf-lite GTest::gmock_main )
add_test ( NAME lite-test
C O M M A N D l i t e - t e s t $ { p r o t o b u f _ G T E S T _ A R G S } )
set ( lite_arena_test_files
set ( lite_arena_test_files
$ { p r o t o b u f _ S O U R C E _ D I R } / s r c / g o o g l e / p r o t o b u f / l i t e _ a r e n a _ u n i t t e s t . c c
$ { p r o t o b u f _ S O U R C E _ D I R } / s r c / g o o g l e / p r o t o b u f / l i t e _ a r e n a _ u n i t t e s t . c c
)
)
add_executable ( lite-arena-test ${ lite_arena_test_files } )
add_executable ( lite-arena-test ${ lite_arena_test_files } )
target_link_libraries ( lite-arena-test protobuf-lite-test-common libprotobuf-lite GTest::gmock_main )
target_link_libraries ( lite-arena-test protobuf-lite-test-common libprotobuf-lite GTest::gmock_main )
add_test ( NAME lite-arena-test
C O M M A N D l i t e - a r e n a - t e s t $ { p r o t o b u f _ G T E S T _ A R G S } )
add_custom_target ( check
add_custom_target ( check
C O M M A N D t e s t s
C O M M A N D t e s t s
D E P E N D S t e s t s t e s t _ p l u g i n
D E P E N D S t e s t s t e s t _ p l u g i n
W O R K I N G _ D I R E C T O R Y $ { p r o t o b u f _ S O U R C E _ D I R } )
W O R K I N G _ D I R E C T O R Y $ { p r o t o b u f _ S O U R C E _ D I R } )
add_test ( NAME check
add_test ( NAME check
C O M M A N D t e s t s
C O M M A N D t e s t s $ { p r o t o b u f _ G T E S T _ A R G S }
W O R K I N G _ D I R E C T O R Y " $ { p r o t o b u f _ S O U R C E _ D I R } " )
W O R K I N G _ D I R E C T O R Y " $ { p r o t o b u f _ S O U R C E _ D I R } " )