An open API service indexing awesome lists of open source software.

https://github.com/bialger/qtcmake

A C++ crossplatform project template with Qt6 and CMake that is linked statically
https://github.com/bialger/qtcmake

ci-cd cpp-template crossplatform project-template qt qt-cmake qt6

Last synced: 3 months ago
JSON representation

A C++ crossplatform project template with Qt6 and CMake that is linked statically

Awesome Lists containing this project

README

          

# QtCMake
A C++ project template with Qt6 and CMake that downloads and compiles Qt.
The resulting app is an executable that can be run on a system without Qt.

The main Qt6 configuration is found in the [correspondent](lib/qt/CMakeLists.txt) CMakeLists.txt file.

> Note that statically compiled Qt6 weights more than 5 GB.
> The good thing is that user does not need whole compiled Qt6 with this configuration.

## Prerequisites

* CMake
* Ninja
* Git

On Linux: `libgl1-mesa-dev libglu1-mesa-dev` and all dependencies are required.
> Note that most of the libraries that match `*xcb*` and `*xkb*` may be required on Linux.

## How to build and run

Run the following commands from the project directory.

1. Create CMake cache

This step may take a lot of time because it downloads and compiles Qt.

```shell
cmake -S . -B cmake-build -G "Ninja" -DCMAKE_BUILD_TYPE=Release
```

2. Build executable target

```shell
cmake --build cmake-build --target QtCMake
```

3. Run executable target

* On Windows:

```shell
.\cmake-build\bin\QtCMake.exe
```

* On *nix:

```shell
./cmake-build/bin/QtCMake
```