vcpkg/ports/libjpeg-turbo/vcpkg-cmake-wrapper.cmake
Kai Pastor cb91b416cb
[cmake-user] Verify library location for debug vs. release, fix ports (#21641)
* Verify library location for debug vs. release

* Use existing variables for wrapper

* Always install freetype wrapper

* Quote @expressions

* Set policies for freetype wrapper (#19459)

* Test JPEG

* Fix jpeg wrapper for CMake < 3.12

* Test TIFF

* Test with current and oldest supported CMake

* Test and fix icu cmake wrapper

* CMake policy fixes [skip actions]

* Update versions

* CI

* CI

* Nicole CRs

* Disable Curses test

* Prefer <Pkg>_VAR over <PKG>_VAR

Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2022-04-01 13:30:43 -07:00

39 lines
1.8 KiB
CMake

cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0054 NEW)
find_path(JPEG_INCLUDE_DIR NAMES jpeglib.h PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" NO_DEFAULT_PATH)
find_library(JPEG_LIBRARY_RELEASE NAMES jpeg PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
find_library(JPEG_LIBRARY_DEBUG NAMES jpeg PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
if(CMAKE_VERSION VERSION_LESS 3.12 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set(JPEG_LIBRARY "${JPEG_LIBRARY_DEBUG}" CACHE FILEPATH "")
endif()
_find_package(${ARGS})
if(JPEG_FOUND AND NOT TARGET JPEG::JPEG)
# Backfill JPEG::JPEG to versions of cmake before 3.12
add_library(JPEG::JPEG UNKNOWN IMPORTED)
if(DEFINED JPEG_INCLUDE_DIRS)
set_target_properties(JPEG::JPEG PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${JPEG_INCLUDE_DIRS}")
endif()
if(EXISTS "${JPEG_LIBRARY}")
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${JPEG_LIBRARY}")
endif()
if(EXISTS "${JPEG_LIBRARY_RELEASE}")
set_property(TARGET JPEG::JPEG APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${JPEG_LIBRARY_RELEASE}")
endif()
if(EXISTS "${JPEG_LIBRARY_DEBUG}")
set_property(TARGET JPEG::JPEG APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
IMPORTED_LOCATION_DEBUG "${JPEG_LIBRARY_DEBUG}")
endif()
endif()
cmake_policy(POP)