当前位置:网站首页>Solve cmakelist find_ Package cannot find Qt5, ECM cannot be found

Solve cmakelist find_ Package cannot find Qt5, ECM cannot be found

2022-07-05 16:39:00 Trendy technology research society

  Compiling a cmake When the project is , Need to use ECM, So using vcpkg install ecm, Results the installation was successful , however cmake Still don't recognize ,find_package Report errors , Can't find ecm Location , Obviously ,vcpkg install ecm To packages Under the path , This packages The path is not cmake Find the

Now , We need to be in CMakeList Add path description to the file , That is to use set 了 .

As shown in the figure below ,Qt5 Can directly set, however ECM, I can't find it ECM How to set the path of ,Qt5_DIR We often see , however ECM_DIR But I have never seen , Obviously , Give it a try , no way .

Then I tried to vcpkg in packages In the catalog ecm Installation directory share Copy the directory directly to cmake share Directory ,cmake Successfully found ecm, But that's normal ,cmake Look under your own path , It must be found .

find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} )

set(Qt5_DIR "D:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5")
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Svg Concurrent)

 

 

原网站

版权声明
本文为[Trendy technology research society]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207051556081849.html