Skip to content

Commit

Permalink
Remove usage of string(JOIN ...)
Browse files Browse the repository at this point in the history
This is not implemented in cmake 3.4. Instead create omr_join utility
function with the same behaviour

Signed-off-by: Devin Nakamura <devinn@ca.ibm.com>
  • Loading branch information
dnakamura committed Mar 21, 2019
1 parent 5b1c2ad commit bbe9052
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cmake/modules/OmrDDRSupport.cmake
Expand Up @@ -25,6 +25,7 @@ endif()
set(_OMR_DDR_SUPPORT 1)

include(OmrAssert)
include(OmrUtility)
include(ExternalProject)

set(OMR_MODULES_DIR ${CMAKE_CURRENT_LIST_DIR})
Expand Down Expand Up @@ -71,7 +72,7 @@ function(target_enable_ddr tgt ddr_set)

get_property(DDR_BIN_DIR TARGET "${DDR_SET_TARGET}" PROPERTY DDR_BIN_DIR)

string(JOIN "\n" MAGIC_TEMPLATE
omr_join("\n" MAGIC_TEMPLATE
"SOURCE_DIR"
"$<TARGET_PROPERTY:${tgt},SOURCE_DIR>"
"INCLUDE_PATH"
Expand Down
9 changes: 8 additions & 1 deletion cmake/modules/OmrUtility.cmake
Expand Up @@ -58,10 +58,17 @@ function(omr_remove_flags variable)
set(${variable} "${result}" PARENT_SCOPE)
endfunction(omr_remove_flags)

# omr_join(<output_variable> <item>...)
# takes given items an joins them with <glue>, places result in output variable
function(omr_join glue output)
string(REGEX REPLACE "(^|[^\\]);" "\\1${glue}" result "${ARGN}")
set(${output} "${result}" PARENT_SCOPE)
endfunction(omr_join)

# omr_stringify(<output_variable> <item>...)
# Convert items to a string of space-separated items.
function(omr_stringify output)
string(REPLACE ";" " " result "${ARGN}")
omr_join(" " result ${ARGN})
set(${output} ${result} PARENT_SCOPE)
endfunction(omr_stringify)

Expand Down

0 comments on commit bbe9052

Please sign in to comment.