Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtCreator doesn't load .cpp and .h files from CMake project



  • Hi,

    Usually my Qt (and QtCreator) work fine with CMake. But there is a big project Slicer 3D that I'm trying to debug wich is writen with CMake and superbuild (it uploads and builds all the external libraries by itself) and when I open CMakeLists.txt in QtCreator I cannot see .cpp files and most .h files. Those few headers files that I can see are grayed out like in the picture.

    I compiled the project with MSVC 2019 x64, CMake generator is Visual Studio 16 2019, platform x64, Qt 5.15.2, QtCreator 4.13.3, Windows 10 x64.

    There is documentation how to debug in Visual Studio and it works fine.
    And here is the documentation about QtCreator debugging. There is also mentioned that it is not so easy to make QtCreator to display .cpp and .h files.

    If somebody has idea please share

    a16fd2e5-e043-4b56-ae2e-6d6062691de0-image.png


  • Lifetime Qt Champion

    @Please_Help_me_D You should analyse the whole CMake output - can be that it does not find something and disables modules.



  • @jsulm thank you for answer
    I think CMake pass fine. Or I misunderstood your idea?

    Работа C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/S/Slicer -B C:/S/d на C:\S\d.
    -- Setting C++ standard
    -- Setting C++ standard - C++11
    -- Could NOT find Subversion (missing: Subversion_SVN_EXECUTABLE) 
    -- Configuring Slicer organization domain [www.na-mic.org]
    -- Configuring Slicer organization name [NA-MIC]
    -- Configuring Slicer default home module [Welcome]
    -- Configuring Slicer default favorite modules [Data, Volumes, Models, Transforms, Markups, SegmentEditor]
    -- Configuring Slicer text of disclaimer at startup [Thank you for using %1!<br><br>This software is not intended for clinical use.]
    -- Configuring Slicer requires admin account [OFF]
    -- Configuring Slicer install root [$LOCALAPPDATA/NA-MIC]
    -- Configuring Slicer release type [Experimental]
    -- Configuring Slicer version [4.11.20200930-2020-09-30]
    -- Configuring Slicer revision [29402]
    -- Configuring VTK
    --   Slicer_VTK_RENDERING_BACKEND is OpenGL2
    --   Slicer_VTK_SMP_IMPLEMENTATION_TYPE is TBB
    --   Slicer_VTK_VERSION_MAJOR is 8
    -- Configuring Slicer with Qt 5.15.2 (using modules: Core, Widgets, Multimedia, Network, OpenGL, PrintSupport, UiTools, Xml, XmlPatterns, Svg, Sql, WebEngine, WebEngineWidgets, WebChannel, Script, Test, )
    -- Setting QT_PLUGINS_DIR: C:/Qt/5.15.2/msvc2019_64/plugins
    -- Setting QT_BINARY_DIR: C:/Qt/5.15.2/msvc2019_64/bin
    -- Setting ExternalData_OBJECT_STORES to 'C:/S/d/ExternalData/Objects'
    -- Configuring Slicer for [win-amd64]
    -- Checking if CMake supports https
    -- Checking if CMake supports https - ok
    -- Remote - vtkAddon [OK]
    -- Remote - jqPlot [OK]
    -- Remote - MultiVolumeExplorer [OK]
    -- Remote - MultiVolumeImporter [OK]
    -- Remote - SimpleFilters [OK]
    -- Remote - BRAINSTools [OK]
    -- Remote - DataStore [OK]
    -- Remote - CompareVolumes [OK]
    -- Remote - LandmarkRegistration [OK]
    -- Remote - SurfaceToolbox [OK]
    -- SuperBuild - First pass
    -- SuperBuild - TBB_INSTALL_DIR:C:/S/d/tbb-install
    -- SuperBuild - First pass - done
    -- SuperBuild - Slicer => Requires curl, CTKAppLauncherLib, teem, VTK, ITK, CTK, LibArchive, RapidJSON, SimpleITK, SlicerExecutionModel, qRestAPI, DCMTK, CTKAPPLAUNCHER, python, python-pythonqt-requirements, python-scipy, python-numpy, python-dicom-requirements, python-extension-manager-requirements, python-extension-manager-ssl-requirements, tbb[INCLUDED], JsonCpp, 
    -- SuperBuild -   curl => Requires zlib, OpenSSL, 
    -- SuperBuild -     zlib[OK]
    -- SuperBuild -     ZLIB_INCLUDE_DIR:C:/S/d/zlib-install/include
    -- SuperBuild -     ZLIB_LIBRARY:C:/S/d/zlib-install/lib/zlib.lib
    -- SuperBuild -     ZLIB_ROOT:C:/S/d/zlib-install
    -- SuperBuild -     OpenSSL[OK]
    -- SuperBuild -     LIB_EAY_DEBUG:C:/S/d/OpenSSL-install/Debug/lib/libcrypto.lib
    -- SuperBuild -     LIB_EAY_RELEASE:C:/S/d/OpenSSL-install/Release/lib/libcrypto.lib
    -- SuperBuild -     SSL_EAY_DEBUG:C:/S/d/OpenSSL-install/Debug/lib/libssl.lib
    -- SuperBuild -     SSL_EAY_RELEASE:C:/S/d/OpenSSL-install/Release/lib/libssl.lib
    -- SuperBuild -     OpenSSL 1.1.1g
    -- SuperBuild -     OPENSSL_LIBRARY_DIR:C:/S/d/OpenSSL-install/$(Configuration)/lib
    -- SuperBuild -     OPENSSL_EXPORT_LIBRARY_DIR:C:/S/d/OpenSSL-install/$(Configuration)/bin
    -- SuperBuild -     OPENSSL_INCLUDE_DIR:C:/S/d/OpenSSL-install/$(Configuration)/include
    -- SuperBuild -     OPENSSL_LIBRARIES:optimized;C:/S/d/OpenSSL-install/Release/lib/libssl.lib;debug;C:/S/d/OpenSSL-install/Debug/lib/libssl.lib;optimized;C:/S/d/OpenSSL-install/Release/lib/libcrypto.lib;debug;C:/S/d/OpenSSL-install/Debug/lib/libcrypto.lib
    -- SuperBuild -   curl[OK]
    -- SuperBuild -   CURL_INCLUDE_DIR:C:/S/d/curl-install/include
    -- SuperBuild -   CURL_LIBRARY:C:/S/d/curl-install/lib/libcurl.lib
    -- SuperBuild -   CTKAppLauncherLib[OK]
    -- SuperBuild -   teem => Requires zlib[INCLUDED], VTK, 
    -- SuperBuild -     VTK => Requires zlib[INCLUDED], python, tbb[INCLUDED], 
    -- SuperBuild -       python => Requires bzip2, CTKAPPLAUNCHER, LZMA, zlib[INCLUDED], sqlite, OpenSSL[INCLUDED], 
    -- SuperBuild -         bzip2[OK]
    -- SuperBuild -         BZIP2_INCLUDE_DIR:C:/S/d/bzip2
    -- SuperBuild -         BZIP2_LIBRARIES:C:/S/d/bzip2-install/lib/libbz2.lib
    -- SuperBuild -         CTKAPPLAUNCHER => Requires CTKResEdit, 
    -- SuperBuild -           CTKResEdit[OK]
    -- SuperBuild -         CTKAPPLAUNCHER[OK]
    -- SuperBuild -         LZMA[OK]
    -- SuperBuild -         sqlite[OK]
    -- SuperBuild -       python[OK]
    -- SuperBuild -       PYTHON_EXECUTABLE:C:/S/d/python-install/bin/PythonSlicer.exe
    -- SuperBuild -       PYTHON_INCLUDE_DIR:C:/S/d/python-install/include
    -- SuperBuild -       PYTHON_LIBRARY:C:/S/d/python-install/libs/python36.lib
    -- SuperBuild -       PYTHON_DEBUG_LIBRARY:C:/S/d/python-install/libs/python36.lib
    -- SuperBuild -     VTK[OK]
    -- SuperBuild -   teem[OK]
    -- SuperBuild -   ITK => Requires zlib[INCLUDED], VTK[INCLUDED], DCMTK, tbb[INCLUDED], 
    -- SuperBuild -     DCMTK => Requires zlib[INCLUDED], 
    -- SuperBuild -     DCMTK[OK]
    -- SuperBuild -   ITK[OK]
    -- SuperBuild -   CTK => Requires VTK[INCLUDED], ITK[INCLUDED], python[INCLUDED], DCMTK[INCLUDED], 
    -- SuperBuild -   CTK[OK]
    -- SuperBuild -   LibArchive => Requires zlib[INCLUDED], zlib[INCLUDED], 
    -- SuperBuild -   LibArchive[OK]
    -- SuperBuild -   RapidJSON[OK]
    -- SuperBuild -   SimpleITK => Requires ITK[INCLUDED], Swig[INCLUDED], python[INCLUDED], python-setuptools, 
    -- SuperBuild -     python-setuptools => Requires python[INCLUDED], python-ensurepip, 
    -- SuperBuild -       python-ensurepip => Requires python[INCLUDED], 
    -- SuperBuild -       python-ensurepip[OK]
    -- SuperBuild -     python-setuptools[OK]
    -- SuperBuild -   SimpleITK[OK]
    -- SuperBuild -   SlicerExecutionModel => Requires ITK[INCLUDED], tbb[INCLUDED], 
    -- SuperBuild -   SlicerExecutionModel[OK]
    -- SuperBuild -   qRestAPI[OK]
    -- SuperBuild -   python-pythonqt-requirements => Requires python[INCLUDED], python-ensurepip[INCLUDED], python-pip, python-setuptools[INCLUDED], python-wheel, 
    -- SuperBuild -     python-pip => Requires python[INCLUDED], python-ensurepip[INCLUDED], python-setuptools[INCLUDED], 
    -- SuperBuild -     python-pip[OK]
    -- SuperBuild -     python-wheel => Requires python[INCLUDED], python-pip[INCLUDED], python-setuptools[INCLUDED], 
    -- SuperBuild -     python-wheel[OK]
    -- SuperBuild -   python-pythonqt-requirements[OK]
    -- SuperBuild -   python-scipy => Requires python[INCLUDED], python-ensurepip[INCLUDED], python-numpy, python-pip[INCLUDED], python-setuptools[INCLUDED], python-wheel[INCLUDED], 
    -- SuperBuild -     python-numpy => Requires python[INCLUDED], python-pip[INCLUDED], python-setuptools[INCLUDED], 
    -- SuperBuild -     python-numpy[OK]
    -- SuperBuild -   python-scipy[OK]
    -- SuperBuild -   python-dicom-requirements => Requires python[INCLUDED], python-numpy[INCLUDED], python-pip[INCLUDED], python-requests-requirements, python-setuptools[INCLUDED], 
    -- SuperBuild -     python-requests-requirements => Requires python[INCLUDED], python-pip[INCLUDED], python-setuptools[INCLUDED], 
    -- SuperBuild -     python-requests-requirements[OK]
    -- SuperBuild -   python-dicom-requirements[OK]
    -- SuperBuild -   python-extension-manager-requirements => Requires python[INCLUDED], python-pip[INCLUDED], python-setuptools[INCLUDED], 
    -- SuperBuild -   python-extension-manager-requirements[OK]
    -- SuperBuild -   python-extension-manager-ssl-requirements => Requires python[INCLUDED], python-pip[INCLUDED], python-requests-requirements[INCLUDED], python-setuptools[INCLUDED], 
    -- SuperBuild -   python-extension-manager-ssl-requirements[OK]
    -- SuperBuild -   JsonCpp[OK]
    -- SuperBuild - Slicer[OK]
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/S/d
    


  • If possible maybe somebody could clone the repository and try it his computer to open project and run CMake.

    Not necessary to build the project (it may take 9 hours) but before launching CMake set build dir path as short as possible (I have build folder C:\S\b and the source C:\S\Slicer) because Slicer has some problems with path length and CMake will throw an error if build folder path is too long.

    I'm very interested in working on this project in QtCreator and not in Visual Studio but that QtCreator's behavior doesn't leave me any chances.