[cmake-commits] king committed Linux.cmake 1.11 1.12

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Apr 10 11:22:17 EDT 2007


Update of /cvsroot/CMake/CMake/Modules/Platform
In directory public:/mounts/ram/cvs-serv18348/Modules/Platform

Modified Files:
	Linux.cmake 
Log Message:
ENH: Added option CMAKE_INSTALL_SO_NO_EXE on linux to choose whether the default permissions for shared libraries include the executable bit.  This is necessary to support the conflicting policies of Debian and Fedora.  These changes address bug#4805.


Index: Linux.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/Platform/Linux.cmake,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Linux.cmake	15 Sep 2006 18:08:39 -0000	1.11
+++ Linux.cmake	10 Apr 2007 15:22:15 -0000	1.12
@@ -18,4 +18,41 @@
   SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
 ENDFOREACH(type)
 
+# Debian policy requires that shared libraries be installed without
+# executable permission.  Fedora policy requires that shared libraries
+# be installed with the executable permission.  Since the native tools
+# create shared libraries with execute permission in the first place a
+# reasonable policy seems to be to install with execute permission by
+# default.  In order to support debian packages we provide an option
+# here.  The option default is based on the current distribution, but
+# packagers can set it explicitly on the command line.
+IF(DEFINED CMAKE_INSTALL_SO_NO_EXE)
+  # Store the decision variable in the cache.  This preserves any
+  # setting the user provides on the command line.
+  SET(CMAKE_INSTALL_SO_NO_EXE "${CMAKE_INSTALL_SO_NO_EXE}" CACHE INTERNAL
+    "Install .so files without execute permission.")
+ELSE(DEFINED CMAKE_INSTALL_SO_NO_EXE)
+  # Detect the linux distribution.
+  SET(CMAKE_LINUX_DISTRO)
+  IF(EXISTS "/proc/version")
+    FILE(READ "/proc/version" CMAKE_LINUX_DISTRO)
+  ENDIF(EXISTS "/proc/version")
+
+  # List the distributions that require shared libraries to not have
+  # execute permission.
+  SET(CMAKE_INSTALL_SO_NO_EXE_DISTRO "(Debian|Ubuntu)")
+
+  # Store the decision variable as an internal cache entry to avoid
+  # checking the platform every time.  This option is advanced enough
+  # that only package maintainers should need to adjust it.  They are
+  # capable of providing a setting on the command line.
+  IF("${CMAKE_LINUX_DISTRO}" MATCHES "${CMAKE_INSTALL_SO_NO_EXE_DISTRO}")
+    SET(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
+      "Install .so files without execute permission.")
+  ELSE("${CMAKE_LINUX_DISTRO}" MATCHES "${CMAKE_INSTALL_SO_NO_EXE_DISTRO}")
+    SET(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL
+      "Install .so files without execute permission.")
+  ENDIF("${CMAKE_LINUX_DISTRO}" MATCHES "${CMAKE_INSTALL_SO_NO_EXE_DISTRO}")
+ENDIF(DEFINED CMAKE_INSTALL_SO_NO_EXE)
+
 INCLUDE(Platform/UnixPaths)



More information about the Cmake-commits mailing list