]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix build with custom glib/gmime
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 26 Nov 2016 12:09:12 +0000 (12:09 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 26 Nov 2016 12:10:10 +0000 (12:10 +0000)
CMakeLists.txt
contrib/lgpl/CMakeLists.txt

index 151d6cd9e3e494ecb5d8635d5dfa4d17e4084a28..f22a131d33a94ee82f1834bb23f60b4f12439616 100644 (file)
@@ -647,10 +647,10 @@ ELSE(ENABLE_LUAJIT MATCHES "ON")
 ENDIF(ENABLE_LUAJIT MATCHES "ON")
 
 ProcessPackage(GLIB2 LIBRARY glib-2.0 INCLUDE glib.h
-       INCLUDE_SUFFIXES include/glib
+       INCLUDE_SUFFIXES include/glib include/glib-2.0
        ROOT ${GLIB_ROOT_DIR} MODULES glib-2.0>=2.28)
 ProcessPackage(GMODULE2 LIBRARY gmodule-2.0 INCLUDE glib.h
-       INCLUDE_SUFFIXES include/glib
+       INCLUDE_SUFFIXES include/glib include/glib-2.0
        ROOT ${GLIB_ROOT_DIR} MODULES gmodule-no-export-2.0>=2.28 gmodule-2.0>=2.28)
 
 IF(ENABLE_PCRE2 MATCHES "ON")
@@ -665,7 +665,9 @@ IF(ENABLE_JEMALLOC MATCHES "ON")
                ROOT ${JEMALLOC_ROOT_DIR} MODULES jemalloc)
        SET(WITH_JEMALLOC "1")
 ENDIF()
-ProcessPackage(GMIME LIBRARY gmime-2.6 gmime-2.4 gmime-2.2 gmime-2 INCLUDE gmime.h INCLUDE_SUFFIXES include/gmime
+ProcessPackage(GMIME LIBRARY gmime-2.6 gmime-2.4 gmime-2.2 gmime-2
+       INCLUDE gmime.h
+       INCLUDE_SUFFIXES include/gmime include/gmime-2.0 include/gmime-2.4 include/gmime-2.6
        ROOT ${GMIME_ROOT_DIR} MODULES gmime-2.6 gmime-2.4 gmime-2.0)
 ProcessPackage(LIBEVENT LIBRARY event INCLUDE event.h INCLUDE_SUFFIXES include/event
        ROOT ${LIBEVENT_ROOT_DIR} MODULES event libevent)
index 39191620ae10b993728d97fc7ed1ffbb6a3d2b91..7f418002d3b066f52f1485588c5b30dfa803b9ce 100644 (file)
@@ -1,23 +1,25 @@
 # Hack for glib < 2.16
-IF(GLIB2_VERSION VERSION_LESS "2.16")
-       IF(GLIB2_VERSION VERSION_LESS "2.14")
-               SET(LIBGLIBSRC gregex.c gchecksum.c guniscript.c)
-               SET(GLIB_RE_COMPAT 1 PARENT_SCOPE)
-               SET(GLIB_UNISCRIPT_COMPAT 1 PARENT_SCOPE)
-               SET(GLIB_HASH_COMPAT 1 PARENT_SCOPE)
-       ELSE(GLIB2_VERSION VERSION_LESS "2.14")
-               SET(LIBGLIBSRC gchecksum.c)
-       ENDIF(GLIB2_VERSION VERSION_LESS "2.14")
-       
-       ADD_LIBRARY(glibadditions SHARED ${LIBGLIBSRC})
-       SET_TARGET_PROPERTIES(glibadditions PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/contrib/lgpl")
-       
-       TARGET_LINK_LIBRARIES(glibadditions ${RSPAMD_REQUIRED_LIBRARIES})
+IF(NOT GLIB_ROOT_DIR)
+       IF(GLIB2_VERSION VERSION_LESS "2.16")
+               IF(GLIB2_VERSION VERSION_LESS "2.14")
+                       SET(LIBGLIBSRC gregex.c gchecksum.c guniscript.c)
+                       SET(GLIB_RE_COMPAT 1 PARENT_SCOPE)
+                       SET(GLIB_UNISCRIPT_COMPAT 1 PARENT_SCOPE)
+                       SET(GLIB_HASH_COMPAT 1 PARENT_SCOPE)
+               ELSE(GLIB2_VERSION VERSION_LESS "2.14")
+                       SET(LIBGLIBSRC gchecksum.c)
+               ENDIF(GLIB2_VERSION VERSION_LESS "2.14")
 
-       SET_TARGET_PROPERTIES(glibadditions PROPERTIES VERSION ${RSPAMD_VERSION})
+               ADD_LIBRARY(glibadditions SHARED ${LIBGLIBSRC})
+               SET_TARGET_PROPERTIES(glibadditions PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/contrib/lgpl")
 
-       INSTALL(TARGETS glibadditions LIBRARY PUBLIC_HEADER 
-       LIBRARY DESTINATION lib 
-       PUBLIC_HEADER DESTINATION include)
-    SET(GLIB_COMPAT 1 PARENT_SCOPE)
-ENDIF(GLIB2_VERSION VERSION_LESS "2.16")
+               TARGET_LINK_LIBRARIES(glibadditions ${RSPAMD_REQUIRED_LIBRARIES})
+
+               SET_TARGET_PROPERTIES(glibadditions PROPERTIES VERSION ${RSPAMD_VERSION})
+
+               INSTALL(TARGETS glibadditions LIBRARY PUBLIC_HEADER
+                       LIBRARY DESTINATION lib
+                       PUBLIC_HEADER DESTINATION include)
+               SET(GLIB_COMPAT 1 PARENT_SCOPE)
+       ENDIF(GLIB2_VERSION VERSION_LESS "2.16")
+ENDIF()