Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt CMake project cannot be build outside QtCreator
Forum Updated to NodeBB v4.3 + New Features

Qt CMake project cannot be build outside QtCreator

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 382 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lankatle
    wrote on last edited by
    #1

    I am trying to build an old CMake Qt project using command line on Windows with MinGW. The project get configured and build without any issues using QtCreator. However, when I try to build it manually with regular command line (using exact commands that QtCreator uses) it fails. Matter of fact it fails at CMake configurations.

    PS C:\> C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/project_orange/src -B C:/project_orange/build -GNinja "-DCMAKE_BUILD_TYPE:STRING=Debug" "-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=C:/Qt/Tools/QtCreator/share/qtcreator/package-manager/auto-setup.cmake" "-DQT_QMAKE_EXECUTABLE:STRING=C:/Qt/5.5/mingw492_32/bin/qmake.exe" "-DCMAKE_PREFIX_PATH:STRING=C:/Qt/5.5/mingw492_32" "-DCMAKE_C_COMPILER:STRING=C:/Qt/Tools/mingw492_32/bin/gcc.exe" "-DCMAKE_CXX_COMPILER:STRING=C:/Qt/Tools/mingw492_32/bin/g++.exe" "-DCMAKE_MAKE_PROGRAM:STRING=C:/Qt/Tools/Ninja/ninja.exe"
            -- The C compiler identification is unknown
            -- The CXX compiler identification is unknown
            -- Detecting C compiler ABI info
            -- Detecting C compiler ABI info - failed
            -- Check for working C compiler: C:/Qt/Tools/mingw492_32/bin/gcc.exe
            -- Check for working C compiler: C:/Qt/Tools/mingw492_32/bin/gcc.exe - broken
            CMake Error at C:/Qt/Tools/CMake_64/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
              The C compiler
            
                "C:/Qt/Tools/mingw492_32/bin/gcc.exe"
            
              is not able to compile a simple test program.
            
              It fails with the following output:
            
                Change Dir: C:/project_orange/build/CMakeFiles/CMakeTmp
            
                Run Build Command(s):C:/Qt/Tools/Ninja/ninja.exe cmTC_83ec3 && [1/2] Building C object CMakeFiles\cmTC_83ec3.dir\testCCompiler.c.obj
                FAILED: CMakeFiles/cmTC_83ec3.dir/testCCompiler.c.obj
                C:\Qt\Tools\mingw492_32\bin\gcc.exe    -o CMakeFiles\cmTC_83ec3.dir\testCCompiler.c.obj -c C:\project_orange\build\CMakeFiles\CMakeTmp\testCCompiler.c
                ninja: build stopped: subcommand failed.
    
    
    
    
    
      CMake will not be able to correctly generate this project.
    Call Stack (most recent call first):
      CMakeLists.txt:5 (project)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/project_orange/build/CMakeFiles/CMakeOutput.log".
    See also "C:/project_orange/build/CMakeFiles/CMakeError.log".
    

    Strange enough, if I open a terminal using QtCreator (Projects> Build Environment> Open Terminal), same command would work. This made me believe that I might be missing some environment variables. So, using a normal command line, I set all the Environment variables listed in Build Environment section by QtCreator manually and then ran same command. Unfortunately this leads to the same error output. I believe QtCreator is doing something on the background witch is not visible.

    Can anyone explain what is happening and how to fix this?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      Quite possibly ensuring the compiler's binary folder (s) are in the PATH of the environment cmake is launched in.

      From the command line you ran the failing cmake from, does this run

      C:\Qt\Tools\mingw492_32\bin\gcc.exe -v
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved