2016-12-22 17:30:18 +01:00
|
|
|
#.rst:
|
|
|
|
# FindG3log
|
|
|
|
# -------
|
|
|
|
#
|
2020-07-09 06:42:55 +02:00
|
|
|
# Find libg3log, G3log is an asynchronous, "crash safe", logger that is easy to use with default logging sinks or you can add your own.
|
2016-12-22 17:30:18 +01:00
|
|
|
#
|
2020-07-09 06:42:55 +02:00
|
|
|
# This defines the cmake import target "g3log" you can use like this
|
2019-02-18 18:52:02 +01:00
|
|
|
#```
|
2020-07-09 06:42:55 +02:00
|
|
|
# target_link_libraries(YourTarget PUBLIC g3log)
|
2019-02-18 18:52:02 +01:00
|
|
|
#```
|
|
|
|
# Variables and features
|
|
|
|
# ----------------------
|
2020-07-09 06:42:55 +02:00
|
|
|
# * ``G3LOG`` -- if this environment variable is set, it'll be used as a hint as to where the g3log files are.
|
2019-02-18 18:52:02 +01:00
|
|
|
# * ``G3LOG_INCLUDE_DIRS`` -- raw cmake variable with include path
|
|
|
|
# * ``G3LOG_LIBRARIES`` -- raw cmake variable with library link line
|
2020-07-09 06:42:55 +02:00
|
|
|
# * ``G3LOG_FOUND`` -- check if the lib was found without using the newer ``if(TARGET g3log)...``
|
2019-02-18 18:52:02 +01:00
|
|
|
|
2016-12-22 17:30:18 +01:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2019-05-14 06:42:15 +02:00
|
|
|
include(SelectLibraryConfigurations)
|
|
|
|
|
|
|
|
@PACKAGE_INIT@
|
|
|
|
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2020-07-09 06:42:55 +02:00
|
|
|
if (NOT TARGET g3log)
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/g3logTargets.cmake")
|
2019-05-14 06:42:15 +02:00
|
|
|
|
2020-07-09 06:42:55 +02:00
|
|
|
get_target_property(G3LOG_INCLUDE_DIR g3log INTERFACE_INCLUDE_DIRECTORIES)
|
|
|
|
get_target_property(G3LOG_LIBRARY_DEBUG g3log IMPORTED_IMPLIB_DEBUG)
|
|
|
|
|
2019-05-14 06:42:15 +02:00
|
|
|
if (G3LOG_LIBRARY_DEBUG MATCHES ".*-NOTFOUND")
|
2020-07-09 06:42:55 +02:00
|
|
|
get_target_property(G3LOG_LIBRARY_DEBUG g3log IMPORTED_LOCATION_DEBUG)
|
2019-05-14 06:42:15 +02:00
|
|
|
endif ()
|
|
|
|
|
2020-07-09 06:42:55 +02:00
|
|
|
get_target_property(G3LOG_LIBRARY_RELEASE g3log IMPORTED_IMPLIB_RELEASE)
|
2019-05-14 06:42:15 +02:00
|
|
|
if (G3LOG_LIBRARY_RELEASE MATCHES ".*-NOTFOUND")
|
2020-07-09 06:42:55 +02:00
|
|
|
get_target_property(G3LOG_LIBRARY_RELEASE g3log IMPORTED_LOCATION_RELEASE)
|
2019-05-14 06:42:15 +02:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
select_library_configurations(G3LOG)
|
|
|
|
|
|
|
|
if (G3LOG_LIBRARY)
|
|
|
|
list(APPEND G3LOG_LIBRARY Threads::Threads)
|
|
|
|
if (WIN32)
|
|
|
|
list(APPEND G3LOG_LIBRARY DbgHelp.lib)
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
2020-07-09 06:42:55 +02:00
|
|
|
find_package_handle_standard_args(G3LOG REQUIRED_VARS G3LOG_INCLUDE_DIR G3LOG_LIBRARY)
|
2016-12-22 17:30:18 +01:00
|
|
|
mark_as_advanced(G3LOG_INCLUDE_DIR G3LOG_LIBRARY)
|
|
|
|
set(G3LOG_INCLUDE_DIRS ${G3LOG_INCLUDE_DIR})
|
2019-05-14 06:42:15 +02:00
|
|
|
set(G3LOG_LIBRARIES ${G3LOG_LIBRARY})
|