Skip to content

[cmake-user] Test multi-config cmake usage - #27408

Draft
Kai Pastor (dg0yt) wants to merge 12 commits into
microsoft:masterfrom
dg0yt:multi-config
Draft

Kai Pastor (dg0yt) wants to merge 12 commits into
microsoft:masterfrom
dg0yt:multi-config

Conversation

@dg0yt

Copy link
Copy Markdown
Contributor

github-actions[bot]
github-actions Bot previously approved these changes Oct 23, 2022
@dg0yt

Copy link
Copy Markdown
Contributor Author

Example output,
buildtrees/cmake-user/x64-linux-3.24.0-find-package-ICU-release-out.log:

-- find_package(ICU) check: success
-- ICU_LIBRARIES: /home/dg0yt/vcpkg/installed/x64-linux/debug/lib/libicudata.a;/home/dg0yt/vcpkg/installed/x64-linux/debug/lib/libicudata.a
-- Configuring incomplete, errors occurred!

buildtrees/cmake-user/x64-linux-3.24.0-find-package-ICU-release-err.log:

CMake Error at CMakeLists.txt:103 (message):
  Unguarded debug lib during multi-config usage:
  /home/dg0yt/vcpkg/installed/x64-linux/debug/lib/libicudata.a


CMake Error at CMakeLists.txt:103 (message):
  Unguarded debug lib during multi-config usage:
  /home/dg0yt/vcpkg/installed/x64-linux/debug/lib/libicudata.a

@Neumann-A

Copy link
Copy Markdown
Contributor

Multi config will always be a bit buggy because of vendored/custom Find<pkg>.cmake scripts which doesn't concern themselves with multi config at all. There is also no way to fix it since adding vcpkg-cmake-wrappers for all those custom scripts is not really and option. Furthermore FindPkgConfig itself doesn't work in multi config.

@dg0yt

Copy link
Copy Markdown
Contributor Author

Multi config will always be a bit buggy because of vendored/custom Find.cmake scripts which doesn't concern themselves with multi config at all.

I don't care much about vendored copies. All the tests in cmake-user are for Kitware's Find modules. Still, vcpkg gets the bug reports (cf. port giflib).

Results from CI, x64-windows release

-- Running tests with CMake 3.24.0 for 'release'
--   find_package(BZip2)
--   find_package(CURL)
--   find_package(EXPAT)
--   find_package(Fontconfig)
--   find_package(Freetype)
--   find_package(Intl)
CMake Error at scripts/test_ports/cmake-user/portfile.cmake:209 (message):
    CMake 3.24.0: configuration with `find_package(Intl)` failed.
    See logs for more information:
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-Intl-release-out.log
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-Intl-release-err.log

Call Stack (most recent call first):
  scripts/test_ports/cmake-user/portfile.cmake:232 (test_cmake_project)
  scripts/ports.cmake:147 (include)


--   find_package(GIF)
CMake Error at scripts/test_ports/cmake-user/portfile.cmake:209 (message):
    CMake 3.24.0: configuration with `find_package(GIF)` failed.
    See logs for more information:
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-GIF-release-out.log
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-GIF-release-err.log

Call Stack (most recent call first):
  scripts/test_ports/cmake-user/portfile.cmake:232 (test_cmake_project)
  scripts/ports.cmake:147 (include)


--   find_package(ICU)
--   find_package(Iconv)
CMake Error at scripts/test_ports/cmake-user/portfile.cmake:209 (message):
    CMake 3.24.0: configuration with `find_package(Iconv)` failed.
    See logs for more information:
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-Iconv-release-out.log
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-Iconv-release-err.log

Call Stack (most recent call first):
  scripts/test_ports/cmake-user/portfile.cmake:232 (test_cmake_project)
  scripts/ports.cmake:147 (include)


--   find_package(JPEG)
--   find_package(LibLZMA)
--   find_package(PNG)
--   find_package(PostgreSQL)
CMake Error at scripts/test_ports/cmake-user/portfile.cmake:209 (message):
    CMake 3.24.0: configuration with `find_package(PostgreSQL)` failed.
    See logs for more information:
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-PostgreSQL-release-out.log
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-PostgreSQL-release-err.log

Call Stack (most recent call first):
  scripts/test_ports/cmake-user/portfile.cmake:232 (test_cmake_project)
  scripts/ports.cmake:147 (include)


--   find_package(LibXml2)
CMake Error at scripts/test_ports/cmake-user/portfile.cmake:209 (message):
    CMake 3.24.0: configuration with `find_package(LibXml2)` failed.
    See logs for more information:
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-LibXml2-release-out.log
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-LibXml2-release-err.log

Call Stack (most recent call first):
  scripts/test_ports/cmake-user/portfile.cmake:232 (test_cmake_project)
  scripts/ports.cmake:147 (include)


