File tree 3 files changed +32
-1
lines changed 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ MANIFEST
32
32
.DS_Store
33
33
/dist
34
34
/build
35
- /cmake /
36
35
.cache /
37
36
sosize- * .txt
38
37
pybind11Config * .cmake
Original file line number Diff line number Diff line change @@ -246,3 +246,12 @@ if(PYBIND11_INSTALL)
246
246
NAMESPACE "pybind11::"
247
247
DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR} )
248
248
endif ()
249
+
250
+ # Uninstall target
251
+ if (PYBIND11_MASTER_PROJECT)
252
+ configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /cmake/cmake_uninstall.cmake.in"
253
+ "${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake" IMMEDIATE @ONLY)
254
+
255
+ add_custom_target (uninstall COMMAND ${CMAKE_COMMAND} -P
256
+ ${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake)
257
+ endif ()
Original file line number Diff line number Diff line change
1
+ # Source: https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
2
+
3
+ if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt" )
4
+ message (FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt" )
5
+ endif ()
6
+
7
+ file (READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files )
8
+ string (REGEX REPLACE "\n " ";" files "${files} " )
9
+ foreach (file ${files} )
10
+ message (STATUS "Uninstalling $ENV{DESTDIR}${file} " )
11
+ if (IS_SYMLINK "$ENV{DESTDIR}${file} " OR EXISTS "$ENV{DESTDIR}${file} " )
12
+ exec_program (
13
+ "@CMAKE_COMMAND@" ARGS "-E remove \" $ENV{DESTDIR}${file} \" "
14
+ OUTPUT_VARIABLE rm_out
15
+ RETURN_VALUE rm_retval
16
+ )
17
+ if (NOT "${rm_retval} " STREQUAL 0)
18
+ message (FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file} " )
19
+ endif ()
20
+ else (IS_SYMLINK "$ENV{DESTDIR}${file} " OR EXISTS "$ENV{DESTDIR}${file} " )
21
+ message (STATUS "File $ENV{DESTDIR}${file} does not exist." )
22
+ endif ()
23
+ endforeach ()
You can’t perform that action at this time.
0 commit comments