How to strip trailing whitespace in CMake variable?

前端 未结 4 1435
悲哀的现实
悲哀的现实 2020-12-09 18:50

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:

#         


        
4条回答
  •  清歌不尽
    2020-12-09 19:16

    This strips terminating newline in the variable :

    string(REGEX REPLACE "\n$" ""  "${}")
    

    Works for one of the project I involved to since CMake 2.8.

提交回复
热议问题