gnustep / libobjc2

Objective-C runtime library intended for use with Clang.
http://www.gnustep.org/
MIT License
426 stars 116 forks source link

Install runtime files in CMAKE_INSTALL_BINDIR when GNUstep is not installed #275

Closed qmfrederik closed 5 months ago

qmfrederik commented 5 months ago

By default, the RUNTIME files are installed in LIB_INSTALL_PATH, which defaults to CMAKE_INSTALL_LIBDIR. Change that to BIN_INSTALL_PATH and have it default to CMAKE_INSTALL_BINDIR, so that objc.dll is installed into bin/objc.dll on msys2/mingw.

See https://github.com/msys2/MINGW-packages/pull/19948#issuecomment-1928034043

davidchisnall commented 5 months ago

Does this change the install location on *NIX? If the .so files are not installed in $PREFIX/lib, the loader won’t find them (unless you link with an rpath).

qmfrederik commented 5 months ago

No, that shouldn't be the case -- on Windows, libraries are categorized as RUNTIME, so they go into /bin, whereas on *nix, they qualify as LIBRARY, and the go into /lib. See https://cmake.org/cmake/help/latest/command/install.html#targets .

qmfrederik commented 5 months ago

I double-checked, on Linux, the .so files go into lib/, which is the intended behavior:

vagrant@vagrant:~/git/libobjc2/build$ git status
On branch bin-install-path
Your branch is up to date with 'origin/bin-install-path'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        ./

nothing added to commit but untracked files present (use "git add" to track)
vagrant@vagrant:~/git/libobjc2/build$ DESTDIR=./out cmake --install .
-- Install configuration: ""
-- Up-to-date: ./out/usr/local/lib/libobjc.so.4.6
-- Up-to-date: ./out/usr/local/lib/libobjc.so
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/Availability.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/Object.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/Protocol.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/blocks_private.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/blocks_runtime.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/capabilities.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/developer.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/encoding.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/hooks.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/message.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/objc-api.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/objc-arc.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/objc-auto.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/objc-class.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/objc-exception.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/objc-runtime.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/objc-visibility.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/objc.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/runtime-deprecated.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/runtime.h
-- Up-to-date: ./out/usr/local/include/GNUstep/objc/slot.h
-- Up-to-date: ./out/usr/local/include/GNUstep/Block.h
-- Up-to-date: ./out/usr/local/include/GNUstep/Block_private.h
-- Up-to-date: ./out/usr/local/lib/pkgconfig/libobjc.pc
vagrant@vagrant:~/git/libobjc2/build$