summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt64
1 files changed, 60 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52f89c3..b7282f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,10 +54,66 @@ if(ENABLE_SVG)
endif()
# fontforge starts using pkg-config 'correctly' since 2.0.0
-pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.0)
-include_directories(${FONTFORGE_INCLUDE_DIRS})
-link_directories(${FONTFORGE_LIBRARY_DIRS})
-set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES})
+pkg_check_modules(FONTFORGE libfontforge>=2.0.0)
+if(FONTFORGE_FOUND)
+ include_directories(${FONTFORGE_INCLUDE_DIRS})
+ link_directories(${FONTFORGE_LIBRARY_DIRS})
+ set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES})
+else()
+ message("Trying to locate old versions of fontforge...")
+ find_path(FF_INCLUDE_PATH fontforge/fontforge.h)
+ if(FF_INCLUDE_PATH)
+ message("Found fontforge.h: ${FF_INCLUDE_PATH}/fontforge/fontforge.h")
+ set(FONTFORGE_INCLUDE_DIRS ${FF_INCLUDE_PATH}/fontforge)
+ include_directories(${FONTFORGE_INCLUDE_DIRS})
+ # MacOSX gettext is in /opt/local/include - strange
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ find_path(GETTEXT_INCLUDE_PATH libintl.h HINTS "/usr/local/opt/gettext/include") # homebrew
+ if(GETTEXT_INCLUDE_PATH)
+ include_directories(${GETTEXT_INCLUDE_PATH})
+ else()
+ message("Cannot found libintl.h, if you see errors about libintl.h, add the path to gettext header files into your include paths")
+ endif()
+ endif()
+ else()
+ message(FATAL_ERROR "Error: cannot locate fontforge.h")
+ endif()
+ find_path(FF_CONFIG_INCLUDE_PATH config.h PATHS ${FONTFORGE_INCLUDE_DIRS} NO_DEFAULT_PATH)
+ if(FF_CONFIG_INCLUDE_PATH)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include ${FF_CONFIG_INCLUDE_PATH}/config.h")
+ message("Found config.h: ${FF_CONFIG_INCLUDE_PATH}/config.h")
+ else()
+ message("Cannot locate config.h for fontforge")
+ endif()
+
+ macro(wl_find_library LIB_NAME RESULT)
+ unset(${RESULT})
+ unset(${RESULT} CACHE)
+ foreach(FULL_LIB_NAME
+ ${CMAKE_IMPORT_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}
+ ${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
+ ${CMAKE_STATIC_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
+ )
+ find_library(FULL_LIB ${FULL_LIB_NAME})
+ if(FULL_LIB)
+ message("Found ${LIB_NAME}: ${FULL_LIB}")
+ set(${RESULT} ${FULL_LIB})
+ break()
+ endif()
+ endforeach()
+ unset(FULL_LIB_NAME)
+ unset(FULL_LIB_NAME CACHE)
+ unset(FULL_LIB)
+ unset(FULL_LIB CACHE)
+ endmacro()
+
+ wl_find_library(fontforge FONTFORGE_LIBRARIES)
+ if(NOT DEFINED FONTFORGE_LIBRARIES)
+ set(FONTFORGE_LIBRARIES fontforge)
+ message("Error: cannot locate fontforge")
+ endif()
+ set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES})
+endif()
# debug build flags (overwrite default cmake debug flags)
set(CMAKE_C_FLAGS_DEBUG "-ggdb -pg")