If I make my project I can see this:
[ 50%] Building C object CMakeFiles/hello.dir/hello.c.obj
/cygdrive/c/users/me/Home/bin/iccarm /cygdrive/c/users/me/Home/sandbox/iar/hello.c -I/cygdrive/c/users/me/Home/sandbox/iar/foo -I/cygdrive/c/users/me/Home/inc -o CMakeFiles/hello.dir/hello.c.obj
Since I always call make
inside my build
directory, why not using relative path for the sake of readability and compatibility across operating systems?
[ 50%] Building C object CMakeFiles/hello.dir/hello.c.obj
iccarm hello.c -Ifoo -Iinc -o CMakeFiles/hello.dir/hello.c.obj
Is it much better isn't it?
Is there a way to force CMake to use relative paths as much as possible?
CMake does always use absolute paths. It's part of the concept. Therefore you can't move the generated build environment files nor can you e.g. bring them under source control or make the verbose output prettier (you could just play a little with the rule messages like here).
There once was CMAKE_USE_RELATIVE_PATHS
, but the documentation reveals:
This variable has no effect. The partially implemented effect it had in previous releases was removed in CMake 3.4.
References
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With