Describe the bug
The target and plugin properties in the CMake config files for referencing the library filename do not match the actual filename on disk for the triplet x64-osx. When linking against a Qt5 target via CMake, this results in an error message, that the file does not exist.
The portfile.cmake currently removes the debug-specific config files and the script fixcmake.py does not correctly update the release-specific one for the Qt5 macOS build. Qt5 on macOS adds the postfix _debug to all files.
Environment
To Reproduce
Steps to reproduce the behavior:
$ ls installed/x64-osx/debug/lib/libQt5Core_debug.a
installed/x64-osx/debug/lib/libQt5Core_debug.a
$ grep "libQt5Core" installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake
_populate_Core_target_properties(RELEASE "libQt5Core.a" "" )
_populate_Core_target_properties(DEBUG "libQt5Core.a" "" )
$ grep "libQt5Core" buildtrees/qt5-base/x64-osx-dbg/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
_populate_Core_target_properties(DEBUG "libQt5Core_debug.a" "" )
Expected behavior
The target and plugin properties in all Qt5 CMake config files should match the actual filename on disk, e.g., the correct entry for target properties in installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake should be:
_populate_Core_target_properties(DEBUG "libQt5Core_debug.a" "" )
and the correct entry for plugin properties, e.g., in installed/x64-osx/share/cmake/Qt5Gui/Qt5Gui_QCocoaIntegrationPlugin.cmake should be:
_populate_Gui_plugin_properties(QCocoaIntegrationPlugin DEBUG "platforms/libqcocoa_debug.a")
Failure logs
CMake error when trying to link against target Qt5::Core after using find_package():
CMake Error at /Users/test/vcpkg/installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake:15 (message):
The imported target "Qt5::Core" references the file
"/Users/test/vcpkg/installed/x64-osx/debug/lib/libQt5Core.a"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/Users/test/vcpkg/installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake"
but not all the files it references.
Call Stack (most recent call first):
/Users/test/vcpkg/installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake:35 (_qt5_Core_check_file_exists)
/Users/test/vcpkg/installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake:156 (_populate_Core_target_properties)
/Users/test/vcpkg/installed/x64-osx/share/qt5core/vcpkg-cmake-wrapper.cmake:1 (_find_package)
/Users/test/vcpkg/scripts/buildsystems/vcpkg.cmake:240 (include)
/Users/test/vcpkg/installed/x64-osx/share/cmake/Qt5/Qt5Config.cmake:28 (find_package)
/Users/test/vcpkg/scripts/buildsystems/vcpkg.cmake:285 (_find_package)
CMakeLists.txt:129 (find_package)
should already be fixed in #9705 since I remove the fixcmake.py script and patched the config.in instead. The python script was just too fragile and it seemed to never really work for all cases.
I've just tested a build with #9705 on x64-osx and that seems to fix this issue.
@JackBoosY: this can be closed.
Most helpful comment
I've just tested a build with #9705 on x64-osx and that seems to fix this issue.