diff --git a/CMakeLists.txt b/CMakeLists.txt index b8de9fa4..a2fe7818 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,14 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") include(CTest) +option(USE_SYSTEM_DATE "\ + Use find_package to find installed HowardHinnant's \ + date library instead of fetching it from github" OFF +) + +if(USE_SYSTEM_DATE) + find_package(date REQUIRED) +endif() ### Dependencies add_subdirectory(dependencies) diff --git a/README.md b/README.md index fa496b55..ec318b46 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ To demonstrate that sqlpp11 can work with other backends as well, here is an exp * STL Container: https://github.com/rbock/sqlpp11-connector-stl __Date Library:__ -sqlpp11 requires [Howard Hinnant's date library](https://github.com/HowardHinnant/date) for `date` and `date_time` data types. Sqlpp11 uses FetchContent to pull the library automatically in the project. +sqlpp11 requires [Howard Hinnant's date library](https://github.com/HowardHinnant/date) for `date` and `date_time` data types. By default, sqlpp11 uses FetchContent to pull the library automatically in the project. If you want to use an already installed version of the library with `find_package`, set `USE_SYSTEM_DATE` option to `ON`. Build and Install ----------------- diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 90010ff9..df389a6b 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -22,11 +22,14 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -include(FetchContent) -FetchContent_Declare(date - GIT_REPOSITORY https://github.com/HowardHinnant/date.git - GIT_TAG v3.0.0 -) +if(NOT USE_SYSTEM_DATE) + include(FetchContent) -add_subdirectory(hinnant_date) \ No newline at end of file + FetchContent_Declare(date + GIT_REPOSITORY https://github.com/HowardHinnant/date.git + GIT_TAG v3.0.0 + ) + + add_subdirectory(hinnant_date) +endif()