gpt4 book ai didi

c++ - CMakeList 设置 CMAKE_PREFIX_PATH

转载 作者:搜寻专家 更新时间:2023-10-31 00:25:45 36 4
gpt4 key购买 nike

如果我跑

cmake -DCMAKE_PREFIX_PATH=/home/rip/Qt/5.12.1/gcc_64/lib/cmake

一切正常。但是如果我写

set(CMAKE_PREFIX_PATH "/home/rip/Qt/5.12.1/gcc_64/lib/cmake")

CMakeLists.txt中只运行cmake,出现如下错误信息:

Could not find a package configuration file provided by "Qt5Quick" with any
of the following names:

Qt5QuickConfig.cmake
qt5quick-config.cmake

这是完整的代码:

set(CMAKE_CXX_FLAGS " -O3 -fopenmp")
set(CMAKE_PREFIX_PATH "/home/rip/Qt/5.12.1/gcc_64/lib/cmake")

project(${PROJECT_NAME} LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(SOURCES main.cpp Test5.cpp )
set(HAEDERS Test5.h )
set(RESOURCES qml.qrc )

find_package(Qt5 COMPONENTS Core Quick REQUIRED)
add_executable(${PROJECT_NAME} ${SOURCES} ${HAEDERS} ${RESOURCES})
target_compile_definitions(${PROJECT_NAME} PRIVATE $,$>:QT_QML_DEBUG>)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick)

最佳答案

前缀路径是一个路径列表。使用这个:

list(APPEND CMAKE_PREFIX_PATH "/home/rip/Qt/5.12.1/gcc_64")

此外,您不必直接指向配置文件路径,您也可以指向包含 lib/cmake/...

的目录

关于c++ - CMakeList 设置 CMAKE_PREFIX_PATH,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55120611/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com