How to "unescape" CXXFLAGS option using CMake 3.12.3

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to "unescape" CXXFLAGS option using CMake 3.12.3

Chris Rankin
Hi,

I am trying to add this compiler-specific G++ option to CXXFLAGS:

    -frandom-seed=$(shell sha256sum $< | awk '{print $$1}')

This option obviously needs to be parsed by GNU Make before G++ can use it, and so I am doing the following:

    add_compile_options(SHELL:"-frandom-seed=$(shell sha256sum $< | awk '{print $$1}')")

However, CMake is turning this option into nonsense like:

    CXXFLAGS = -g "-frandom-seed=\$$(shell sha256sum \$$< | awk '{print \$$\$$1}')"

Is there any way that I can turn this accursed "escaping" OFF please? All I need is for CMake to write the given command verbatim!

Thanks for any help here,
Cheers,
Chris

P.S. This is for a large build with lots and lots of subdirectories, and so adding this option to CXXFLAGS would be by far the simplest solution - despite what CMake seems to think.



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake