From ab834f338bdd0580def6a18a81dbf9cbf7e7f18e Mon Sep 17 00:00:00 2001 From: wb2osz Date: Mon, 25 Sep 2023 03:17:15 +0100 Subject: [PATCH] Second attempt to fix build on Alpine Linux. issues 150, 319, 344. --- external/misc/CMakeLists.txt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/external/misc/CMakeLists.txt b/external/misc/CMakeLists.txt index 16125d0a..685b89ad 100644 --- a/external/misc/CMakeLists.txt +++ b/external/misc/CMakeLists.txt @@ -32,9 +32,22 @@ if(LINUX) ) endif() - add_library(misc STATIC - ${misc_SOURCES} - ) + # Add_library doesn't like to get an empty source file list. + # I tried several variations on this theme to test whether the list + # was not empty and was not successful in getting it to work + # on both Alpine and RPi. + #if("${misc_SOURCES}") + # This is less elegant and less maintainable but it works. + + if ((NOT HAVE_STRLCPY) OR (NOT HAVE_STRLCAT)) + add_library(misc STATIC + ${misc_SOURCES} + ) + else() + set(MISC_LIBRARIES "" CACHE INTERNAL "") + endif() + + elseif(WIN32 OR CYGWIN) # windows