Skip to content

Commit

Permalink
CODECS: Don't use REQUIRED with find_library() as it requires CMake 3.18
Browse files Browse the repository at this point in the history
  • Loading branch information
HappySeaFox committed Dec 9, 2023
1 parent 3bddd3f commit f60af90
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/sail-codecs/jpegxl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
find_library(JPEGXL_LIBRARY jxl NAMES jxl jxl-static ${SAIL_CODEC_JPEGXL_REQUIRED_OPTION})
find_library(JPEGXL_THREADS_LIBRARY jxl_threads NAMES jxl_threads jxl_threads-static ${SAIL_CODEC_JPEGXL_REQUIRED_OPTION})
find_path(JPEGXL_INCLUDE_DIRS jxl/decode.h ${SAIL_CODEC_JPEGXL_REQUIRED_OPTION})
# Don't use SAIL_CODEC_JPEGXL_REQUIRED_OPTION as it requires CMake 3.18
#
find_library(JPEGXL_LIBRARY jxl NAMES jxl jxl-static)
find_library(JPEGXL_THREADS_LIBRARY jxl_threads NAMES jxl_threads jxl_threads-static)
find_path(JPEGXL_INCLUDE_DIRS jxl/decode.h)

if (NOT JPEGXL_LIBRARY OR NOT JPEGXL_THREADS_LIBRARY OR NOT JPEGXL_INCLUDE_DIRS)
return()
if (SAIL_CODEC_JPEGXL_REQUIRED_OPTION STREQUAL "REQUIRED")
message(FATAL_ERROR "JPEGXL: Missing dependencies")
else()
return()
endif()
endif()

# Find dependencies for static builds as libjxl doesn't provide CMake configs
Expand Down
10 changes: 8 additions & 2 deletions src/sail-codecs/svg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ find_path(SVG_INCLUDE_DIRS resvg.h)
#
if (NOT SVG_LIBRARY OR NOT SVG_INCLUDE_DIRS)
set(SVG_LIBRARY "")
find_path(SVG_INCLUDE_DIRS nanosvg/nanosvg.h ${SAIL_CODEC_SVG_REQUIRED_OPTION})
# Don't use SAIL_CODEC_SVG_REQUIRED_OPTION as it requires CMake 3.18
#
find_path(SVG_INCLUDE_DIRS nanosvg/nanosvg.h)

if (NOT SVG_INCLUDE_DIRS)
return()
if (SAIL_CODEC_SVG_REQUIRED_OPTION STREQUAL "REQUIRED")
message(FATAL_ERROR "SVG: Missing dependencies")
else()
return()
endif()
endif()
else()
set(SAIL_RESVG ON)
Expand Down

0 comments on commit f60af90

Please sign in to comment.