Hello, in our code base we would like to add a warning compilation flags. Nevertheless, this flag prevents us from compiling a few targets so we would like to remove this flag for the given targets.
If I'm right (I'm far from being a cmake expert) there are two ways to define "global" compilation flags: 1- set the CXX_COMPILE_FLAGS variable; 2- use add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-WMyFavouriteWarning). Since I don't want to *add* a compilation flags but remove one, I would like to retrieve the properties of the target (get_target_property(my_compilation_flags TARGET COMPILE_FLAGS)), and then modify those and use it to set the properties of the target. Two questions for me remain: 1- How do I get *all* the compilation flags used for a target? get_target_property doesn't return flags is CXX_COMPILE_FLAGS nor those added by add_compile_options. 2- How do I *replace* compilation flags and don't *add* compilation flags? Both target_compile_options and set_target_properties seems to *add* flags and don't replace. Everything is tested under linux and cmake 3.13.3. Thanks for you help, any pointer to a ressource that might contain useful information for this problem would be really appreciated. Regards, -- Benjamin Orgogozo -- 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