From b2fae367bf505fa4ec77856373396cd2b8b6ae96 Mon Sep 17 00:00:00 2001 From: Derek Dai Date: Fri, 24 Mar 2017 01:08:18 +0800 Subject: [PATCH] update cmake minimum requirement from 2.8 to 3.0.2 due to usage of version comparasion of if command check valac version to decide whether or not to use new Gdk.Monitor class --- CMakeLists.txt | 2 +- demo/CMakeLists.txt | 10 +++++++++- demo/wfdctl.vala | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index beff6c3..31d5a13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.0.2) project(Miraclecast) diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index eac2023..4deb642 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -17,10 +17,18 @@ find_library(READLINE REQUIRED) pkg_check_modules(GIO2 REQUIRED gio-2.0) pkg_check_modules(GDK3 REQUIRED gdk-3.0) +execute_process(COMMAND ${VALAC} --version + OUTPUT_VARIABLE VALAC_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(REPLACE "Vala " "" VALAC_VERSION "${VALAC_VERSION}") +if(VALAC_VERSION VERSION_GREATER 0.34.0) + list(APPEND VALA_EXTRA_OPTIONS -D VALA_VERSION_NEWER_THEN_0_34) +endif() + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --atleast-version 3.22 gdk-3.0 RESULT_VARIABLE GDK_VERSION_NEWER_THEN_3_22) if(NOT GDK_VERSION_NEWER_THEN_3_22) - set(VALA_EXTRA_OPTIONS -D GDK_VERSION_NEWER_THEN_3_22) + list(APPEND VALA_EXTRA_OPTIONS -D GDK_VERSION_NEWER_THEN_3_22) endif() set(RES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/res) diff --git a/demo/wfdctl.vala b/demo/wfdctl.vala index 86baeda..79e15ba 100644 --- a/demo/wfdctl.vala +++ b/demo/wfdctl.vala @@ -330,7 +330,7 @@ private class WfdCtl : GLib.Application info("P2P group formed"); } -#if GDK_VERSION_NEWER_THEN_3_22 +#if GDK_VERSION_NEWER_THEN_3_22 && VALA_VERSION_NEWER_THEN_0_34 private void get_monitor_geometry(out Gdk.Rectangle g) throws Error { Gdk.Monitor m; @@ -441,7 +441,7 @@ private class WfdCtl : GLib.Application } int n_monitors; -#if GDK_VERSION_NEWER_THEN_3_22 +#if GDK_VERSION_NEWER_THEN_3_22 && VALA_VERSION_NEWER_THEN_0_34 n_monitors = display.get_n_monitors(); #else n_monitors = display.get_default_screen().get_n_monitors();