diff options
author | samelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-01-06 17:29:02 +0000 |
---|---|---|
committer | samelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-01-06 17:29:02 +0000 |
commit | 5c180c43bec355fe35c113c6c51be837fb5899f2 (patch) | |
tree | 842828c3c87949ba39cd4510e73f2e5a7b7cc842 /cmake/modules | |
parent | 2098cacfe9ed67d0db29435e6328bc3f7b0fcd66 (diff) | |
download | other-5c180c43bec355fe35c113c6c51be837fb5899f2.tar.gz other-5c180c43bec355fe35c113c6c51be837fb5899f2.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@1212363 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/TDEMacros.cmake | 51 | ||||
-rw-r--r-- | cmake/modules/template_export_library.cmake | 7 |
2 files changed, 52 insertions, 6 deletions
diff --git a/cmake/modules/TDEMacros.cmake b/cmake/modules/TDEMacros.cmake index 4b7bf48..08df111 100644 --- a/cmake/modules/TDEMacros.cmake +++ b/cmake/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/cmake/modules/template_export_library.cmake b/cmake/modules/template_export_library.cmake new file mode 100644 index 0000000..4d6cb3f --- /dev/null +++ b/cmake/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@" ) + |