Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

if you use CMake 2.8.11 or newer (allowed in Jade and I think also Indigo) it gets even easier: http://doc.qt.io/qt-5/cmake-manual.html

cmake_minimum_required(VERSION 2.8.11)

project(testproject)

# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)

# Find the QtWidgets library
find_package(Qt5Widgets)

# Tell CMake to create the helloworld executable
add_executable(helloworld WIN32 main.cpp)

# Use the Widgets module from Qt 5.
target_link_libraries(helloworld Qt5::Widgets)

if you replace every 5 by a 4 you will get it build against qt4. Mixing is not allowed for the same target but inside the same CMakeLists.txt is ok