CMake find_package cannot find my MinGW libjpeg
I am getting error: Could not find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR) when using
FIND_PACKAGE(JPEG REQUIRED)
IF(JPEG_FOUND)
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(mpo ${JPEG_LIBRARIES})
ENDIF()
I have libjpeg installed under
C:\MinGW\
|-lib\ for libjpeg.a
|-include\ for jpeglib.h
Did I miss something? I am using MSYS Makefiles generator
+3
source to share
1 answer
You need to make sure CMake knows where to look for your libraries / headers. Some search modules provide a hint of where to look, it looks like FindJPEG.cmake does not.
- You can specify the location of the JPEG lib by specifying JPEG_LIBRARY and JPEG_INCLUDE_DIR via
-DJPEG_LIBRARY:PATH=C:/MinGW/lib/libjpeg.a -DJPEG_INCLUDE_DIR:PATH=C:/MinGW/include/
when running cmake (or add these variables using CMake GUI) - You can add C: \ MinGW \ lib and C: \ MinGW \ include to the respective CMake environment variables (see http://www.cmake.org/Wiki/CMake_Useful_Variables#Environment_Variables )
+2
source to share