I am new to cmake and made a cmake project with scaffolding provided by qt creator. I added a library (assimp) in source form. While compiling my project with the default kit (mingw), I get errors that all have the following:
error: ignoring '#pragma warning ' [-Werror=unknown-pragmas]
I understand that the flag "-Werror=unknown-pragmas" asks the compiler to treat unknown pragmas as errors. Assimp has many pragma directives that gcc doesn't understand so I would like to not pass that flag to the compiler. I looked in settings and can't find where the flag is set. How do I disable it so that my program compiles?
[edit]: I searched cmake files of Assimp library and couldn't find culprit compiler flag. It makes me think it has to do with what qt passes to cmake when invoking it. In the Projects->Build Settings->Cmake->Initial Configuration, I found:
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
What does this evaluate to?
[edit]: I found a cache variable in Assimp that enables warnings as errors. Forgive me for not looking in well enough.
Revelant code in assimp/code/cmakelists.txt:
IF (ASSIMP_WARNINGS_AS_ERRORS)
MESSAGE(STATUS "Treating all warnings as errors (for assimp library only)")
IF (MSVC)
TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX)
ELSE()
TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror)
ENDIF()
ENDIF()