Discussion:
[Qt-creator] [QtCreator] CMAKE_INSTALL_PREFIX overwritten with /usr/local
Christoph Mathys
2016-10-27 13:40:43 UTC
Permalink
Hi!

Whenever I change the Kit-Settings in QtCreator, it wants to overwrite
my cmake configuration, specifically it insists on passing
CMAKE_INSTALL_PREFIX. I would like QtCreator to just call cmake
without changing any cmake settings.

I found that for the compiler I can do that by clearing "CMake
Configuration" in the "Build&Run / Configuration" dialogue.

Is there a way to stop QtCreator from always passing
CMAKE_INSTALL_PREFIX? Or if not, can it automatically use the value
that is already configured in cmake instead of assuming /usr/local?

Thanks.
Christoph
Tobias Hunger
2016-10-27 13:57:08 UTC
Permalink
Post by Christoph Mathys
Hi!
Whenever I change the Kit-Settings in QtCreator, it wants to overwrite
my cmake configuration, specifically it insists on passing
CMAKE_INSTALL_PREFIX. I would like QtCreator to just call cmake
without changing any cmake settings.
The only settings that creator wants to manage are:
QT_QMAKE_EXECUTABLE,
CMAKE_PREFIX_PATH,
CMAKE_C_COMPILER and
CMAKE_CXX_COMPILER

It does so in Tools>Options>Build & Run>Kits>CMake Configuration and makes these
variables point to the toolchains and Qt version you selected for the kit.

CMAKE_INSTALL_PREFIX is not found in the Creator sources.
Post by Christoph Mathys
I found that for the compiler I can do that by clearing "CMake
Configuration" in the "Build&Run / Configuration" dialogue.
If there is CMAKE_INSTALL_PREFIX set in the Kit's CMake Configuration, then it
was not creator that put it there.
Post by Christoph Mathys
Is there a way to stop QtCreator from always passing
CMAKE_INSTALL_PREFIX? Or if not, can it automatically use the value
that is already configured in cmake instead of assuming /usr/local?
No idea, sorry. I do not know where that setting comes from in your setup. It is
definitely not set in mine.

Best Regards,
Tobias

--
Tobias Hunger, Senior Software Engineer | The Qt Company
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho. Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
Christoph Mathys
2016-10-31 12:20:12 UTC
Permalink
Hi Tobias,
Post by Tobias Hunger
Post by Christoph Mathys
Is there a way to stop QtCreator from always passing
CMAKE_INSTALL_PREFIX? Or if not, can it automatically use the value
that is already configured in cmake instead of assuming /usr/local?
No idea, sorry. I do not know where that setting comes from in your setup. It is
definitely not set in mine.
Hmm, I had another look. Indeed, CMAKE_INSTALL_PREFIX is not found on
the cmake call done by QtCreator, sorry for that misinformation. I
guess I had some FUd kit configurations while experimenting.

But I still loose the setting of CMAKE_INSTALL_PREFIX when I change
anything in the current kit, for example edit its name. QtCreator then
invokes cmake, and for some reason cmake falls back to the default
prefix /usr/local. The same cmake call executed in a shell behaves as
expected. Does QtCreator manipulate CMakeCache.txt in any way in case
the kit is altered?

Thanks,
Christoph
Christoph Mathys
2016-10-31 12:47:18 UTC
Permalink
Post by Christoph Mathys
expected. Does QtCreator manipulate CMakeCache.txt in any way in case
the kit is altered?
When doing a watch on the file it seems like QtCreator just deletes
CMakeCache.txt. Unfortunate in my case because it means that all the
settings done from the buildscript inside the repo are lost. So far,
I've only seen this happen when I altered the kit that is used.

Christoph
Tobias Hunger
2016-10-31 13:11:42 UTC
Permalink
Post by Christoph Mathys
Hi Tobias,
Post by Tobias Hunger
Post by Christoph Mathys
Is there a way to stop QtCreator from always passing
CMAKE_INSTALL_PREFIX? Or if not, can it automatically use the value
that is already configured in cmake instead of assuming /usr/local?
No idea, sorry. I do not know where that setting comes from in your setup. It is
definitely not set in mine.
Hmm, I had another look. Indeed, CMAKE_INSTALL_PREFIX is not found on
the cmake call done by QtCreator, sorry for that misinformation. I
guess I had some FUd kit configurations while experimenting.
But I still loose the setting of CMAKE_INSTALL_PREFIX when I change
anything in the current kit, for example edit its name. QtCreator then
invokes cmake, and for some reason cmake falls back to the default
prefix /usr/local. The same cmake call executed in a shell behaves as
expected. Does QtCreator manipulate CMakeCache.txt in any way in case
the kit is altered?
Yes, it does that: Creator assumes to be in charge of the build directory and
will delete the cmake cache file whenever it thinks that is necessary. That
should be whenever the kit changes in a way that makes creator assume that cmake
will not be able to run anymore -- that is mostly when it thinks the generator
has changed and maybe some more equally critical things that cmake can not
handle on the fly.

It will then pass the kit and the project configuration as defined in Creator
and regenerate the cache file with that information. So setting
CMAKE_INSTALL_PREFIX from Creator should work.

Best Regards,
Tobias

--
Tobias Hunger, Senior Software Engineer | The Qt Company
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho. Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
Loading...