Question: why add_library(project_warnings INTERFACE) is not inside cmake/CompilerWarnings.cmake?
Talkless opened this issue · comments
Sorry for maybe a silly and obvious question, but since I'm qmake user switching to cmake.. why is that it's not CompilerWarnings.cmake
that defines that INTERFACE
fake-library called project_warnings
to be used in all targets you might need? CompilerWarnings.cmake
would seem kinda more "complete" if it did by itself.
Or is there some sort of CMake limitation, or better flexibility to do that in two-step: helper .cmake
has a function, but target created on the root CMakeLists.txt
?
Thanks!
@Talkless This is intentional to give finer grained control over which compiler warnings get applied to which sub projects.
For example - we don't want a noisy third-party library to cause a bunch of warnings. This way we link in the project_warnings in the projects we have (and we may have many sub projects, which is another reason we cannot do it automatically in CompilerWarnings.cmake, because we don't know all of the possible sub project names at this point.)