Ninja and Make run linker from different directories
Hi,
I noticed that CMake "invokes" the linker from different directories with Ninja and Make.
This is fine for most use-cases. Because CMake will change all paths passed to the linker appropriately.
But this will go horribly wrong if a custom linker script is used and this linker script is using relative paths to libraries.
For my particular use-case I can (and should) rewrite the linker script to support being invoked from different directories, but wouldn't it be desired behaviour to be consistent across generators?
To reproduce:
CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
add_subdirectory(sub)
sub/CMakeLists.txt
add_executable(app main.c)
Make output:
cd /home/sebo/workspace_zephyr/ninja_vs_make/b/sub && /home/sebo/zephyr/samples/bluetooth/mesh/a/cmake-3.10.0-rc4-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/app.dir/link.txt --verbose=1 /usr/bin/cc CMakeFiles/app.dir/main.c.o -o app
Ninja output:
ninja: Entering directory `n/' [1/1] : && /usr/bin/cc sub/CMakeFiles/app.dir/main.c.o -o sub/app && :