mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
Issue 83 fix: use correct pthread linker flags with clang.
1. -lpthreads was previously added to the CMAKE_CXX_FLAGS which are not passed to the linker thus linking would fail. 2. Clang would emit a warning about -lpthreads being added to a build instruction with -c (compile only). This patch fixes both of these issues by adding -lpthreads to the linker flags (and removes them from the CXX flags). Change-Id: I5e54de3ab7eced177aa31f311926893598af5b56
This commit is contained in:
+2
-1
@@ -473,7 +473,8 @@ IF ("${UNIX}" AND NOT ${BUILD_ANDROID})
|
||||
# At least on Linux, we need pthreads to be enabled for mutex to compile.
|
||||
# This may not work on windows or android.
|
||||
FIND_PACKAGE(Threads REQUIRED)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
|
||||
SET(STATIC_LIBRARY_FLAGS "${STATIC_LIBRARY_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
|
||||
ADD_DEFINITIONS(-DCERES_HAVE_PTHREAD)
|
||||
ADD_DEFINITIONS(-DCERES_HAVE_RWLOCK)
|
||||
ENDIF ("${UNIX}" AND NOT ${BUILD_ANDROID})
|
||||
|
||||
Reference in New Issue
Block a user