Skip to content

Commit

Permalink
Replace list(JOIN) CMake function with custom implementation, so requ…
Browse files Browse the repository at this point in the history
…ired CMake version can be lowered.
  • Loading branch information
mcserep committed Oct 1, 2020
1 parent 4e62435 commit 4e7118c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.5.1)
project(CodeCompass)

# Common config variables and settings
Expand Down
8 changes: 8 additions & 0 deletions Functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,11 @@ function(fancy_message _str _colour _isBold)
${CMAKE_COMMAND} -E env CLICOLOR_FORCE=1
${CMAKE_COMMAND} -E cmake_echo_color ${COLOUR_TAG} ${BOLD_TAG} ${_str})
endfunction(fancy_message)

# Joins a list of elements with a given glue string.
# See: https://stackoverflow.com/questions/7172670/best-shortest-way-to-join-a-list-in-cmake
function(join _values _glue _output)
string (REGEX REPLACE "([^\\]|^);" "\\1${_glue}" _tmpStr "${_values}")
string (REGEX REPLACE "[\\](.)" "\\1" _tmpStr "${_tmpStr}") #fixes escaping
set (${_output} "${_tmpStr}" PARENT_SCOPE)
endfunction(join)
5 changes: 4 additions & 1 deletion webgui/InstallGUI.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Utility functions
include(../Functions.cmake)

message("Install npm packages...")

if(${CC_PACKAGE} IS_NEWER_THAN ${INSTALL_SCRIPTS_DIR}/package.json)
Expand Down Expand Up @@ -25,7 +28,7 @@ foreach(_jsfile ${_jsfiles})
string(REGEX REPLACE "\\.js*$" "" _jsfile ${_jsfile})
list(APPEND DOJO_VIEWLIST "'${_jsfile}'")
endforeach()
list(JOIN DOJO_VIEWLIST ", " DOJO_VIEWLIST)
join("${DOJO_VIEWLIST}" ", " DOJO_VIEWLIST)

set(DOJO_OPTIMIZE "") # optimization for non-layer modules
set(DOJO_LAYEROPTIMIZE "") # optimization for layer modules
Expand Down

0 comments on commit 4e7118c

Please sign in to comment.