Skip to content

Commit 4fe1fd6

Browse files
committed
build: only build the fuzzer when appropriate
This is a test binary, only build it if testing is enabled.
1 parent 8b51fc2 commit 4fe1fd6

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,3 @@ endif()
176176
CONFIGURE_FILE(
177177
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
178178
${CMAKE_CURRENT_BINARY_DIR}/config.h)
179-
180-
if(CMARK_LIB_FUZZER)
181-
add_executable(cmark-fuzz ../test/cmark-fuzz.c ${LIBRARY_SOURCES})
182-
target_link_libraries(cmark-fuzz "${CMAKE_LIB_FUZZER_PATH}")
183-
# cmark is written in C but the libFuzzer runtime is written in C++ which
184-
# needs to link against the C++ runtime.
185-
set_target_properties(cmark-fuzz PROPERTIES
186-
LINKER_LANGUAGE CXX)
187-
endif()

test/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,15 @@ else(Python3_Interpreter_FOUND)
9292
message(WARNING "A python 3 interpreter is required to run the spec tests")
9393

9494
endif(Python3_Interpreter_FOUND)
95+
96+
97+
if(CMARK_LIB_FUZZER)
98+
add_executable(cmark-fuzz cmark-fuzz.c)
99+
target_link_libraries(cmark-fuzz PRIVATE
100+
libcmark-gfm_static
101+
"${CMAKE_LIB_FUZZER_PATH}")
102+
# cmark is written in C but the libFuzzer runtime is written in C++ which
103+
# needs to link against the C++ runtime.
104+
set_target_properties(cmark-fuzz PROPERTIES
105+
LINKER_LANGUAGE CXX)
106+
endif()

0 commit comments

Comments
 (0)