From 2149577f892116d4080d16fbf0b0455b1026b219 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Wed, 6 Jul 2016 15:36:56 -0400 Subject: [PATCH] Add export linker flags policy to cmake (#251) Add policy CMP0056, which honors the link flags in try_compile and try_run. This allows for building against non-system libc++ by providing the correct -L and rpath options in a containing project. For example: set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${LLVM_ROOT}/lib -l c++ -l c++abi") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,${LLVM_ROOT}/lib") --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f340fb35..a1251e74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project (benchmark) foreach(p CMP0054 # CMake 3.1 + CMP0056 # export EXE_LINKER_FLAGS to try_run ) if(POLICY ${p}) cmake_policy(SET ${p} NEW)