Add cmake option WITH_JXL

ON = Force required
OFF = Optional
This commit is contained in:
xiota 2024-04-10 13:44:09 +00:00
parent 7715d15615
commit b2550abd83

View File

@ -222,6 +222,7 @@ option(USE_EXPERIMENTAL_LANG_VERSIONS "Build with -std=c++0x" OFF)
option(BUILD_SHARED "Build with shared libraries" OFF)
option(WITH_BENCHMARK "Build with benchmark code" OFF)
option(WITH_MYFILE_MMAP "Build using memory mapped file" ON)
option(WITH_JXL "Build with JPEG XL import support" OFF)
option(WITH_LTO "Build with link-time optimizations" OFF)
option(WITH_SAN "Build with run-time sanitizer" OFF)
option(WITH_PROF "Build with profiling instrumentation" OFF)
@ -552,7 +553,12 @@ if(WITH_SYSTEM_KLT)
find_package(KLT REQUIRED)
endif()
pkg_check_modules(JXL IMPORTED_TARGET libjxl libjxl_threads)
set(JXL_LIBS "libjxl libjxl_threads")
if(WITH_JXL)
pkg_check_modules(JXL REQUIRED IMPORTED_TARGET ${JXL_LIBS})
else()
pkg_check_modules(JXL IMPORTED_TARGET ${JXL_LIBS})
endif()
if(JXL_FOUND)
add_definitions(-DLIBJXL)
endif()