Warning, /frameworks/extra-cmake-modules/modules/ECMUninstallTarget.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2015 Alex Merry <alex.merry@kde.org> 0002 # 0003 # SPDX-License-Identifier: BSD-3-Clause 0004 0005 #[=======================================================================[.rst: 0006 ECMUninstallTarget 0007 ------------------ 0008 0009 Add an ``uninstall`` target. 0010 0011 By including this module, an ``uninstall`` target will be added to your CMake 0012 project. This will remove all files installed (or updated) by a previous 0013 invocation of the ``install`` target. It will not remove files created or 0014 modified by an ``install(SCRIPT)`` or ``install(CODE)`` command; you should 0015 create a custom uninstallation target for these and use ``add_dependency`` to 0016 make the ``uninstall`` target depend on it: 0017 0018 .. code-block:: cmake 0019 0020 include(ECMUninstallTarget) 0021 install(SCRIPT install-foo.cmake) 0022 add_custom_target(uninstall_foo COMMAND ${CMAKE_COMMAND} -P uninstall-foo.cmake) 0023 add_dependency(uninstall uninstall_foo) 0024 0025 The target will fail if the ``install`` target has not yet been run (so it is 0026 not possible to run CMake on the project and then immediately run the 0027 ``uninstall`` target). 0028 0029 .. warning:: 0030 0031 CMake deliberately does not provide an ``uninstall`` target by default on 0032 the basis that such a target has the potential to remove important files 0033 from a user's computer. Use with caution. 0034 0035 Since 1.7.0. 0036 #]=======================================================================] 0037 0038 if (NOT TARGET uninstall) 0039 configure_file( 0040 "${CMAKE_CURRENT_LIST_DIR}/ecm_uninstall.cmake.in" 0041 "${CMAKE_BINARY_DIR}/ecm_uninstall.cmake" 0042 IMMEDIATE 0043 @ONLY 0044 ) 0045 0046 add_custom_target(uninstall 0047 COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/ecm_uninstall.cmake" 0048 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" 0049 ) 0050 endif()