diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2013-09-08 01:31:01 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-09-08 04:52:51 +0200 |
commit | 11b5fd8f08aa59fdfed395d7e6de0aa6914fb021 (patch) | |
tree | 925620321e582e376761b6f4c20a321bb328c781 /CMakeLists.txt | |
parent | c4284606f6b7a3dab5c38f58daea398c44b33745 (diff) | |
download | tdelibs-11b5fd8f08aa59fdfed395d7e6de0aa6914fb021.tar.gz tdelibs-11b5fd8f08aa59fdfed395d7e6de0aa6914fb021.zip |
Fix tdesu backend check in CMake
This relates to Bug 1655
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7700f7391..722dddf43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -446,26 +446,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 tdesu backend ########################## + if( WITH_SUDO_TDESU_BACKEND ) - if( __PATH_SUDO ) - set( DEFAULT_SUPER_USER_COMMAND ${__PATH_SUDO} ) - else( __PATH_SUDO ) - message( FATAL_ERROR "sudo was chosen as tdesu backend, but was not found in path." ) - endif( __PATH_SUDO ) -endif( WITH_SUDO_TDESU_BACKEND ) + set( DEFAULT_SUPER_USER_COMMAND sudo CACHE INTERNAL "" FORCE ) +else() + set( DEFAULT_SUPER_USER_COMMAND su CACHE INTERNAL "" FORCE ) +endif() +find_file( TDESU_BACKEND ${DEFAULT_SUPER_USER_COMMAND} PATHS ENV PATH ) +if( TDESU_BACKEND-NOTFOUND ) + tde_message_fatal( "${DEFAULT_SUPER_USER_COMMAND} was chosen as tdesu backend, but was not found in path." ) +endif( TDESU_BACKEND-NOTFOUND ) #### set some constants ######################### |