From 2a847be412bd1dc66e53ea4652cc42f24a412d0f 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: [PATCH] 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 --- modules/TDEMacros.cmake | 34 ++++++++++++++++--- .../tde_dummy_cpp.cmake | 0 .../tde_export_library.cmake | 0 .../tde_libtool_file.cmake | 0 .../tde_tdeinit_executable.cmake | 0 .../tde_tdeinit_module.cmake | 0 6 files changed, 30 insertions(+), 4 deletions(-) rename modules/template_dummy_cpp.cmake => templates/tde_dummy_cpp.cmake (100%) rename modules/template_export_library.cmake => templates/tde_export_library.cmake (100%) rename modules/template_libtool_file.cmake => templates/tde_libtool_file.cmake (100%) rename modules/template_tdeinit_executable.cmake => templates/tde_tdeinit_executable.cmake (100%) rename modules/template_tdeinit_module.cmake => templates/tde_tdeinit_module.cmake (100%) diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index 9ffcfa0..e45de66 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/templates/tde_dummy_cpp.cmake similarity index 100% rename from modules/template_dummy_cpp.cmake rename to templates/tde_dummy_cpp.cmake diff --git a/modules/template_export_library.cmake b/templates/tde_export_library.cmake similarity index 100% rename from modules/template_export_library.cmake rename to templates/tde_export_library.cmake diff --git a/modules/template_libtool_file.cmake b/templates/tde_libtool_file.cmake similarity index 100% rename from modules/template_libtool_file.cmake rename to templates/tde_libtool_file.cmake diff --git a/modules/template_tdeinit_executable.cmake b/templates/tde_tdeinit_executable.cmake similarity index 100% rename from modules/template_tdeinit_executable.cmake rename to templates/tde_tdeinit_executable.cmake diff --git a/modules/template_tdeinit_module.cmake b/templates/tde_tdeinit_module.cmake similarity index 100% rename from modules/template_tdeinit_module.cmake rename to templates/tde_tdeinit_module.cmake