File tree Expand file tree Collapse file tree 3 files changed +23
-18
lines changed Expand file tree Collapse file tree 3 files changed +23
-18
lines changed Original file line number Diff line number Diff line change @@ -85,20 +85,18 @@ message(STATUS "Build abseil-cpp: ${BUILD_absl}")
8585option (BUILD_Protobuf "Build the Protobuf dependency Library" ON )
8686message (STATUS "Build protobuf: ${BUILD_Protobuf} " )
8787
88- if (BUILD_TESTING)
89- option (BUILD_re2 "Build the re2 dependency Library" ON )
90- message (STATUS "Build re2: ${BUILD_re2} " )
88+ option (BUILD_re2 "Build the re2 dependency Library" ON )
89+ message (STATUS "Build re2: ${BUILD_re2} " )
9190
91+ if (BUILD_TESTING)
9292 option (BUILD_googletest "Build googletest" ON )
93- message (STATUS "Build googletest: ${BUILD_googletest} " )
94-
9593 option (BUILD_benchmark "Build benchmark" ON )
96- message (STATUS "Build benchmark: ${BUILD_benchmark} " )
9794else ()
98- set (BUILD_re2 OFF )
9995 set (BUILD_googletest OFF )
10096 set (BUILD_benchmark OFF )
10197endif ()
98+ message (STATUS "Build googletest: ${BUILD_googletest} " )
99+ message (STATUS "Build benchmark: ${BUILD_benchmark} " )
102100
103101# Find system deps
104102include (system_deps)
Original file line number Diff line number Diff line change @@ -45,13 +45,16 @@ if(NOT TARGET protobuf::libprotobuf)
4545 message (FATAL_ERROR "Target protobuf::libprotobuf not available." )
4646endif ()
4747
48+ if (NOT TARGET re2::re2)
49+ message (FATAL_ERROR "Target re2::re2 not available." )
50+ endif ()
51+
4852# CXX Test
4953if (BUILD_TESTING)
50- if (NOT TARGET re2::re2)
51- message (FATAL_ERROR "Target re2::re2 not available." )
52- endif ()
53-
5454 if (NOT TARGET GTest::gtest_main)
5555 message (FATAL_ERROR "Target GTest::gtest_main not available." )
5656 endif ()
57+ if (NOT TARGET benchmark::benchmark)
58+ message (FATAL_ERROR "Target benchmark::benchmark not available." )
59+ endif ()
5760endif ()
Original file line number Diff line number Diff line change @@ -9,25 +9,29 @@ find_package(Threads REQUIRED)
99set (CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE )
1010
1111# libprotobuf force us to depends on ZLIB::ZLIB target
12- if (NOT BUILD_ZLIB)
12+ if (NOT BUILD_ZLIB AND NOT TARGET ZLIB::ZLIB )
1313 find_package (ZLIB REQUIRED)
1414endif ()
1515
16- if (NOT BUILD_absl)
16+ if (NOT BUILD_absl AND NOT TARGET absl::base )
1717 find_package (absl REQUIRED)
1818endif ()
1919
20- if (NOT BUILD_Protobuf)
20+ if (NOT BUILD_Protobuf AND NOT TARGET protobuf::libprotobuf )
2121 find_package (Protobuf REQUIRED)
2222endif ()
2323
24+ if (NOT BUILD_re2 AND NOT TARGET re2::re2)
25+ find_package (re2 REQUIRED)
26+ endif ()
27+
2428# CXX Test
2529if (BUILD_TESTING)
26- if (NOT BUILD_re2 )
27- find_package (re2 REQUIRED)
30+ if (NOT BUILD_googletest AND NOT TARGET GTest::gtest_main )
31+ find_package (GTest REQUIRED)
2832 endif ()
2933
30- if (NOT BUILD_googletest )
31- find_package (GTest REQUIRED)
34+ if (NOT BUILD_benchmark AND NOT TARGET benchmark::benchmark )
35+ find_package (benchmark REQUIRED)
3236 endif ()
3337endif ()
You can’t perform that action at this time.
0 commit comments