mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Approved error messages of FindHinnantDate.cmake
Also added a documented variable to give hints.
This commit is contained in:
parent
f41770dbe2
commit
7097d4a325
@ -9,11 +9,14 @@
|
|||||||
#
|
#
|
||||||
# HinnantDate_FOUND - True if the system has the library
|
# HinnantDate_FOUND - True if the system has the library
|
||||||
# HinnantDate_INCLUDE_DIR - The directory which includes the header
|
# HinnantDate_INCLUDE_DIR - The directory which includes the header
|
||||||
|
# HinnantDate_ROOT_DIR - The base directory of the library
|
||||||
#
|
#
|
||||||
# and the following imported targets::
|
# and the following imported targets::
|
||||||
#
|
#
|
||||||
# HinnantDate::Date - The target to use date.h
|
# HinnantDate::Date - The target to use date.h
|
||||||
#
|
#
|
||||||
|
# You can set HinnantDate_ROOT_DIR as hint to the location of the library.
|
||||||
|
#
|
||||||
# The target will enable the required C++11 standard in your compiler. You can
|
# The target will enable the required C++11 standard in your compiler. You can
|
||||||
# use any later standard but you have to enable them explicitly.
|
# use any later standard but you have to enable them explicitly.
|
||||||
|
|
||||||
@ -44,10 +47,16 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
|
||||||
|
# ensure cache entry
|
||||||
|
set(HinnantDate_ROOT_DIR "${HinnantDate_ROOT_DIR}" CACHE PATH "Root directory of Howard Hinnant's date library")
|
||||||
|
set(HinnantDate_NOT_FOUND_MESSAGE "Could NOT find HinnantDate.
|
||||||
|
Maybe you need to adjust the search paths or HinnantDate_ROOT_DIR.")
|
||||||
|
|
||||||
find_file(HinnantDate_INCLUDE_FILE
|
find_file(HinnantDate_INCLUDE_FILE
|
||||||
date.h
|
date.h
|
||||||
HINTS ${HinnantDate_INCLUDE_DIR}
|
HINTS ${HinnantDate_ROOT_DIR}
|
||||||
)
|
)
|
||||||
|
mark_as_advanced(HinnantDate_INCLUDE_FILE)
|
||||||
|
|
||||||
if (HinnantDate_INCLUDE_FILE)
|
if (HinnantDate_INCLUDE_FILE)
|
||||||
# Validate that correct file is found
|
# Validate that correct file is found
|
||||||
@ -57,11 +66,15 @@ if (HinnantDate_INCLUDE_FILE)
|
|||||||
)
|
)
|
||||||
|
|
||||||
if("${check_result}" STREQUAL "")
|
if("${check_result}" STREQUAL "")
|
||||||
message(STATUS "FindHinnantDate: Rejecting found '${HinnantDate_INCLUDE_FILE}', it seems to be a name twin.")
|
string(APPEND HinnantDate_NOT_FOUND_MESSAGE "\nRejecting found '${HinnantDate_INCLUDE_FILE}', it seems to be a name twin.")
|
||||||
unset(HinnantDate_INCLUDE_FILE)
|
unset(HinnantDate_INCLUDE_FILE CACHE)
|
||||||
else()
|
else()
|
||||||
# Check succeeded, create target
|
# Check succeeded, create target
|
||||||
get_filename_component(HinnantDate_INCLUDE_DIR "${HinnantDate_INCLUDE_FILE}" DIRECTORY CACHE)
|
get_filename_component(HinnantDate_INCLUDE_DIR "${HinnantDate_INCLUDE_FILE}" DIRECTORY CACHE)
|
||||||
|
mark_as_advanced(HinnantDate_INCLUDE_DIR)
|
||||||
|
set(HinnantDate_ROOT_DIR "${HinnantDate_INCLUDE_DIR}")
|
||||||
|
unset(HinnantDate_NOT_FOUND_MESSAGE)
|
||||||
|
|
||||||
if(NOT TARGET HinnantDate::Date)
|
if(NOT TARGET HinnantDate::Date)
|
||||||
add_library(HinnantDate::Date INTERFACE IMPORTED)
|
add_library(HinnantDate::Date INTERFACE IMPORTED)
|
||||||
set_target_properties(HinnantDate::Date PROPERTIES
|
set_target_properties(HinnantDate::Date PROPERTIES
|
||||||
@ -78,6 +91,6 @@ endif()
|
|||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(HinnantDate
|
find_package_handle_standard_args(HinnantDate
|
||||||
REQUIRED_VARS
|
REQUIRED_VARS HinnantDate_ROOT_DIR HinnantDate_INCLUDE_DIR
|
||||||
HinnantDate_INCLUDE_DIR
|
FAIL_MESSAGE ${HinnantDate_NOT_FOUND_MESSAGE}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user