aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2006-04-08 20:05:12 +0000
committerAlexander Neundorf <neundorf@kde.org>2006-04-08 20:05:12 +0000
commit708473aa3339b90f03c8f774b5067dba64cc92f1 (patch)
tree3edac2ba66d19937763c8db27ebdc44b8b45f71b
parentabdca3e2a38cf7e8fe615823ced9b194478948b7 (diff)
downloadextra-cmake-modules-708473aa3339b90f03c8f774b5067dba64cc92f1.tar.gz
extra-cmake-modules-708473aa3339b90f03c8f774b5067dba64cc92f1.tar.bz2
-generate the shell-wrappers for the executables during buildtime instead of cmake time, and remove them when "cleaning"
Alex svn path=/trunk/KDE/kdelibs/; revision=527599
-rw-r--r--modules/KDE4Macros.cmake13
-rwxr-xr-xmodules/kde4_exec_via_sh.cmake11
2 files changed, 20 insertions, 4 deletions
diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake
index 2fe4dc33..1a6a356f 100644
--- a/modules/KDE4Macros.cmake
+++ b/modules/KDE4Macros.cmake
@@ -401,7 +401,18 @@ macro (KDE4_HANDLE_RPATH _target_NAME _type)
set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/:${CMAKE_INSTALL_PREFIX}${LIB_INSTALL_DIR}:${KDE4_LIB_DIR}:${QT_LIBRARY_DIR}")
get_target_property(_executable ${_target_NAME} LOCATION )
- configure_file(${KDE4_MODULE_DIR}/kde4_exec_via_sh.cmake ${_executable}.sh)
+
+ # use add_custom_target() to have the sh-wrapper generated during build time instead of cmake time
+ add_custom_target(${_target_NAME}sh_target
+ COMMAND ${CMAKE_COMMAND}
+ -D_filename=${_executable}.sh -D_library_path_variable=${_library_path_variable}
+ -D_ld_library_path="${_ld_library_path}" -D_executable=${_executable}
+ -P ${KDE4_MODULE_DIR}/kde4_exec_via_sh.cmake
+ )
+
+ add_dependencies(${_target_NAME} ${_target_NAME}sh_target)
+ macro_additional_clean_files(${_executable}.sh)
+
endif (UNIX)
endmacro (KDE4_HANDLE_RPATH)
diff --git a/modules/kde4_exec_via_sh.cmake b/modules/kde4_exec_via_sh.cmake
index 148f87e7..e3eb8328 100755
--- a/modules/kde4_exec_via_sh.cmake
+++ b/modules/kde4_exec_via_sh.cmake
@@ -1,6 +1,11 @@
-#!/bin/sh
-# created by cmake, don't edit, changes will be lost
+file(WRITE "${_filename}"
+"#!/bin/sh
+# created by cmake, don't edit, changes will be lost
-${_library_path_variable}="${_ld_library_path}":$${_library_path_variable} ${_executable} $@
+${_library_path_variable}=\"${_ld_library_path}\":$${_library_path_variable} ${_executable} $@
+")
+# make it executable
+# since this is only executed on UNIX, it is safe to call chmod
+exec_program(chmod ARGS 755 "${_filename}" OUTPUT_VARIABLE _dummy )