summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-09-08 01:31:01 +0200
committerSlávek Banko <slavek.banko@axis.cz>2015-12-23 02:22:30 +0100
commite10a4809f12f17d6ceebdcf9205ef93d0fda45a0 (patch)
treeb1b0d4490361b3deabfea01998805b1f5e5f21a0
parentdbf291f74b2186baffea9f3a95fb13804ca948bd (diff)
downloadtdelibs-e10a4809f12f17d6ceebdcf9205ef93d0fda45a0.tar.gz
tdelibs-e10a4809f12f17d6ceebdcf9205ef93d0fda45a0.zip
Fix tdesu backend check in CMake
This relates to Bug 1655 (cherry picked from commit 11b5fd8f08aa59fdfed395d7e6de0aa6914fb021)
-rw-r--r--CMakeLists.txt29
1 files changed, 10 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0832deb2e..0d0b270b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -438,26 +438,17 @@ set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
unset( bak_CMAKE_REQUIRED_LIBRARIES )
-# FIXME for unknown reason cmake cannot find su
-#find_program( __PATH_SU su )
-set( __PATH_SU "/bin/su" )
-
-if( __PATH_SU )
- set( DEFAULT_SUPER_USER_COMMAND ${__PATH_SU} )
-else( __PATH_SU )
- message( STATUS "WARNING: su was not found" )
-endif( __PATH_SU )
-
-# FIXME for unknown reason cmake cannot find sudo
-# find_program( __PATH_SUDO "sudo" )
-set( __PATH_SUDO "/usr/bin/sudo" )
+#### set kdesu backend ##########################
+
if( WITH_SUDO_KDESU_BACKEND )
- if( __PATH_SUDO )
- set( DEFAULT_SUPER_USER_COMMAND ${__PATH_SUDO} )
- else( __PATH_SUDO )
- message( FATAL_ERROR "sudo was chosen as kdesu backend, but was not found in path." )
- endif( __PATH_SUDO )
-endif( WITH_SUDO_KDESU_BACKEND )
+ set( DEFAULT_SUPER_USER_COMMAND sudo CACHE INTERNAL "" FORCE )
+else()
+ set( DEFAULT_SUPER_USER_COMMAND su CACHE INTERNAL "" FORCE )
+endif()
+find_file( KDESU_BACKEND ${DEFAULT_SUPER_USER_COMMAND} PATHS ENV PATH )
+if( KDESU_BACKEND-NOTFOUND )
+ tde_message_fatal( "${DEFAULT_SUPER_USER_COMMAND} was chosen as kdesu backend, but was not found in path." )
+endif( KDESU_BACKEND-NOTFOUND )
#### set some constants #########################