Our project has CMakeList.txt , but this is not our main build system. On Mac OS X, using Cmake generates a warning (nothing new here):
MACOSX_RPATH is not specified for the following targets...
The quoted question / answer uses the use of set(CMAKE_MACOSX_RPATH 0) or set(CMAKE_MACOSX_RPATH 1) . Our problem is that this feature is too new , and it violates existing Cmake installations, such as those found on Ubuntu LTS or CentOS. We need to protect its use for Cmake> = 2,8.12, but the post does not discuss how to do this.
The search yields no useful results: how to protect the cmake directive . My inability to find relevant results is probably related to my inexperienced with Cmake (others had to support her).
How do we protect set(CMAKE_MACOSX_RPATH 0) or set(CMAKE_MACOSX_RPATH 1) ?
Please note: I'm not looking for cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR) . The best I can say has nothing to do. From testing, we know that it does not reject target_include_directories , although target_include_directories does not meet the minimum requirements and causes failures for lower-level clients such as Ubuntu LTS.
I think that what I am looking for is closer to the C macro processor:
#define 2_8_12 ... #if CMAKE_VERSION >= 2_8_12 set(CMAKE_MACOSX_RPATH 0) #endif
source share