Compile nnpack and pthreadpool with -fPIC

Summary: Closes https://github.com/caffe2/caffe2/pull/1428

Reviewed By: Maratyszcza

Differential Revision: D6240390

Pulled By: pietern

fbshipit-source-id: 6d441bbfda81ce79e3c824ec28eec0b2cdd8c7cd
This commit is contained in:
Pieter Noordhuis
2017-11-03 20:14:31 -07:00
committed by Facebook Github Bot
parent 5616d41421
commit 1021402136

View File

@ -53,6 +53,10 @@ if (ANDROID OR IOS OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NA
add_subdirectory(
"${NNPACK_PREFIX}"
"${CONFU_DEPENDENCIES_BINARY_DIR}")
# We build static versions of nnpack and pthreadpool but link
# them into a shared library for Caffe2, so they need PIC.
set_property(TARGET nnpack PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET pthreadpool PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
set(NNPACK_FOUND TRUE)