sierrafoxtrot / srecord

SRecord github Mirror
https://srecord.sourceforge.net/
GNU General Public License v3.0
46 stars 23 forks source link

srecord-1.65.0 forces install into /usr even if CMAKE_INSTALL_PREFIX is defined #65

Open nieder opened 10 months ago

nieder commented 10 months ago

The install is being forced into /usr, which is often write-restricted. CMakeLists should honor $CMAKE_INSTALL_PREFIX.

cmake -DCMAKE_INSTALL_NAME_DIR=/opt/sw/lib -DCMAKE_INSTALL_PREFIX=/opt/sw .
...
-- Packaging for Macintosh
-- gcrypt location 
-- CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib
-- CMAKE_INSTALL_PREFIX /usr
-- CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib
-- CMAKE_INSTALL_PREFIX /usr
-- CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib
-- CMAKE_INSTALL_PREFIX /usr
...
lots of building...
...
make install DESTDIR=/tmp/srecord
Install the project...
/sw/bin/cmake -P cmake_install.cmake
-- Install configuration: "Release"
-- Installing: /tmp/srecord/usr/lib/liblib_srecord.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /tmp/srecord/usr/lib/liblib_srecord.a(vsnprintf.cc.o) has no symbols
-- Installing: /tmp/srecord/usr/include/srecord
-- Installing: /tmp/srecord/usr/include/srecord/format_printf.h
-- Installing: /tmp/srecord/usr/include/srecord/quit.h
-- Installing: /tmp/srecord/usr/include/srecord/endian
...
iillyyaa commented 9 months ago

I filed PR https://github.com/sierrafoxtrot/srecord/pull/68 that fixes this issue as recommended by cmake documentation, while maintaining the default behavior when CMAKE_INSTALL_PREFIX is omitted. An identical patch has been submitted, reviewed and admitted into yocto's meta-openembedded/meta-oe layer: https://github.com/openembedded/meta-openembedded/commit/7b66ea10817f90fe4b869de7b3b04d3aa4b2714f