2022-11-12 10:34:51 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
project(webfuse VERSION 2.0.0)
|
|
|
|
|
2022-11-13 13:22:11 +00:00
|
|
|
set (CMAKE_CXX_STANDARD 17)
|
|
|
|
|
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
|
2022-11-13 13:17:47 +00:00
|
|
|
src/webfuse/webfuse.cpp
|
2022-11-13 17:18:44 +00:00
|
|
|
src/webfuse/fuse.cpp
|
2022-11-14 18:02:46 +00:00
|
|
|
src/webfuse/filesystem.cpp
|
2022-11-13 13:17:47 +00:00
|
|
|
src/webfuse/filesystem/status.cpp
|
|
|
|
src/webfuse/filesystem/accessmode.cpp
|
|
|
|
src/webfuse/filesystem/openflags.cpp
|
|
|
|
src/webfuse/filesystem/filemode.cpp
|
2022-11-13 17:18:44 +00:00
|
|
|
src/webfuse/filesystem/filesystem_statistics.cpp
|
|
|
|
src/webfuse/filesystem/empty_filesystem.cpp
|
2022-11-13 21:22:35 +00:00
|
|
|
src/webfuse/ws/config.cpp
|
|
|
|
src/webfuse/ws/server.cpp
|
2022-11-20 12:29:34 +00:00
|
|
|
src/webfuse/ws/messagewriter.cpp
|
|
|
|
src/webfuse/ws/messagereader.cpp
|
2022-11-13 13:17:47 +00:00
|
|
|
)
|
2022-11-12 11:29:30 +00:00
|
|
|
|
|
|
|
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
|
2022-11-13 13:17:47 +00:00
|
|
|
test-src/webfuse/test_app.cpp
|
|
|
|
test-src/webfuse/filesystem/test_status.cpp
|
|
|
|
test-src/webfuse/filesystem/test_accessmode.cpp
|
|
|
|
test-src/webfuse/filesystem/test_openflags.cpp
|
|
|
|
test-src/webfuse/filesystem/test_filemode.cpp
|
2022-11-12 11:29:30 +00:00
|
|
|
)
|
|
|
|
|
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()
|