We are trying to improve the makefiles produced by CMake. For Clang, GCC and ICC, we want to add -march=native. The block to do so looks like:
-march=native
#
This strips terminating newline in the variable :
string(REGEX REPLACE "\n$" "" "${}")
Works for one of the project I involved to since CMake 2.8.