Fix FindSQLiteCpp for find_package(SQLiteCpp) to work without any requested version

This commit is contained in:
Sébastien Rombauts 2020-06-01 16:23:22 +02:00
parent 7edd337591
commit 6a5a24f9a9

View File

@ -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,6 +11,8 @@ 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_FIND_VERSION)
if(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
set(SQLITECPP_VERSION_OK FALSE)
else(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
@ -23,6 +23,11 @@ macro(_sqlitecpp_check_version)
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})