因此,我正在尝试将我一直在从事的该项目从qmake移植到cmake。我还计划通过Conan获得我的qt依赖关系,并开始提供CI服务。 使用qt/5.12.4@bincrafters/stable可以轻松获得大多数qt库。除了一个。由于某些原因,该软件包中不包含Qt5Svg模块,并且我找不到适合的解决方案,所以我陷入了困境。下面是错误消息和相关的cmake文件。
错误消息
[sCM / analysis_tool / CMakeLists.txt:33(find_package)上的[CMake] CMake错误:
[CMake]通过在此项目的CMAKE_MODULE_PATH中不提供“ FindQt5Svg.cmake”
[CMake]要求CMake查找“ Qt5Svg”提供的程序包配置文件,但是
[CMake] CMake找不到一个。
[CMake]
[CMake]找不到“ Qt5Svg”提供的程序包配置文件以及任何
以下名称的[CMake]:
[CMake]
[CMake] Qt5SvgConfig.cmake
[CMake] qt5svg-config.cmake
[CMake]
[CMake]将安装前缀“ Qt5Svg”添加到CMAKE_PREFIX_PATH或设置
[CMake]“ Qt5Svg_DIR”到包含上述文件之一的目录。如果是“ Qt5Svg”
[CMake]提供了单独的开发包或SDK,请确保已被
[CMake]已安装。
Conan.cmake (从顶层CMakeLists.txt文件调用)
base/
可执行CMake
macro(run_conan)
# Download automatically, you can also just copy the conan.cmake file
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
message(${CMAKE_BINARY_DIR};)
file(DOWNLOAD "https://github.com/conan-io/cmake-conan/raw/v0.15/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_add_remote(
NAME
bincrafters
URL
https://api.bintray.com/conan/bincrafters/public-conan)
conan_cmake_run(
REQUIRES
qt/5.12.4@bincrafters/stable
OPTIONS
${CONAN_EXTRA_OPTIONS}
BASIC_SETUP
CMAKE_TARGETS # individual targets to link to
BUILD
missing)
endmacro()
所有其他模块似乎都安装得很好(Qt5Core Qt5Widgets等),我可以在.conan文件夹中找到它们,而在Qt5Svg文件夹中找不到。感谢您抽出宝贵的时间阅读此内容。
答案 0 :(得分:0)
您需要提供和选择以使用qt软件包构建qtsvg
。您的conan_cmake_run
应该如下所示:
cmake_minimum_required(VERSION 3.8)
project(codego)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOUIC_SEARCH_PATHS ui)
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
message(${CMAKE_BINARY_DIR};)
file(DOWNLOAD "https://github.com/conan-io/cmake-conan/raw/v0.15/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_add_remote(
NAME
bincrafters
URL
https://api.bintray.com/conan/bincrafters/public-conan)
conan_cmake_run(
REQUIRES qt/5.14.1@bincrafters/stable
OPTIONS qt:qtsvg=True
BASIC_SETUP
CMAKE_TARGETS
BUILD missing
)
编辑:我使用qt 5.14.1,因为由于一些过时的软件包,导致5.12.4无法在osx机器上构建。现在,当我做ls
时:
ls ~/.conan/data/qt/5.14.1/bincrafters/stable/package/<package_id>/lib/cmake/
在文件夹中给我Qt5Svg