[evolution-data-server] Bug 775363 - Fails to build with minimum CMake version



commit e29f75ea28350f8034144cb600db8fd0da01315d
Author: Milan Crha <mcrha redhat com>
Date:   Thu Dec 1 11:06:11 2016 +0100

    Bug 775363 - Fails to build with minimum CMake version

 CMakeLists.txt                      |   12 +++++++++---
 cmake/modules/FindKRB5.cmake        |    8 +++++++-
 cmake/modules/FindLDAP.cmake        |   15 +++++++++++++--
 cmake/modules/FindPhonenumber.cmake |    8 +++++++-
 4 files changed, 36 insertions(+), 7 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7f3349c..1149654 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 # Evolution-Data-Server build script
 
-cmake_minimum_required(VERSION 3.0)
-cmake_policy(VERSION 3.0)
+cmake_minimum_required(VERSION 3.1)
+cmake_policy(VERSION 3.1)
 
 project(evolution-data-server
        VERSION 3.23.3
@@ -217,7 +217,12 @@ add_printable_variable_path(WITH_DBUS_SERVICE_DIR "Set directory for D-Bus servi
 add_printable_variable_path(WITH_SYSTEMDUSERUNITDIR "Set directory for systemd user units, or 'no' to 
disable" "${CMAKE_INSTALL_PREFIX}/lib/systemd/user")
 
 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
-string(SUBSTRING "${WITH_SYSTEMDUSERUNITDIR}" 0 ${bindirlen} substr)
+string(LENGTH "${WITH_SYSTEMDUSERUNITDIR}" maxlen)
+if(maxlen LESS bindirlen)
+       set(substr "***")
+else(maxlen LESS bindirlen)
+       string(SUBSTRING "${WITH_SYSTEMDUSERUNITDIR}" 0 ${bindirlen} substr)
+endif(maxlen LESS bindirlen)
 string(TOUPPER "${WITH_SYSTEMDUSERUNITDIR}" optupper)
 
 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
@@ -230,6 +235,7 @@ else()
 endif()
 
 unset(bindirlen)
+unset(maxlen)
 unset(substr)
 unset(optupper)
 
diff --git a/cmake/modules/FindKRB5.cmake b/cmake/modules/FindKRB5.cmake
index 2f34fb6..a78f83b 100644
--- a/cmake/modules/FindKRB5.cmake
+++ b/cmake/modules/FindKRB5.cmake
@@ -38,7 +38,12 @@ if(KRB5_FOUND)
 endif()
 
 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
-string(SUBSTRING "${WITH_KRB5}" 0 ${bindirlen} substr)
+string(LENGTH "${WITH_KRB5}" maxlen)
+if(maxlen LESS bindirlen)
+       set(substr "***")
+else(maxlen LESS bindirlen)
+       string(SUBSTRING "${WITH_KRB5}" 0 ${bindirlen} substr)
+endif(maxlen LESS bindirlen)
 string(TOUPPER "${WITH_KRB5}" optupper)
 
 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
@@ -46,6 +51,7 @@ if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}")
 endif(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
 
 unset(bindirlen)
+unset(maxlen)
 unset(substr)
 unset(optupper)
 
diff --git a/cmake/modules/FindLDAP.cmake b/cmake/modules/FindLDAP.cmake
index 6dde4b8..abbc328 100644
--- a/cmake/modules/FindLDAP.cmake
+++ b/cmake/modules/FindLDAP.cmake
@@ -29,14 +29,24 @@ if((NOT WITH_OPENLDAP) AND (NOT WITH_SUNLDAP))
 endif((NOT WITH_OPENLDAP) AND (NOT WITH_SUNLDAP))
 
 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
-string(SUBSTRING "${WITH_OPENLDAP}" 0 ${bindirlen} substr)
+string(LENGTH "${WITH_OPENLDAP}" maxlen)
+if(maxlen LESS bindirlen)
+       set(substr "***")
+else(maxlen LESS bindirlen)
+       string(SUBSTRING "${WITH_OPENLDAP}" 0 ${bindirlen} substr)
+endif(maxlen LESS bindirlen)
 string(TOUPPER "${WITH_OPENLDAP}" optupper)
 
 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
        set(WITH_OPENLDAP "/usr")
 endif(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
 
-string(SUBSTRING "${WITH_SUNLDAP}" 0 ${bindirlen} substr)
+string(LENGTH "${WITH_SUNLDAP}" maxlen)
+if(maxlen LESS bindirlen)
+       set(substr "***")
+else(maxlen LESS bindirlen)
+       string(SUBSTRING "${WITH_SUNLDAP}" 0 ${bindirlen} substr)
+endif(maxlen LESS bindirlen)
 string(TOUPPER "${WITH_SUNLDAP}" optupper)
 
 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
@@ -44,6 +54,7 @@ if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}")
 endif(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
 
 unset(bindirlen)
+unset(maxlen)
 unset(substr)
 unset(optupper)
 
diff --git a/cmake/modules/FindPhonenumber.cmake b/cmake/modules/FindPhonenumber.cmake
index cf54804..1aff78a 100644
--- a/cmake/modules/FindPhonenumber.cmake
+++ b/cmake/modules/FindPhonenumber.cmake
@@ -22,7 +22,12 @@ set(PHONENUMBER_CXXFLAGS -DI18N_PHONENUMBERS_USE_BOOST)
 set(PHONENUMBER_LDFLAGS -lphonenumber)
 
 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
-string(SUBSTRING "${WITH_PHONENUMBER}" 0 ${bindirlen} substr)
+string(LENGTH "${WITH_PHONENUMBER}" maxlen)
+if(maxlen LESS bindirlen)
+       set(substr "***")
+else(maxlen LESS bindirlen)
+       string(SUBSTRING "${WITH_PHONENUMBER}" 0 ${bindirlen} substr)
+endif(maxlen LESS bindirlen)
 string(TOUPPER "${WITH_PHONENUMBER}" optupper)
 
 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
@@ -33,6 +38,7 @@ else(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}
 endif(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
 
 unset(bindirlen)
+unset(maxlen)
 unset(substr)
 unset(optupper)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]