mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-30 09:29:11 +08:00
8f542fd07a
Fixes #37184 When use libexif provide usage, you will get three error: ```` 1> [CMake] CMake Error at F:/test/vcpkg/installed/x64-windows/share/unofficial-libexif/unofficial-libexif-config.cmake:10 (find_library): 1> [CMake] Syntax error in cmake code at 1> [CMake] 1> [CMake] F:/test/vcpkg/installed/x64-windows/share/unofficial-libexif/unofficial-libexif-config.cmake:10 1> [CMake] 1> [CMake] when parsing string 1> [CMake] 1> [CMake] ${z_vcpkg_LIBEXIF_root }/lib 1> [CMake] 1> [CMake] Invalid character (' ') in a variable name: 'z_vcpkg_LIBEXIF_root' ```` ```` 1> [CMake] CMake Error at F:/test/vcpkg/installed/x64-windows/share/unofficial-libexif/unofficial-libexif-config.cmake:10 (find_library): 1> [CMake] Could not find Z_VCPKG_LIBEXIF_LIBRARY_RELEASE using the following names: 1> [CMake] libexif ```` ```` 1> [CMake] CMake Error in CMakeProject1/CMakeLists.txt: 1> [CMake] Imported target "unofficial::libexif::libexif" includes non-existent path 1> [CMake] 1> [CMake] "/include" ```` Change the `unofficial-libexif-config.cmake` file to fix usage error. Usage tested successfully by `libexif:x64-windows`: ```` libexif provides CMake targets: # this is heuristically generated, and may not be correct find_package(unofficial-libexif CONFIG REQUIRED) target_link_libraries(main PRIVATE unofficial::libexif::libexif) ```` - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [ ] ~~SHA512s are updated for each updated download.~~ - [ ] ~~The "supports" clause reflects platforms that may be fixed by this new version.~~ - [ ] ~~Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file.~~ - [ ] ~~Any patches that are no longer applied are deleted from the port's directory.~~ - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is added to each modified port's versions file. --------- Co-authored-by: Jon <v-zhli17@microsoft.com>
31 lines
1.5 KiB
CMake
31 lines
1.5 KiB
CMake
|
|
if(NOT TARGET unofficial::libexif::libexif)
|
|
add_library(unofficial::libexif::libexif UNKNOWN IMPORTED)
|
|
get_filename_component(z_vcpkg_LIBEXIF_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
get_filename_component(z_vcpkg_LIBEXIF_ROOT "${z_vcpkg_LIBEXIF_root}" PATH)
|
|
get_filename_component(z_VCPKG_LIBEXIF_ROOT "${z_vcpkg_LIBEXIF_ROOT}" PATH)
|
|
set_target_properties(unofficial::libexif::libexif PROPERTIES
|
|
INTERFACE_INCLUDE_DIRECTORIES "${z_VCPKG_LIBEXIF_ROOT}/include"
|
|
)
|
|
find_library(Z_VCPKG_LIBEXIF_LIBRARY_RELEASE NAMES exif PATHS "${z_VCPKG_LIBEXIF_ROOT}/lib" NO_DEFAULT_PATH REQUIRED)
|
|
find_library(Z_VCPKG_LIBEXIF_LIBRARY_DEBUG NAMES exif PATHS "${z_VCPKG_LIBEXIF_ROOT}/debug/lib" NO_DEFAULT_PATH)
|
|
|
|
if(EXISTS "${Z_VCPKG_LIBEXIF_LIBRARY_RELEASE}")
|
|
set_property(TARGET unofficial::libexif::libexif APPEND PROPERTY IMPORTED_CONFIGURATIONS "Release")
|
|
set_target_properties(unofficial::libexif::libexif PROPERTIES
|
|
IMPORTED_LOCATION_RELEASE "${Z_VCPKG_LIBEXIF_LIBRARY_RELEASE}"
|
|
)
|
|
endif()
|
|
|
|
if(EXISTS "${Z_VCPKG_LIBEXIF_LIBRARY_DEBUG}")
|
|
set_property(TARGET unofficial::libexif::libexif APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug")
|
|
set_target_properties(unofficial::libexif::libexif PROPERTIES
|
|
IMPORTED_LOCATION_DEBUG "${Z_VCPKG_LIBEXIF_LIBRARY_DEBUG}"
|
|
)
|
|
endif()
|
|
|
|
unset(z_vcpkg_LIBEXIF_root)
|
|
unset(z_vcpkg_LIBEXIF_ROOT)
|
|
unset(z_VCPKG_LIBEXIF_ROOT)
|
|
endif()
|