Created
June 29, 2019 12:43
-
-
Save chfle/1c44e0474d54accb7786b5d4628c107f to your computer and use it in GitHub Desktop.
CMakeLists.txt with QT5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this in Clion: Preferences | Build, Execution, Deployment | CMake | Cmake options: -DCMAKE_PREFIX_PATH=/Users/username/Qt/QT_VERSION/clang_64/lib/cmake | |
# CMAKE STANDART | |
set(CMAKE_CXX_STANDARD 17) | |
set(CMAKE_CXX_STANDARD_REQUIRED YES) | |
# INPORTANT | |
set(CMAKE_AUTOMOC ON) | |
set(CMAKE_AUTOUIC ON) | |
set(CMAKE_AUTORCC ON) | |
set(CMAKE_INCLUDE_CURRENT_DIR ON) | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") | |
set(CMAKE_INCLUDE_CURRENT_DIR ON) | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") | |
# QT | |
find_package(Qt5Core REQUIRED) | |
find_package(Qt5Widgets REQUIRED) | |
include_directories(${Qt5Widgets_INCLUDE_DIRS}) | |
qt5_generate_moc(main.cpp main.moc) | |
#target | |
qt5_use_modules(${NAME} Core Widgets Gui) | |
target_link_libraries("${NAME}" Qt5::Widgets) | |
target_link_libraries("${NAME}" Qt5::Core) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment