diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index f6dd338..a4f6320 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} ) @@ -1006,7 +1032,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 @@ -1322,8 +1348,8 @@ endmacro( tde_add_check_executable ) macro( tde_add_kdeinit_executable _target ) - configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_kdeinit_executable.cmake ${_target}_kdeinit_executable.cpp COPYONLY ) - configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_kdeinit_module.cmake ${_target}_kdeinit_module.cpp COPYONLY ) + configure_file( ${TDE_CMAKE_TEMPLATES}/tde_kdeinit_executable.cmake ${_target}_kdeinit_executable.cpp COPYONLY ) + configure_file( ${TDE_CMAKE_TEMPLATES}/tde_kdeinit_module.cmake ${_target}_kdeinit_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_kdeinit_executable.cmake b/templates/tde_kdeinit_executable.cmake similarity index 100% rename from modules/template_kdeinit_executable.cmake rename to templates/tde_kdeinit_executable.cmake diff --git a/modules/template_kdeinit_module.cmake b/templates/tde_kdeinit_module.cmake similarity index 100% rename from modules/template_kdeinit_module.cmake rename to templates/tde_kdeinit_module.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