How to extract compile flags from setting CMAKE_CXX_STANDARD
I'm using the following function to setup precompiled headers for unix. The goal is to extract all flags and definitions from the current target and add them to the command line for compiling the precompiled header.
The problem is, I set CMAKE_CXX_STANDARD to sth above 11 which will result in -std=gnu++11 being set in any of my target's compilation units. However the appropriate flag isn't captured by the above function. It seems like the flag is added after the function runs (I call it after add_executable or add_library) or not being visible to query on the target at all. What's an appropriate solution here?