From 8b639845a9f53ae48f7c755ffb925c76b17bc407 Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Sat, 14 Mar 2020 10:37:35 +0100 Subject: [PATCH] Move the uninstall definition at the end of the root CMakeLists and add custom commands to remove the lv2/vst directories --- CMakeLists.txt | 5 +++++ cmake/SfizzConfig.cmake | 11 ----------- cmake/SfizzUninstall.cmake | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 cmake/SfizzUninstall.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 670fd81d..55a80114 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,4 +64,9 @@ if (SFIZZ_TESTS) add_subdirectory (tests) endif() +# Put it at the end so that the vst/lv2 directories are registered +if (NOT MSVC) + include(SfizzUninstall) +endif() + show_build_info_if_needed() diff --git a/cmake/SfizzConfig.cmake b/cmake/SfizzConfig.cmake index 6ad1aae4..81184a87 100644 --- a/cmake/SfizzConfig.cmake +++ b/cmake/SfizzConfig.cmake @@ -94,15 +94,4 @@ Compiler CXX min size flags: ${CMAKE_CXX_FLAGS_MINSIZEREL} endif() endfunction() -if(NOT TARGET uninstall) - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/MakeUninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/MakeUninstall.cmake" - IMMEDIATE @ONLY) - - add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/MakeUninstall.cmake) -endif() - - find_package (Threads REQUIRED) diff --git a/cmake/SfizzUninstall.cmake b/cmake/SfizzUninstall.cmake new file mode 100644 index 00000000..6c1d7f12 --- /dev/null +++ b/cmake/SfizzUninstall.cmake @@ -0,0 +1,19 @@ +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/MakeUninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/MakeUninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/MakeUninstall.cmake) + + if (SFIZZ_LV2 AND LV2PLUGIN_INSTALL_DIR) + add_custom_command(TARGET uninstall + COMMAND rm -rv "${LV2PLUGIN_INSTALL_DIR}/${PROJECT_NAME}.lv2") + endif() + + if (SFIZZ_VST AND VSTPLUGIN_INSTALL_DIR) + add_custom_command(TARGET uninstall + COMMAND rm -rv "${VSTPLUGIN_INSTALL_DIR}/${PROJECT_NAME}.vst3") + endif() +endif()