用CMake为Qt生成visual studio的工程
来源:互联网 发布:搜狗搜索sem优化师 编辑:程序博客网 时间:2024/05/29 17:45
Qt的版本是Qt 5.9.1 for Windows,visual studio是2015 professional。cmake是3.72
Qt的官方文档说得很清楚
http://doc.qt.io/qt-5/cmake-manual.html
这里要注意的就是CMAKE_PREFIX_PATH的设置,要写在cmakelists.txt里。
cmake_minimum_required(VERSION 2.8.11)project(testproject)# Find includes in corresponding build directoriesset(CMAKE_INCLUDE_CURRENT_DIR ON)# Instruct CMake to run moc automatically when needed.set(CMAKE_AUTOMOC ON)set(CMAKE_PREFIX_PATH "E:\\Qt\\5.9.0\\5.9\\msvc2015_64\\")# Find the QtWidgets libraryfind_package(Qt5Widgets)# Tell CMake to create the helloworld executableadd_executable(helloworld main.cpp mainwindow.cpp mainwindow.h)# Use the Widgets module from Qt 5.target_link_libraries(helloworld Qt5::Widgets)
然后
cmake -G "Visual Studio 14 Win64" Cmakelists.txt所在路径,即可生成visual studio所需的sln文件且编译通过。
阅读全文
0 0
- 用CMake为Qt生成visual studio的工程
- 利用CMake和OpenCV源代码生成Visual Studio工程
- 利用CMake和OpenCV源代码生成Visual Studio工程
- 利用CMake和OpenCV源代码生成Visual Studio工程
- CMake生成Qt工程的opencv
- cmake生成Mysql Connector/C++ 1.0.5的visual studio 2005工程
- cmake生成利用VTK库类的visual studio 2010 MFC工程
- 如何将Visual Studio的工程转成QT的工程
- 如何将Visual Studio的工程转成QT的工程
- cmake为visual studio2015编译工程
- FireBreath 生成Visual Studio 工程
- Visual Studio生成Smart Device工程慢的解决办法
- 一个自动生成visual studio工程的脚本
- Visual Studio的工程依赖
- cmake构建qt工程
- cmake生成eclipse工程的调试问题
- 关于工程输出日志的三两事(qt creator 、visual studio)
- 为Cmake工程设置默认的启动工程
- 【2017多校】HDU6053 TrickGCD 【莫比乌斯】
- 自己学着写一个BindView来减少findViewById的应用
- Hibernate---缓存
- react-native之初识react-native
- ZooKeeper典型应用——分布式锁
- 用CMake为Qt生成visual studio的工程
- 洛谷P1369 矩形
- linux网络编程,进程间的通信之互斥锁与条件变量
- 杭电oj1014 互质就可以了
- display:none ,inline, block, inline-block
- Go mobile(一)
- FZU1977 Pandora adventure
- Activity 跳转到指定非宿主 Fragment
- Idea git打tag