mirror of
https://github.com/biojppm/rapidyaml.git
synced 2026-01-18 13:31:19 +01:00
[cmake]: add uninstall target
This commit is contained in:
@@ -99,3 +99,7 @@ if(RYML_BUILD_TESTS OR RYML_BUILD_BENCHMARKS)
|
||||
endif()
|
||||
|
||||
c4_add_dev_targets()
|
||||
|
||||
add_custom_target(uninstall
|
||||
"${CMAKE_COMMAND}" -P "${PROJECT_SOURCE_DIR}/cmake/uninstall.cmake"
|
||||
)
|
||||
|
||||
24
cmake/uninstall.cmake
Normal file
24
cmake/uninstall.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")
|
||||
|
||||
if(NOT EXISTS ${MANIFEST})
|
||||
message(FATAL_ERROR "Cannot find install manifest: '${MANIFEST}'")
|
||||
endif()
|
||||
|
||||
file(STRINGS ${MANIFEST} files)
|
||||
foreach(file ${files})
|
||||
if(EXISTS ${file})
|
||||
message(STATUS "Removing file: '${file}'")
|
||||
|
||||
exec_program(
|
||||
${CMAKE_COMMAND} ARGS "-E remove ${file}"
|
||||
OUTPUT_VARIABLE stdout
|
||||
RETURN_VALUE result
|
||||
)
|
||||
|
||||
if(NOT "${result}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Failed to remove file: '${file}'.")
|
||||
endif()
|
||||
else()
|
||||
MESSAGE(STATUS "File '${file}' does not exist.")
|
||||
endif()
|
||||
endforeach(file)
|
||||
Reference in New Issue
Block a user