Fix RPATH for APPLE
authorTrond Norbye <trond.norbye@gmail.com>
Tue, 21 Feb 2017 11:54:02 +0000 (12:54 +0100)
committerAzat Khuzhin <a3at.mail@gmail.com>
Tue, 28 Feb 2017 08:02:39 +0000 (11:02 +0300)
By setting the CMake minimum version to 3.1 CMake automatically
adds the correct magic to make the library relocatable on
the filesystem (instead of burning the location of the library
at link time into the binary).

ex:
otool -L bin/http-connect
bin/http-connect:
@rpath/libevent_extra.2.2.0.dylib (compatibility version 2.2.0, current version 0.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)

Fixes: #468 (cherry-picked)
CMakeLists.txt

index 25327a359b946b6b47e689af235df16071ae300b..cab56903c4d79c17d2b3e91cf37fb9aae8fd4bff 100644 (file)
@@ -18,7 +18,7 @@
 #       cmake -G "Visual Studio 10" ..
 #       start libevent.sln
 #
-if (WIN32)
+if (WIN32 OR APPLE)
     cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
 else()
     cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)