mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 14:08:35 +08:00
FindProtobuf: add tests
This commit is contained in:
@@ -1437,6 +1437,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
||||
add_subdirectory(FindPNG)
|
||||
endif()
|
||||
|
||||
if(CMake_TEST_FindProtobuf)
|
||||
add_subdirectory(FindProtobuf)
|
||||
endif()
|
||||
|
||||
if(CMake_TEST_FindTIFF)
|
||||
add_subdirectory(FindTIFF)
|
||||
endif()
|
||||
|
10
Tests/FindProtobuf/CMakeLists.txt
Normal file
10
Tests/FindProtobuf/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
add_test(NAME FindProtobuf.Test COMMAND
|
||||
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
|
||||
--build-and-test
|
||||
"${CMake_SOURCE_DIR}/Tests/FindProtobuf/Test"
|
||||
"${CMake_BINARY_DIR}/Tests/FindProtobuf/Test"
|
||||
${build_generator_args}
|
||||
--build-project TestFindProtobuf
|
||||
--build-options ${build_options}
|
||||
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
|
||||
)
|
32
Tests/FindProtobuf/Test/CMakeLists.txt
Normal file
32
Tests/FindProtobuf/Test/CMakeLists.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
cmake_minimum_required(VERSION 3.4)
|
||||
project(TestFindProtobuf CXX)
|
||||
include(CTest)
|
||||
|
||||
find_package(Protobuf REQUIRED)
|
||||
|
||||
add_executable(test_tgt main.cxx)
|
||||
target_link_libraries(test_tgt Protobuf::protobuf)
|
||||
add_test(NAME test_tgt COMMAND test_tgt)
|
||||
|
||||
add_executable(test_var main.cxx)
|
||||
target_include_directories(test_var PRIVATE ${Protobuf_INCLUDE_DIRS})
|
||||
target_link_libraries(test_var PRIVATE ${Protobuf_LIBRARIES})
|
||||
add_test(NAME test_var COMMAND test_var)
|
||||
|
||||
add_executable(test_tgt_lite main.cxx)
|
||||
target_link_libraries(test_tgt_lite Protobuf::protobuf-lite)
|
||||
add_test(NAME test_tgt_lite COMMAND test_tgt_lite)
|
||||
|
||||
add_executable(test_var_lite main.cxx)
|
||||
target_include_directories(test_var_lite PRIVATE ${Protobuf_INCLUDE_DIRS})
|
||||
target_link_libraries(test_var_lite PRIVATE ${Protobuf_LITE_LIBRARIES})
|
||||
add_test(NAME test_var_lite COMMAND test_var_lite)
|
||||
|
||||
add_executable(test_tgt_protoc main-protoc.cxx)
|
||||
target_link_libraries(test_tgt_protoc Protobuf::protoc)
|
||||
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})
|
||||
add_test(NAME test_var_protoc COMMAND test_var_protoc)
|
8
Tests/FindProtobuf/Test/main-protoc.cxx
Normal file
8
Tests/FindProtobuf/Test/main-protoc.cxx
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <google/protobuf/compiler/command_line_interface.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
google::protobuf::compiler::CommandLineInterface();
|
||||
|
||||
return 0;
|
||||
}
|
8
Tests/FindProtobuf/Test/main.cxx
Normal file
8
Tests/FindProtobuf/Test/main.cxx
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user