diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2022-06-29 03:41:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-29 03:41:40 +0200 |
commit | 01fc5097d3b6921fce5c159e5c772dc1590eb847 (patch) | |
tree | b36490b858b49ba379a23522760202bef5f4d610 /cmake | |
parent | 998dc07288c174937347b006ebe918fe0eb57f52 (diff) | |
parent | 674787feaeced1fe51f6d344e28ca522808c1292 (diff) | |
download | rneovim-01fc5097d3b6921fce5c159e5c772dc1590eb847.tar.gz rneovim-01fc5097d3b6921fce5c159e5c772dc1590eb847.tar.bz2 rneovim-01fc5097d3b6921fce5c159e5c772dc1590eb847.zip |
Merge #19139 build(cmake): fix static libintl on macOS
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindLibIntl.cmake | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cmake/FindLibIntl.cmake b/cmake/FindLibIntl.cmake index 09eafb786a..8cc5cb7dd2 100644 --- a/cmake/FindLibIntl.cmake +++ b/cmake/FindLibIntl.cmake @@ -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() |