2022-11-12 10:34:51 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
project(webfuse VERSION 2.0.0)
|
|
|
|
|
2022-11-12 11:29:30 +00:00
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(FUSE REQUIRED IMPORTED_TARGET fuse3)
|
|
|
|
pkg_check_modules(LWS REQUIRED IMPORTED_TARGET libwebsockets)
|
|
|
|
|
|
|
|
add_library(webfuse_static STATIC
|
|
|
|
src/webfuse/webfuse.cpp)
|
|
|
|
|
|
|
|
target_include_directories(webfuse_static PUBLIC src)
|
|
|
|
target_link_libraries(webfuse_static PUBLIC PkgConfig::FUSE PkgConfig::LWS)
|
|
|
|
|
2022-11-12 10:34:51 +00:00
|
|
|
add_executable(webfuse
|
|
|
|
src/main.cpp)
|
2022-11-12 11:29:30 +00:00
|
|
|
|
|
|
|
target_link_libraries(webfuse PRIVATE webfuse_static)
|
|
|
|
|
|
|
|
if(NOT(WITHOUT_TEST))
|
|
|
|
|
2022-11-12 12:32:13 +00:00
|
|
|
pkg_check_modules(GTEST REQUIRED gtest_main)
|
|
|
|
pkg_check_modules(GMOCK REQUIRED gmock)
|
2022-11-12 11:29:30 +00:00
|
|
|
|
|
|
|
add_executable(alltests
|
|
|
|
test/webfuse/test_app.cpp
|
|
|
|
)
|
|
|
|
|
2022-11-12 12:32:13 +00:00
|
|
|
target_include_directories(alltests PRIVATE ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})
|
|
|
|
target_compile_options(alltests PRIVATE
|
|
|
|
${GTEST_CFLAGS} ${GTEST_CFLAGS_OTHER}
|
|
|
|
${GMOCK_CFLAGS} ${GMOCK_CFLAGS_OTHER}
|
|
|
|
)
|
|
|
|
target_link_libraries(alltests PRIVATE webfuse_static ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES})
|
2022-11-12 11:29:30 +00:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
add_test(NAME alltests COMMAND alltests)
|
|
|
|
|
2022-11-12 12:32:13 +00:00
|
|
|
find_program(VALGRIND valgrind REQUIRED)
|
|
|
|
if(VALGRIND)
|
|
|
|
add_custom_target(memcheck COMMAND valgrind --leak-check=full --error-exitcode=1 ./alltests)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endif()
|