Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt6Config.cmake clash #1

Open
kuriankattukaren opened this issue Oct 30, 2023 · 7 comments
Open

Qt6Config.cmake clash #1

kuriankattukaren opened this issue Oct 30, 2023 · 7 comments
Assignees

Comments

@kuriankattukaren
Copy link

I'm running Qt6.6 on a Windows machine. I've added QT to my system path and has everything installed. However, I get an error from CMAKE

[proc] Executing command: cmake --version [proc] Executing command: cmake -E capabilities [variant] Loaded new set of variants [kit] Successfully loaded 21 kits from C:\Users\kurian_2\AppData\Local\CMakeTools\cmake-tools-kits.json [presetController] Successfully validated presets in C:\src\projects\qtest\blog-vscode-template\CMakePresets.json [presetController] Successfully validated presets in C:\src\projects\qtest\blog-vscode-template\CMakeUserPresets.json [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --version [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -E capabilities [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -SC:/src/projects/qtest/blog-vscode-template -BC:/src/projects/qtest/blog-vscode-template/build-debug-msvc -G Ninja [proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" -SC:/src/projects/qtest/blog-vscode-template -BC:/src/projects/qtest/blog-vscode-template/build-debug-msvc -G Ninja exited with code: 1 [main] Configuring project: blog-vscode-template [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -SC:/src/projects/qtest/blog-vscode-template -BC:/src/projects/qtest/blog-vscode-template/build-debug-msvc -G Ninja [cmake] CMake Error at CMakeLists.txt:12 (find_package): [cmake] Could not find a configuration file for package "QT" that is compatible [cmake] with requested version "". [cmake] [cmake] The following configuration files were considered but not accepted: [cmake] [cmake] C:/Qt/6.6.0/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.6.0 (64bit) [cmake] [cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred! [proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -SC:/src/projects/qtest/blog-vscode-template -BC:/src/projects/qtest/blog-vscode-template/build-debug-msvc -G Ninja exited with code: 1

I'm not able to debug the problem. Is there anything that I'm doing wrong?

Cheers,
Kurian

@iamsergio iamsergio self-assigned this Oct 30, 2023
@iamsergio
Copy link
Collaborator

iamsergio commented Oct 30, 2023

Hi,

Is this a x86_64 Windows or something else ?

If x86_64, do you have the msvc c++ toolchain installed ? Usually done via the Visual Studio installer

@kuriankattukaren
Copy link
Author

Yes it's x86_64 Windows Machine. I have mscv c++ toolchain installed.

@iamsergio
Copy link
Collaborator

Can you remove the build directory and post a new paste ?
Yours seems clipped, I'd expect to see some lines saying "Detecting CXX compiler"

@BK0x7C8
Copy link

BK0x7C8 commented Dec 13, 2024

Hello,

thank you providing this template!

However, I am experiencing the same issues as @kuriankattukaren. I have added the whole output to the attached text file:
output.txt

I have installed MSVC_64 toolchain via Qt Maintenance Tool, and added its \bin directory to my system PATH.
I also have C:\Qt\Tools\CMake_64\bin and C:\Qt\Tools\Ninja in my PATH.
I use x86_64 Windows.
I want to switch from Qt Creator to VS Code. Is there any chance of transporting the Kit config from Qt Creator to VS Code?

The line in CMakeLists.txt, which is causing the problem is:

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)

Any advice?

Best regards,
Bjørn

@iamsergio
Copy link
Collaborator

output.txt

Hi, can you paste the full cmake configure step, the lines that include "Detecting CXX compiler" are missing.

I'd also suggest we forget about vscode for the moment, and try to build on the command line, because if it doesn't work
via command line then there's no chance it will work on vscode, as there would be something wrong with your toolchains

@BK0x7C8
Copy link

BK0x7C8 commented Dec 13, 2024

In blog-vscode-template\build-debug\CMakeFiles, I pasted the CMakeConfigureLog.yaml file here:

CMakeConfigureLog.yaml.txt

Yes, it seems, there is a problem with how Qt and CMake interact. The only output in terminal I get, when running

cmake.exe -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -SC:/Users/bke/repos/blog-vscode-template -BC:/Users/bke/repos/blog-vscode-template/build-debug -G Ninja,

is:

CMake Error at CMakeLists.txt:12 (find_package):
  Could not find a configuration file for package "QT" that is compatible
  with requested version "".

  The following configuration files were considered but not accepted:

    C:/Qt/6.5.3/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.5.3 (64bit)



-- Configuring incomplete, errors occurred!

Thank you for supporting!

Best.
Bjørn

@iamsergio
Copy link
Collaborator

ah, Compiler: C:/MinGW/bin/c++.exe It's trying to use MinGW against a Qt built with MSVC

do you have cl.exe in PATH ? do a cl.exe --version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants