Is it possible to add _CRT_SECURE_NO_WARNINGS
preprocessor definition using cmake?
add_definitions(-CRT_SECURE_NO_WARNINGS)
add_definitions(-_CRT_SECURE_NO_WARNINGS)
add_definitions(_CRT_SECURE_NO_WARNINGS)
These are what I've tried so far. None of these attempts were successful.
Use this:
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
See here for the official documentation.
The general form is:
add_definitions(-DFOO -DBAR ...)
Note that, if it's intended for a single target, you should rather use target_compile_definitions
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With