]> granicus.if.org Git - icinga2/commitdiff
Fix installations that use DESTDIR
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 13 Apr 2016 07:32:08 +0000 (09:32 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 20 Apr 2016 08:09:35 +0000 (10:09 +0200)
fixes #11574

cmake/InstallConfig.cmake

index 7f70177f973cfdc5b5819560e881247bb9281029..7af92cf22911797935e5fa8f66fdecd01483974f 100644 (file)
@@ -26,6 +26,11 @@ function(install_if_not_exists src dest)
   string(REPLACE "/" "\\\\" nsis_dest_dir "${real_dest}")
   string(REPLACE "/" "\\\\" nsis_dest "${real_dest}/${basename_dest}")
   install(CODE "
+   if(\"\$ENV{DESTDIR}\" STREQUAL \"\")
+      set(target_dir \${CMAKE_INSTALL_PREFIX})
+    else()
+      set(target_dir \$ENV{DESTDIR})
+    endif()
     if(\${CMAKE_INSTALL_PREFIX} MATCHES .*/_CPack_Packages/.* OR NOT EXISTS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${skel_prefix}${dest}/${src_name}\")
       message(STATUS \"Installing: \$ENV{DESTDIR}${dest}/${src_name}\")
       if(\${CMAKE_INSTALL_PREFIX} MATCHES .*/_CPack_Packages/.*)
@@ -34,14 +39,14 @@ function(install_if_not_exists src dest)
         set(skel_prefix \"\")
       endif()
       execute_process(COMMAND \${CMAKE_COMMAND} -E copy \"${src}\"
-                      \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${skel_prefix}${dest}/${src_name}\"
+                      \"\${target_dir}/\${skel_prefix}${dest}/${src_name}\"
                       RESULT_VARIABLE copy_result
                       ERROR_VARIABLE error_output)
       if(copy_result)
         message(FATAL_ERROR \${error_output})
       endif()
     else()
-      message(STATUS \"Skipping  : \$ENV{DESTDIR}${dest}/${src_name}\")
+      message(STATUS \"Skipping  : \${target_dir}/${dest}/${src_name}\")
     endif()
   ")
 endfunction(install_if_not_exists)