Perlmint / glew-cmake

GLEW(https://github.com/nigels-com/glew, source updated nightly) with Cmake and pre-generated sources
Other
234 stars 95 forks source link

Silence warning for policy CMP0042 #43

Closed tobybell closed 3 years ago

tobybell commented 3 years ago

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 OLD behavior in order to silence the warning. This is the same behavior as used by CMake by default, so this makes no functional change to the build.

Note: CMake encourages using NEW behavior as of CMake 3.0, and NEW behavior is also what appears to be used in the cmake/build/CMakeLists.txt from the original GLEW repository, so perhaps we should consider setting this policy to NEW. I can build and link successfully on macOS using both the OLD and NEW behavior, but I'm not sure what other testing might be required. If you'd like me to include that change in this PR, let me know.

Documentation for policy CMP0042:

https://cmake.org/cmake/help/latest/policy/CMP0042.html

Perlmint commented 3 years ago

Thanks for sending PR. Can you change the CMP0042 to NEW?.

With CMP0042 OLD, a shared library is linked with the absolute path. But, with CMP0042 NEW, a shared library is linked with using rpath. You can see the different linked path with otool -L <shared library or linked executable>

tobybell commented 3 years ago

Yep. I had only set it to OLD because that's what CMake was already defaulting to, but NEW seems preferred.

Perlmint commented 3 years ago

LGTM. It should pass the checks. But could you please rebase onto the latest master and, if you can, squash commits?