@@ -16,105 +16,125 @@ cmake_minimum_required(VERSION 3.19)
1616
1717include (FetchContent )
1818
19- set (absl_URL https://github.com/abseil/abseil-cpp.git)
20- set (absl_TAG d04b964d82ed5146f7e5e34701a5ba69f9514c9a)
19+ if (FUZZTEST_DOWNLOAD_DEPENDENCIES)
20+ set (absl_URL https://github.com/abseil/abseil-cpp.git)
21+ set (absl_TAG d04b964d82ed5146f7e5e34701a5ba69f9514c9a)
2122
23+ set (re2_URL https://github.com/google/re2.git)
24+ set (re2_TAG 2024-07-02)
2225
23- if (FUZZTEST_USE_SYSTEM_RE2)
24- find_package (re2 REQUIRED )
25- set (FUZZTEST_BUILD_REGEXP_DFA OFF CACHE BOOL
26- "Build regexp_dfa (needs private RE2 headers)" FORCE )
27- message (WARNING "System RE2 detected: regexp_dfa will NOT be built" )
28- else ()
29- set (FUZZTEST_BUILD_REGEXP_DFA ON CACHE BOOL
30- "Build regexp_dfa (needs private RE2 headers)" FORCE )
31- endif ()
26+ set (gtest_URL https://github.com/google/googletest.git)
27+ set (gtest_TAG v1.16.0)
3228
29+ set (proto_URL https://github.com/protocolbuffers/protobuf.git)
30+ set (proto_TAG v30.2)
3331
34- set (gtest_URL https://github.com/google/googletest.git)
35- set (gtest_TAG v1.16.0)
32+ set (nlohmann_json_URL https://github.com/nlohmann/json.git)
33+ set (nlohmann_json_TAG v3.11.3)
34+
35+ set (flatbuffers_URL https://github.com/google/flatbuffers.git)
36+ set (flatbuffers_TAG v25.2.10)
37+ endif ()
3638
3739# From https://www.antlr.org/download.html
3840set (antlr_cpp_URL https://www.antlr.org/download/antlr4-cpp-runtime-4.12.0-source.zip)
3941set (antlr_cpp_MD5 acf7371bd7562188712751266d8a7b90)
4042
41- set (proto_URL https://github.com/protocolbuffers/protobuf.git)
42- set (proto_TAG v30.2)
43-
44- set (nlohmann_json_URL https://github.com/nlohmann/json.git)
45- set (nlohmann_json_TAG v3.11.3)
46-
47- set (flatbuffers_URL https://github.com/google/flatbuffers.git)
48- set (flatbuffers_TAG v25.2.10)
49-
5043if (POLICY CMP0135)
51- cmake_policy (SET CMP0135 NEW )
52- set (CMAKE_POLICY_DEFAULT_CMP0135 NEW)
44+ cmake_policy (SET CMP0135 NEW )
45+ set (CMAKE_POLICY_DEFAULT_CMP0135 NEW)
5346endif ()
5447
55- FetchContent_Declare (
56- abseil-cpp
57- GIT_REPOSITORY ${absl_URL}
58- GIT_TAG ${absl_TAG}
59- )
60-
61- FetchContent_Declare (
62- googletest
63- GIT_REPOSITORY ${gtest_URL}
64- GIT_TAG ${gtest_TAG}
65- )
66-
67- FetchContent_Declare (
68- antlr_cpp
69- URL ${antlr_cpp_URL}
70- URL_HASH MD5=${antlr_cpp_MD5}
71- )
72-
73- if (FUZZTEST_BUILD_FLATBUFFERS)
48+ if (FUZZTEST_DOWNLOAD_DEPENDENCIES)
7449 FetchContent_Declare (
75- flatbuffers
76- GIT_REPOSITORY ${flatbuffers_URL }
77- GIT_TAG ${flatbuffers_TAG }
50+ abseil-cpp
51+ GIT_REPOSITORY ${absl_URL }
52+ GIT_TAG ${absl_TAG }
7853 )
79- endif ()
80-
81- if (FUZZTEST_BUILD_TESTING)
8254
8355 FetchContent_Declare (
84- protobuf
85- GIT_REPOSITORY ${proto_URL }
86- GIT_TAG ${proto_TAG }
56+ re2
57+ GIT_REPOSITORY ${re2_URL }
58+ GIT_TAG ${re2_TAG }
8759 )
8860
8961 FetchContent_Declare (
90- nlohmann_json
91- GIT_REPOSITORY ${nlohmann_json_URL }
92- GIT_TAG ${nlohmann_json_TAG }
62+ googletest
63+ GIT_REPOSITORY ${gtest_URL }
64+ GIT_TAG ${gtest_TAG }
9365 )
66+ else ()
67+ find_package (absl REQUIRED )
68+ find_package (re2 REQUIRED )
69+ find_package (GTest REQUIRED )
70+ endif ()
71+
72+ FetchContent_Declare (
73+ antlr_cpp
74+ URL ${antlr_cpp_URL}
75+ URL_HASH MD5=${antlr_cpp_MD5}
76+ )
9477
78+ if (FUZZTEST_BUILD_FLATBUFFERS)
79+ if (FUZZTEST_DOWNLOAD_DEPENDENCIES)
80+ FetchContent_Declare (
81+ flatbuffers
82+ GIT_REPOSITORY ${flatbuffers_URL}
83+ GIT_TAG ${flatbuffers_TAG}
84+ )
85+ else ()
86+ find_package (flatbuffers REQUIRED )
87+ endif ()
88+ endif ()
89+
90+ if (FUZZTEST_BUILD_TESTING)
91+ if (FUZZTEST_DOWNLOAD_DEPENDENCIES)
92+ FetchContent_Declare (
93+ protobuf
94+ GIT_REPOSITORY ${proto_URL}
95+ GIT_TAG ${proto_TAG}
96+ )
97+
98+ FetchContent_Declare (
99+ nlohmann_json
100+ GIT_REPOSITORY ${nlohmann_json_URL}
101+ GIT_TAG ${nlohmann_json_TAG}
102+ )
103+ else ()
104+ find_package (Protobuf REQUIRED )
105+ add_library (protobuf::libprotobuf ALIAS Protobuf::protobuf )
106+ find_package (nlohmann_json REQUIRED )
107+ endif ()
95108endif ()
96109
97- set (ABSL_PROPAGATE_CXX_STD ON )
98- set (ABSL_ENABLE_INSTALL ON )
99- FetchContent_MakeAvailable (abseil-cpp)
110+ if (FUZZTEST_DOWNLOAD_DEPENDENCIES)
111+ set (ABSL_PROPAGATE_CXX_STD ON )
112+ set (ABSL_ENABLE_INSTALL ON )
113+ FetchContent_MakeAvailable (abseil-cpp)
100114
101- set (GTEST_HAS_ABSL ON )
102- FetchContent_MakeAvailable (googletest)
115+ set (RE2_BUILD_TESTING OFF )
116+ FetchContent_MakeAvailable (re2)
117+
118+ set (GTEST_HAS_ABSL ON )
119+ FetchContent_MakeAvailable (googletest)
120+ endif ()
103121
104122FetchContent_MakeAvailable (antlr_cpp)
105123
106124if (FUZZTEST_BUILD_TESTING)
125+ if (FUZZTEST_DOWNLOAD_DEPENDENCIES)
126+ set (protobuf_BUILD_TESTS OFF )
127+ set (protobuf_INSTALL OFF )
128+ FetchContent_MakeAvailable (protobuf)
107129
108- set (protobuf_BUILD_TESTS OFF )
109- set (protobuf_INSTALL OFF )
110- FetchContent_MakeAvailable (protobuf)
111-
112- FetchContent_MakeAvailable (nlohmann_json)
113-
130+ FetchContent_MakeAvailable (nlohmann_json)
131+ endif ()
114132endif ()
115133
116134if (FUZZTEST_BUILD_FLATBUFFERS)
117- set (FLATBUFFERS_BUILD_TESTS OFF )
118- set (FLATBUFFERS_BUILD_INSTALL OFF )
119- FetchContent_MakeAvailable (flatbuffers)
135+ if (FUZZTEST_DOWNLOAD_DEPENDENCIES)
136+ set (FLATBUFFERS_BUILD_TESTS OFF )
137+ set (FLATBUFFERS_BUILD_INSTALL OFF )
138+ FetchContent_MakeAvailable (flatbuffers)
139+ endif ()
120140endif ()
0 commit comments