@ -22,7 +22,26 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set ( C_WARNINGS -Wall -Wextra )
set ( C_WARNINGS -Wall -Wextra )
set ( CMAKE_POSITION_INDEPENDENT_CODE ON )
set ( CMAKE_POSITION_INDEPENDENT_CODE ON )
set ( EXTRA_INCLUDE_DIRS
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
add_definitions (
- p g
- - c o v e r a g e
- f p r o f i l e - a r c s
- f t e s t - c o v e r a g e
)
if ( CMAKE_C_COMPILER_ID STREQUAL "GNU" )
link_libraries ( gcov )
else ( )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage" )
endif ( )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs" )
endif ( )
include_directories (
" i n c l u d e "
" i n c l u d e "
$ { F U S E 3 _ I N C L U D E _ D I R S }
$ { F U S E 3 _ I N C L U D E _ D I R S }
$ { L W S _ I N C L U D E _ D I R S }
$ { L W S _ I N C L U D E _ D I R S }
@ -39,7 +58,7 @@ set(EXTRA_LIBS
$ { C M A K E _ T H R E A D _ L I B S _ I N I T }
$ { C M A K E _ T H R E A D _ L I B S _ I N I T }
)
)
set( EXTRA_CFLAGS
add_compile_options(
$ { C _ W A R N I N G S }
$ { C _ W A R N I N G S }
$ { F U S E 3 _ C F L A G S _ O T H E R }
$ { F U S E 3 _ C F L A G S _ O T H E R }
$ { L W S _ C F L A G S _ O T H E R }
$ { L W S _ C F L A G S _ O T H E R }
@ -48,7 +67,6 @@ set(EXTRA_CFLAGS
" - p t h r e a d "
" - p t h r e a d "
)
)
# l i b w e b f u s e - c o r e
# l i b w e b f u s e - c o r e
add_library ( webfuse-core STATIC
add_library ( webfuse-core STATIC
@ -61,8 +79,7 @@ add_library(webfuse-core STATIC
)
)
set_target_properties ( webfuse-core PROPERTIES OUTPUT_NAME webfuse-core )
set_target_properties ( webfuse-core PROPERTIES OUTPUT_NAME webfuse-core )
target_include_directories ( webfuse-core PUBLIC lib ${ EXTRA_INCLUDE_DIRS } )
target_include_directories ( webfuse-core PUBLIC lib )
target_compile_options ( webfuse-core PUBLIC ${ EXTRA_CFLAGS } )
set_target_properties ( webfuse-core PROPERTIES C_VISIBILITY_PRESET hidden )
set_target_properties ( webfuse-core PROPERTIES C_VISIBILITY_PRESET hidden )
install ( DIRECTORY include/webfuse/core DESTINATION include/webfuse )
install ( DIRECTORY include/webfuse/core DESTINATION include/webfuse )
@ -100,9 +117,8 @@ add_library(webfuse-adapter-static STATIC
)
)
set_target_properties ( webfuse-adapter-static PROPERTIES OUTPUT_NAME webfuse-adapter )
set_target_properties ( webfuse-adapter-static PROPERTIES OUTPUT_NAME webfuse-adapter )
target_include_directories ( webfuse-adapter-static PUBLIC lib ${ EXTRA_INCLUDE_DIRS } )
target_compile_options ( webfuse-adapter-static PUBLIC ${ EXTRA_CFLAGS } )
set_target_properties ( webfuse-adapter-static PROPERTIES C_VISIBILITY_PRESET hidden )
set_target_properties ( webfuse-adapter-static PROPERTIES C_VISIBILITY_PRESET hidden )
target_include_directories ( webfuse-adapter-static PUBLIC lib )
add_library ( webfuse-adapter SHARED
add_library ( webfuse-adapter SHARED
l i b / w e b f u s e / a d a p t e r / a p i . c
l i b / w e b f u s e / a d a p t e r / a p i . c
@ -113,8 +129,6 @@ set_target_properties(webfuse-adapter PROPERTIES SOVERSION 0)
set_target_properties ( webfuse-adapter PROPERTIES C_VISIBILITY_PRESET hidden )
set_target_properties ( webfuse-adapter PROPERTIES C_VISIBILITY_PRESET hidden )
set_target_properties ( webfuse-adapter PROPERTIES COMPILE_DEFINITIONS "WF_API=WF_EXPORT" )
set_target_properties ( webfuse-adapter PROPERTIES COMPILE_DEFINITIONS "WF_API=WF_EXPORT" )
target_include_directories ( webfuse-adapter PUBLIC lib ${ EXTRA_INCLUDE_DIRS } )
target_compile_options ( webfuse-adapter PUBLIC ${ EXTRA_CFLAGS } )
target_link_libraries ( webfuse-adapter PRIVATE webfuse-adapter-static webfuse-core )
target_link_libraries ( webfuse-adapter PRIVATE webfuse-adapter-static webfuse-core )
file ( WRITE "${PROJECT_BINARY_DIR}/libwebfuse-adapter.pc"
file ( WRITE "${PROJECT_BINARY_DIR}/libwebfuse-adapter.pc"
@ -157,9 +171,8 @@ add_library(webfuse-provider-static STATIC
)
)
set_target_properties ( webfuse-provider-static PROPERTIES OUTPUT_NAME webfuse-provider )
set_target_properties ( webfuse-provider-static PROPERTIES OUTPUT_NAME webfuse-provider )
target_include_directories ( webfuse-provider-static PUBLIC lib ${ EXTRA_INCLUDE_DIRS } )
target_compile_options ( webfuse-provider-static PUBLIC ${ EXTRA_CFLAGS } )
set_target_properties ( webfuse-provider-static PROPERTIES C_VISIBILITY_PRESET hidden )
set_target_properties ( webfuse-provider-static PROPERTIES C_VISIBILITY_PRESET hidden )
target_include_directories ( webfuse-provider-static PUBLIC lib )
add_library ( webfuse-provider SHARED
add_library ( webfuse-provider SHARED
l i b / w e b f u s e / p r o v i d e r / a p i . c
l i b / w e b f u s e / p r o v i d e r / a p i . c
@ -170,8 +183,7 @@ set_target_properties(webfuse-provider PROPERTIES SOVERSION 0)
set_target_properties ( webfuse-provider PROPERTIES C_VISIBILITY_PRESET hidden )
set_target_properties ( webfuse-provider PROPERTIES C_VISIBILITY_PRESET hidden )
set_target_properties ( webfuse-provider PROPERTIES COMPILE_DEFINITIONS "WFP_API=WFP_EXPORT" )
set_target_properties ( webfuse-provider PROPERTIES COMPILE_DEFINITIONS "WFP_API=WFP_EXPORT" )
target_include_directories ( webfuse-provider PUBLIC lib ${ EXTRA_INCLUDE_DIRS } )
target_include_directories ( webfuse-provider PUBLIC lib )
target_compile_options ( webfuse-provider PUBLIC ${ EXTRA_CFLAGS } )
target_link_libraries ( webfuse-provider PRIVATE webfuse-provider-static webfuse-core )
target_link_libraries ( webfuse-provider PRIVATE webfuse-provider-static webfuse-core )
file ( WRITE "${PROJECT_BINARY_DIR}/libwebfuse-provider.pc"
file ( WRITE "${PROJECT_BINARY_DIR}/libwebfuse-provider.pc"
@ -211,11 +223,7 @@ target_include_directories(userdb PUBLIC
$ { J A N S S O N _ I N C L U D E _ D I R S }
$ { J A N S S O N _ I N C L U D E _ D I R S }
)
)
target_compile_options ( userdb PUBLIC
target_compile_options ( userdb PUBLIC ${ OPENSSL_CFLAGS_OTHER } )
$ { C _ W A R N I N G S }
$ { O P E N S S L _ C F L A G S _ O T H E R }
$ { J A N S S O N _ C F L A G S _ O T H E R }
)
# d a e m o n
# d a e m o n
@ -224,8 +232,7 @@ add_executable(webfused
)
)
target_link_libraries ( webfused PUBLIC webfuse-adapter userdb ${ OPENSSL_LIBRARIES } ${ EXTRA_LIBS } )
target_link_libraries ( webfused PUBLIC webfuse-adapter userdb ${ OPENSSL_LIBRARIES } ${ EXTRA_LIBS } )
target_include_directories ( webfused PUBLIC ${ EXTRA_INCLUDE_DIRS } )
target_compile_options ( webfused PUBLIC ${ OPENSSL_CFLAGS_OTHER } )
target_compile_options ( webfused PUBLIC ${ C_WARNINGS } ${ OPENSSL_CFLAGS_OTHER } ${ EXTRA_CFLAGS } )
# p r o v i d e r
# p r o v i d e r
@ -237,7 +244,6 @@ set_target_properties(webfuse-provider-app PROPERTIES OUTPUT_NAME webfuse-provid
target_link_libraries ( webfuse-provider-app PUBLIC webfuse-provider ${ EXTRA_LIBS } )
target_link_libraries ( webfuse-provider-app PUBLIC webfuse-provider ${ EXTRA_LIBS } )
target_include_directories ( webfuse-provider-app PUBLIC ${ EXTRA_INCLUDE_DIRS } )
target_include_directories ( webfuse-provider-app PUBLIC ${ EXTRA_INCLUDE_DIRS } )
target_compile_options ( webfuse-provider-app PUBLIC ${ EXTRA_CFLAGS } )
# s t a t i c - f i l e s y s t e m - p r o v i d e r
# s t a t i c - f i l e s y s t e m - p r o v i d e r
@ -268,11 +274,7 @@ target_include_directories(webfuse-passwd PUBLIC
$ { J A N S S O N _ I N C L U D E _ D I R S }
$ { J A N S S O N _ I N C L U D E _ D I R S }
)
)
target_compile_options ( webfuse-passwd PUBLIC
target_compile_options ( webfuse-passwd PUBLIC ${ OPENSSL_CFLAGS_OTHER } )
$ { C _ W A R N I N G S }
$ { O P E N S S L _ C F L A G S _ O T H E R }
$ { J A N S S O N _ C F L A G S _ O T H E R }
)
endif ( NOT WITHOUT_EXAMPLE )
endif ( NOT WITHOUT_EXAMPLE )
@ -307,10 +309,23 @@ add_executable(alltests
)
)
target_link_libraries ( alltests PUBLIC webfuse-adapter-static webfuse-provider-static webfuse-core ${ EXTRA_LIBS } ${ GMOCK_LIBRARIES } ${ GTEST_LIBRARIES } )
target_link_libraries ( alltests PUBLIC webfuse-adapter-static webfuse-provider-static webfuse-core ${ EXTRA_LIBS } ${ GMOCK_LIBRARIES } ${ GTEST_LIBRARIES } )
target_include_directories ( alltests PUBLIC lib ${ EXTRA_INCLUDE_DIRS} ${ GMOCK_INCLUDE_DIRS} ${ GTEST_INCLUDE_DIRS } )
target_include_directories ( alltests PUBLIC lib ${ GMOCK_INCLUDE_DIRS} ${ GTEST_INCLUDE_DIRS } )
target_compile_options ( alltests PUBLIC ${ EXTRA_CFLAGS} ${ GMOCK_CFLAGS} ${ GTEST_CFLAGS } )
target_compile_options ( alltests PUBLIC ${ GMOCK_CFLAGS} ${ GTEST_CFLAGS } )
enable_testing ( )
enable_testing ( )
gtest_discover_tests ( alltests TEST_PREFIX alltests: )
gtest_discover_tests ( alltests TEST_PREFIX alltests: )
add_custom_target ( coverage
. / a l l t e s t s
C O M M A N D m k d i r - p c o v e r a g e
C O M M A N D l c o v - - c a p t u r e - - d i r e c t o r y . - - o u t p u t - f i l e c o v e r a g e / l c o v . i n f o
C O M M A N D l c o v - - r e m o v e c o v e r a g e / l c o v . i n f o ' / u s r / * ' - - o u t p u t - f i l e c o v e r a g e / l c o v . i n f o
)
add_dependencies ( coverage alltests )
add_custom_target ( coverage-report
C O M M A N D g e n h t m l c o v e r a g e / l c o v . i n f o - - o u t p u t - d i r e c t o r y c o v e r a g e / r e p o r t
)
add_dependencies ( coverage-report coverage )
endif ( NOT WITHOUT_TESTS )
endif ( NOT WITHOUT_TESTS )