summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2020-06-23 18:59:44 +0200
committerSlávek Banko <[email protected]>2020-06-25 00:43:23 +0200
commitb69bc31c49ae9f6decbfdeba9e3841e7ca3d9b3f (patch)
treeb1049369ed0d104ad7a3e524b08a43cba3766a2a
parenta01b484d37a877e1677eece969bf8669528078ca (diff)
downloadtde-cmake-b69bc31c49ae9f6decbfdeba9e3841e7ca3d9b3f.tar.gz
tde-cmake-b69bc31c49ae9f6decbfdeba9e3841e7ca3d9b3f.zip
tde_create_translated_desktop: Process the source file using configure_file
if it has a ".cmake" extension. Signed-off-by: Slávek Banko <[email protected]> (cherry picked from commit 690e7a7ec30cb96baf8c8f0a3f69969ad074aad1)
-rw-r--r--modules/TDEMacros.cmake19
1 files changed, 13 insertions, 6 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index d547c63..988c63f 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1876,16 +1876,23 @@ macro( tde_create_translated_desktop )
get_filename_component( _basedir ${_basename} PATH )
file( RELATIVE_PATH _basename "${CMAKE_CURRENT_SOURCE_DIR}" "${_basename}" )
- # if no output name specified, use the same as source
- if( NOT _out_name )
- get_filename_component( _out_name ${_src} NAME )
- endif( )
-
# prepare the binary directory according to source directory
file( RELATIVE_PATH _binary_basedir "${CMAKE_CURRENT_SOURCE_DIR}" "${_basedir}" )
set( _binary_basedir "${CMAKE_CURRENT_BINARY_DIR}/${_binary_basedir}" )
file( MAKE_DIRECTORY "${_binary_basedir}" )
+ # process source file as a configuration file if necessary
+ if( "${_src}" MATCHES "\\.cmake$" )
+ configure_file( ${_src} ${_basename} @ONLY )
+ set( ${_src} "${CMAKE_CURRENT_BINARY_DIR}/${_basename}" )
+ string( REGEX REPLACE "\\.cmake$" "" _basename "${_basename}" )
+ endif()
+
+ # if no output name specified, use the same as source
+ if( NOT _out_name )
+ get_filename_component( _out_name ${_basename} NAME )
+ endif( )
+
# if no po directory specified, try to determine it
if( NOT _po_dir )
if( EXISTS ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_basename} AND
@@ -1912,7 +1919,7 @@ macro( tde_create_translated_desktop )
if( _translations )
# prepare a full name for the target
- get_filename_component( _target ${_src} ABSOLUTE )
+ get_filename_component( _target ${_basename} ABSOLUTE )
file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" )
string( REPLACE "/" "+" _target "${_target}-translated" )