From bd97a17f6fbfcf1152056dea763d4567d0c72367 Mon Sep 17 00:00:00 2001 From: David Golden Date: Thu, 15 Dec 2016 13:38:44 -0500 Subject: [PATCH] CXX-1158 Add OS X framework support to FindLibMongoC.cmake --- cmake/FindLibMongoC.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/FindLibMongoC.cmake b/cmake/FindLibMongoC.cmake index 830de11..0583f3f 100644 --- a/cmake/FindLibMongoC.cmake +++ b/cmake/FindLibMongoC.cmake @@ -34,6 +34,17 @@ elseif (PKG_CONFIG_FOUND) # We don't reiterate the version information here because we assume that # pkg_check_modules has honored our request. find_package_handle_standard_args(LIBMONGOC DEFAULT_MSG LIBMONGOC_FOUND) + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND LIBMONGOC_LDFLAGS_OTHER) + # pkg_check_modules strips framework libraries and puts them in the + # LIBMONGOC_LDFLAGS_OTHER variable. We need to append them + # back to LIBMONGOC_LIBRARIES, but need to change from + # "-framework;Security;-framework;CoreFoundation" to + # "-framework Security;-framework CoreFoundation" + string(REPLACE "-framework;" "-framework " LIBMONGOC_FRAMEWORKS "${LIBMONGOC_LDFLAGS_OTHER}") + list(APPEND LIBMONGOC_LIBRARIES ${LIBMONGOC_FRAMEWORKS}) + # publish updated value back to the cache + set(LIBMONGOC_LIBRARIES ${LIBMONGOC_LIBRARIES} CACHE INTERNAL "") + endif() else() message(FATAL_ERROR "Don't know how to find libmongoc; please set LIBMONGOC_DIR to the prefix directory with which libbson was configured.") endif() -- 2.10.1