CMake: Add FindSlog2

Add FindSlog2 and use it in src/corelib/configure.cmake.

Change-Id: I7e6a696a49df568a41ed1224228ab608db2dbb0e
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
Tobias Hunger 2018-11-06 14:58:26 +01:00
parent 38f1a10b6f
commit eb2ece3c59
3 changed files with 23 additions and 1 deletions

19
cmake/FindSlog2.cmake Normal file
View File

@ -0,0 +1,19 @@
# Find the Slog2 library
# Will make the target Slog2::Slog2 available when found.
find_library(Slog2_LIBRARY NAMES "slog2")
find_path(Slog2_INCLUDE_DIR NAMES "sys/slog2.h" DOC "The Slog2 Include path")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Slog2 DEFAULT_MSG Slog2_INCLUDE_DIR Slog2_LIBRARY)
mark_as_advanced(Slog2_INCLUDE_DIR Slog2_LIBRARY)
if(Slog2_FOUND)
add_library(__Slog2 IMPORTED)
target_link_libraries(__Slog2 INTERFACE ${Slog2_LIBRARY})
target_include_directories(__Slog2 INTERFACE ${Slog2_INCLUDE_DIR})
add_library(Slog2::Slog2 ALIAS __Slog2)
endif()

View File

@ -24,6 +24,8 @@ find_package(PCRE2)
set_package_properties(PCRE2 PROPERTIES TYPE REQUIRED)
find_package(PPS)
set_package_properties(PPS PROPERTIES TYPE OPTIONAL)
find_package(Slog2)
set_package_properties(Slog2 PROPERTIES TYPE OPTIONAL)
#### Tests
@ -477,7 +479,7 @@ qt_feature("renameat2" PRIVATE
)
qt_feature("slog2" PRIVATE
LABEL "slog2"
CONDITION libs.slog2 OR FIXME
CONDITION Slog2_FOUND
)
qt_feature("statx" PRIVATE
LABEL "statx() in libc"

View File

@ -74,6 +74,7 @@ def map_library(lib: str) -> Union[str, LibraryMapping, List[str]]:
'pcre2': ['PCRE2', 'REQUIRED'],
'posix_iconv': None,
'pps': 'PPS',
'slog2': 'Slog2',
'sun_iconv': None,
'udev': 'Libudev',
'vulkan': 'Vulkan',