Merge pull request #120 from paulfd/make-uninstall
Add a make uninstall target
This commit is contained in:
commit
1af782109f
4 changed files with 48 additions and 8 deletions
|
|
@ -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()
|
||||
|
|
|
|||
21
cmake/MakeUninstall.cmake.in
Normal file
21
cmake/MakeUninstall.cmake.in
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
endif()
|
||||
|
||||
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
foreach(file ${files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
exec_program(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
||||
endif()
|
||||
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
|
||||
endif()
|
||||
endforeach()
|
||||
19
cmake/SfizzUninstall.cmake
Normal file
19
cmake/SfizzUninstall.cmake
Normal file
|
|
@ -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()
|
||||
|
|
@ -53,6 +53,8 @@ if (NOT MSVC)
|
|||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
configure_file (${PROJECT_SOURCE_DIR}/scripts/sfizz.pc.in sfizz.pc @ONLY)
|
||||
install (FILES ${CMAKE_BINARY_DIR}/src/sfizz.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
endif()
|
||||
if(WIN32)
|
||||
include(VSTConfig)
|
||||
|
|
@ -78,7 +80,6 @@ if (SFIZZ_SHARED)
|
|||
target_compile_definitions (sfizz_shared PRIVATE _USE_MATH_DEFINES)
|
||||
endif()
|
||||
target_compile_definitions(sfizz_shared PRIVATE SFIZZ_EXPORT_SYMBOLS)
|
||||
set_target_properties (sfizz_shared PROPERTIES OUTPUT_NAME sfizz PUBLIC_HEADER "sfizz.h;sfizz.hpp")
|
||||
set_property (TARGET sfizz_shared PROPERTY SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
sfizz_enable_lto_if_needed(sfizz_shared)
|
||||
|
||||
|
|
@ -86,8 +87,7 @@ if (SFIZZ_SHARED)
|
|||
install (TARGETS sfizz_shared
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
|
|
@ -96,8 +96,3 @@ if (SFIZZ_SHARED)
|
|||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT MSVC)
|
||||
install (FILES ${CMAKE_BINARY_DIR}/src/sfizz.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue