Skip to content

Commit

Permalink
Fix FindSQLiteCpp for find_package(SQLiteCpp) to work without any req…
Browse files Browse the repository at this point in the history
…uested version
  • Loading branch information
SRombauts committed Jun 1, 2020
1 parent 7edd337 commit 6a5a24f
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions cmake/FindSQLiteCpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# @ingroup SQLiteCpp
# @brief SQLiteCpp CMake module.
#
# Copyright (c) 2010-2014 Kartik Kumar ([email protected])
#
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
# or copy at http://opensource.org/licenses/MIT)

Expand All @@ -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})
Expand Down

3 comments on commit 6a5a24f

@sum01
Copy link
Contributor

@sum01 sum01 commented on 6a5a24f Jun 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why maintain a FindSQLiteCpp.cmake file when the export is already generated & installed via Cmake?
Exported XXXConfig.cmake files serve the same purpose.

@SRombauts
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't know...

Someone made a PR for it, and someone else another one for the Config without me noticing.

I started tweaking this because this is the one I am familiar with, but we should drop it and document the use of the Config (which I am not comfortable doing right now)

Thanks for your time reporting this!

@SRombauts
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.