Skip to content

Commit

Permalink
Fix position independent code on Linux. (libigl#941)
Browse files Browse the repository at this point in the history
Former-commit-id: e21aa88
  • Loading branch information
jdumas authored and alecjacobson committed Oct 15, 2018
1 parent 7f852d8 commit 8895c71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmake/libigl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ if(BUILD_SHARED_LIBS)
set_target_properties(igl_common PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON)
endif()

if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
endif()

# Eigen
if(TARGET Eigen3::Eigen)
# If an imported target already exists, use it
Expand Down
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ find_package(PythonLibs REQUIRED)

string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
if(NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -flto")
Expand Down

0 comments on commit 8895c71

Please sign in to comment.