Adding threads libraries to exported dependencies if using OpenMP. - Previously we were only adding the flags to the link flags for the Ceres project, which resulted in them not being exported. Thus projects importing Ceres (if using OpenMP) would have to manually specify them in addition to CERES_LIBRARIES. Change-Id: If0354cc07e84dbebfc870a8862e1a8ca64659791
diff --git a/CMakeLists.txt b/CMakeLists.txt index bfc5616..ba89d02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -385,10 +385,6 @@ # 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(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)
diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt index f4a4578..87faf2b 100644 --- a/internal/ceres/CMakeLists.txt +++ b/internal/ceres/CMakeLists.txt
@@ -161,6 +161,7 @@ IF (OPENMP_FOUND) IF (NOT MSVC) LIST(APPEND CERES_LIBRARY_DEPENDENCIES gomp) + LIST(APPEND CERES_LIBRARY_DEPENDENCIES ${CMAKE_THREAD_LIBS_INIT}) ENDIF (NOT MSVC) ENDIF (OPENMP_FOUND)