aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2018-08-24 12:27:21 -0700
committerJosh Haberman <jhaberman@gmail.com>2018-08-24 12:27:21 -0700
commit4249692ce6ba9ba761ddf721f88bc4fc7b1840c3 (patch)
tree9d7d68c457e51cec1e650b62ca70a90ee2cab8e6
parent62fc66ada365c679f8df74b1192819023788864d (diff)
downloadprotobuf-4249692ce6ba9ba761ddf721f88bc4fc7b1840c3.tar.gz
protobuf-4249692ce6ba9ba761ddf721f88bc4fc7b1840c3.tar.bz2
protobuf-4249692ce6ba9ba761ddf721f88bc4fc7b1840c3.zip
Added cmake build files for the conformance test runner.
I want to use the conformance tests from upb, which is switching to CMake.
-rw-r--r--cmake/CMakeLists.txt5
-rw-r--r--cmake/conformance.cmake47
2 files changed, 52 insertions, 0 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index ece39f7f..06436c3a 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -30,6 +30,7 @@ endif()
# Options
option(protobuf_BUILD_TESTS "Build tests" ON)
+option(protobuf_BUILD_CONFORMANCE "Build conformance tests" OFF)
option(protobuf_BUILD_EXAMPLES "Build examples" OFF)
option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON)
if (BUILD_SHARED_LIBS)
@@ -218,6 +219,10 @@ if (protobuf_BUILD_TESTS)
include(tests.cmake)
endif (protobuf_BUILD_TESTS)
+if (protobuf_BUILD_CONFORMANCE)
+ include(conformance.cmake)
+endif (protobuf_BUILD_CONFORMANCE)
+
include(install.cmake)
if (protobuf_BUILD_EXAMPLES)
diff --git a/cmake/conformance.cmake b/cmake/conformance.cmake
new file mode 100644
index 00000000..17fa4b96
--- /dev/null
+++ b/cmake/conformance.cmake
@@ -0,0 +1,47 @@
+
+add_custom_command(
+ OUTPUT ${protobuf_source_dir}/conformance/conformance.pb.cc
+ DEPENDS protoc ${protobuf_source_dir}/conformance/conformance.proto
+ COMMAND protoc ${protobuf_source_dir}/conformance/conformance.proto
+ --proto_path=${protobuf_source_dir}/conformance
+ --cpp_out=${protobuf_source_dir}/conformance
+)
+
+add_custom_command(
+ OUTPUT ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
+ ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
+ DEPENDS protoc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto
+ protoc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto
+ COMMAND protoc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto
+ ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto
+ --proto_path=${protobuf_source_dir}/src
+ --cpp_out=${protobuf_source_dir}/src
+)
+
+add_executable(conformance_test_runner
+ ${protobuf_source_dir}/conformance/conformance.pb.cc
+ ${protobuf_source_dir}/conformance/conformance_test.cc
+ ${protobuf_source_dir}/conformance/conformance_test_runner.cc
+ ${protobuf_source_dir}/conformance/third_party/jsoncpp/json.h
+ ${protobuf_source_dir}/conformance/third_party/jsoncpp/jsoncpp.cpp
+ ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
+ ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
+)
+
+add_executable(conformance_cpp
+ ${protobuf_source_dir}/conformance/conformance.pb.cc
+ ${protobuf_source_dir}/conformance/conformance_cpp.cc
+ ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
+ ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
+)
+
+target_include_directories(
+ conformance_test_runner
+ PUBLIC ${protobuf_source_dir}/conformance)
+
+target_include_directories(
+ conformance_cpp
+ PUBLIC ${protobuf_source_dir}/conformance)
+
+target_link_libraries(conformance_test_runner libprotobuf)
+target_link_libraries(conformance_cpp libprotobuf)