Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(cmake): Add ability to real disable optional dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Diadlo committed Feb 5, 2017
1 parent 36f7f65 commit fb43e30
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 22 deletions.
54 changes: 37 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fb43e30

Please sign in to comment.