CMake policy CMP0042 affects whether @rpath is used in the install path for
dynamic libraries on macOS. It was introduced in CMake 3.0. If the policy is
not explicitly set, CMake uses OLD behavior and emits a warning.
This commit explicitly sets NEW behavior in order to silence the warning and
adopt the preferred behavior by CMake. This uses @rpath instead of @loader_path
in install names.
Documentation for policy CMP0042:
https://cmake.org/cmake/help/latest/policy/CMP0042.html
On Linux, cmake gives the error:
~~~bash
CMake Error at CMakeLists.txt:79 (INSTALL):
INSTALL TARGETS given no LIBRARY DESTINATION for shared library target
"libglew_shared".
CMake Error at CMakeLists.txt:94 (INSTALL):
INSTALL TARGETS given no LIBRARY DESTINATION for shared library target
"libglewmx_shared".
-- Configuring incomplete, errors occurred!
~~~
This bug was caused by the merge:
e4de8a77a1
Containing:
* Update library install directories in Cmake
commit 5a7232fc53
* Install directories set in single statement
commit def19e7de4
The cause is that RUNTIME DESTINATION is now defined (for Windows), but
not LIBRARY DESTINATION (for Linux).
See issue: https://github.com/Perlmint/glew-cmake/issues/17
Currently (well, at least on Windows), the created DLL files aren't installed to the correct directory after a build. The DLL files are installed to the 'lib' directory. Which actually is the place for the static library or the shared library's symbols file (.lib).
The shared library runtimes should be installed to the 'bin' output directory, as proposed in this PR.
See the ```CONFIGURATIONS``` option in [Install command introduction in the CMake manual](https://cmake.org/cmake/help/v3.14/command/install.html#introduction) for an example.
It's considered best practice and follows convention as used in other notable libraries as libpng, libogg/vorbis, freetype, zlib, tinyxml, etc, to install the runtime output in the 'bin' directory.