mirror of
https://git.familie-radermacher.ch/linux/ptouch-print.git
synced 2026-09-15 22:27:34 +00:00
cmake: let the argp probe pass where argp-standalone needs strchrnul
On macOS with Homebrew's argp-standalone, Findargp's link test for argp_parse fails with an undefined strchrnul, because libargp.a itself references that GNU extension and the platform has none. The module then stops with "does not have a symbol named argp_parse", which is not what is wrong. Probe for strchrnul first (with _GNU_SOURCE, so glibc answers correctly). Where it exists, the test is unchanged. Where it is missing, run the same argp_parse test with a local definition of strchrnul, and have ptouch-print supply that definition for the real build. On glibc nothing changes: the probe finds strchrnul and the original test runs. Checked on Debian stable in the same session.
This commit is contained in:
committed by
Dominic Radermacher
parent
97a9576c6e
commit
ef6e6f4925
@@ -15,6 +15,11 @@ find_package(Git REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Intl REQUIRED)
|
||||
find_package(argp REQUIRED)
|
||||
if(NOT ARGP_IN_LIBC AND NOT HAVE_STRCHRNUL)
|
||||
# See cmake/Findargp.cmake: argp-standalone needs a strchrnul() the
|
||||
# platform does not have, so ptouch-print.c defines one.
|
||||
add_compile_definitions(NEED_STRCHRNUL=1)
|
||||
endif()
|
||||
|
||||
pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user