Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/cmake/Modules/CMakeUninstallTarget.cmake is written in an unsupported language. File is not indexed.

0001 # - create an uninstall target for CMake installed projects
0002 #
0003 # Taken from example on CMake Wiki:
0004 #
0005 # http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
0006 #
0007 # Available under Attribution 2.5 license
0008 #
0009 #
0010 
0011 function(write_uninstall_target_script)
0012     # Create uninstall target template file, if it doesn't exist...
0013     if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in)
0014         set(__uninstall_filename ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake.in)
0015         # BEGIN actual write to file...
0016         file(WRITE ${__uninstall_filename} "\# - uninstall target template\n\#")
0017         file(APPEND ${__uninstall_filename} "
0018 if (NOT EXISTS \"\@CMAKE_CURRENT_BINARY_DIR\@/install_manifest.txt\")
0019     message(FATAL_ERROR \"Cannot find install manifest: \\\"\@CMAKE_CURRENT_BINARY_DIR\@/install_manifest.txt\\\"\")
0020 endif(NOT EXISTS \"\@CMAKE_CURRENT_BINARY_DIR\@/install_manifest.txt\")
0021 
0022 file(READ \"\@CMAKE_CURRENT_BINARY_DIR\@/install_manifest.txt\" files)
0023 string(REGEX REPLACE \"\\n\" \";\" files \"\${files}\")
0024 
0025 foreach (file \${files})
0026     message(STATUS \"Uninstalling \\\"\$ENV{DESTDIR}\${file}\\\"\")
0027     if (EXISTS \"\$ENV{DESTDIR}\${file}\")
0028         execute_process(
0029             COMMAND \@CMAKE_COMMAND\@ -E remove \"\$ENV{DESTDIR}\${file}\"
0030             OUTPUT_VARIABLE rm_out
0031             RESULT_VARIABLE rm_retval
0032         )
0033         if(NOT \${rm_retval} EQUAL 0)
0034             message(FATAL_ERROR \"Problem when removing \\\"\$ENV{DESTDIR}\${file}\\\"\")
0035         endif (NOT \${rm_retval} EQUAL 0)
0036     else (EXISTS \"\$ENV{DESTDIR}\${file}\")
0037         message(STATUS \"File \\\"\$ENV{DESTDIR}\${file}\\\" does not exist.\")
0038     endif (EXISTS \"\$ENV{DESTDIR}\${file}\")
0039 endforeach(file)
0040 
0041 ") # END of appending to file...
0042     endif()
0043 endfunction()
0044 
0045 # Call the file writing function, if needed
0046 write_uninstall_target_script()
0047 
0048 # Configure the file that reads the install manifest and processes the files
0049 configure_file(
0050     "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake.in"
0051     "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
0052     IMMEDIATE @ONLY)
0053 
0054 # Add the uninstall target
0055 add_custom_target(uninstall
0056     COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)