1
0
mirror of https://github.com/libjpeg-turbo/libjpeg-turbo.git synced 2026-10-23 11:48:53 +03:00
Files
libjpeg-turbo/release/Config.cmake.in
DRC 240e20d87c Build: Try to find libspng via CMake config file
Currently only vcpkg and Slackware seem to provide a libspng CMake
package config file, and the one in Slackware is slightly broken.  (It
doesn't include CMakeFindDependencyMacro, so find_dependency() fails.)
Thus, I am only barely confident that this works.

CMakeLists.txt:

- If WITH_SYSTEM_SPNG, silently try to find libspng via a CMake package
  config file and fall back to using pkg-config.

- If WITH_SYSTEM_SPNG, allow the imported libspng target to be
  overridden with a new CMake variable (SPNG_TARGET.)

Config.cmake.in:

- If WITH_SYSTEM_SPNG, call find_dependency(SPNG) if the libspng
  imported target doesn't start with PkgConfig::.

Further addresses limitations discussed in #901
2026-07-16 11:40:33 -04:00

25 lines
640 B
CMake

@PACKAGE_INIT@
set(WITH_SYSTEM_SPNG @WITH_SYSTEM_SPNG@)
set(WITH_SYSTEM_ZLIB @WITH_SYSTEM_ZLIB@)
if(WITH_SYSTEM_SPNG OR WITH_SYSTEM_ZLIB)
include(CMakeFindDependencyMacro)
if(WITH_SYSTEM_SPNG)
set(SPNG_LIBRARY @SPNG_LIBRARY@)
if(SPNG_LIBRARY MATCHES "PkgConfig::")
find_dependency(PkgConfig)
if(PkgConfig_FOUND)
pkg_check_modules(spng REQUIRED spng IMPORTED_TARGET)
endif()
else()
find_dependency(SPNG)
endif()
else()
find_dependency(ZLIB)
endif()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@Targets.cmake")
check_required_components("@CMAKE_PROJECT_NAME@")