microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22k stars 6.12k forks source link

vcpkg ignoring default-features: false in custom overlay #38686

Closed patrikhuber closed 1 month ago

patrikhuber commented 1 month ago

Describe the bug .\vcpkg.exe install my-test-package --overlay-ports=C:\Users\MyUser\vcpkg-custom-overlay --dry-run where my-test-package has a vcpkg.json with:

  "dependencies": [
    {
      "name" : "vcpkg-cmake",
      "host" : true
    },
    {
      "name" : "vcpkg-cmake-config",
      "host" : true
    },
    {
      "name": "opencv4",
      "default-features": false
    }
  }

ignores the default-features: false flag and wants to install: * opencv4[core,default-features,dnn,jpeg,png,quirc,tiff,webp]:x64-windows@4.8.0#19

Environment

To Reproduce Steps to reproduce the behavior:

  1. git clone https://github.com/Microsoft/vcpkg.git vcpkg-clean
  2. cd .\vcpkg-clean\
  3. .\bootstrap-vcpkg.bat
  4. .\vcpkg.exe install my-test-package --overlay-ports=C:\Users\MyUser\vcpkg-custom-overlay --dry-run

produces the following output:

Computing installation plan...
The following packages will be built and installed:
    my-test-package:x64-windows@1.0.0 -- C:\Users\PatrikHuber\Projects\vcpkg-custom-overlay\my-test-package
  * flatbuffers:x64-windows@24.3.25
  * libjpeg-turbo:x64-windows@3.0.2
  * liblzma:x64-windows@5.4.4
  * libpng:x64-windows@1.6.43#1
  * libwebp[core,libwebpmux,nearlossless,simd,unicode]:x64-windows@1.4.0#1
  * opencv4[core,default-features,dnn,jpeg,png,quirc,tiff,webp]:x64-windows@4.8.0#19
  * protobuf:x64-windows@3.21.12#2
  * quirc:x64-windows@1.2
  * tiff[core,jpeg,lzma,zip]:x64-windows@4.6.0#4
  * vcpkg-cmake:x64-windows@2024-04-18
  * vcpkg-cmake-config:x64-windows@2022-02-06#1
  * vcpkg-get-python-packages:x64-windows@2024-01-24
  * zlib:x64-windows@1.3.1
Additional packages (*) will be modified to complete this operation.

Expected behavior It should only install opencv4[core], without default-features (dnn etc.).

Failure logs See above.

Additional context

- vcpkg-custom-overlay/my-test-package/portfile.cmake:

vcpkg_from_gitlab( GITLAB_URL https://gitlab.com OUT_SOURCE_PATH SOURCE_PATH REPO private/private REF "${VERSION}" SHA512 0 HEAD_REF main )

vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" )

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(PACKAGE_NAME "my-test-package")

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY)

JonLiu1993 commented 1 month ago

Duplicate of #35694

patrikhuber commented 1 month ago

Thank you @JonLiu1993, I posted a comment in that other issue.