[kde-common/cmake] added support for imported targets; few fixes DESTDIR related

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kde-common/cmake@1190534 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
pull/1/head
samelian 14 years ago
parent d7a101293d
commit 2eca09993f

@ -356,6 +356,7 @@ macro( tde_add_library _arg_target )
unset( _static_pic ) unset( _static_pic )
unset( _automoc ) unset( _automoc )
unset( _no_libtool_file ) unset( _no_libtool_file )
unset( _no_export )
unset( _version ) unset( _version )
unset( _sources ) unset( _sources )
unset( _destination ) unset( _destination )
@ -397,6 +398,12 @@ macro( tde_add_library _arg_target )
set( _no_libtool_file 1 ) set( _no_libtool_file 1 )
endif( "${_arg}" STREQUAL "NO_LIBTOOL_FILE" ) endif( "${_arg}" STREQUAL "NO_LIBTOOL_FILE" )
# found directive "NO_EXPORT"
if( "${_arg}" STREQUAL "NO_EXPORT" )
set( _skip_store 1 )
set( _no_export 1 )
endif( "${_arg}" STREQUAL "NO_EXPORT" )
# found directive "VERSION" # found directive "VERSION"
if( "${_arg}" STREQUAL "VERSION" ) if( "${_arg}" STREQUAL "VERSION" )
set( _skip_store 1 ) set( _skip_store 1 )
@ -500,8 +507,17 @@ macro( tde_add_library _arg_target )
set_target_properties( ${_target} PROPERTIES VERSION ${_version} SOVERSION ${_soversion} ) set_target_properties( ${_target} PROPERTIES VERSION ${_version} SOVERSION ${_soversion} )
endif( _version ) endif( _version )
# set interface libraries # set interface libraries (only for shared)
target_link_libraries( ${_target} LINK_INTERFACE_LIBRARIES ${_link} ) unset( _shared_libs )
foreach( _lib ${_link} )
#get_target_property( _lib_type ${_lib} TYPE )
#if( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" )
if( NOT ${_lib} MATCHES ".+-static" )
list( APPEND _shared_libs ${_lib} )
endif( NOT ${_lib} MATCHES ".+-static" )
#endif( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" )
endforeach( _lib )
target_link_libraries( ${_target} LINK_INTERFACE_LIBRARIES ${_shared_libs} )
# set embedded archives # set embedded archives
if( _embed ) if( _embed )
@ -520,7 +536,13 @@ macro( tde_add_library _arg_target )
# set destination directory # set destination directory
if( _destination ) if( _destination )
install( TARGETS ${_target} DESTINATION ${_destination} ) if( "SHARED" STREQUAL ${_type} AND NOT _no_export )
# we export only shared libs (no static, no modules)
# also, do not export target marked as "NO_EXPORT" (usually for kdeinit)
install( TARGETS ${_target} DESTINATION ${_destination} EXPORT ${CMAKE_PROJECT_NAME} )
else( "SHARED" STREQUAL ${_type} AND NOT _no_export )
install( TARGETS ${_target} DESTINATION ${_destination} )
endif( "SHARED" STREQUAL ${_type} AND NOT _no_export )
if( NOT "STATIC" STREQUAL ${_type} AND NOT _no_libtool_file ) if( NOT "STATIC" STREQUAL ${_type} AND NOT _no_libtool_file )
tde_install_libtool_file( ${_target} ${_destination} ) tde_install_libtool_file( ${_target} ${_destination} )
endif( NOT "STATIC" STREQUAL ${_type} AND NOT _no_libtool_file ) endif( NOT "STATIC" STREQUAL ${_type} AND NOT _no_libtool_file )
@ -710,7 +732,7 @@ macro( tde_add_kdeinit_executable _target )
endif( NOT _plugin_destination ) endif( NOT _plugin_destination )
# create the library # create the library
tde_add_library( kdeinit_${_target} ${_sources} SHARED tde_add_library( kdeinit_${_target} ${_sources} SHARED NO_EXPORT
DESTINATION ${_library_destination} DESTINATION ${_library_destination}
) )
@ -744,15 +766,12 @@ macro( tde_install_symlink _target _link )
set( _destination "${CMAKE_INSTALL_PREFIX}/${_link}" ) set( _destination "${CMAKE_INSTALL_PREFIX}/${_link}" )
endif( IS_ABSOLUTE "${_link}" ) endif( IS_ABSOLUTE "${_link}" )
# prefix with DESTDIR
set( _destination "$ENV{DESTDIR}${_destination}" )
get_filename_component( _path "${_destination}" PATH ) get_filename_component( _path "${_destination}" PATH )
if( NOT IS_DIRECTORY "${_path}" ) if( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" )
install( CODE "file( MAKE_DIRECTORY \"${_path}\" )" ) install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_path}\" )" )
endif( NOT IS_DIRECTORY "${_path}" ) endif( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" )
install( CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ${_target} ${_destination} )" ) install( CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ${_target} \$ENV{DESTDIR}${_destination} )" )
endmacro( tde_install_symlink ) endmacro( tde_install_symlink )
@ -770,10 +789,7 @@ macro( tde_install_empty_directory _path )
set( _destination "${CMAKE_INSTALL_PREFIX}/${_path}" ) set( _destination "${CMAKE_INSTALL_PREFIX}/${_path}" )
endif( IS_ABSOLUTE "${_path}" ) endif( IS_ABSOLUTE "${_path}" )
# prefix with DESTDIR install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_destination}\" )" )
set( _destination "$ENV{DESTDIR}${_destination}" )
install( CODE "file( MAKE_DIRECTORY \"${_destination}\" )" )
endmacro( tde_install_empty_directory ) endmacro( tde_install_empty_directory )

@ -37,6 +37,7 @@ macro( tde_setup_paths )
_tde_internal_setup_path( LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde3/libexec)" ) _tde_internal_setup_path( LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde3/libexec)" )
_tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix" ) _tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix" )
_tde_internal_setup_path( CMAKE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/cmake" "The install dir for cmake import modules" )
_tde_internal_setup_path( PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde3)" ) _tde_internal_setup_path( PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde3)" )
_tde_internal_setup_path( CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir" ) _tde_internal_setup_path( CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir" )
_tde_internal_setup_path( DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data" ) _tde_internal_setup_path( DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data" )

Loading…
Cancel
Save