diff options
-rw-r--r-- | CMakeLists.txt | 29 | ||||
-rw-r--r-- | arts.pc.cmake | 8 |
2 files changed, 19 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c026d0c..22ce656 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,21 +37,19 @@ option( WITH_MAD "Enable MAD mp3 decoder support" ON ) ##### paths setup ############################### -if( NOT BIN_INSTALL_DIR ) - set( BIN_INSTALL_DIR bin ) -endif ( NOT BIN_INSTALL_DIR ) +macro( _tde_internal_setup_path _path _default ) + if( DEFINED ${_path} ) + set( ${_path} "${${_path}}" CACHE INTERNAL "" FORCE ) + else( ) + set( ${_path} "${_default}" ) + endif( ) +endmacro( _tde_internal_setup_path ) -if( NOT LIB_INSTALL_DIR ) - set( LIB_INSTALL_DIR lib ) -endif( NOT LIB_INSTALL_DIR ) - -if( NOT INCLUDE_INSTALL_DIR ) - set( INCLUDE_INSTALL_DIR include/${CMAKE_PROJECT_NAME} ) -endif( NOT INCLUDE_INSTALL_DIR ) - -if( NOT PKGCONFIG_INSTALL_DIR ) - set( PKGCONFIG_INSTALL_DIR lib/pkgconfig ) -endif( NOT PKGCONFIG_INSTALL_DIR ) +_tde_internal_setup_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ) +_tde_internal_setup_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" ) +_tde_internal_setup_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" ) +_tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/${CMAKE_PROJECT_NAME}" ) +_tde_internal_setup_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" ) ##### check for include files ################### @@ -192,6 +190,9 @@ configure_file( config.h.cmake config.h @ONLY ) ##### write pkgconfig file ###################### +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_EXEC_PREFIX ${EXEC_INSTALL_PREFIX} ) +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_INCLUDE_DIR ${INCLUDE_INSTALL_DIR} ) +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_LIB_DIR ${LIB_INSTALL_DIR} ) configure_file( arts.pc.cmake arts.pc @ONLY ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/arts.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} ) diff --git a/arts.pc.cmake b/arts.pc.cmake index 74f16d1..17f8aff 100644 --- a/arts.pc.cmake +++ b/arts.pc.cmake @@ -1,10 +1,10 @@ prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=${prefix}/@LIB_INSTALL_DIR@ -includedir=${prefix}/@INCLUDE_INSTALL_DIR@ +exec_prefix=@PC_EXEC_PREFIX@ +libdir=@PC_LIB_DIR@ +includedir=@PC_INCLUDE_DIR@ Name: arts Description: Soundserver for the K Desktop Environment (KDE) Version: @ARTS_VERSION@ -Libs: -L${libdir} +Libs: -L${libdir} Cflags: -I${includedir} |