Browse Source

Update CMakeLists.txt

Former-commit-id: 52c0371af8951173bb98184b4410f6fdacb2bc94
Sebastian Koch 9 years ago
parent
commit
04d608aa7b
1 changed files with 15 additions and 6 deletions
  1. 15 6
      python/CMakeLists.txt

+ 15 - 6
python/CMakeLists.txt

@@ -139,18 +139,27 @@ elseif (UNIX)
   # .SO file extension on Linux/Mac OS
   set_target_properties(pyigl PROPERTIES SUFFIX ".so")
 
-  # Strip unnecessary sections of the binary on Linux/Mac OS
+  #Enable flag if undefined symbols appear on pyigl module import to get notified about the missing symbols at link time
+  option(CHECK_UNDEFINED        "Check for undefined symbols"    OFF)
+
+  # Strip unnecessary sections of the binary on Linux/Mac OS 
   if(APPLE)
     set_target_properties(pyigl PROPERTIES MACOSX_RPATH ".")
-    #Comment out if undefined symbols appear on pyigl module import to get notified about the missing templates at link time
-    set_target_properties(pyigl PROPERTIES LINK_FLAGS "-undefined dynamic_lookup -dead_strip")
+    
+    if (NOT CHECK_UNDEFINED)
+      set_target_properties(pyigl PROPERTIES LINK_FLAGS "-undefined dynamic_lookup -dead_strip")
+    endif()
+
     if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
       add_custom_command(TARGET pyigl POST_BUILD COMMAND strip -u -r ${CMAKE_CURRENT_BINARY_DIR}/../pyigl.so)
     endif()
   else()
-    #Comment in if undefined symbols appear on pyigl module import to get notified about the missing templates at link time
-    #target_link_libraries(pyigl ${PYTHON_LIBRARIES})
-    #set_target_properties(pyigl PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
+
+    if (CHECK_UNDEFINED)
+      target_link_libraries(pyigl ${PYTHON_LIBRARIES})
+      set_target_properties(pyigl PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
+    endif()
+
     if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
       add_custom_command(TARGET pyigl POST_BUILD COMMAND strip ${CMAKE_CURRENT_BINARY_DIR}/../pyigl.so)
     endif()