Browse Source

hotfix for ar issue on mac os x

Former-commit-id: 55ee24a3bd17338d8a45f1cc7a61eb3226f1ede0
Alec Jacobson 7 years ago
parent
commit
2bc4a2fb18
1 changed files with 18 additions and 0 deletions
  1. 18 0
      shared/cmake/libigl.cmake

+ 18 - 0
shared/cmake/libigl.cmake

@@ -1,5 +1,23 @@
 cmake_minimum_required(VERSION 3.1)
 
+# https://github.com/libigl/libigl/issues/751
+# http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160425/351643.html
+if(APPLE)
+  if(NOT CMAKE_LIBTOOL)
+    find_program(CMAKE_LIBTOOL NAMES libtool)
+  endif()
+  if(CMAKE_LIBTOOL)
+    set(CMAKE_LIBTOOL ${CMAKE_LIBTOOL} CACHE PATH "libtool executable")
+    message(STATUS "Found libtool - ${CMAKE_LIBTOOL}")
+    get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+    foreach(lang ${languages})
+      # Added -c 
+      set(CMAKE_${lang}_CREATE_STATIC_LIBRARY
+        "${CMAKE_LIBTOOL} -c -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
+    endforeach()
+  endif()
+endif()
+
 ### Find packages to populate default options ###
 #
 # COMPONENTS should match subsequent calls