summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsamelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-06 17:29:02 +0000
committersamelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-06 17:29:02 +0000
commit45bcef7b050c2da52a830b9abeadcc661f851c74 (patch)
treeee4570f9d823688ff1a29e1629590803d159830e
parent6b6377bc0165cfb1685c95e26cb45639c9c237e2 (diff)
downloadtde-cmake-45bcef7b.tar.gz
tde-cmake-45bcef7b.zip
[kde-common/cmake] using our own export procedure, for more control
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kde-common/cmake@1212363 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--modules/TDEMacros.cmake51
-rw-r--r--modules/template_export_library.cmake7
2 files changed, 52 insertions, 6 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 4b7bf48..08df111 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -364,6 +364,40 @@ endmacro( tde_install_libtool_file )
#################################################
#####
+##### tde_install_export / tde_import
+
+function( tde_install_export )
+ file( GLOB export_files ${CMAKE_CURRENT_BINARY_DIR}/export-*.cmake )
+
+ set( mode "WRITE" )
+ foreach( filename ${export_files} )
+ file( READ ${filename} content )
+ file( ${mode} "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" "${content}" )
+ set( mode "APPEND" )
+ endforeach( )
+
+ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" DESTINATION ${CMAKE_INSTALL_DIR} )
+endfunction( )
+
+
+macro( tde_import _library )
+ message( STATUS "checking for '${_library}'" )
+ string( TOUPPER "BUILD_${_library}" _build )
+ if( ${_build} )
+ message( STATUS " ok, activated for build" )
+ else()
+ if( EXISTS "${TDE_CMAKE_DIR}/${_library}.cmake" )
+ include( "${TDE_CMAKE_DIR}/${_library}.cmake" )
+ message( STATUS " ok, found import file" )
+ else()
+ tde_message_fatal( "'${_library}' are required,\n but is not installed nor selected for build" )
+ endif()
+ endif()
+endmacro()
+
+
+#################################################
+#####
##### tde_add_library
macro( tde_add_library _arg_target )
@@ -544,7 +578,7 @@ macro( tde_add_library _arg_target )
# set link libraries
if( _link )
target_link_libraries( ${_target} ${_link} )
- endif( _link )
+ endif( )
# set dependencies
if( _dependencies )
@@ -556,14 +590,19 @@ macro( tde_add_library _arg_target )
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 ${PROJECT_NAME} )
- else( "SHARED" STREQUAL ${_type} AND NOT _no_export )
install( TARGETS ${_target} DESTINATION ${_destination} )
- endif( "SHARED" STREQUAL ${_type} AND NOT _no_export )
+ get_target_property( _output ${_target} LOCATION )
+ get_filename_component( _output ${_output} NAME )
+ set( _location "${_destination}/${_output}.${_version}" )
+ set( _soname "${_output}.${_soversion}" )
+ configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_export_library.cmake "${PROJECT_BINARY_DIR}/export-${_target}.cmake" @ONLY )
+ else( )
+ install( TARGETS ${_target} DESTINATION ${_destination} )
+ endif( )
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 )
- endif( _destination )
+ endif( )
+ endif( )
endmacro( tde_add_library )
diff --git a/modules/template_export_library.cmake b/modules/template_export_library.cmake
new file mode 100644
index 0000000..4d6cb3f
--- /dev/null
+++ b/modules/template_export_library.cmake
@@ -0,0 +1,7 @@
+add_library( @_target@ @_type@ IMPORTED )
+
+set_target_properties( @_target@ PROPERTIES
+ IMPORTED_LINK_INTERFACE_LIBRARIES "@_shared_libs@"
+ IMPORTED_LOCATION "@_location@"
+ IMPORTED_SONAME "@_soname@" )
+