[kde-common/cmake] tde_setup_paths: some paths can be detected automatically using kde-config

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kde-common/cmake@1186350 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
pull/1/head
samelian 14 years ago
parent 47c168fc0b
commit 536ef9b767

@ -9,135 +9,179 @@
# #
################################################# #################################################
#################################################
#####
##### __tde_internal_setup_paths_error
macro( __tde_internal_setup_paths_error )
message( FATAL_ERROR
"#################################################\n"
" ${ARGV}\n"
"#################################################" )
endmacro( __tde_internal_setup_paths_error )
#################################################
#####
##### __tde_internal_setup_paths_status
macro( __tde_internal_setup_paths_status __path __value __method )
message( STATUS " ${__path}=${__value} [${__method}]" )
endmacro( __tde_internal_setup_paths_status )
#################################################
#####
##### __tde_internal_setup_path
macro( __tde_internal_setup_path __path __default )
set( __method "user" )
if( NOT ${__path} )
set( __method "default" )
set( __kdeconfig_type ${ARGV2} )
if( _use_kdeconfig AND __kdeconfig_type )
execute_process(
COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install ${__kdeconfig_type}
OUTPUT_VARIABLE ${__path}
RESULT_VARIABLE __result
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( __result )
__tde_internal_setup_paths_error( "Unable to run kde-config!\n kdelibs are correctly installed?\n LD_LIBRARY_PATH are correctly set?" )
endif( __result )
endif( _use_kdeconfig AND __kdeconfig_type )
if( ${__path} )
set( __method "kde-config" )
else( ${__path} )
set( ${__path} "${__default}" )
endif( ${__path} )
endif( NOT ${__path} )
__tde_internal_setup_paths_status( ${__path} ${${__path}} ${__method} )
endmacro( __tde_internal_setup_path )
#################################################
#####
##### tde_setup_paths
macro( tde_setup_paths ) macro( tde_setup_paths )
message( STATUS "Setup install paths:" )
# --prefix # --prefix
# install architecture-independent files in PREFIX # install architecture-independent files in PREFIX
if( NOT PREFIX ) if( NOT PREFIX )
set( __method "CMAKE_INSTALL_PREFIX" )
set( PREFIX "${CMAKE_INSTALL_PREFIX}" ) set( PREFIX "${CMAKE_INSTALL_PREFIX}" )
else( NOT PREFIX ) else( NOT PREFIX )
# PREFIX have precedence over CMAKE_INSTALL_PREFIX # PREFIX have precedence over CMAKE_INSTALL_PREFIX
set( __method "user" )
set( CMAKE_INSTALL_PREFIX "${PREFIX}" ) set( CMAKE_INSTALL_PREFIX "${PREFIX}" )
endif( NOT PREFIX ) endif( NOT PREFIX )
__tde_internal_setup_paths_status( PREFIX ${PREFIX} ${__method} )
# --exec-prefix # --exec-prefix
# install architecture-dependent files in EPREFIX # install architecture-dependent files in EPREFIX
if( NOT EPREFIX ) if( NOT EPREFIX )
set( __method "default" )
set( EPREFIX "${PREFIX}" ) set( EPREFIX "${PREFIX}" )
endif( NOT EPREFIX ) endif( NOT EPREFIX )
__tde_internal_setup_paths_status( EPREFIX ${EPREFIX} ${__method} )
# we will using kde-config for discover paths
set( _use_kdeconfig ${ARGV0} )
if( _use_kdeconfig )
# KDECONFIG_EXECUTABLE is not set, so will must to search for it
if( NOT KDECONFIG_EXECUTABLE )
find_program( KDECONFIG_EXECUTABLE
NAMES kde-config
HINTS $ENV{KDEDIR}/bin
PATHS "${EPREFIX}/bin" "${PREFIX}/bin" "${CMAKE_INSTALL_PREFIX}/bin" )
if( NOT KDECONFIG_EXECUTABLE )
__tde_internal_setup_paths_error(
"kde-config executable are NOT found!
kdelibs(-devel) are installed? EPREFIX are correctly set?
Try to set KDECONFIG_EXECUTABLE to kde-config path.
Example: cmake -DKDECONFIG_EXECUTABLE=/usr/kde/3.5/bin/kde-config" )
endif( NOT KDECONFIG_EXECUTABLE )
endif( NOT KDECONFIG_EXECUTABLE )
endif( _use_kdeconfig )
# --bindir # --bindir
# user executables # user executables
if( NOT BINDIR ) __tde_internal_setup_path( BINDIR "${EPREFIX}/bin" "exe" )
set( BINDIR "${EPREFIX}/bin" )
endif( NOT BINDIR )
# --sbindir # --sbindir
# system admin executables # system admin executables
if( NOT SBINDIR ) __tde_internal_setup_path( SBINDIR "${EPREFIX}/sbin" )
set( SBINDIR "${EPREFIX}/sbin" )
endif( NOT SBINDIR )
# --libexecdir # --libexecdir
# program executables # program executables
if( NOT LIBEXECDIR ) __tde_internal_setup_path( LIBEXECDIR "${EPREFIX}/libexec" )
set( LIBEXECDIR "${EPREFIX}/libexec" )
endif( NOT LIBEXECDIR )
# --sysconfdir # --sysconfdir
# read-only single-machine data # read-only single-machine data
if( NOT SYSCONFDIR ) __tde_internal_setup_path( SYSCONFDIR "${PREFIX}/etc" )
set( SYSCONFDIR "${PREFIX}/etc" )
endif( NOT SYSCONFDIR )
# --sharedstatedir # --sharedstatedir
# modifiable architecture-independent data # modifiable architecture-independent data
if( NOT SHAREDSTATEDIR ) __tde_internal_setup_path( SHAREDSTATEDIR "${PREFIX}/com" )
set( SHAREDSTATEDIR "${PREFIX}/com" )
endif( NOT SHAREDSTATEDIR )
# --localstatedir # --localstatedir
# modifiable single-machine data # modifiable single-machine data
if( NOT LOCALSTATEDIR ) __tde_internal_setup_path( LOCALSTATEDIR "${PREFIX}/var" )
set( LOCALSTATEDIR "${PREFIX}/var" )
endif( NOT LOCALSTATEDIR )
# --libdir # --libdir
# object code libraries # object code libraries
if( NOT LIBDIR ) __tde_internal_setup_path( LIBDIR "${EPREFIX}/lib" "lib" )
set( LIBDIR "${EPREFIX}/lib" )
endif( NOT LIBDIR )
# --includedir # --includedir
# C header files # C header files
if( NOT INCLUDEDIR ) __tde_internal_setup_path( INCLUDEDIR "${PREFIX}/include" "include" )
set( INCLUDEDIR "${PREFIX}/include" )
endif( NOT INCLUDEDIR )
# --oldincludedir # --oldincludedir
# C header files for non-gcc # C header files for non-gcc
if( NOT OLDINCLUDEDIR ) __tde_internal_setup_path( OLDINCLUDEDIR "/usr/include" )
set( OLDINCLUDEDIR "/usr/include" )
endif( NOT OLDINCLUDEDIR )
# --datarootdir # --datarootdir
# read-only arch.-independent data root # read-only arch.-independent data root
if( NOT DATAROOTDIR ) __tde_internal_setup_path( DATAROOTDIR "${PREFIX}/share" )
set( DATAROOTDIR "${PREFIX}/share" )
endif( NOT DATAROOTDIR )
# --datadir # --datadir
# read-only architecture-independent data # read-only architecture-independent data
if( NOT DATADIR ) __tde_internal_setup_path( DATADIR "${DATAROOTDIR}" )
set( DATADIR "${DATAROOTDIR}" )
endif( NOT DATADIR )
# --infodir # --infodir
# info documentation # info documentation
if( NOT INFODIR ) __tde_internal_setup_path( INFODIR "${DATAROOTDIR}/info" )
set( INFODIR "${DATAROOTDIR}/info" )
endif( NOT INFODIR )
# --localedir # --localedir
# locale-dependent data # locale-dependent data
if( NOT LOCALEDIR ) __tde_internal_setup_path( LOCALEDIR "${DATAROOTDIR}/locale" )
set( LOCALEDIR "${DATAROOTDIR}/locale" )
endif( NOT LOCALEDIR )
# --mandir # --mandir
# man documentation # man documentation
if( NOT MANDIR ) __tde_internal_setup_path( MANDIR "${DATAROOTDIR}/man" )
set( MANDIR "${DATAROOTDIR}/man" )
endif( NOT MANDIR )
# --docdir # --docdir
# documentation root # documentation root
if( NOT DOCDIR ) __tde_internal_setup_path( DOCDIR "${DATAROOTDIR}/doc/${PACKAGE}" )
set( DOCDIR "${DATAROOTDIR}/doc/${PACKAGE}" )
endif( NOT DOCDIR )
# --htmldir # --htmldir
# html documentation # html documentation
if( NOT HTMLDIR ) __tde_internal_setup_path( HTMLDIR "${DOCDIR}" "html" )
set( HTMLDIR "${DOCDIR}" )
endif( NOT HTMLDIR )
# --dvidir # --dvidir
# dvi documentation # dvi documentation
if( NOT DVIDIR ) __tde_internal_setup_path( DVIDIR "${DOCDIR}" )
set( DVIDIR "${DOCDIR}" )
endif( NOT DVIDIR )
# --pdfdir # --pdfdir
# pdf documentation # pdf documentation
if( NOT PDFDIR ) __tde_internal_setup_path( PDFDIR "${DOCDIR}" )
set( PDFDIR "${DOCDIR}" )
endif( NOT PDFDIR )
# --psdir # --psdir
# ps documentation # ps documentation
if( NOT PSDIR ) __tde_internal_setup_path( PSDIR "${DOCDIR}" )
set( PSDIR "${DOCDIR}" )
endif( NOT PSDIR )
endmacro( tde_setup_paths ) endmacro( tde_setup_paths )

Loading…
Cancel
Save