From be1fee9567b0feae736966468c8f1b480d01890c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 11 Jun 2020 01:55:37 +0200 Subject: Move templates to a separate directory and rename to the tde_ prefix. Create the TDE_CMAKE_ROOT and TDE_CMAKE_TEMPLATES variables. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit 2a847be412bd1dc66e53ea4652cc42f24a412d0f) --- modules/TDEMacros.cmake | 34 ++++++++++++++++++++++++++---- modules/template_dummy_cpp.cmake | 5 ----- modules/template_export_library.cmake | 7 ------- modules/template_libtool_file.cmake | 35 ------------------------------- modules/template_tdeinit_executable.cmake | 2 -- modules/template_tdeinit_module.cmake | 3 --- templates/tde_dummy_cpp.cmake | 5 +++++ templates/tde_export_library.cmake | 7 +++++++ templates/tde_libtool_file.cmake | 35 +++++++++++++++++++++++++++++++ templates/tde_tdeinit_executable.cmake | 2 ++ templates/tde_tdeinit_module.cmake | 3 +++ 11 files changed, 82 insertions(+), 56 deletions(-) delete mode 100644 modules/template_dummy_cpp.cmake delete mode 100644 modules/template_export_library.cmake delete mode 100644 modules/template_libtool_file.cmake delete mode 100644 modules/template_tdeinit_executable.cmake delete mode 100644 modules/template_tdeinit_module.cmake create mode 100644 templates/tde_dummy_cpp.cmake create mode 100644 templates/tde_export_library.cmake create mode 100644 templates/tde_libtool_file.cmake create mode 100644 templates/tde_tdeinit_executable.cmake create mode 100644 templates/tde_tdeinit_module.cmake diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index 7886e39..6e940b0 100644 --- a/modules/TDEMacros.cmake +++ b/modules/TDEMacros.cmake @@ -18,6 +18,32 @@ include( CheckCXXCompilerFlag ) +################################################# +##### +##### initialization... + +if( NOT TDE_CMAKE_ROOT ) + if( ${CMAKE_CURRENT_LIST_DIR} STREQUAL ${CMAKE_ROOT}/Modules ) + + # TDE CMake is installed in the system directory + set( TDE_CMAKE_ROOT ${CMAKE_ROOT} + CACHE FILEPATH "TDE CMake root" ) + set( TDE_CMAKE_TEMPLATES ${TDE_CMAKE_ROOT}/Templates + CACHE FILEPATH "TDE CMake templates" ) + + else() + + # TDE CMake is part of the source code + get_filename_component( TDE_CMAKE_ROOT ${CMAKE_CURRENT_LIST_DIR} PATH ) + set( TDE_CMAKE_ROOT ${TDE_CMAKE_ROOT} + CACHE FILEPATH "TDE CMake root" ) + set( TDE_CMAKE_TEMPLATES ${TDE_CMAKE_ROOT}/templates + CACHE FILEPATH "TDE CMake templates" ) + + endif() +endif() + + ################################################# ##### ##### tde_message_fatal @@ -701,7 +727,7 @@ macro( tde_install_libtool_file _target _destination ) set( _libdir "${CMAKE_INSTALL_PREFIX}/${_destination}" ) endif( IS_ABSOLUTE ${_destination} ) - configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_libtool_file.cmake "${_laname}" @ONLY ) + configure_file( ${TDE_CMAKE_TEMPLATES}/tde_libtool_file.cmake "${_laname}" @ONLY ) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${_laname}" DESTINATION ${_destination} ) @@ -1059,7 +1085,7 @@ macro( tde_add_library _arg_target ) unset( _version ) endif( ) - configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_export_library.cmake "${PROJECT_BINARY_DIR}/export-${_target}.cmake" @ONLY ) + configure_file( ${TDE_CMAKE_TEMPLATES}/tde_export_library.cmake "${PROJECT_BINARY_DIR}/export-${_target}.cmake" @ONLY ) endif( ) # install target @@ -1509,8 +1535,8 @@ endmacro( tde_add_check_executable ) macro( tde_add_tdeinit_executable _target ) - configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_tdeinit_executable.cmake ${_target}_tdeinit_executable.cpp COPYONLY ) - configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_tdeinit_module.cmake ${_target}_tdeinit_module.cpp COPYONLY ) + configure_file( ${TDE_CMAKE_TEMPLATES}/tde_tdeinit_executable.cmake ${_target}_tdeinit_executable.cpp COPYONLY ) + configure_file( ${TDE_CMAKE_TEMPLATES}/tde_tdeinit_module.cmake ${_target}_tdeinit_module.cpp COPYONLY ) unset( _sources ) unset( _runtime_destination ) diff --git a/modules/template_dummy_cpp.cmake b/modules/template_dummy_cpp.cmake deleted file mode 100644 index 8e1f5ff..0000000 --- a/modules/template_dummy_cpp.cmake +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef _AIX - namespace { - void *not_empty_file; - } -#endif diff --git a/modules/template_export_library.cmake b/modules/template_export_library.cmake deleted file mode 100644 index 4d6cb3f..0000000 --- a/modules/template_export_library.cmake +++ /dev/null @@ -1,7 +0,0 @@ -add_library( @_target@ @_type@ IMPORTED ) - -set_target_properties( @_target@ PROPERTIES - IMPORTED_LINK_INTERFACE_LIBRARIES "@_shared_libs@" - IMPORTED_LOCATION "@_location@" - IMPORTED_SONAME "@_soname@" ) - diff --git a/modules/template_libtool_file.cmake b/modules/template_libtool_file.cmake deleted file mode 100644 index fcd73d4..0000000 --- a/modules/template_libtool_file.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# @_laname@ - a libtool library file -# Generated by CMake - GNU libtool -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='@_library_name_2@' - -# Names of this library. -library_names='@_library_name_1@ @_library_name_2@ @_library_name_3@' - -# The name of the static archive. -old_library='' - -# Libraries that this one depends upon. -dependency_libs='' - -# Version information for @_name@. -current=@_version_current@ -age=@_version_age@ -revision=@_version_revision@ - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=@_shouldnotlink@ - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='@_libdir@' diff --git a/modules/template_tdeinit_executable.cmake b/modules/template_tdeinit_executable.cmake deleted file mode 100644 index 3d480c4..0000000 --- a/modules/template_tdeinit_executable.cmake +++ /dev/null @@ -1,2 +0,0 @@ -extern "C" int kdemain(int argc, char* argv[]); -int main(int argc, char* argv[]) { return kdemain(argc,argv); } diff --git a/modules/template_tdeinit_module.cmake b/modules/template_tdeinit_module.cmake deleted file mode 100644 index efd89d8..0000000 --- a/modules/template_tdeinit_module.cmake +++ /dev/null @@ -1,3 +0,0 @@ -#include -extern "C" int kdemain(int argc, char* argv[]); -extern "C" KDE_EXPORT int tdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); } diff --git a/templates/tde_dummy_cpp.cmake b/templates/tde_dummy_cpp.cmake new file mode 100644 index 0000000..8e1f5ff --- /dev/null +++ b/templates/tde_dummy_cpp.cmake @@ -0,0 +1,5 @@ +#ifdef _AIX + namespace { + void *not_empty_file; + } +#endif diff --git a/templates/tde_export_library.cmake b/templates/tde_export_library.cmake new file mode 100644 index 0000000..4d6cb3f --- /dev/null +++ b/templates/tde_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@" ) + diff --git a/templates/tde_libtool_file.cmake b/templates/tde_libtool_file.cmake new file mode 100644 index 0000000..fcd73d4 --- /dev/null +++ b/templates/tde_libtool_file.cmake @@ -0,0 +1,35 @@ +# @_laname@ - a libtool library file +# Generated by CMake - GNU libtool +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='@_library_name_2@' + +# Names of this library. +library_names='@_library_name_1@ @_library_name_2@ @_library_name_3@' + +# The name of the static archive. +old_library='' + +# Libraries that this one depends upon. +dependency_libs='' + +# Version information for @_name@. +current=@_version_current@ +age=@_version_age@ +revision=@_version_revision@ + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=@_shouldnotlink@ + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='@_libdir@' diff --git a/templates/tde_tdeinit_executable.cmake b/templates/tde_tdeinit_executable.cmake new file mode 100644 index 0000000..3d480c4 --- /dev/null +++ b/templates/tde_tdeinit_executable.cmake @@ -0,0 +1,2 @@ +extern "C" int kdemain(int argc, char* argv[]); +int main(int argc, char* argv[]) { return kdemain(argc,argv); } diff --git a/templates/tde_tdeinit_module.cmake b/templates/tde_tdeinit_module.cmake new file mode 100644 index 0000000..efd89d8 --- /dev/null +++ b/templates/tde_tdeinit_module.cmake @@ -0,0 +1,3 @@ +#include +extern "C" int kdemain(int argc, char* argv[]); +extern "C" KDE_EXPORT int tdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); } -- cgit v1.2.1