mirror of
https://github.com/transmission/transmission
synced 2025-03-04 10:38:13 +00:00
Support switching between GTK 3 and 4 within the same build directory (#3918)
This commit is contained in:
parent
c75c6bf5c8
commit
8712db3b4c
2 changed files with 16 additions and 8 deletions
|
@ -268,19 +268,21 @@ if(ENABLE_GTK)
|
|||
tr_get_required_flag(ENABLE_GTK GTK_IS_REQUIRED)
|
||||
|
||||
if(USE_GTK_VERSION STREQUAL "AUTO" OR USE_GTK_VERSION EQUAL 4)
|
||||
pkg_check_modules(GTK
|
||||
pkg_check_modules(GTK4
|
||||
gtkmm-4.0>=${GTKMM_MINIMUM}
|
||||
glibmm-2.68>=${GLIBMM_MINIMUM}
|
||||
giomm-2.68>=${GIOMM_MINIMUM})
|
||||
set(GTK_VERSION 4)
|
||||
set(GTK_FOUND ${GTK4_FOUND})
|
||||
endif()
|
||||
|
||||
if(NOT GTK_FOUND AND (USE_GTK_VERSION STREQUAL "AUTO" OR USE_GTK_VERSION EQUAL 3))
|
||||
pkg_check_modules(GTK ${GTK_IS_REQUIRED}
|
||||
pkg_check_modules(GTK3
|
||||
gtkmm-3.0>=${GTKMM_MINIMUM}
|
||||
glibmm-2.4>=${GLIBMM_MINIMUM}
|
||||
giomm-2.4>=${GIOMM_MINIMUM})
|
||||
set(GTK_VERSION 3)
|
||||
set(GTK_FOUND ${GTK3_FOUND})
|
||||
endif()
|
||||
|
||||
if(GTK_IS_REQUIRED AND NOT GTK_FOUND)
|
||||
|
|
|
@ -164,14 +164,17 @@ include_directories(
|
|||
)
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${LIBAPPINDICATOR_INCLUDE_DIRS}
|
||||
${GTK_INCLUDE_DIRS}
|
||||
${GTK${GTK_VERSION}_INCLUDE_DIRS}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${EVENT2_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(WITH_LIBAPPINDICATOR)
|
||||
include_directories(SYSTEM ${LIBAPPINDICATOR_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
link_directories(
|
||||
${GTK_LIBRARY_DIRS}
|
||||
${GTK${GTK_VERSION}_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
|
@ -191,7 +194,7 @@ add_definitions(
|
|||
-DGTKMM_DISABLE_DEPRECATED
|
||||
-DPANGOMM_DISABLE_DEPRECATED
|
||||
-DSIGCXX_DISABLE_DEPRECATED
|
||||
${GTK_CFLAGS_OTHER}
|
||||
${GTK${GTK_VERSION}_CFLAGS_OTHER}
|
||||
)
|
||||
|
||||
tr_win32_app_info(${PROJECT_NAME}_WIN32_RC_FILE
|
||||
|
@ -210,12 +213,15 @@ add_executable(${TR_NAME}-gtk WIN32
|
|||
|
||||
target_link_libraries(${TR_NAME}-gtk
|
||||
${TR_NAME}
|
||||
${LIBAPPINDICATOR_LIBRARIES}
|
||||
${GTK_LIBRARIES}
|
||||
${GTK${GTK_VERSION}_LIBRARIES}
|
||||
${CURL_LIBRARIES}
|
||||
${EVENT2_LIBRARIES}
|
||||
)
|
||||
|
||||
if(WITH_LIBAPPINDICATOR)
|
||||
target_link_libraries(${TR_NAME}-gtk ${LIBAPPINDICATOR_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(${TR_NAME}-gtk PRIVATE -Wno-exit-time-destructors)
|
||||
endif()
|
||||
|
|
Loading…
Add table
Reference in a new issue