1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(cmake): Add ability to real disable optional dependency

This commit is contained in:
Diadlo 2017-01-29 13:27:50 +03:00
parent 36f7f65732
commit fb43e30677
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 37 additions and 22 deletions

View File

@ -432,20 +432,26 @@ endif()
add_definitions(-DQT_MESSAGELOGCONTEXT=1)
if (NOT ENABLE_STATUSNOTIFIER)
if (NOT DEFINED ENABLE_STATUSNOTIFIER)
set(ENABLE_STATUSNOTIFIER True)
endif()
if(${ENABLE_STATUSNOTIFIER} AND GDK_PIXBUF_FOUND AND GLIB_FOUND AND GTK_FOUND)
set(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES}
src/platform/statusnotifier/closures.c
src/platform/statusnotifier/closures.h
src/platform/statusnotifier/enums.c
src/platform/statusnotifier/enums.h
src/platform/statusnotifier/interfaces.h
src/platform/statusnotifier/statusnotifier.c
src/platform/statusnotifier/statusnotifier.h)
add_definitions(-DENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND=1)
if(${ENABLE_STATUSNOTIFIER})
search_dependency(GDK_PIXBUF PACKAGE gdk-pixbuf-2.0 OPTIONAL)
search_dependency(GLIB PACKAGE glib-2.0 OPTIONAL)
search_dependency(GTK PACKAGE gtk+-2.0 OPTIONAL)
if(GDK_PIXBUF_FOUND AND GLIB_FOUND AND GTK_FOUND)
set(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES}
src/platform/statusnotifier/closures.c
src/platform/statusnotifier/closures.h
src/platform/statusnotifier/enums.c
src/platform/statusnotifier/enums.h
src/platform/statusnotifier/interfaces.h
src/platform/statusnotifier/statusnotifier.c
src/platform/statusnotifier/statusnotifier.h)
add_definitions(-DENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND=1)
endif()
endif()
if(AVFOUNDATION_FOUND)
@ -454,19 +460,33 @@ if(AVFOUNDATION_FOUND)
src/platform/camera/avfoundation.h)
endif()
if (NOT ENABLE_APPINDICATOR)
if (NOT DEFINED ENABLE_APPINDICATOR)
set(ENABLE_APPINDICATOR False)
endif()
if(${ENABLE_APPINDICATOR} AND APPINDICATOR_FOUND)
add_definitions(-DENABLE_SYSTRAY_UNITY_BACKEND=1)
if(${ENABLE_APPINDICATOR})
search_dependency(APPINDICATOR PACKAGE appindicator-0.1)
search_dependency(GDK_PIXBUF PACKAGE gdk-pixbuf-2.0)
search_dependency(GLIB PACKAGE glib-2.0)
search_dependency(GTK PACKAGE gtk+-2.0)
if(APPINDICATOR_FOUND)
add_definitions(-DENABLE_SYSTRAY_UNITY_BACKEND=1)
endif()
endif()
if (NOT ENABLE_GTK_SYSTRAY)
if (NOT DEFINED ENABLE_GTK_SYSTRAY)
set(ENABLE_GTK_SYSTRAY True)
endif()
if(${ENABLE_GTK_SYSTRAY} AND GTK_FOUND)
add_definitions(-DENABLE_SYSTRAY_GTK_BACKEND=1)
if(${ENABLE_GTK_SYSTRAY})
if(NOT GTK_FOUND)
search_dependency(GTK PACKAGE gtk+-2.0 OPTIONAL)
endif()
if(GTK_FOUND)
add_definitions(-DENABLE_SYSTRAY_GTK_BACKEND=1)
endif()
endif()
add_library(${PROJECT_NAME}_static

View File

@ -81,11 +81,6 @@ function(search_dependency pkg)
set(${pkg}_FOUND ${${pkg}_FOUND} PARENT_SCOPE)
endfunction()
search_dependency(APPINDICATOR PACKAGE appindicator-0.1 OPTIONAL)
search_dependency(GDK_PIXBUF PACKAGE gdk-pixbuf-2.0 OPTIONAL)
search_dependency(GLIB PACKAGE glib-2.0 OPTIONAL)
search_dependency(GTK PACKAGE gtk+-2.0 OPTIONAL)
search_dependency(LIBAVCODEC PACKAGE libavcodec)
search_dependency(LIBAVDEVICE PACKAGE libavdevice)
search_dependency(LIBAVFORMAT PACKAGE libavformat)