QT 6.5.3 and conan/CMake - how to turn off LTCG and /GL in the release build
-
I am using "conan" and QT 6.5.3 with the Visual Studio 2019 toolset
In the conanfile.py for my target I have
self.requires("qt/6.5.3")When creating a "Release" build it appears that the QT6 cmake modules inserts /GL as a compiler option and /LTCG as a link option. Debug builds are not problem.
These options are part of "Link Time Code Generation"I really need to turn off these options for the build of my target but I am finding it impossible to tweak the CMakeLists.txt to do so.
Things I have tried in the CMakeLists.txt.
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/GL->)
When I add the GL- option I get a compiler command line such as below. The /GL- option is overridden by the later /GL option.
FLAGS = /DWIN32 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG -MD /GL- /diagnostics:caret /Zi -permissive- -Zc:__cplusplus /bigobj /MP /GL /Os -std:c++17
So the mystery is there some way to disable the LTCG turned on by the QT6 CMake modules?
-
I am using "conan" and QT 6.5.3 with the Visual Studio 2019 toolset
In the conanfile.py for my target I have
self.requires("qt/6.5.3")When creating a "Release" build it appears that the QT6 cmake modules inserts /GL as a compiler option and /LTCG as a link option. Debug builds are not problem.
These options are part of "Link Time Code Generation"I really need to turn off these options for the build of my target but I am finding it impossible to tweak the CMakeLists.txt to do so.
Things I have tried in the CMakeLists.txt.
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/GL->)
When I add the GL- option I get a compiler command line such as below. The /GL- option is overridden by the later /GL option.
FLAGS = /DWIN32 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG -MD /GL- /diagnostics:caret /Zi -permissive- -Zc:__cplusplus /bigobj /MP /GL /Os -std:c++17
So the mystery is there some way to disable the LTCG turned on by the QT6 CMake modules?
LTCG and GL is not added in my system. Please show a minimal CMakeLists.txt to reproduce the issue. Maybe somewhere the interprocedural optimization is enabled where you did not notice it.