From e5a36c3bc6ad5342826d879f6b87ff751f4bb92d Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Thu, 15 Aug 2019 13:13:44 +0200 Subject: [PATCH] CMake VFS: Enable us to provided vfs plugins from an external directory --- src/libsync/vfs/CMakeLists.txt | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/libsync/vfs/CMakeLists.txt b/src/libsync/vfs/CMakeLists.txt index 306988f46..fec473b57 100644 --- a/src/libsync/vfs/CMakeLists.txt +++ b/src/libsync/vfs/CMakeLists.txt @@ -1,20 +1,25 @@ # Globbing for plugins has a problem with in-source builds # that create directories for the build. -#file(GLOB vfsPlugins RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*") +#file(GLOB VIRTUAL_FILE_SYSTEM_PLUGINS RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*") -SET(vfsPlugins "suffix;win") +list(APPEND VIRTUAL_FILE_SYSTEM_PLUGINS "suffix" "win") -foreach(vfsPlugin ${vfsPlugins}) - if(NOT IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/${vfsPlugin}") +foreach(vfsPlugin ${VIRTUAL_FILE_SYSTEM_PLUGINS}) + set(vfsPluginPath ${vfsPlugin}) + get_filename_component(vfsPluginName ${vfsPlugin} NAME) + if (NOT IS_ABSOLUTE ${vfsPlugin}) + set(vfsPluginPath "${CMAKE_CURRENT_LIST_DIR}/${vfsPlugin}") + endif() + if(NOT IS_DIRECTORY ${vfsPluginPath}) continue() endif() - add_subdirectory("${vfsPlugin}") + add_subdirectory(${vfsPluginPath} ${vfsPluginName}) - if(UNIT_TESTING AND IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/${vfsPlugin}/test") - add_subdirectory("${vfsPlugin}/test" "${vfsPlugin}_test") - message(STATUS "Added vfsPlugin with tests: ${vfsPlugin}") + if(UNIT_TESTING AND IS_DIRECTORY "${vfsPluginPath}/test") + add_subdirectory("${vfsPluginPath}/test" "${vfsPluginName}_test") + message(STATUS "Added vfsPlugin with tests: ${vfsPluginName}") else() - message(STATUS "Added vfsPlugin without tests: ${vfsPlugin}") + message(STATUS "Added vfsPlugin without tests: ${vfsPluginName}") endif() endforeach() -- 2.30.2