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

chore(cmake): Added optional dependencies

This commit is contained in:
Diadlo 2016-11-30 09:45:15 +03:00
parent ba872e02af
commit d5870d8079
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 41 additions and 26 deletions

View File

@ -411,7 +411,10 @@ set(${PROJECT_NAME}_SOURCES
src/widget/widget.cpp src/widget/widget.cpp
src/widget/widget.h) src/widget/widget.h)
if(GDK_PIXBUF_FOUND AND GLIB_FOUND AND GTK_FOUND) if (NOT 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} set(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES}
src/platform/statusnotifier/closures.c src/platform/statusnotifier/closures.c
src/platform/statusnotifier/closures.h src/platform/statusnotifier/closures.h
@ -429,11 +432,18 @@ if(AVFOUNDATION_FOUND)
src/platform/camera/avfoundation.h) src/platform/camera/avfoundation.h)
endif() endif()
if(APPINDICATOR_FOUND) if (NOT ENABLE_APPINDICATOR)
set(ENABLE_APPINDICATOR False)
endif()
if(${ENABLE_APPINDICATOR} AND APPINDICATOR_FOUND)
add_definitions(-DENABLE_SYSTRAY_UNITY_BACKEND=1) add_definitions(-DENABLE_SYSTRAY_UNITY_BACKEND=1)
endif() endif()
if(GTK_FOUND) if (NOT ENABLE_GTK_SYSTRAY)
set(ENABLE_GTK_SYSTRAY True)
endif()
if(${ENABLE_GTK_SYSTRAY} AND GTK_FOUND)
add_definitions(-DENABLE_SYSTRAY_GTK_BACKEND=1) add_definitions(-DENABLE_SYSTRAY_GTK_BACKEND=1)
endif() endif()

View File

@ -111,43 +111,48 @@ if(WIN32)
search_dependency(STRMIIDS LIBRARY strmiids) search_dependency(STRMIIDS LIBRARY strmiids)
endif() endif()
execute_process( if (NOT GIT_DESCRIBE)
COMMAND git describe --tags execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND git describe --tags
OUTPUT_VARIABLE GIT_DESCRIBE WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
ERROR_QUIET OUTPUT_VARIABLE GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
) OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_DESCRIBE) if(NOT GIT_DESCRIBE)
set(GIT_DESCRIBE "Nightly") set(GIT_DESCRIBE "Nightly")
endif()
endif() endif()
add_definitions( add_definitions(
-DGIT_DESCRIBE="${GIT_DESCRIBE}" -DGIT_DESCRIBE="${GIT_DESCRIBE}"
) )
# GIT_VERSION if (NOT GIT_VERSION)
execute_process( execute_process(
COMMAND git rev-parse HEAD COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION OUTPUT_VARIABLE GIT_VERSION
ERROR_QUIET ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
if(NOT GIT_VERSION) if(NOT GIT_VERSION)
set(GIT_VERSION "build without git") set(GIT_VERSION "build without git")
endif()
endif() endif()
add_definitions( add_definitions(
-DGIT_VERSION="${GIT_VERSION}" -DGIT_VERSION="${GIT_VERSION}"
) )
execute_process( if (NOT TIMESTAMP)
COMMAND date +%s execute_process(
OUTPUT_VARIABLE TIMESTAMP COMMAND date +%s
) OUTPUT_VARIABLE TIMESTAMP
)
endif()
add_definitions( add_definitions(
-DTIMESTAMP=${TIMESTAMP} -DTIMESTAMP=${TIMESTAMP}