microsoft / vcpkg

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

cmake files for Qt5LinguistTools and other executables from qt-tools are not configured properly #2834

Closed yosagi closed 6 years ago

yosagi commented 6 years ago

Some executables such as lrelease.exe in qt-tools are installed under "vcpkg\installed\x64-windows\tools\qt5-tools". However, multiple cmake files installed by qt-tools including Qt5LinguistToolsConfig.cmake, point the executable at the wrong directory

    set(imported_location "${_qt5_linguisttools_install_prefix}/tools/qt5/lrelease.exe")

The location should be .../tools/qt5-tools/lrelease.exe.

Minimal CMakeLists.txt for reproducing this problem:

Project(QL)
Find_package(Qt5 COMPONENTS LinguistTools)
QT5_CREATE_TRANSLATION(QM_files test.cc test.ts)

CMake Error from the CMakeLists.txt

CMake Error at C:/opt/vc141win64-vcpkg/vcpkg/installed/x64-windows/share/cmake/Qt5LinguistTools/Qt5LinguistToolsConfig.cmake:10 (message):
  The package "Qt5LinguistTools" references the file

     "C:/opt/vc141win64-vcpkg/vcpkg/installed/x64-windows/tools/qt5/lrelease.exe"

  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

     "C:/opt/vc141win64-vcpkg/vcpkg/installed/x64-windows/share/cmake/Qt5LinguistTools/Qt5LinguistToolsConfig.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  C:/opt/vc141win64-vcpkg/vcpkg/installed/x64-windows/share/cmake/Qt5LinguistTools/Qt5LinguistToolsConfig.cmake:26 (_qt5_LinguistTools_check_file_exists)
  C:/opt/vc141win64-vcpkg/vcpkg/installed/x64-windows/share/cmake/Qt5/Qt5Config.cmake:28 (find_package)
  CMakeLists.txt:2 (Find_package)

I think qt5-scxml package also affected by this problem.

yosagi commented 6 years ago

Modifying such paths by fixcmake.py in qt5-modularscripts could avoid this problem.

Possible solution: https://github.com/yosagi/vcpkg/commit/6e2a34cbbdd130fd141cf82a94a9098cbd1e6a72

cmpute commented 6 years ago

A pull request is welcomed! 😄

ras0219-msft commented 6 years ago

PR gratefully accepted :)

longhuan2018 commented 5 years ago

Fixcmake.py Modify the tools/qt5 in the cmake file of the qt tool to the tools/${port} directory, but it only considers the file suffix of windows. Add the suffix of linux and osx to the regular expression to fix the issue. #8029