Skip to content
Snippets Groups Projects
Commit 3250910f authored by Georgiy Lebedev's avatar Georgiy Lebedev Committed by Vladimir Davydov
Browse files

build: replace `string` with JOIN option to `string_join` helper in CMake

`string` with JOIN option is only available since CMake 3.12, but we have
developers using CMake 3.1: implement a utility `string_join` function to
remove this dependency.

Closes #5881

NO_CHANGELOG=<build fix>
NO_DOC=<build fix>
NO_TEST=<build fix>

(cherry picked from commit 55298308)
parent 992ea525
No related branches found
No related tags found
No related merge requests found
include(cmake/utils.cmake)
#
# Check if the same compile family is used for both C and CXX
#
......@@ -240,7 +242,7 @@ macro(enable_tnt_compile_flags)
if (NOT CMAKE_COMPILER_IS_CLANG)
message(FATAL_ERROR "Undefined behaviour sanitizer only available for clang")
else()
string(JOIN "," SANITIZE_FLAGS
string_join("," SANITIZE_FLAGS
alignment bool bounds builtin enum float-cast-overflow
float-divide-by-zero function integer-divide-by-zero return
shift unreachable vla-bound
......
......@@ -114,3 +114,21 @@ function(file_is_in_directory varname file dir)
set(${varname} TRUE PARENT_SCOPE)
endif()
endfunction()
# string() has JOIN option but only since 3.12.
function(string_join
glue
string_out
)
set(result "")
set(is_first_item TRUE)
foreach(item IN LISTS ARGN)
if(is_first_item)
set(result "${item}")
set(is_first_item FALSE)
else()
set(result "${result}${glue}${item}")
endif()
endforeach()
set(${string_out} ${result} PARENT_SCOPE)
endfunction()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment