Commit 89ee7cdb authored by Davis King's avatar Davis King

Make sure fPIC gets propagated to nvcc in all cases.

parent 9bd418a5
...@@ -529,6 +529,11 @@ if (NOT TARGET dlib) ...@@ -529,6 +529,11 @@ if (NOT TARGET dlib)
# magic in the standard C++ header files (since nvcc uses gcc headers on # magic in the standard C++ header files (since nvcc uses gcc headers on
# linux). # linux).
list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__;-D_MWAITXINTRIN_H_INCLUDED;-D_FORCE_INLINES;${FLAGS_FOR_NVCC}") list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__;-D_MWAITXINTRIN_H_INCLUDED;-D_FORCE_INLINES;${FLAGS_FOR_NVCC}")
if (CMAKE_POSITION_INDEPENDENT_CODE)
# sometimes this setting isn't propagated to NVCC, which then causes the
# compile to fail. So make sure it's propagated.
list(APPEND CUDA_NVCC_FLAGS "-Xcompiler -fPIC")
endif()
include(cmake_utils/test_for_cudnn/find_cudnn.txt) include(cmake_utils/test_for_cudnn/find_cudnn.txt)
......
...@@ -132,6 +132,7 @@ if (CMAKE_COMPILER_IS_GNUCXX) ...@@ -132,6 +132,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
# -fPIC for GCC but sometimes it still doesn't get set, so make sure it # -fPIC for GCC but sometimes it still doesn't get set, so make sure it
# does. # does.
add_definitions("-fPIC") add_definitions("-fPIC")
set(CMAKE_POSITION_INDEPENDENT_CODE True)
else() else()
set(CMAKE_POSITION_INDEPENDENT_CODE True) set(CMAKE_POSITION_INDEPENDENT_CODE True)
endif() endif()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment