From c2a4529dd75ebd7b40ae2ab07766085e2919ebd4 Mon Sep 17 00:00:00 2001
From: Adrian Sampson <adrian@radbox.org>
Date: Thu, 23 Jul 2015 16:07:42 -0700
Subject: [PATCH] Slightly more proper CMake nonsense

---
 skeleton/CMakeLists.txt | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/skeleton/CMakeLists.txt b/skeleton/CMakeLists.txt
index e351804..ce2ee18 100644
--- a/skeleton/CMakeLists.txt
+++ b/skeleton/CMakeLists.txt
@@ -3,7 +3,18 @@ add_library(SkeletonPass MODULE
     Skeleton.cpp
 )
 
+# Use C++11 to compile our pass (i.e., supply -std=c++11).
+target_compile_features(SkeletonPass PRIVATE cxx_range_for cxx_auto_type)
+
+# LLVM is (typically) built with no C++ RTTI. We need to match that.
 set_target_properties(SkeletonPass PROPERTIES
-    COMPILE_FLAGS "-std=c++11 -fno-rtti"
-    LINK_FLAGS "-undefined dynamic_lookup"
+    COMPILE_FLAGS "-fno-rtti"
 )
+
+# Get proper shared-library behavior (where symbols are not necessarily
+# resolved when the shared library is linked) on OS X.
+if(APPLE)
+    set_target_properties(SkeletonPass PROPERTIES
+        LINK_FLAGS "-undefined dynamic_lookup"
+    )
+endif(APPLE)
-- 
GitLab