Hi Tobias Hunger the #28742 is buggy on Windows, it works correctly on Unix and correctly adds dependency libraries paths to the LD_LIBRARY_PATH, but it doesn't on windows ( not to LD_LIBRARY_PATH but to PATH of course on Windows ).
I have spent 7 hours yesterday investigating what is going on, first I thought that I have something bad in my CmakeLists.txt, after few hours I understood that the problem will be somewhere else.
Then I discovered this PR #28742 and found these files in CMake build directory .cmake\api\v1\reply\target-utils-Debug-b58a280613befd8bf0f3.json and I understood that the Qt Creator somehow queries the CMake build system and obtains info about dependencies for every target ( FileApi and so-called fragments in your source code ). So I started investigating these files.
I have discovered that on Unix the fragments at link.commandFragment.fragment have forward slashes in the path, but on Windows, they have and this can be a source of the whole problem. eg.
Problem is that I don't have setup qtcreator dev. env. so I can not verify it, I have deduced it only from the #28742 PR and the source of the problem can still be somewhere else.
I have also set up a simple example that should add 2 paths on the PATH, but on windows, it adds only 1 path, and it is the path of the compiled executable ( I don't understand why this path ), the rest 2 paths for executable library dependencies are not added.
This example behaves correctly on Unix and it correctly adds 2 paths on LD_LIBRARY_PATH.
Let me know what do you need to fix or confirm this issue, can you verify it?
So I tried to use the same commands that process filepaths in PR #28742 and manually paste buggy input:
And at the end here the command looks like this:
Do you see it, it contains double forward slashes.
All this is based on the assumption that input.targetDetails here already contains paths with on Windows, if it doesn't then the problem will be somewhere else.
Screenshots below are from the library_cmake example project that I have uploaded in the comment above and I have selected Run Configuration for the query subproject, to be clear I'm pasting screenshot:
It adds 2 paths on Unix:
And 1 path on windows:
On windows, it adds the path of compiled autotest exe, I don't understand why this folder?
On Unix it adds 2 paths of compiled autotest executable's shared library dependencies, this is correct.
|For Gerrit Dashboard: QTCREATORBUG-26110|
|366016,5||CMakePM: Fix build library search path with CMake 3.20+||5.0||qt-creator/qt-creator||Status: MERGED||+2||0|