Different output of "Unix Makefile" and "Ninja" generator for referenced shared library
I experience generation differences between CMake's Unix Makefile
and Ninja
generator.
I added an external shared library (add_library
/set_target_properties
). I set the target properties for IMPORTED_LOCATION
and INTERFACE_INCLUDE_DIRECTORIES
.
I expected that both generators produce the same binary. However, the two binaries’ NEEDED
entries, which reference the shared library, differ. As a result, the Ninja
-based version is not executable.
I attached a minimal demo example (for Linux x64). Extract the file and start the build.sh
script to run the demo.
A workaround for this bug is to add IMPORTED_NO_SONAME ON
in the set_target_properties
statement of the used shared library.
However, I consider this difference in the generators a bug, which should be investigated.
Thanks, Martin