Skip to content

Commit 4cf7782

Browse files
author
Tor Didriksen
committed
Bug#35311140 Build failure with Homebrew rapidjson installed & symlinked
On MacOS, If Homebrew rapidjson is installed, then build fails. Note that even -DWITH_RAPIDJSON=bundled does not help, and the only workaround is brew unlink rapidjson. This is a regression from Bug#35006191 Convert rapidjson to a cmake interface library which removed the global INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RAPIDJSON_INCLUDE_DIR}) It turns out we need this on MacOS to avoid accidental #include of rapidjson headers from Homebrew rather than the bundled code in extra/rapidjson. Backported to 8.0 (cherry picked from commit ac364d25c0fdd10eaaecc5bb935e85c592879f7e) Change-Id: Id737953d05ea77f35de656067f594b47a7c7ba51
1 parent 120d7c2 commit 4cf7782

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmake/rapidjson.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ MACRO (MYSQL_CHECK_RAPIDJSON)
8686

8787
IF (WITH_RAPIDJSON STREQUAL "bundled")
8888
SET(RAPIDJSON_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extra/rapidjson/include)
89+
# We must include this first, in case we use other Homebrew libraries.
90+
IF(APPLE)
91+
INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RAPIDJSON_INCLUDE_DIR})
92+
ENDIF()
8993
ELSEIF(WITH_RAPIDJSON STREQUAL "system")
9094
FIND_SYSTEM_RAPIDJSON()
9195
IF (NOT SYSTEM_RAPIDJSON_FOUND)

0 commit comments

Comments
 (0)