Skip to content

Commit e492071

Browse files
author
Christian Beier
committed
CMake: test jpeglib.h header for TurboVNC if compile check fails
1 parent 708efe1 commit e492071

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,16 @@ if(WITH_JPEG)
106106
set(CMAKE_REQUIRED_DEFINITIONS)
107107

108108
if(NOT FOUND_LIBJPEG_TURBO)
109-
message(WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***")
109+
# last-resort grep check (when using LibVNCServer as a CMake subdir together with turbojpeg CMake subdir, the build check above fails since turbojpeg is not yet built when LibVNCServer is configured)
110+
if(JPEG_INCLUDE_DIR MATCHES "\..*") # is relative?
111+
set(JPEGLIB_H_PATH "${CMAKE_SOURCE_DIR}/${JPEG_INCLUDE_DIR}/jpeglib.h")
112+
else()
113+
set(JPEGLIB_H_PATH "${JPEG_INCLUDE_DIR}/jpeglib.h")
114+
endif()
115+
file(STRINGS ${JPEGLIB_H_PATH} FOUND_LIBJPEG_TURBO REGEX "JCS_EXT_RGB")
116+
if(NOT FOUND_LIBJPEG_TURBO)
117+
message(WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***")
118+
endif()
110119
endif()
111120
endif(JPEG_FOUND)
112121
endif(WITH_JPEG)

0 commit comments

Comments
 (0)