[Qgis-developer] Compilation qgis2.7.0 with VS2010 and Qt 5.3.2

Anatoliy Golubev darth.naihil at gmail.com
Fri Dec 26 06:16:55 PST 2014

Hi list!

I am successfully build QGIS-dev with Qt5 in windows. Here are some notes:

1. PR#1743 is necessary for windows build, without it compilation
fails trying to include linux headers (netinet/in.h);

2. CMake 3.1 throws many warnings like this:
    CMake Warning (dev) in src/core/CMakeLists.txt:
        Policy CMP0020 is not set: Automatically link Qt executables to qtmain
        target on Windows.  Run "cmake --help-policy CMP0020" for
policy details.
    Use the cmake_policy command to set the policy and suppress this warning.

With these warnings compilation fails at linking executables with
errors like this:
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol
_WinMain at 16 referenced in function ___tmainCRTStartup
1>D:\Projects\other\qgis\qt5\build-debug\output\Debug\qgis_help.exe :
fatal error LNK1120: 1 unresolved externals

There is post at SO about this warning
    > As of CMake 2.8.11 and Qt 5.1, linking to Qt5::WinMain is
automatic/implicit if you specify WIN32 in your add_executable call,
or otherwise set the WIN32_EXECUTABLE target property. – steveire
    >> Note that the automatic adding of Qt5::WinMain target is
subject to the POLICY CMP0020 cmake policy. Default is the old
behavior (not to add it). – codeling
    >>> Your comment is misleading. The default behavior is NEW if the
minimum required cmake version is 2.8.11. – steveire

Changing CMAKE_MINIMUM_REQUIRED to 2.8.11 solved problems with
linking, maybe setting this policy is better way, dont know.

3. There are some other warnings:
CMake Warning (dev) at CMakeLists.txt:389 (IF):
CMake Warning (dev) at src/core/CMakeLists.txt:294 (IF):
CMake Warning (dev) at src/analysis/CMakeLists.txt:80 (IF):
    Policy CMP0054 is not set: Only interpret if() arguments as variables or
    keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
    details.  Use the cmake_policy command to set the policy and suppress this

    Quoted variables like "MSVC" will no longer be dereferenced when the policy
    is set to NEW.  Since the policy is not set the OLD behavior will be used.

But they dont break anything for now.

I dont work with CMake before, cant create patches for these, maybe
someone more experienced can take a look.

4. QSpatiaLite driver compilation fails, coz there was some
refactoring of sql-drivers in qt5. I can try fix it when have more
free time, i think its not hard.

More information about the Qgis-developer mailing list