Better_Software_Header_Mobile Better_Software_Header_Web

Find what you need - explore our website and developer resources

CMake and Qt

cmake_and_qt_front_page

Download PDF:

if(CPUS)
	math(EXPR CPUS "${CPUS} + 1")
	set(BLD_FLAGS "${BLD_FLAGS} -j${CPUS}")
endif()
find_package(somecoollib)
target_link_libraries(main somecoollib)

CMake includes a GUI for configuration; very handy for building debug and release candidates.

cmake_minimum_required(VERSION 3.16)
project(helloworld VERSION 1.0.0)
set(CMAKE_CXX_STANDARD 17)set(CMAKE_CXX_STANDARD_REQUIRED ON) 

set(CMAKE_AUTOMOC TRUE)set(CMAKE_AUTORCC TRUE) 
set(CMAKE_AUTOUIC TRUE) 

find_package(Qt6 CONFIG REQUIRED COMPONENTS Widgets)
add_executable(helloworld  ➅
   mainwindow.ui 
   mainwindow.cpp 
   main.cpp 
   resources.qrc 
) 

target_link_libraries(helloworld Qt::Widgets)

Tags:

qt