From 260a5fce3adf2fcca5575c9e64cf9f5f0bb485cf Mon Sep 17 00:00:00 2001 From: Riccardo Maria Bianchi <riccardo.maria.bianchi@cern.ch> Date: Tue, 30 Jun 2020 16:20:22 +0200 Subject: [PATCH] Modified CMake code to be 3.10 compliant, because Ubuntu 18 ships 3.10 by default (apt) --- CMakeLists.txt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 93d37b571..380fe9b36 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,11 +66,27 @@ if(GEOMODEL_BUILD_GEOMODELG4 OR GEOMODEL_BUILD_EXAMPLES_W_GEANT4) endif() +# A function to get a string with comma-separated package names from a list of packages +# NOTE: We could make use of list(JOIN ...) on CMake >= 3.12, +# but Ubuntu 18 pat package installs 3.10 instead +function(getCSVStringFromList inputList outputString) + message("input: ${inputList}") + set(tempList "") + foreach( item ${inputList}) + list(APPEND tempList ${item}) + endforeach() + string (REPLACE ";" ", " outStr "${tempList}") + message("string: ${outStr}") + set( ${outputString} ${outStr} PARENT_SCOPE) +endfunction() # Let the users know which and how many packages they are building list(LENGTH BUILT_PACKAGES BUILT_PACKAGES_LENGTH) -list(JOIN BUILT_PACKAGES ", " BUILT_PACKAGES_STR) +# +# list(JOIN BUILT_PACKAGES ", " BUILT_PACKAGES_STR) # list(JOIN) needs /CMake 3.12, which is missing on Ubuntu 18 by default +getCSVStringFromList( "${BUILT_PACKAGES}" BUILT_PACKAGES_STR ) +# message(STATUS "${BoldWhite}-----${ColourReset}") message( STATUS "${BoldGreen}Building the following ${BUILT_PACKAGES_LENGTH} packages: ${BUILT_PACKAGES_STR}${ColourReset}") message(STATUS "${BoldWhite}-----${ColourReset}") -- GitLab