CLion 写 Qt程序时 CMakeLists.txt 文件的配置

 cmake  的基本设置

set(CMAKE_AUTOMOC ON)
#set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_INCLUDE_CURRENT_DIR ON)


添加Qt 的库

find_package(Qt5Core)
find_package(Qt5Widgets)
find_package(Qt5Gui)
find_package(Qt5OpenGL)
find_package(Qt5Xml)


 添加窗体 .ui文件 与 资源文件 .qrc

qt5_wrap_ui( ui_FILES mainwindow.ui)
qt5_add_resources( qrc_FILES drawable.qrc)
add_executable(${PROJECT_NAME} ${SRC_LIST} ${ui_FILES} ${qrc_FILES})


最后给大家个链接,有问题上去查一查 

http://qt.developpez.com/doc/5.0-snapshot/cmake-manual