- 
    Bug 
- 
    Resolution: Duplicate
- 
     Not Evaluated Not Evaluated
- 
    None
- 
    Qt Creator 4.3.0
- 
    OS: Ubuntu 17.04
 
 Qt Creator: 4.3.0
 
 CMake: 3.7
 
 Cross-compiler: gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf
I have a Kit configured for cross-compilation:
Device type: Generic Linux Device
 Sysroot: /home/julien/vqm_build/build/rootfs
 Compiler: /home/julien/Tools/gcc-...-gnueabihf/bin/arm-linux-gnueabihf-gcc
 Qt version: Qt 5.6.2
 CMake tool: System CMake at /usr/local/bin/cmake
 CMake generator: <none> - Unix Makefiles, Platform: <none>, Toolset: <none>
This configuration works properly when using a qmake .pro file. However this configuration fails to work with a CMakeLists.txt file and results in linking errors ("libraries cannot be found"). I found that it fails to pass the sysroot variable to CMake. This is confirmed by checking the CMake configuration field in the Kit:
CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}
 CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}
 CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}
 QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}
Adding the following line resolves the linking issues:
CMAKE_SYSROOT:STRING=%{SysRoot:FilePath}
Apparently this is a know issue:
https://bugreports.qt.io/browse/QTCREATORBUG-16155
The patch is available but was never pushed and it is unclear why. I understand that the OPĀ had other issues which were notĀ solved by this fix. However I think the fix is legit as the sysroot is a critical variable when doing cross-compilation that needs to be passed to CMake.
- duplicates
- 
                    QTCREATORBUG-16155 Cmake compiler check does not seem to take into account sysroot settings -         
- Closed
 
-