This gist packs the header-only CImg library into CMake package to enable reusing code. To use it, follow the instructions below.
- Clone the CImg library and change the command line path into this directory.
- Run
mkdir include && mv CImg.h include/ && mv plugins/ include/. This small change helps better managing the header files. - Put the following two CMake-related files in the CImg project directory.
- Run
mkdir build && cd build - Run
cmake .. -G "MinGW Makefiles". You may change the generator as you want. - Run
cmake install .
Nice! You can now see CImgConfig.cmake and CImgConfigVersion.cmake under the build directory. Then just add it into the PATH system variable and use FIND_PACKAGE (CImg REQUIRED CONFIG) and add ${CIMG_INCLUDE_DIR} into include paths. Enjoy!
- This gist uses example from CMake Documentation.