Skip to content

Commit 6a5a24f

Browse files
committed
Fix FindSQLiteCpp for find_package(SQLiteCpp) to work without any requested version
1 parent 7edd337 commit 6a5a24f

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

cmake/FindSQLiteCpp.cmake

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# @ingroup SQLiteCpp
33
# @brief SQLiteCpp CMake module.
44
#
5-
# Copyright (c) 2010-2014 Kartik Kumar ([email protected])
6-
#
75
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
86
# or copy at http://opensource.org/licenses/MIT)
97

@@ -13,16 +11,23 @@ macro(_sqlitecpp_check_version)
1311
string(REGEX MATCH "define[ \t]+SQLITECPP_VERSION_NUMBER[ \t]+([0-9]+)"
1412
_sqlitecpp_version_match "${_sqlitecpp_header}")
1513
set(SQLITECPP_VERSION "${CMAKE_MATCH_1}")
16-
if(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
17-
set(SQLITECPP_VERSION_OK FALSE)
18-
else(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
19-
set(SQLITECPP_VERSION_OK TRUE)
20-
endif(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
21-
22-
if(NOT SQLITECPP_VERSION_OK)
23-
message(STATUS "SQLiteCpp version ${SQLITECPP_VERSION} found in ${SQLITECPP_INCLUDE_DIR}, "
24-
"but at least version ${SQLiteCpp_FIND_VERSION} is required!")
25-
endif(NOT SQLITECPP_VERSION_OK)
14+
15+
if(SQLiteCpp_FIND_VERSION)
16+
if(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
17+
set(SQLITECPP_VERSION_OK FALSE)
18+
else(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
19+
set(SQLITECPP_VERSION_OK TRUE)
20+
endif(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
21+
22+
if(NOT SQLITECPP_VERSION_OK)
23+
message(STATUS "SQLiteCpp version ${SQLITECPP_VERSION} found in ${SQLITECPP_INCLUDE_DIR}, "
24+
"but at least version ${SQLiteCpp_FIND_VERSION} is required!")
25+
endif(NOT SQLITECPP_VERSION_OK)
26+
else(SQLiteCpp_FIND_VERSION)
27+
if(SQLITECPP_VERSION)
28+
set(SQLITECPP_VERSION_OK TRUE)
29+
endif(SQLITECPP_VERSION)
30+
endif(SQLiteCpp_FIND_VERSION)
2631

2732
set(SQLITECPP_LIBRARY "SQLiteCpp")
2833
link_directories(${SQLITECPP_LIBRARY_DIR})

0 commit comments

Comments
 (0)