Skip to content

Commit

Permalink
cmake: Check strlcpy for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
Biswa96 authored and anatol committed Feb 25, 2023
1 parent 4ebec5b commit 3c6dd36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vendor/CMakeLists.fastboot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ add_library(libselinux STATIC
selinux/libselinux/src/label_file.c
selinux/libselinux/src/regex.c)

if(HAVE_STRLCPY)
target_compile_definitions(libselinux PRIVATE HAVE_STRLCPY)
endif()

target_compile_definitions(libselinux PRIVATE
-DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DBUILD_HOST -DUSE_PCRE2
-DNO_PERSISTENTLY_STORED_PATTERNS -DDISABLE_SETRANS
Expand Down
3 changes: 3 additions & 0 deletions vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
enable_language(C CXX)
include(CheckSymbolExists)

# Use C11 with GNU extensions.
set(CMAKE_C_STANDARD 11)
Expand Down Expand Up @@ -76,6 +77,8 @@ find_package(Protobuf REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY)

include_directories(${PROTOBUF_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

Expand Down

0 comments on commit 3c6dd36

Please sign in to comment.