diff options
author | Peter Mitrano <mitranopeter@gmail.com> | 2017-09-21 13:23:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-02 12:08:24 (GMT) |
commit | 1299f4cc5ee5a996b051f7767049e239092a65a0 (patch) | |
tree | d3c873f8ec327bc1d094c668a8debb555712ba8f /Tests/FindProtobuf/Test/CMakeLists.txt | |
parent | 4e91be95323fa869a82ea59e733a706a5fd3867b (diff) | |
download | CMake-1299f4cc5ee5a996b051f7767049e239092a65a0.zip CMake-1299f4cc5ee5a996b051f7767049e239092a65a0.tar.gz CMake-1299f4cc5ee5a996b051f7767049e239092a65a0.tar.bz2 |
FindProtobuf: add flag to allow descriptor files to be generated
- The .desc files will be in the same folder as the generated .cc and .h files.
- Paths to generate .desc files are stored in a variable passed in
- This is only implemented for C++
- Remove legacy ARGS
- Add test that generates and uses C++ protobuf message
- Add test that checks that the generated .desc file can be instantiated
with DynamicMessageFactory
- Add Help rst for new feature
Diffstat (limited to 'Tests/FindProtobuf/Test/CMakeLists.txt')
-rw-r--r-- | Tests/FindProtobuf/Test/CMakeLists.txt | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Tests/FindProtobuf/Test/CMakeLists.txt b/Tests/FindProtobuf/Test/CMakeLists.txt index 10ce976..bc89190 100644 --- a/Tests/FindProtobuf/Test/CMakeLists.txt +++ b/Tests/FindProtobuf/Test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.8) project(TestFindProtobuf CXX) include(CTest) @@ -32,3 +32,19 @@ target_link_libraries(test_var_protoc PRIVATE ${Protobuf_PROTOC_LIBRARIES}) add_test(NAME test_var_protoc COMMAND test_var_protoc) add_test(NAME test_tgt_protoc_version COMMAND protobuf::protoc --version) + +set(Protobuf_IMPORT_DIRS ${Protobuf_INCLUDE_DIRS}) +PROTOBUF_GENERATE_CPP(PROTO_SRC PROTO_HEADER msgs/example.proto) +PROTOBUF_GENERATE_CPP(DESC_PROTO_SRC DESC_PROTO_HEADER DESCRIPTORS DESC_PROTO_DESC msgs/example_desc.proto) +add_library(msgs ${PROTO_SRC} ${PROTO_HEADER}) + +add_executable(test_generate main-generate.cxx ${PROTO_SRC}) +target_include_directories(test_generate PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(test_generate msgs ${Protobuf_LIBRARIES}) +add_test(NAME test_generate COMMAND test_generate) + +add_executable(test_desc main-desc.cxx ${DESC_PROTO_SRC}) +target_compile_features(test_desc PRIVATE cxx_std_11) +target_include_directories(test_desc PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(test_desc msgs ${Protobuf_LIBRARIES}) +add_test(NAME test_desc COMMAND test_desc ${DESC_PROTO_DESC}) |