Open
Description
openedon May 16, 2024
Hi,
Here is my CMakeLists.txt file for my existing google unit tests, and Now I want to integrate Fuzztests to it.
How can I add/update my existing CMakeLists.txt file to support this?
Do I need to install any package for fuzztest ?
here is my CMakeLists.txt file:
include(FetchContent)
include(GoogleTest)
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
)
FetchContent_MakeAvailable(googletest)
add_compile_options(
-O0
-ggdb
)
# Add source files from the src/dbus directory
file(GLOB SRC_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../../src/*.cpp)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../src
${CMAKE_CURRENT_SOURCE_DIR}/../../src/dbus
${GLIBMM_INCLUDE_DIRS}
${JSONRPC_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIRS}
${LIBWEBSOCKETS_INCLUDE_DIRS}
${LIBCURL_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}/_deps/googletest-src/googletest/include
${CMAKE_CURRENT_BINARY_DIR}/googletest-src/googletest
${CMAKE_CURRENT_BINARY_DIR}/googletest-src/googletest/include
${CMAKE_CURRENT_BINARY_DIR}/googletest-src/googlemock
${CMAKE_CURRENT_BINARY_DIR}/googletest-src/googlemock/include
)
# Set sources for your test files
set(TEST_SOURCES
Test_Main.cpp
)
# Create executable for tests
add_executable(tests ${TEST_SOURCES} ${DBUS_SOURCES} ${SRC_SOURCES})
#target_link_libraries(tests gtest gtest_main)
# Link GoogleTest to your executable
#target_link_libraries(tests ${GTEST_LIBRARIES} pthread)
target_link_libraries(tests ${GTEST_LIBRARIES}
gtest
gtest_main
gmock
gmock_main
${GLIBMM_LIBRARIES}
${JSONRPC_LIBRARIES}
${LIBSYSTEMD_LIBRARIES}
${OPENSSL_LIBRARIES}
${LIBWEBSOCKETS_LIBRARIES}
${LIBCURL_LIBRARIES}
)
I am thinking of having a package check , uisng below code in my main CMakeLists.txt file:
find_package(fuzztest REQUIRED)
I am thing about this approach because I need fuzztest.h header for test files.
Please suggest.
Thanks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels