[cmake-developers] CMake build with static crt and static QtDialog not linking

Brad King brad.king at kitware.com
Tue Feb 13 12:10:42 EST 2018


On 2/13/2018 11:28 AM, Stuermer, Michael SP/HZA-ZSEP wrote:
> I try to do a CMake build with static C runtime and a static Qt 5.10.0

Make sure Qt is configured with both `-static` and `-static-runtime`,
and that it is built with the same compiler as CMake.  See the command
used below to configure the 64-bit Qt build for the cmake.org binaries.
We use Qt 5.6.3 because it is the last to support Windows XP.

Also, Qt 5.6 doesn't quite set up it's CMake targets correctly when doing
a static build.  I had to hack lib/cmake/Qt5Core/Qt5CoreConfig.cmake:

    set(_Qt5Core_LIB_DEPENDENCIES "${_qt5Core_install_prefix}/lib/qtpcre.lib")

> PS: I’m not sure how the mailing list is handled compared to the gitlab
> instance. Would this be something I should open an issue for?

The mailing list is fine for this.

-Brad

```
call ..\qt-everywhere-opensource-src-5.6.3\configure.bat ^
  -prefix c:/path/to/prefix ^
  -static ^
  -static-runtime ^
  -release ^
  -opensource -confirm-license ^
  -platform win32-msvc2017 ^
  -mp ^
  -gui ^
  -widgets ^
  -qt-pcre ^
  -qt-zlib ^
  -qt-libpng ^
  -qt-libjpeg ^
  -no-gif ^
  -no-icu ^
  -no-pch ^
  -no-sql-sqlite ^
  -no-cetest ^
  -no-angle ^
  -no-opengl ^
  -no-dbus ^
  -no-qml-debug ^
  -no-harfbuzz ^
  -no-accessibility ^
  -skip declarative ^
  -skip multimedia ^
  -skip qtcanvas3d ^
  -skip qtconnectivity ^
  -skip qtdeclarative ^
  -skip qtlocation ^
  -skip qtmultimedia ^
  -skip qtsensors ^
  -skip qtserialport ^
  -skip qtsvg ^
  -skip qtwayland ^
  -skip qtwebchannel ^
  -skip qtwebengine ^
  -skip qtwebsockets ^
  -skip qtwinextras ^
  -skip qtxmlpatterns ^
  -nomake examples -nomake tests
```


More information about the cmake-developers mailing list