Unsolved QTCreator builds in temp folder when running CMake
-
I have a small CMake project which downloads another library, builds and links it to my C++ program(in this case just a main.cpp which tests if the library was built and linked).
My workflow is as follows: Open QTCreator -> Drag&Drop / opening a CMakeLists.txt -> Select build directories.
After that, CMake should automically download, build and link a thirdparty library which I need...I store the "install step" of this thirdparty lib in the build directory.
However, the QtCreator seems to ignore my chosen build directories and builds it in "C:/Users/UserAppData/Local/Temp/QtCreator-npjYSY/qtc-cmake-utoKdxQf" as an example. How can I change this? Is this an error on my side?I found this thread, which is very similar to my problem, where in the end the solution is to put in
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
before anexecute_process
command but in my case I dont use it to call my main CMakeLists.txt.Re: QtCreator runs CMake from /tmp directory
It seems like only after pressing the build button that my chosen build directory is being filled.
Normally that might not be an issue, but in my case the building of a thirdparty library can fail because the temp folder path name is too long and Windows has issues with that.
Is there anything I can do to prevent this temp folder behavior? -
I know this post is quite old, but maybe some folks might find this useful.
I've had the same problem and I've solved it by changing the build directory of the project (in the project menu on the left) to a folder that already exists. In this way, QtCreator builds directly to that folder, rather than creating a new temporary one. Clearly this is just a workaround but it might be enough for some.