From e4a9af5500f44db787ee523cc8b8004153b11dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= <francois.grisez@belledonne-communications.com> Date: Wed, 11 Dec 2019 11:20:38 +0100 Subject: [PATCH] CMakeLists.txt: Introduce ENABLE_PACKAGE_SOURCE option This option makes the creation of 'package_source' custom target optional, allowing to build with CMake < 3.11 if it is disabled (default). (cherry picked from commit 141ea279331c587b15316d7fd937250f4cafcd1b) --- CMakeLists.txt | 8 ++++++-- build/CMakeLists.txt | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3917b2f37f..fa55a419a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ # ############################################################################ -cmake_minimum_required(VERSION 3.11) # we need CMake 3.11 for defining 'package_source' target as custom target +cmake_minimum_required(VERSION 3.1) project(linphone VERSION 4.3.0 LANGUAGES C CXX) @@ -66,6 +66,7 @@ option(ENABLE_UPDATE_CHECK "Enable update check." NO) option(ENABLE_VCARD "Turn on compilation of vcard4 support." YES) option(ENABLE_VIDEO "Build with video support." YES) option(ENABLE_ASSETS "Package sound assets." YES) +option(ENABLE_PACKAGE_SOURCE "Create 'package_source' target for source archive making (CMake >= 3.11)" OFF) cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI;NOT APPLE" NO) cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO) @@ -417,4 +418,7 @@ install(FILES DESTINATION ${CONFIG_PACKAGE_LOCATION} ) -add_subdirectory(build) +if (ENABLE_PACKAGE_SOURCE) + add_subdirectory(build) +endif() + diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 50519a0c1c..ffbad072d0 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -20,6 +20,8 @@ # ############################################################################ +cmake_minimum_required(VERSION 3.11) # we need CMake 3.11 for defining 'package_source' target as custom target + if(NOT CPACK_PACKAGE_NAME) set(CPACK_PACKAGE_NAME "liblinphone") endif() -- GitLab