mirror of
https://github.com/darlinghq/darling-libobjc2.git
synced 2024-11-26 21:50:25 +00:00
Add uninstall target to CMake.
This commit is contained in:
parent
5cd0a37e27
commit
651962702a
@ -97,7 +97,7 @@ if (BOEHM_GC)
|
||||
else ()
|
||||
find_library(LIBGC gc PATHS GC_LIBRARY_DIRS)
|
||||
endif ()
|
||||
message("-- Using Boehm GC library: ${LIBGC}")
|
||||
message(STATUS "Using Boehm GC library: ${LIBGC}")
|
||||
include_directories(GC_INCLUDE_DIRS)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GC_CFLAGS}")
|
||||
set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -fobjc-gc")
|
||||
@ -158,13 +158,13 @@ endif (NOT CXX_RUNTIME)
|
||||
# for Objective-C and Objective-C++. If not, then we need to provide a
|
||||
# separate libobjcxx.
|
||||
if (CXX_RUNTIME)
|
||||
message("-- Using ${CXX_RUNTIME} as the C++ runtime library")
|
||||
message(STATUS "Using ${CXX_RUNTIME} as the C++ runtime library")
|
||||
set(libobjc_CXX_SRCS ${libobjcxx_CXX_SRCS})
|
||||
# We don't want to link the STL implementation (e.g. libstdc++) if we have
|
||||
# a separate C++ runtime.
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
|
||||
else (CXX_RUNTIME)
|
||||
message("-- No C++ runtime library found")
|
||||
message(STATUS "No C++ runtime library found")
|
||||
add_library(objcxx SHARED ${libobjcxx_CXX_SRCS})
|
||||
set_target_properties(objcxx PROPERTIES
|
||||
LINKER_LANGUAGE C
|
||||
@ -262,3 +262,12 @@ if (UNIX)
|
||||
endif ()
|
||||
include (CPack)
|
||||
|
||||
# uninstall target
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
|
||||
|
22
cmake_uninstall.cmake.in
Normal file
22
cmake_uninstall.cmake.in
Normal file
@ -0,0 +1,22 @@
|
||||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
list(REVERSE files)
|
||||
foreach (file ${files})
|
||||
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||
if (EXISTS "$ENV{DESTDIR}${file}")
|
||||
execute_process(
|
||||
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RESULT_VARIABLE rm_retval
|
||||
)
|
||||
if(NOT ${rm_retval} EQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
endif (NOT ${rm_retval} EQUAL 0)
|
||||
else (EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
endif (EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
Loading…
Reference in New Issue
Block a user