首页 > 其他分享 >mingw64 cmake build command

mingw64 cmake build command

时间:2024-03-11 21:00:50浏览次数:25  
标签:00 set cmake qt mingw64 command build hello

mingw64 cmake  build command

 

cmake_minimum_required(VERSION 3.5)

project(00_qt_hello VERSION 0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check https://doc.qt.io/qt/deployment-android.html for more information.
# They need to be set before the find_package( ...) calls below.

#if(ANDROID)
#    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
#    if (ANDROID_ABI STREQUAL "armeabi-v7a")
#        set(ANDROID_EXTRA_LIBS
#            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
#            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
#    endif()
#endif()

find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets LinguistTools REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets LinguistTools REQUIRED)

set(TS_FILES 00_qt_hello_zh_CN.ts)

set(PROJECT_SOURCES
        main.cpp
        mainwindow.cpp
        mainwindow.h
        mainwindow.ui
        ${TS_FILES}
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
    qt_add_executable(00_qt_hello
        MANUAL_FINALIZATION
        ${PROJECT_SOURCES}
    )

    qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
else()
    if(ANDROID)
        add_library(00_qt_hello SHARED
            ${PROJECT_SOURCES}
        )
    else()
        add_executable(00_qt_hello
            ${PROJECT_SOURCES}
        )
    endif()

    qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
endif()

target_link_libraries(00_qt_hello PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

set_target_properties(00_qt_hello PROPERTIES
    MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)

if(QT_VERSION_MAJOR EQUAL 6)
    qt_finalize_executable(00_qt_hello)
endif()

 

# cmake gen cache
"C:\cmake\bin\cmake.exe" -S D:/mydevelop/mydemo/00_qt_hello -B D:/mydevelop/mydemo/build-00_qt_hello-mingw64-Release "-GMinGW Makefiles" "-DCMAKE_BUILD_TYPE:STRING=Release" "-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=D:/program/qtcreator-mingw64/share/qtcreator/package-manager/auto-setup.cmake" "-DQT_QMAKE_EXECUTABLE:STRING=D:/program/qt5.15.12-mingw64/bin/qmake.exe" "-DCMAKE_PREFIX_PATH:STRING=D:/program/qt5.15.12-mingw64" "-DCMAKE_C_COMPILER:STRING=C:/mingw64/bin/gcc.exe" "-DCMAKE_CXX_COMPILER:STRING=C:/mingw64/bin/g++.exe" 

# cmake cache update
"C:\cmake\bin\cmake.exe" -S D:/mydevelop/mydemo/00_qt_hello -B D:/mydevelop/mydemo/build-00_qt_hello-mingw64-Release

# cmake target clean
"C:\cmake\bin\cmake.exe" --build D:/mydevelop/mydemo/build-00_qt_hello-mingw64-Release --target clean

# cmake target all
"C:\cmake\bin\cmake.exe" --build D:/mydevelop/mydemo/build-00_qt_hello-mingw64-Release --target all

# running target
"D:\mydevelop\mydemo\build-00_qt_hello-mingw64-Release\00_qt_hello.exe"

 

======= End

 

 

 

 

 

 

标签:00,set,cmake,qt,mingw64,command,build,hello
From: https://www.cnblogs.com/lsgxeva/p/18067029

相关文章

  • [Learn]Build a Business Application Using CAP for Node.js
    https://developers.sap.com/mission.cp-starter-extensions-cap.html1、使用VSCode创建服务https://developers.sap.com/tutorials/cp-apm-nodejs-create-service.html 通过使用SAPCloud应用程序编程模型(CAP)并在本地环境中进行开发,使用CoreData&Services(CDS)、N......
  • vscode+cmake开发,头文件显示找不到(转载)
    原文地址:https://blog.csdn.net/lizy_fish/article/details/106376080 vsc在cmake开发当中会遇到,编辑器的插件判断头文件包含路径有问题。但是实际上通过cmake编译是正常的。特别是qt+vscode开发的时候,这个问题会导致编辑器的智能提示完全没有或者有误(比如包含这个文件的容......
  • error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft
       Defaultingtouserinstallationbecausenormalsite-packagesisnotwriteableCollectingPyQt5-sipUsingcachedPyQt5_sip-12.13.0.tar.gz(123kB)Installingbuilddependencies...doneGettingrequirementstobuildwheel...donePreparing......
  • StringBuilder
    StringBuilder的介绍问题:为什么要学习StringBuilder?回答:因为StringBuilder可以大幅度提升字符串的操作效率场景:如果今后涉及到字符串的拼接操作,拼接次数过于频繁,请一定要使用StringBuilder介绍:StringBuilder是可变的字符序列StringBuilder......
  • WPF 解决 CommandParameter 参数不更新问题
    参考https://devbox.cn/p/WPFCommandParame_71b81418.html环境软件/系统版本说明WindowsWindows10专业版22H219045.4046MicrosoftVisualStudioMicrosoftVisualStudioCommunity2022(64位)-17.6.5Microsoft.NetSDK8.0.101手动安装Mic......
  • 【深度解析】'go build'缓存机制:揭秘Windows下缓慢的原因
    引言本文主要围绕gobuild的缓存hash计算与获取缓存文件来编写。  笔者是Windows系统用户,在gobuild或golist-export一些需要编译(但已存在编译缓存)场景下执行的很慢。网上有很多说法大多都是说关闭杀毒软件、关闭磁盘扫描等,并未清楚的描述为什么。  接下来我将围绕g......
  • JavaScript 打包器esbuild的基础使用
    esbuild是一种类似于webpack的极速JavaScript打包器。esbuild项目主要目标是:开辟一个构建工具性能的新时代,创建一个易用的现代打包器。先安装esbuildnpmiesbuild-g-g代表全局范围检查esbuild的版本esbuild--version命令行构建esbuildsrc\app.jsx--bundle--outfi......
  • CMake教程
    学习使用一个工具最好的办法是从它的官方文档入手。这篇CMake教程搭配的CMake版本是3.25,参考的文档地址:https://cmake.org/cmake/help/v3.25/guide/tutorial/index.html。在官网的教程完成以后,就是一日又一日地补充。第1步1️⃣从最基本的开始练习1、构建一个基本的工程需要......
  • Qt开发,报错:Error while building/deploying project untitled (kit: ....)
    1、问题描述 Qt开发,编译时,报错如下:1Cannotfindfile:F:\linux\...\Console.pro.213:49:47:进程"D:\Qt\Qt5.14.2\5.14.2\msvc2017_64\bin\qmake.exe"退出,退出代码2。3Errorwhilebuilding/deployingprojectConsole(kit:DesktopQt5.14.2MSVC201764bit)4......
  • 【教程】HBuilderX开发实践:隐私合规检测问题解决方案
    文章目录摘要引言正文1、违规收集个人信息2、APP强制、频繁、过度索取权限知识点补充总结 摘要本篇博客介绍了在使用HBuilderX进行开发过程中,常遇到的隐私合规问题,并提供了相应的解决方案。主要包括违规收集个人信息和APP强制、频繁、过度索取权限两方面。......