string() used with REPLACE command inserts a line feed '\n' at the end of the processed string
The function string() used with REPLACE command inserts a line feed '\n' at the end of the processed string.
https://cmake.org/cmake/help/v3.0/command/string.html?highlight=string%20replace
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE COMPILER_VERSION)
string(REPLACE "." "" COMPILER_VERSION "${COMPILER_VERSION}")
# workaround
#string(REGEX REPLACE "\n$" "" COMPILER_VERSION "${COMPILER_VERSION}")