Skip to content

Commit

Permalink
[giflib] Fix multi-config find_package(GIF) (#27369)
Browse files Browse the repository at this point in the history
* Fix multi-config find_package(GIF)

* Update versions

* Fix invalid vcpkg tool output

* Update versions
  • Loading branch information
dg0yt authored Oct 28, 2022
1 parent 763ec7a commit acd359d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ports/giflib/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ vcpkg_cmake_configure(
vcpkg_cmake_install()
vcpkg_copy_pdbs()

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/gif")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
4 changes: 4 additions & 0 deletions ports/giflib/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The package giflib is compatible with built-in CMake targets:

find_package(GIF REQUIRED)
target_link_libraries(main PRIVATE GIF::GIF)
25 changes: 25 additions & 0 deletions ports/giflib/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
find_path(GIF_INCLUDE_DIR NAMES gif_lib.h PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" NO_DEFAULT_PATH)
find_library(GIF_LIBRARY_RELEASE NAMES gif PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
find_library(GIF_LIBRARY_DEBUG NAMES gif PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
include(SelectLibraryConfigurations)
select_library_configurations(GIF)
set(GIF_LIBRARY "${GIF_LIBRARY}" CACHE STRING "")
unset(GIF_LIBRARY)
unset(GIF_FOUND)
if(NOT TARGET GIF::GIF)
add_library(GIF::GIF UNKNOWN IMPORTED)
set_target_properties(GIF::GIF PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GIF_INCLUDE_DIR}"
IMPORTED_CONFIGURATIONS RELEASE
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${GIF_LIBRARY_RELEASE}"
)
if("${GIF_LIBRARY_DEBUG}")
set_property(TARGET GIF::GIF APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(GIF::GIF PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
IMPORTED_LOCATION_DEBUG "${GIF_LIBRARY_DEBUG}")
endif()
endif()
_find_package(${ARGS})
2 changes: 1 addition & 1 deletion ports/giflib/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "giflib",
"version": "5.2.1",
"port-version": 2,
"port-version": 3,
"description": "A library for reading and writing gif images.",
"homepage": "https://sourceforge.net/projects/giflib/",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2610,7 +2610,7 @@
},
"giflib": {
"baseline": "5.2.1",
"port-version": 2
"port-version": 3
},
"ginkgo": {
"baseline": "1.4.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/g-/giflib.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "8ba54b2de43f1fe619e5a7e554f108fc01a771da",
"version": "5.2.1",
"port-version": 3
},
{
"git-tree": "5b5833304ba0e1be5ff125f265d1f2e1098a93cb",
"version": "5.2.1",
Expand Down

0 comments on commit acd359d

Please sign in to comment.