diff --git a/CMakeLists.txt b/CMakeLists.txt index 8274416c3..d4e81c7d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.5.1) project(CodeCompass) # Common config variables and settings diff --git a/Functions.cmake b/Functions.cmake index 8b8a52613..c97ce9f8e 100644 --- a/Functions.cmake +++ b/Functions.cmake @@ -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) diff --git a/webgui/InstallGUI.cmake b/webgui/InstallGUI.cmake index 78445a275..90c63011d 100644 --- a/webgui/InstallGUI.cmake +++ b/webgui/InstallGUI.cmake @@ -1,3 +1,6 @@ +# Utility functions +include(../Functions.cmake) + message("Install npm packages...") if(${CC_PACKAGE} IS_NEWER_THAN ${INSTALL_SCRIPTS_DIR}/package.json) @@ -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