summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2021-01-27 22:29:06 +0100
committerSlávek Banko <slavek.banko@axis.cz>2021-01-27 22:31:08 +0100
commit356a15955cd717c20e4f8de29f7c36a6f38883ef (patch)
tree8b27e81ee8bc9b65ed601d6a914afd0bf1ac17c1
parentf8bcc8f59595cd15a8a88a65807a93af0e38432f (diff)
downloadtde-cmake-356a15955cd717c20e4f8de29f7c36a6f38883ef.tar.gz
tde-cmake-356a15955cd717c20e4f8de29f7c36a6f38883ef.zip
tde_create_translated_desktop: Prevent FTBFS if the length
of CMAKE_BINARY_DIR is longer than the tested _basename. Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 111a08942a8b5452cd51f41e6f811d55de30c657)
-rw-r--r--modules/TDEMacros.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index ffc890a..4507430 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1914,7 +1914,12 @@ macro( tde_create_translated_desktop )
get_filename_component( _basename ${_src} ABSOLUTE )
get_filename_component( _basedir ${_basename} PATH )
file( RELATIVE_PATH _sourcename "${CMAKE_SOURCE_DIR}" "${_basename}" )
- string( SUBSTRING "${_basename}" 0 ${CMAKE_BINARY_DIR_LEN} _basedir_prefix )
+ string( LENGTH "${_basename}" _basename_len )
+ if( ${_basename_len} LESS ${CMAKE_BINARY_DIR_LEN} )
+ set( _basedir_prefix "${CMAKE_SOURCE_DIR}" )
+ else( )
+ string( SUBSTRING "${_basename}" 0 ${CMAKE_BINARY_DIR_LEN} _basedir_prefix )
+ endif( )
if( ${_basedir_prefix} STREQUAL "${CMAKE_BINARY_DIR}" )
file( RELATIVE_PATH _basename "${CMAKE_CURRENT_BINARY_DIR}" "${_basename}" )
set( _binsuffix ".out" )