Fix UNITTEST for MacOSX.

This commit is contained in:
wb2osz 2021-01-01 21:09:25 -05:00
parent 5d02e0ba0e
commit 6513efd052
2 changed files with 14 additions and 12 deletions

View File

@ -251,6 +251,20 @@ else()
endif(WIN32 OR CYGWIN) endif(WIN32 OR CYGWIN)
# requirements # requirements
include(CheckSymbolExists)
# Some platforms provide their own strlcpy & strlcat. (BSD, MacOSX)
# Others don't so we provide our own. (Most, but not all Linux)
# Define the preprocessor macro so libgps does not supply its own version.
check_symbol_exists(strlcpy string.h HAVE_STRLCPY)
if(HAVE_STRLCPY)
add_compile_options(-DHAVE_STRLCPY)
endif()
check_symbol_exists(strlcat string.h HAVE_STRLCAT)
if(HAVE_STRLCAT)
add_compile_options(-DHAVE_STRLCAT)
endif()
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)

View File

@ -1,15 +1,3 @@
include(CheckSymbolExists)
# Some platforms provide their own strlcpy & strlcat. (BSD, MacOSX)
# Others don't so we provide our own. (Most, but not all Linux)
# Define the preprocessor macro so libgps does not supply its own version.
check_symbol_exists(strlcpy string.h HAVE_STRLCPY)
if(HAVE_STRLCPY)
add_compile_options(-DHAVE_STRLCPY)
endif()
check_symbol_exists(strlcat string.h HAVE_STRLCAT)
if(HAVE_STRLCAT)
add_compile_options(-DHAVE_STRLCAT)
endif()
# global includes # global includes
# not ideal but not so slow # not ideal but not so slow