зеркало из https://github.com/microsoft/caffe.git
- Fix to cmake build for clang
This commit is contained in:
Родитель
541386054c
Коммит
12f85982c4
|
@ -42,6 +42,8 @@ if(UNIX OR APPLE)
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall")
|
||||
endif()
|
||||
|
||||
caffe_set_caffe_link()
|
||||
|
||||
if(USE_libstdcpp)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
|
||||
message("-- Warning: forcing libstdc++ (controlled by USE_libstdcpp option in cmake)")
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
################################################################################################
|
||||
# Defines global Caffe_LINK flag, This flag is required to prevent linker from excluding
|
||||
# some objects which are not addressed directly but are registered via static constructors
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(Caffe_LINK caffe)
|
||||
else()
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(Caffe_LINK -Wl,-force_load caffe)
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(Caffe_LINK -Wl,--whole-archive caffe -Wl,--no-whole-archive)
|
||||
macro(caffe_set_caffe_link)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(Caffe_LINK caffe)
|
||||
else()
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(Caffe_LINK -Wl,-force_load caffe)
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(Caffe_LINK -Wl,--whole-archive caffe -Wl,--no-whole-archive)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
################################################################################################
|
||||
# Convenient command to setup source group for IDEs that support this feature (VS, XCode)
|
||||
# Usage:
|
||||
|
|
Загрузка…
Ссылка в новой задаче