-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix FindSQLiteCpp for find_package(SQLiteCpp) to work without any req…
…uested version
- Loading branch information
Showing
1 changed file
with
17 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
||
|
@@ -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}) | ||
|
6a5a24f
There was a problem hiding this comment.
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.
6a5a24f
There was a problem hiding this comment.
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!
6a5a24f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#283