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 111a08942a)
r14.0.x
Slávek Banko 4 years ago
parent f8bcc8f595
commit 356a15955c
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -1914,7 +1914,12 @@ macro( tde_create_translated_desktop )
get_filename_component( _basename ${_src} ABSOLUTE ) get_filename_component( _basename ${_src} ABSOLUTE )
get_filename_component( _basedir ${_basename} PATH ) get_filename_component( _basedir ${_basename} PATH )
file( RELATIVE_PATH _sourcename "${CMAKE_SOURCE_DIR}" "${_basename}" ) file( RELATIVE_PATH _sourcename "${CMAKE_SOURCE_DIR}" "${_basename}" )
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 ) string( SUBSTRING "${_basename}" 0 ${CMAKE_BINARY_DIR_LEN} _basedir_prefix )
endif( )
if( ${_basedir_prefix} STREQUAL "${CMAKE_BINARY_DIR}" ) if( ${_basedir_prefix} STREQUAL "${CMAKE_BINARY_DIR}" )
file( RELATIVE_PATH _basename "${CMAKE_CURRENT_BINARY_DIR}" "${_basename}" ) file( RELATIVE_PATH _basename "${CMAKE_CURRENT_BINARY_DIR}" "${_basename}" )
set( _binsuffix ".out" ) set( _binsuffix ".out" )

Loading…
Cancel
Save