--   find_package(LibXslt)
CMake Error at scripts/test_ports/cmake-user/portfile.cmake:209 (message):
    CMake 3.24.0: configuration with `find_package(LibXslt)` failed.
    See logs for more information:
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-LibXslt-release-out.log
      D:/buildtrees/cmake-user/x64-windows-3.24.0-find-package-LibXslt-release-err.log

Call Stack (most recent call first):
  scripts/test_ports/cmake-user/portfile.cmake:232 (test_cmake_project)
  scripts/ports.cmake:147 (include)


--   find_package(TIFF)
--   find_package(wxWidgets)
--   find_package(ZLIB)
--   find_package(ZLIBviaPkgConfig)

github-actions[bot]
github-actions Bot previously approved these changes Oct 23, 2022
@LilyWangLL Lily Wang (LilyWangLL) added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Oct 24, 2022
github-actions[bot]
github-actions Bot previously approved these changes Nov 5, 2022

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one portfile where deprecated functions are used.

Details

If you feel able to do so, please consider migrating them to the new functions:
vcpkg_install_cmake -> vcpkg_cmake_install (from port vcpkg-cmake)
vcpkg_build_cmake -> vcpkg_cmake_build (from port vcpkg-cmake)
vcpkg_configure_cmake -> vcpkg_cmake_configure (Please remove the option PREFER_NINJA) (from port vcpkg-cmake)
vcpkg_fixup_cmake_targets -> vcpkg_cmake_config_fixup (from port vcpkg-cmake-config)
vcpkg_extract_source_archive_ex -> vcpkg_extract_source_archive
vcpkg_build_msbuild -> vcpkg_install_msbuild
vcpkg_copy_tool_dependencies -> vcpkg_copy_tools
vcpkg_apply_patches should be replaced by the PATCHES arguments to the "extract" helpers (e.g. vcpkg_from_github())

In the ports that use the new function, you have to add the corresponding dependencies:

{
  "name": "vcpkg-cmake",
  "host": true
},
{
  "name": "vcpkg-cmake-config",
  "host": true
}

The following files are affected:

  • scripts/test_ports/cmake-user/portfile.cmake

github-actions[bot]
github-actions Bot previously approved these changes Jan 27, 2023
@BillyONeal

Copy link
Copy Markdown
Member

Closing this PR because it's been in draft without changes for more than a year. Please feel free to recreate or reopen!

@dg0yt

Copy link
Copy Markdown
Contributor Author

Cannot reopen...

@LilyWangLL

Copy link
Copy Markdown
Contributor

Cannot reopen...

If you want to reopen this PR, please ping us anytime. Do you want to reopen this PR now?

@dg0yt

Copy link
Copy Markdown
Contributor Author

yes

@BillyONeal

Copy link
Copy Markdown
Member

Hmm... reopening a PR shouldn't require permissions

@dg0yt

Copy link
Copy Markdown
Contributor Author

Hmm... reopening a PR shouldn't require permissions

It does, in this repo. And we are complaining almost every time.

endif()

message(STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
if(CMAKE_GENERATOR MATCHES "Multi-Config|Visual Studio")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been hitting this issue with xcode, which I think this check would miss - Perhaps can use the GENERATOR_IS_MULTI_CONFIG property instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.
(IIRC the actual problem with this PR was/is how many official Find modules did/do not support vcpkg's multiconfig installation layout.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed. But the test port controls the generator, together with additional options.

Copilot AI balanced review requested due to automatic review settings October 21, 2026 23:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Generator selection breaks CMake 3.16 tests, and the build arguments do not exercise the intended default-versus-active configuration mismatch.

2 open issues
What changed in this PR

Extends the cmake-user test port to check multi-configuration CMake usage, targeting configuration-specific library selection regressions such as #26833 and the fix in #27369.

Changes:

  • Selects Ninja Multi-Config for dual-configuration triplets and passes explicit configurations to package builds.
  • Adds generator diagnostics and checks for unguarded Debug or Release library paths.

Validation was limited to source inspection; no builds were run.

File Description
scripts/​test_ports/​cmake-user/​project/​CMakeLists.txt Adds configuration diagnostics and multi-config library checks.
scripts/​test_ports/​cmake-user/​portfile.cmake Selects generators and supplies configuration-specific build arguments.

Review effort: Balanced

Comment thread scripts/test_ports/cmake-user/portfile.cmake Outdated
Comment thread scripts/test_ports/cmake-user/portfile.cmake Outdated
@dg0yt

Copy link
Copy Markdown
Contributor Author

Testing single-config for CMake 3.16 and for single-config (CI: x64-windows-release).

Considering MSVS and XCode as regular multi-config consumers.

For x64-windows multi-config, the failing packages are:

  • Fontconfig
  • Intl
  • LAPACK
  • Iconv
  • SQLite3

For arm64-osx multi-config, the failing packages are:

  • GnuTLS
  • Curses
  • SQLite3
  • wxWidgets

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist no-stale Issue will not be marked as stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants