Skip to content

Commit c7d61a0

Browse files
committed
[cmake] cuda: use cuda shared runtime when building popsift as shared library
1 parent dafec75 commit c7d61a0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ if(WIN32)
4747
link_directories(Boost_LIBRARRY_DIR_RELEASE)
4848
endif(WIN32)
4949

50+
if(BUILD_SHARED_LIBS)
51+
message(STATUS "BUILD_SHARED_LIBS ON")
52+
# Need to declare CUDA_USE_STATIC_CUDA_RUNTIME as an option to ensure that it is not overwritten in FindCUDA.
53+
option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" OFF)
54+
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
55+
# Workaround to force deactivation of cuda static runtime for cmake < 3.10
56+
set(CUDA_cudart_static_LIBRARY 0)
57+
else()
58+
message(STATUS "BUILD_SHARED_LIBS OFF")
59+
option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" ON)
60+
set(CUDA_USE_STATIC_CUDA_RUNTIME ON)
61+
endif()
62+
5063
find_package(CUDA 7.0 REQUIRED)
5164

5265
if(NOT CUDA_FOUND)

0 commit comments

Comments
 (0)