Warning, /frameworks/kdelibs4support/cmake/modules/check_installed_exports_file.cmake is written in an unsupported language. File is not indexed.

0001 
0002 # This file is executed via install(SCRIPT).
0003 # This means it is include()d into the cmake_install.cmake file
0004 # Due to this the following variables already have the correct value:
0005 # CMAKE_INSTALL_PREFIX
0006 # CMAKE_CURRENT_BINARY_DIR
0007 #
0008 # Additionally the following two variables have to be set:
0009 # EXPORT_INSTALL_DIR - set it to the install destination
0010 # EXPORT_FILES  - the filenames of the exports file
0011 #
0012 # Alex
0013 
0014 
0015 # put all the code into a function so all variables used here are local
0016 # which makes sure including this file multiple times in a cmake_install.cmake works
0017 function(CHECK_INSTALLED_EXPORTS_FILE _filename)
0018 
0019    # get the absolute install directory, consider absolute and relative paths and also DESTDIR
0020    if(IS_ABSOLUTE "${EXPORT_INSTALL_DIR}")
0021       set(installDir "$ENV{DESTDIR}${EXPORT_INSTALL_DIR}")
0022    else(IS_ABSOLUTE "${EXPORT_INSTALL_DIR}")
0023       set(installDir "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${EXPORT_INSTALL_DIR}")
0024    endif(IS_ABSOLUTE "${EXPORT_INSTALL_DIR}")
0025 
0026    set(installedExportsFile "${installDir}/${_filename}")
0027 
0028    #message(STATUS "************ bin dir: ${CMAKE_CURRENT_BINARY_DIR}")
0029    #message(STATUS "************ prefix: ${CMAKE_INSTALL_PREFIX}")
0030    #message(STATUS "************ exportsfile: ${installedExportsFile}")
0031 
0032    # if the file already exists at the install location, and if we can
0033    # find the exports file in the build dir, read both, and if their contents differ,
0034    # remove all configuration-specific exports files from the install dir, since
0035    # they may create conflicts if the new targets have been added/targets have been 
0036    # removed/ targets have been renamed/ the namespace for the exported targets has changed
0037    if(EXISTS "${installedExportsFile}")
0038       if (${EXPORT_INSTALL_DIR} MATCHES "^(/)(.+)$")
0039          set(binaryDirExportFileDir "_${CMAKE_MATCH_2}")
0040          set(binaryDirExportsFile "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Export/${binaryDirExportFileDir}/${_filename}")
0041       else (${EXPORT_INSTALL_DIR} MATCHES "^(/)(.+)$")
0042          set(binaryDirExportsFile "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Export/${EXPORT_INSTALL_DIR}/${_filename}")
0043       endif (${EXPORT_INSTALL_DIR} MATCHES "^(/)(.+)$")
0044 
0045    #   message(STATUS "************* binaryDirExportsFile: ${binaryDirExportsFile}")
0046 
0047       if(EXISTS "${binaryDirExportsFile}") 
0048          file(READ "${installedExportsFile}" installedExportsFileContents)
0049          file(READ "${binaryDirExportsFile}" binaryDirExportsFileContents)
0050 
0051          if(NOT "${installedExportsFileContents}" STREQUAL "${binaryDirExportsFileContents}")
0052 
0053             if("${_filename}" MATCHES "^(.+)(\\.cmake)$")
0054                message(STATUS "XXX Installed and new ${_filename} differ, removing installed ${CMAKE_MATCH_1}-*.cmake files")
0055                file(GLOB exportFiles "${installDir}/${CMAKE_MATCH_1}-*.cmake")
0056 #               message(STATUS "XXX files: ${exportFiles}")
0057                if (exportFiles)
0058                    file(REMOVE ${exportFiles})
0059                endif()
0060             endif("${_filename}" MATCHES "^(.+)(\\.cmake)$")
0061          else(NOT "${installedExportsFileContents}" STREQUAL "${binaryDirExportsFileContents}")
0062 #            message(STATUS "XXX FILES ${_filename} are the same")
0063          endif(NOT "${installedExportsFileContents}" STREQUAL "${binaryDirExportsFileContents}")
0064 
0065       endif(EXISTS "${binaryDirExportsFile}") 
0066 
0067    endif(EXISTS "${installedExportsFile}")
0068 
0069 endfunction(CHECK_INSTALLED_EXPORTS_FILE)
0070 
0071 # call the function for each exports file
0072 foreach(_currentExportsFile ${EXPORT_FILES})
0073    check_installed_exports_file("${_currentExportsFile}")
0074 endforeach(_currentExportsFile ${EXPORT_FILES})
0075