From fb9a060125adf0cc7920ad44b90e383c8cc9bf33 Mon Sep 17 00:00:00 2001 From: Bastian Bloessl Date: Tue, 30 Sep 2014 16:47:07 +0200 Subject: [PATCH] cmake: apple, set install name and use rpath --- CMakeLists.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56522f5..793ca8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,26 @@ if(NOT ITPP_FOUND) message(FATAL_ERROR "ITPP required to compile ieee802-11") endif() +######################################################################## +# On Apple only, set install name and use rpath correctly, if not already set +######################################################################## +if(APPLE) + if(NOT CMAKE_INSTALL_NAME_DIR) + set(CMAKE_INSTALL_NAME_DIR + ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE + PATH "Library Install Name Destination Directory" FORCE) + endif(NOT CMAKE_INSTALL_NAME_DIR) + if(NOT CMAKE_INSTALL_RPATH) + set(cmakE_INSTALL_RPATH + ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE + PATH "Library Install RPath" FORCE) + endif(NOT CMAKE_INSTALL_RPATH) + if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) + set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE + BOOL "Do Build Using Library Install RPath" FORCE) + endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) +endif(APPLE) + ######################################################################## # Setup the include and linker paths ########################################################################