From 6a5a24f9a9e53e967439136e27271915cc73bc45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Mon, 1 Jun 2020 16:23:22 +0200 Subject: [PATCH] Fix FindSQLiteCpp for find_package(SQLiteCpp) to work without any requested version --- cmake/FindSQLiteCpp.cmake | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/cmake/FindSQLiteCpp.cmake b/cmake/FindSQLiteCpp.cmake index c46882f3..71114ca4 100644 --- a/cmake/FindSQLiteCpp.cmake +++ b/cmake/FindSQLiteCpp.cmake @@ -2,8 +2,6 @@ # @ingroup SQLiteCpp # @brief SQLiteCpp CMake module. # -# Copyright (c) 2010-2014 Kartik Kumar (me@kartikkumar.com) -# # Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt # or copy at http://opensource.org/licenses/MIT) @@ -13,16 +11,23 @@ macro(_sqlitecpp_check_version) string(REGEX MATCH "define[ \t]+SQLITECPP_VERSION_NUMBER[ \t]+([0-9]+)" _sqlitecpp_version_match "${_sqlitecpp_header}") set(SQLITECPP_VERSION "${CMAKE_MATCH_1}") - if(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION}) - set(SQLITECPP_VERSION_OK FALSE) - else(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION}) - set(SQLITECPP_VERSION_OK TRUE) - endif(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION}) - - if(NOT SQLITECPP_VERSION_OK) - message(STATUS "SQLiteCpp version ${SQLITECPP_VERSION} found in ${SQLITECPP_INCLUDE_DIR}, " - "but at least version ${SQLiteCpp_FIND_VERSION} is required!") - endif(NOT SQLITECPP_VERSION_OK) + + if(SQLiteCpp_FIND_VERSION) + if(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION}) + set(SQLITECPP_VERSION_OK FALSE) + else(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION}) + set(SQLITECPP_VERSION_OK TRUE) + endif(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION}) + + if(NOT SQLITECPP_VERSION_OK) + message(STATUS "SQLiteCpp version ${SQLITECPP_VERSION} found in ${SQLITECPP_INCLUDE_DIR}, " + "but at least version ${SQLiteCpp_FIND_VERSION} is required!") + endif(NOT SQLITECPP_VERSION_OK) + else(SQLiteCpp_FIND_VERSION) + if(SQLITECPP_VERSION) + set(SQLITECPP_VERSION_OK TRUE) + endif(SQLITECPP_VERSION) + endif(SQLiteCpp_FIND_VERSION) set(SQLITECPP_LIBRARY "SQLiteCpp") link_directories(${SQLITECPP_LIBRARY_DIR})