Recognize newer versions of FriBidi again.

Newer versions don't define a symbol directly confusing cmake, fixed by
letting the compiler test whether it really doesn't exist. The issue was
spotted by Espreon.
This commit is contained in:
Mark de Wever 2011-03-06 10:09:51 +00:00
parent 36022c9cb2
commit ef6eb243e1
2 changed files with 19 additions and 0 deletions

View file

@ -68,6 +68,7 @@ Version 1.9.4+svn:
* Unit invalidation is processed in parallel using OpenMP
* Allow redirection of the logger.
* Polished gui2 code.
* Fixed: Newer versions of FriBidi were no longer recognized.
Version 1.9.4:
* AI:

View file

@ -46,6 +46,24 @@ IF (FRIBIDI_LIBRARY AND FRIBIDI_INCLUDE_DIR)
# 2. Define OLD_FRIBIDI and use fribidi_utf8_to_unicode.
# To compile Wesnoth with fribidi <= 0.10.4, we must define OLD_FRIBIDI.
# Newer versions of fribidi (not tested the initial version which has the
# issue, but at least 0.19.2 has the issue) no longer have the symbol
# FRIBIDI_CHAR_SET_UTF8. But the symbol is build with some macros confusing
# cmake. To test for that case let the compiler give its verdict.
if(FOUND_fribidi_charset_to_unicode AND NOT FOUND_FRIBIDI_CHAR_SET_UTF8)
file(WRITE "${CMAKE_BINARY_DIR}/fribidi_test.c"
"#include <fribidi.h>\nint main(){FriBidiCharSet s = FRIBIDI_CHAR_SET_UTF8;}"
)
try_compile(FOUND_FRIBIDI_CHAR_SET_UTF8
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}/fribidi_test.c"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${FRIBIDI_INCLUDE_DIR}"
)
file(REMOVE "${CMAKE_BINARY_DIR}/fribidi_test.c")
endif(FOUND_fribidi_charset_to_unicode AND NOT FOUND_FRIBIDI_CHAR_SET_UTF8)
if(FOUND_fribidi_charset_to_unicode AND FOUND_FRIBIDI_CHAR_SET_UTF8)
# fribidi >= 0.10.5
SET(FRIBIDI_LIBRARIES ${FRIBIDI_LIBRARY})