[Development] Fwd: About CMAKE_MKSPEC, the spec file recorded in Qt5CoreConfigExtrasMkspecDir.cmake and "using any compiler"

Kevin Funk kevin.funk at kdab.com
Mon Feb 25 10:18:01 CET 2019

On Monday, 25 February 2019 09:56:42 CET René J.V. Bertin wrote:
> Hi,
> Trying to get an answer to the question below once more.
> In a nutshell: shouldn't the CMAKE_MKSPEC (or some equivalent) be preserved
> in the installed CMake modules such that the correct mkspec directory is
> added to the compiler's header include search path?


The header include path is part of the _qt5_corelib_extra_includes CMake var.


% ag -s mkspecs /usr/lib/x86_64-linux-gnu/cmake/Qt5Core/
2:set(_qt5_corelib_extra_includes "${_qt5Core_install_prefix}/lib/x86_64-

That's what you're looking for, right?

If I instead build Qt5 myself using Clang, I end up with this location in the 
.cmake file:

% ag -s mkspecs lib/cmake
2:set(_qt5_corelib_extra_includes "${_qt5Core_install_prefix}/.//mkspecs/

Looks all fine to me?


> Or should that directory be excluded altogether?
> R.
> -------------------------------
> I just noticed something strange in the huge compiler commandlines you tend
> to get while building KDE applications. An application configured to build
> with clang adds qt5/mkspecs/linux-g++-64 to the header include path (with
> -isystem, at that).
> At first I thought this was an error in that my Qt install (5.9.7, FWIW) was
> built with GCC but since a release or two I changed to building Qt with
> clang too.
> Now, I think it's not entirely relevant whether or not this particular
> setting is a left-over due to me not trashing the entire Qt build directory
> before rebuilding with clang. The fact is that you should be able to build
> Qt with one compiler and dependent software with another.
> Am I overlooking an existing way to get the correct mkspec directory added
> to the header search path?
> The source for Qt5CoreConfigExtrasMkspecDir.cmake suggests this is set via
> CMAKE_MKSPEC but that variable is no longer referenced in the installed
> cmake modules (again, in Qt 5.9). So even setting this on the commandline
> doesn't have any effect - but CMake should be able to infer at least the
> most common mkspec dirnames from CMAKE_CXX_COMPILER(_ID) ...
> Thanks,
> R.
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development

Kevin Funk | kevin.funk at kdab.com | Senior Software Engineer
KDAB (Deutschland) GmbH, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5322 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190225/9a8ecc82/attachment.bin>

More information about the Development mailing list