summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-08 15:28:18 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-07-08 15:28:27 (GMT)
commita6a698aafb8fea7191669d9e9ca2bce0fb3be73f (patch)
tree4508cfec42adbde8c3aa79e95c07e4f841b1dbf4
parentbf7f5d0a22c735cd1ebb3e40b8e9c0f6140c6d6a (diff)
parent59a30f2acfdf4bd9d9bd4fffbb9945a372957499 (diff)
downloadCMake-a6a698aafb8fea7191669d9e9ca2bce0fb3be73f.zip
CMake-a6a698aafb8fea7191669d9e9ca2bce0fb3be73f.tar.gz
CMake-a6a698aafb8fea7191669d9e9ca2bce0fb3be73f.tar.bz2
Merge topic 'pb-cxx11'
59a30f2acf FindProtobuf: libprotoc also needs C++11 194adaf985 Tests: require C++11 for some protobuf tests Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3503
-rw-r--r--Modules/FindProtobuf.cmake5
-rw-r--r--Tests/FindProtobuf/Test/CMakeLists.txt4
2 files changed, 9 insertions, 0 deletions
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 085e96c..670352c 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -582,6 +582,11 @@ if(Protobuf_INCLUDE_DIR)
set_target_properties(protobuf::libprotoc PROPERTIES
IMPORTED_LOCATION_DEBUG "${Protobuf_PROTOC_LIBRARY_DEBUG}")
endif()
+ if (Protobuf_VERSION VERSION_GREATER_EQUAL "3.6")
+ set_property(TARGET protobuf::libprotoc APPEND PROPERTY
+ INTERFACE_COMPILE_FEATURES cxx_std_11
+ )
+ endif()
if(UNIX AND TARGET Threads::Threads)
set_property(TARGET protobuf::libprotoc APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Threads::Threads)
diff --git a/Tests/FindProtobuf/Test/CMakeLists.txt b/Tests/FindProtobuf/Test/CMakeLists.txt
index bc89190..fc6b37e 100644
--- a/Tests/FindProtobuf/Test/CMakeLists.txt
+++ b/Tests/FindProtobuf/Test/CMakeLists.txt
@@ -29,6 +29,7 @@ add_test(NAME test_tgt_protoc COMMAND test_tgt_protoc)
add_executable(test_var_protoc main-protoc.cxx)
target_include_directories(test_var_protoc PRIVATE ${Protobuf_INCLUDE_DIRS})
target_link_libraries(test_var_protoc PRIVATE ${Protobuf_PROTOC_LIBRARIES})
+target_compile_features(test_var_protoc PRIVATE cxx_std_11)
add_test(NAME test_var_protoc COMMAND test_var_protoc)
add_test(NAME test_tgt_protoc_version COMMAND protobuf::protoc --version)
@@ -37,14 +38,17 @@ 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})
+target_compile_features(msgs PRIVATE cxx_std_11)
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})
+target_compile_features(test_generate PRIVATE cxx_std_11)
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})
+target_compile_features(test_desc PRIVATE cxx_std_11)
add_test(NAME test_desc COMMAND test_desc ${DESC_PROTO_DESC})