diff options
| -rw-r--r-- | modules/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | modules/FindKDE4Internal.cmake | 15 | ||||
| -rw-r--r-- | modules/kde4_cmake_uninstall.cmake.in | 22 | 
3 files changed, 36 insertions, 3 deletions
| diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 9aa94fee..1496668a 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -4,7 +4,7 @@ file(GLOB cmakeFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.cmake")  set(module_install_dir ${DATA_INSTALL_DIR}/cmake/modules ) -install( FILES  kde4init_dummy.cpp.in ${cmakeFiles} DESTINATION ${module_install_dir}  ) +install( FILES  kde4init_dummy.cpp.in kde4_cmake_uninstall.cmake.in ${cmakeFiles} DESTINATION ${module_install_dir}  )  # the files listed here will be removed by remove_obsoleted_cmake_files.cmake, Alex  set(FILES_TO_REMOVE diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index ba94f0df..bdd08393 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -227,6 +227,8 @@ include (CheckCXXCompilerFlag)  ################################# +# get the directory of the current file, used later on in the file +get_filename_component( kde_cmake_module_dir  ${CMAKE_CURRENT_LIST_FILE} PATH)  # the following are directories where stuff will be installed to @@ -314,7 +316,6 @@ else(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kglobal.h)     set(LIBRARY_OUTPUT_PATH  ${CMAKE_BINARY_DIR}/lib ) -   get_filename_component( kde_cmake_module_dir  ${CMAKE_CURRENT_LIST_FILE} PATH)     # this file contains all dependencies of all libraries of kdelibs, Alex     include(${kde_cmake_module_dir}/KDELibsDependencies.cmake) @@ -643,7 +644,7 @@ endif (CMAKE_C_COMPILER MATCHES "icc")  # KDE4Macros.cmake contains all the KDE specific macros -include(KDE4Macros) +include(${kde_cmake_module_dir}/KDE4Macros.cmake)  # decide whether KDE4 has been found @@ -701,3 +702,13 @@ set(KDE4_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS} -DQT3_SUPPORT -DQT_NO_STL -DQ  string(REGEX REPLACE ".*/lib" "" KDELIBSUFF ${LIB_INSTALL_DIR} )  message(STATUS "KDELIBSUFF :<${KDELIBSUFF}>") + + +if (NOT _kde4_uninstall_rule_created) +   set(_kde4_uninstall_rule_created TRUE) + +   configure_file("${kde_cmake_module_dir}/kde4_cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" @ONLY) + +   add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake") + +endif (NOT _kde4_uninstall_rule_created) diff --git a/modules/kde4_cmake_uninstall.cmake.in b/modules/kde4_cmake_uninstall.cmake.in new file mode 100644 index 00000000..36dd9ba8 --- /dev/null +++ b/modules/kde4_cmake_uninstall.cmake.in @@ -0,0 +1,22 @@ +IF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") +  MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) +  MESSAGE(STATUS "Uninstalling \"${file}\"") +  IF(EXISTS "${file}") +    EXEC_PROGRAM( +      "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\"" +      OUTPUT_VARIABLE rm_out +      RETURN_VALUE rm_retval +      ) +    IF("${rm_retval}" STREQUAL 0) +    ELSE("${rm_retval}" STREQUAL 0) +      MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"") +    ENDIF("${rm_retval}" STREQUAL 0) +  ELSE(EXISTS "${file}") +    MESSAGE(STATUS "File \"${file}\" does not exist.") +  ENDIF(EXISTS "${file}") +ENDFOREACH(file) | 
