Skip to content

Commit

Permalink
CMake: also find jconfig.h from libturbojpeg from arch-specific inclu…
Browse files Browse the repository at this point in the history
…de directory

This header file is architecture-dependent and can be stored as:

- /usr/include/i386-linux-gnu/jconfig.h
- /usr/include/x86_64-linux-gnu/jconfig.h

Instead of:

- /usr/include/jconfig.h

Signed-off-by: Thomas Debesse <[email protected]>
  • Loading branch information
illwieckz committed Oct 31, 2022
1 parent 53d2e5d commit c5c393c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/cmake/modules/FindJPEGTurbo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,22 @@ endif ()
if (JPEG_INCLUDE_DIR AND JPEG_LIBRARY)
set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR} CACHE PATH "JPEG include dirs")
set (JPEG_LIBRARIES ${JPEG_LIBRARY} CACHE STRING "JPEG libraries")
file(STRINGS "${JPEG_INCLUDE_DIR}/jconfig.h"

find_path(jconfig_header_file jconfig.h PATHS "${JPEG_INCLUDE_DIR}")

if (NOT jconfig_header_file)
file(GLOB_RECURSE jconfig_header_file_list "${JPEG_INCLUDE_DIR}/*/jconfig.h")

if (jconfig_header_file_list)
list(GET jconfig_header_file_list 0 jconfig_header_file)
endif()

if (NOT jconfig_header_file)
message(FATAL_ERROR "Cannot find jconfig.h from libturbojpeg")
endif()
endif()

file(STRINGS "${jconfig_header_file}"
jpeg_lib_version REGEX "^#define[\t ]+JPEG_LIB_VERSION[\t ]+.*")
if (jpeg_lib_version)
string(REGEX REPLACE "^#define[\t ]+JPEG_LIB_VERSION[\t ]+([0-9]+).*"
Expand Down

0 comments on commit c5c393c

Please sign in to comment.