M1-Mac Qt5 CMakeLists.txt

#--------------Project Config Begin --------------#
cmake_minimum_required(VERSION 3.17)
project(untitled CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
#--------------Project Config Begin --------------#


#--------------Add Targets of Project Begin --------------#
add_executable(${PROJECT_NAME} main.cpp)
#add_library(${PROJECT_NAME} main.cpp)
#--------------Add Targets of Project End --------------#


#--------------Qt CMake Config Begin --------------#
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

set(QT_VERSION 5)

#   specific the cmake-prefix-path of qt5
set(CMAKE_PREFIX_PATH /opt/homebrew/Cellar/qt@5/5.15.2_1/lib/cmake)
if (NOT CMAKE_PREFIX_PATH)
    message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it "
            "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)")
endif ()

#   select the libs
set(REQUIRED_LIBS Core Gui Widgets)
set(REQUIRED_LIBS_QUALIFIED Qt5::Core Qt5::Gui Qt5::Widgets)
find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED)
#   link to project
target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED})
#--------------Qt CMake Config End --------------#

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值