Refactor cmake code
MODIFY
test/CMakeLists.txt
test/CMakeLists.txt
if(NOT CMAKE_VERSION VERSION_LESS 3.12)
list(JOIN PRNG_SEEDS ", " PRNG_SEEDS_INITIALIZER)
else() # Workaround for not having string(JOIN) and list(JOIN)
- # https://stackoverflow.com/a/31880875/1476661
- function (ListToString result delim)
- list(GET ARGV 2 temp)
- math(EXPR N "${ARGC}-1")
- if((${N} GREATER 3) OR (${N} EQUAL 3))
- foreach(IDX RANGE 3 ${N})
- list(GET ARGV ${IDX} STR)
- set(temp "${temp}${delim}${STR}")
- endforeach()
+ set(PRNG_SEEDS_INITIALIZER "")
+ foreach(PRNG_SEED ${PRNG_SEEDS})
+ if(PRNG_SEEDS_INITIALIZER STREQUAL "")
+ set(PRNG_SEEDS_INITIALIZER "${PRNG_SEED}")
+ else()
+ set(PRNG_SEEDS_INITIALIZER "${PRNG_SEEDS_INITIALIZER}, ${PRNG_SEED}")
endif()
- set(${result} "${temp}" PARENT_SCOPE)
- endfunction(ListToString)
- ListToString(PRNG_SEEDS_INITIALIZER ", " ${PRNG_SEEDS})
+ endforeach()
message(${PRNG_SEEDS_INITIALIZER})
endif()

Refactor cmake code (#208)