mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
Merge pull request #19146 from carlocab/static-libintl-backport
[Backport release-0.7] build(cmake): fix static `libintl` test on macOS
This commit is contained in:
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@ -108,6 +108,7 @@ jobs:
|
||||
brew uninstall $(brew uses --installed --recursive gettext)
|
||||
brew unlink gettext
|
||||
ln -sf "$(brew --prefix)/opt/$(readlink "${GETTEXT_PREFIX}")/bin"/* /usr/local/bin/
|
||||
ln -sf "$(brew --prefix)/opt/$(readlink "${GETTEXT_PREFIX}")/include"/* /usr/local/include/
|
||||
rm -f "$GETTEXT_PREFIX"
|
||||
- name: Build release
|
||||
run: |
|
||||
|
@ -41,6 +41,16 @@ endif()
|
||||
if (MSVC)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
|
||||
endif()
|
||||
|
||||
# On macOS, if libintl is a static library then we also need
|
||||
# to link libiconv and CoreFoundation.
|
||||
get_filename_component(LibIntl_EXT "${LibIntl_LIBRARY}" EXT)
|
||||
if (APPLE AND (LibIntl_EXT STREQUAL ".a"))
|
||||
set(LibIntl_STATIC TRUE)
|
||||
find_library(CoreFoundation_FRAMEWORK CoreFoundation)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARY}" "${CoreFoundation_FRAMEWORK}")
|
||||
endif()
|
||||
|
||||
check_c_source_compiles("
|
||||
#include <libintl.h>
|
||||
|
||||
@ -54,6 +64,9 @@ int main(int argc, char** argv) {
|
||||
if (MSVC)
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
|
||||
endif()
|
||||
if (LibIntl_STATIC)
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARY}" "${CoreFoundation_FRAMEWORK}")
|
||||
endif()
|
||||
if (LibIntl_INCLUDE_DIR)
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user