On 08/03/2018 07:12 PM, Simon Richter wrote: > string(APPEND CMAKE_CXX_FLAGS > "$<IF:$<SOURCE_PROPERTY:GENERATED>,${WARN_SHADOW_OFF},${WARN_SHADOW_ON}> ")
The generators put the project-/target-wide flags in a place that does not depend on the source being compiled so there would be no way to evaluate that. On some generators per-source flags produce a huge slowdown in the build (e.g. VS) so splitting up the settings for every source is not practical. We already run into this in the COMPILE_LANGUAGE generator expression: https://cmake.org/cmake/help/v3.12/manual/cmake-generator-expressions.7.html See the note there about how it is handled on VS and Xcode. > The only way I can think of doing this would be to remove the global > warning flag definitions from the toplevel CMakeLists.txt Per-source flags are placed after the target-wide flags on the command line so you could just keep -Wshadow by default and then add -Wno-shadow to the COMPILE_FLAGS source file property of the generated sources. Alternatively you could use an object library for all the generated sources and then set its target-wide flags to use "-Wno-shadow", or even "-w". -Brad -- 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-developers