Open FuturehomeDinoSaric opened 1 year ago
Hey, thanks for raising the issue! I wasn't aware of these checks and agree that CPM should not create warnings if possible. Once we manage to resolve it, probably it would be a good idea to add these checks in CI as well.
I believe I'm having the same problem. I tried bumping CPM to v0.38.1 and using the SYSTEM
keyword to resolve this but it did not. Would you expect that to fix this or is it a separate issue?
I don't think setting the SYSTEM
keyword would help here, we rather should initialise the variables with reasonable defaults.
I don't think setting the
SYSTEM
keyword would help here, we rather should initialise the variables with reasonable defaults.
Sorry, still very new to CMake. I'm not too sure what you mean by the above. However, the following fixed my problem. I suppressed the warning emitted by the dependency using target_compile_options
. Does this seem appropriate to you?
CPMAddPackage("gh:pboettch/json-schema-validator#2.2.0")
target_compile_options(nlohmann_json_schema_validator PRIVATE -Wno-error=unused-const-variable)
@fng97 I think we're confusing warnings coming from CMake and the C / C++ compiler. From my understanding this issue is about CMake warning that CPM specific variables are not properly initialised in CMake. Your fix targets compiler options relevant for building the actual C / C++ source code.
@TheLartians
@fng97 I think we're confusing warnings coming from CMake and the C / C++ compiler. From my understanding this issue is about CMake warning that CPM specific variables are not properly initialised in CMake. Your fix targets compiler options relevant for building the actual C / C++ source code.
Oops, I think you're right 😅
I would like to bump this issue as I'm still encountering these warnings in the latest release. I think it would be a great user experience benefit to address this.
When using the latest version of CPM.cmake (0.37.0) and configuring the cmake with flags
--warn-unused-vars
and--warn-uninitialized
I get warnings: