Open haferburg opened 3 months ago
So when we run conan install -s build_type=Debug ... followed by conan install -s build_type=Release ... it ends up with the Debug moc.exe. But when we run it the other way round (Release first, Debug second), it uses the Release moc.exe.
Hi @haferburg - thank you for reporting this.
Glad to hear you have a valid workaround, however I agree that this should already work the right way. I'll discuss this with the team in our next meeting.
@memsharded - leaving this issue in the Conan repository since I have a feeling the solution could be in CMakeToolchain
or CMakeDeps
, rather than in the recipe itself (but I could be wrong). Otherwise will move this to coann-center-index
if appropriate.
Summary
We consume Qt6 as a dependency in our application. We use CMake's AUTOMOC feature. When it runs, it ends up using the Debug build of
moc.exe
. Which is not what it should do, as the Debug build runs slower.Analysis
We have two different packages for Qt6, one for Release and one for Debug.
We run
conan install
twice, first for Release, then for Debug.When
find_package(Qt6 CONFIG REQUIRED COMPONENTS Core Widgets)
runs, it printsand this is what sets the path to the moc executable. But this is the Qt Debug package. So what ends up happening is that CMake uses this
moc.exe
for its AUTOMOC feature.This is because in
Qt6Config.cmake
, it says eitheror
So when we run
conan install -s build_type=Debug ...
followed byconan install -s build_type=Release ...
it ends up with the Debug moc.exe. But when we run it the other way round (Release first, Debug second), it uses the Release moc.exe.So in my opinion, Qt6Config.cmake should not depend on the configuration. My understanding is that if a file depends on the configuration, it should also have that configuration in its name. Which is why the order of
conan install
matter. I would consider this a bug.conan install
doesn't seem to overwrite theQt6Config.cmake
file. When I modify this file manually, it's not reset byconan install
. So to fix this issue for all devs, I would need to tell them to delete theconan
folder in the build directory. I would consider this another bug.Environment
Windows 10, conan 2.2, Qt 6.6.2.