summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-06-24 14:56:13 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-06-28 17:16:29 +0200
commit95244af2f996ecd9bab3c9db53fc51b4a7ab6c61 (patch)
treea3ab766be5445571742bc2ed0f5d6a40c7ce4f33 /cmake
parent8c97ae0c1fed0553ecbbc667e03ded7009ec6887 (diff)
CMake: Let qt_copy_or_install set the executable bit for PROGRAMS
In a prefix build, this function uses install(PROGRAMS) which correctly sets the executable bit. In a non-prefix build, we did file(COPY) without explicitly setting executable permissions. Now, we're also setting the executable bit for qt_copy_or_install(PROGRAMS) calls in non-prefix builds. Change-Id: I283e9aeed2a23016ee196d83d584a7eaaa5edd66 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake21
1 files changed, 20 insertions, 1 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index ced8d4a6f0..cdae6b7376 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -534,6 +534,22 @@ function(qt_non_prefix_copy)
endif()
endfunction()
+# Retrieve the permissions that are set by install(PROGRAMS).
+function(qt_get_install_executable_permissions out_var)
+ set(default_permissions ${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS})
+ if(NOT default_permissions)
+ set(default_permissions OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+ endif()
+ set(executable_permissions ${default_permissions} OWNER_EXECUTE)
+ if(GROUP_READ IN_LIST default_permissions)
+ list(APPEND executable_permissions GROUP_EXECUTE)
+ endif()
+ if(WORLD_READ IN_LIST default_permissions)
+ list(APPEND executable_permissions WORLD_EXECUTE)
+ endif()
+ set(${out_var} ${executable_permissions} PARENT_SCOPE)
+endfunction()
+
# Use case is installing files in a prefix build, or copying them to the correct build dir
# in a non-prefix build.
# Pass along arguments as you would pass them to install().
@@ -546,18 +562,21 @@ function(qt_copy_or_install)
cmake_parse_arguments(arg "${flags}" "${options}" "${multiopts}" ${ARGN})
# Remember which option has to be passed to the install command.
+ set(copy_arguments "")
set(argv_copy ${ARGV})
if(arg_FILES)
set(install_option "FILES")
elseif(arg_PROGRAMS)
set(install_option "PROGRAMS")
+ qt_get_install_executable_permissions(executable_permissions)
+ list(APPEND copy_arguments FILE_PERMISSIONS ${executable_permissions})
elseif(arg_DIRECTORY)
set(install_option "DIRECTORY")
endif()
list(REMOVE_AT argv_copy 0)
qt_install(${install_option} ${argv_copy})
- qt_non_prefix_copy(COPY ${argv_copy})
+ qt_non_prefix_copy(COPY ${argv_copy} ${copy_arguments})
endfunction()
# Hacky way to remove the install target in non-prefix builds.