Skip to content

Commit fcce96d

Browse files
committed
CXX-1170 Add OS X framework support to FindLibMongoC.cmake
Backported from CXX-1158
1 parent 2de0ad1 commit fcce96d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cmake/FindLibMongoC.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ elseif (PKG_CONFIG_FOUND)
3434
# We don't reiterate the version information here because we assume that
3535
# pkg_check_modules has honored our request.
3636
find_package_handle_standard_args(LIBMONGOC DEFAULT_MSG LIBMONGOC_FOUND)
37+
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND LIBMONGOC_LDFLAGS_OTHER)
38+
# pkg_check_modules strips framework libraries and puts them in the
39+
# LIBMONGOC_LDFLAGS_OTHER variable. We need to append them
40+
# back to LIBMONGOC_LIBRARIES, but need to change from
41+
# "-framework;Security;-framework;CoreFoundation" to
42+
# "-framework Security;-framework CoreFoundation"
43+
string(REPLACE "-framework;" "-framework " LIBMONGOC_FRAMEWORKS "${LIBMONGOC_LDFLAGS_OTHER}")
44+
list(APPEND LIBMONGOC_LIBRARIES ${LIBMONGOC_FRAMEWORKS})
45+
# publish updated value back to the cache
46+
set(LIBMONGOC_LIBRARIES ${LIBMONGOC_LIBRARIES} CACHE INTERNAL "")
47+
endif()
3748
else()
3849
message(FATAL_ERROR "Don't know how to find libmongoc; please set LIBMONGOC_DIR to the prefix directory with which libbson was configured.")
3950
endif()

0 commit comments

Comments
 (0)