Iam using CMake 3.17.1.
My project structure is like this:
In the CMakeLists.txt I have to specify all sources relative to the Makefiles directory so I end up with something like this:
Now this works well so far as long as the root path is not too long, as it seems the paths to the compiled object files CMake produces are something like this:
Why’s this absolute path necessary here?
Instead if CMakeLists.txt is at toplevel not at sibling level and source file paths are specified like add_executable(some_target Src/SomeSource.c), the object file path looks something like this:
and would be much shorter…
The latter would require a modification of the project structure, but I’d like to try to avoid this, since Iam working in a bigger team maintaining one codebase with multiple projects, and so far my project is the only project which is using CMake/ninja to compile our software.
So my question is, if there is a way to tell CMake to produce object file paths like in the latter form? This would greatly reduce path length and would increase the chance that the project is compiling under most circumstances, because currently Iam struggling big time with Windows’ MAX_PATH_LENGTH restriction, and I’m a little bit out of idea what to do.
Any help on this issue is much appreciated, thanks in advance. If you need more information please let me know.
Kind regards, Steve