Open FlexW opened 3 years ago
This works with visual studio (sorry I don't have much experience outside of visual studio):
This is a section within our precompiled header:
#pragma warning( push )
#pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS )
/*
* Any warnings that would normally be generated by included files here will be suppressed.
*/
#pragma warning (pop)
You could try and find whatever analogous solution there is for the compiler you are using.
You could try and find whatever analogous solution there is for the compiler you are using.
This could be a solution, but I think this problem shouldn't occur in the first place. There are a lot of libraries that get build with CMake where I don't have that problem (like glm, assimp, etc.).
In my project, I want that warnings are treated as errors. However, if I add the rttr library to my project with
add_subdirectory(rttr)
and then link against it withtarget_link_libraries(RTTR::Core_Lib)
, my build fails as there are some warnings (that were treated as errors) that come from the rttr library. A solution would be to include the library headers as system headers. I could get along with addingSYSTEM
beforePUBLIC
intarget_include_directories
insrc/rttr/CMakeLists.txt
. I'm not an CMake expert so I don't know if thats the right way to do things. Also have a look at this blog post.Edit: I do add -Werror as a private option to my build target, not as a global flag.