Define a preprocessor macro through CMake
For a long time, CMake had the add_definitions command for this purpose. However, recently the command has been superseded by a more fine grained approach (separate commands for compile definitions, include directories, and compiler options). An example using the new add_compile_definitions: add_compile_definitions(OPENCV_VERSION=${OpenCV_VERSION}) add_compile_definitions(WITH_OPENCV2) Or: add_compile_definitions(OPENCV_VERSION=${OpenCV_VERSION} WITH_OPENCV2) The good part about this is that it circumvents … Read more