aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorGravatar Konstantin Podsvirov <konstantin@podsvirov.pro>2015-09-15 15:01:05 +0300
committerGravatar Konstantin Podsvirov <konstantin@podsvirov.pro>2015-09-15 15:01:05 +0300
commit2fa0439b0074c61d48fa6120d0734ae8c1e5debb (patch)
tree53b28356c9ab4d8a6c9d7dc1a6547c17e61046f0 /cmake
parent905f46403582ca2c43e1ad249dd01fa97191c4d0 (diff)
Improved testing from CMake project
Diffstat (limited to 'cmake')
-rw-r--r--cmake/tests.cmake16
1 files changed, 13 insertions, 3 deletions
diff --git a/cmake/tests.cmake b/cmake/tests.cmake
index 65feca21..46f631a8 100644
--- a/cmake/tests.cmake
+++ b/cmake/tests.cmake
@@ -96,6 +96,8 @@ set(common_test_files
${protobuf_source_dir}/src/google/protobuf/test_util.cc
${protobuf_source_dir}/src/google/protobuf/testing/file.cc
${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc
)
set(common_lite_test_files
@@ -116,7 +118,6 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/compiler/importer_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_plugin_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/parser_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_plugin_unittest.cc
@@ -162,7 +163,6 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser_test.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource_test.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc
${protobuf_source_dir}/src/google/protobuf/util/json_util_test.cc
${protobuf_source_dir}/src/google/protobuf/util/time_util_test.cc
${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util_test.cc
@@ -179,7 +179,6 @@ set(test_plugin_files
${protobuf_source_dir}/src/google/protobuf/testing/file.h
${protobuf_source_dir}/src/google/protobuf/compiler/test_plugin.cc
)
-
add_executable(test_plugin ${test_plugin_files})
target_link_libraries(test_plugin libprotoc libprotobuf gmock)
@@ -194,3 +193,14 @@ set(lite_arena_test_files
)
add_executable(lite-arena-test ${lite_arena_test_files} ${common_lite_test_files} ${lite_test_proto_files})
target_link_libraries(lite-arena-test libprotobuf-lite gmock_main)
+
+enable_testing()
+add_compile_options(-DGOOGLE_PROTOBUF_TEST_PLUGIN_PATH="$<TARGET_FILE:test_plugin>")
+add_library(libtests STATIC ${common_test_files} ${tests_proto_files} ${lite_test_proto_files})
+foreach(file ${tests_files})
+ get_filename_component(name ${file} NAME_WE)
+ add_executable(${name} ${file})
+ target_link_libraries(${name} libtests libprotoc libprotobuf gmock_main)
+ add_test(NAME ${name} COMMAND ${name}
+ WORKING_DIRECTORY ${protobuf_source_dir})
+endforeach()