How to strip trailing whitespace in CMake variable?

前端 未结 4 1430
悲哀的现实
悲哀的现实 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:13

    Adding dollar sign and curly braces, ${UNAME_MACHINE}, results in the same original problem (the newline is still present).

    If you use curly braces you also need quote marks. EG:

    string(STRIP "${UNAME_MACHINE}" UNAME_MACHINE)
    

提交回复
热议问题