summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsamelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-10-27 23:53:16 +0000
committersamelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-10-27 23:53:16 +0000
commite0e9e985b3eae71db46df0375a7cd3adb79400f2 (patch)
tree4e4ec9d7f82123d166e5af82894397a4b7b3c582
parent9476589c12e297ddaa82af20118463bbaeec92f9 (diff)
downloadother-e0e9e985.tar.gz
other-e0e9e985.zip
[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@1190534 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--cmake/modules/TDEMacros.cmake46
-rw-r--r--cmake/modules/TDESetupPaths.cmake1
2 files changed, 32 insertions, 15 deletions
diff --git a/cmake/modules/TDEMacros.cmake b/cmake/modules/TDEMacros.cmake
index 80373d7..88a5ebd 100644
--- a/cmake/modules/TDEMacros.cmake
+++ b/cmake/modules/TDEMacros.cmake
@@ -356,6 +356,7 @@ macro( tde_add_library _arg_target )
unset( _static_pic )
unset( _automoc )
unset( _no_libtool_file )
+ unset( _no_export )
unset( _version )
unset( _sources )
unset( _destination )
@@ -397,6 +398,12 @@ macro( tde_add_library _arg_target )
set( _no_libtool_file 1 )
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"
if( "${_arg}" STREQUAL "VERSION" )
set( _skip_store 1 )
@@ -500,8 +507,17 @@ macro( tde_add_library _arg_target )
set_target_properties( ${_target} PROPERTIES VERSION ${_version} SOVERSION ${_soversion} )
endif( _version )
- # set interface libraries
- target_link_libraries( ${_target} LINK_INTERFACE_LIBRARIES ${_link} )
+ # set interface libraries (only for shared)
+ 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
if( _embed )
@@ -520,7 +536,13 @@ macro( tde_add_library _arg_target )
# set destination directory
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 )
tde_install_libtool_file( ${_target} ${_destination} )
endif( NOT "STATIC" STREQUAL ${_type} AND NOT _no_libtool_file )
@@ -710,7 +732,7 @@ macro( tde_add_kdeinit_executable _target )
endif( NOT _plugin_destination )
# create the library
- tde_add_library( kdeinit_${_target} ${_sources} SHARED
+ tde_add_library( kdeinit_${_target} ${_sources} SHARED NO_EXPORT
DESTINATION ${_library_destination}
)
@@ -744,15 +766,12 @@ macro( tde_install_symlink _target _link )
set( _destination "${CMAKE_INSTALL_PREFIX}/${_link}" )
endif( IS_ABSOLUTE "${_link}" )
- # prefix with DESTDIR
- set( _destination "$ENV{DESTDIR}${_destination}" )
-
get_filename_component( _path "${_destination}" PATH )
- if( NOT IS_DIRECTORY "${_path}" )
- install( CODE "file( MAKE_DIRECTORY \"${_path}\" )" )
- endif( NOT IS_DIRECTORY "${_path}" )
+ if( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" )
+ install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_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 )
@@ -770,10 +789,7 @@ macro( tde_install_empty_directory _path )
set( _destination "${CMAKE_INSTALL_PREFIX}/${_path}" )
endif( IS_ABSOLUTE "${_path}" )
- # prefix with DESTDIR
- set( _destination "$ENV{DESTDIR}${_destination}" )
-
- install( CODE "file( MAKE_DIRECTORY \"${_destination}\" )" )
+ install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_destination}\" )" )
endmacro( tde_install_empty_directory )
diff --git a/cmake/modules/TDESetupPaths.cmake b/cmake/modules/TDESetupPaths.cmake
index b519274..a4735c3 100644
--- a/cmake/modules/TDESetupPaths.cmake
+++ b/cmake/modules/TDESetupPaths.cmake
@@ -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( 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( 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" )