Skip to content

Commit

Permalink
Use same i18n include/link logic for all platforms
Browse files Browse the repository at this point in the history
OpenBSD ld doesn't include /usr/local/lib for some reason, so
using find_library is the suggested way of dealing with this. Given that
MacOS already has this and most platforms simply add -lintl assuming it
will be in default library path, all that can be simplified by using find_library explicitly for every platform.
This should fix the ld issue for *BSD ones. It's not only the case for
OpenBSD but for some other as well.

See: conan-io/conan#11688

Signed-off-by: Tin Švagelj <[email protected]>
  • Loading branch information
Caellian committed Nov 16, 2024
1 parent cb2e359 commit 243d3c1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions cmake/ConkyPlatformChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ endif(CMAKE_SYSTEM_NAME MATCHES "Linux")

if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(OS_FREEBSD true)
set(conky_libs ${conky_libs} -lkvm -ldevstat -lintl -linotify)
set(conky_libs ${conky_libs} -lkvm -ldevstat -linotify)

if(BUILD_IRC)
set(conky_libs ${conky_libs} -lssl -lcrypto)
Expand All @@ -83,6 +83,8 @@ endif(CMAKE_SYSTEM_NAME MATCHES "DragonFly")

if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
set(OS_OPENBSD true)
link_directories("/usr/local/lib")
set(conky_libs ${conky_libs} -lkvm)
else(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
set(OS_OPENBSD false)
endif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
Expand All @@ -102,7 +104,7 @@ endif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")

if(CMAKE_SYSTEM_NAME MATCHES "Haiku")
set(OS_HAIKU true)
set(conky_libs ${conky_libs} -lnetwork -lintl)
set(conky_libs ${conky_libs} -lnetwork)
else(CMAKE_SYSTEM_NAME MATCHES "Haiku")
set(OS_HAIKU false)
endif(CMAKE_SYSTEM_NAME MATCHES "Haiku")
Expand Down Expand Up @@ -156,11 +158,7 @@ else(OS_LINUX)
check_include_files("sys/soundcard.h" HAVE_SOME_SOUNDCARD_H)
endif(OS_LINUX)

if(BUILD_I18N AND OS_DRAGONFLY)
set(conky_libs ${conky_libs} -lintl)
endif(BUILD_I18N AND OS_DRAGONFLY)

if(BUILD_I18N AND OS_DARWIN)
if(BUILD_I18N)
find_path(LIBINTL_H_N libintl.h
PATHS /usr/local/opt/gettext/include
/usr/include
Expand All @@ -170,7 +168,10 @@ if(BUILD_I18N AND OS_DARWIN)
if(LIBINTL_H_N)
include_directories(${LIBINTL_H_N})
else(LIBINTL_H_N)
message(FATAL_ERROR "Unable to find libintl.h (try `brew install gettext`)")
message(FATAL_ERROR "Unable to find libintl.h")
if(OS_DARWIN)
message(FATAL_ERROR "Try running `brew install gettext` for I18N support")
endif(OS_DARWIN)
endif(LIBINTL_H_N)

find_library(INTL_LIB
Expand All @@ -180,7 +181,7 @@ if(BUILD_I18N AND OS_DARWIN)
/usr/local/lib
/usr/local/opt/lib)
set(conky_libs ${conky_libs} ${INTL_LIB})
endif(BUILD_I18N AND OS_DARWIN)
endif(BUILD_I18N)

if(BUILD_NCURSES AND OS_DARWIN)
set(conky_libs ${conky_libs} -lncurses)
Expand Down

0 comments on commit 243d3c1

Please sign in to comment.