How to add conan CMake build definition

When building a library using conan, this is the default definition for building using CMake

cmake = CMake(self)

You can easily add definitions like this:

cmake.definitions["MY_FLAG"] = "1"

This will generate -DMY_FLAG=1 when calling CMake

Full example:

cmake = CMake(self)
cmake.definitions["USE_SYSTEM_CPR"] = "1

Note that you need to add all cmake.definitions calls before calling cmake.configure()