mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
build(cmake): fix static libintl
test on macOS
If `libintl` is a static library on macOS, we also need to explicitly link with `libiconv` and the `CoreFoundation` framework. Otherwise, our `HAVE_WORKING_LIBINTL` test erroneously fails. Closes #19127 Closes #19138
This commit is contained in:
parent
e0f605bfd8
commit
be40ba68a8
@ -41,6 +41,16 @@ endif()
|
|||||||
if (MSVC)
|
if (MSVC)
|
||||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
|
list(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
|
||||||
endif()
|
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("
|
check_c_source_compiles("
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
||||||
@ -54,6 +64,9 @@ int main(int argc, char** argv) {
|
|||||||
if (MSVC)
|
if (MSVC)
|
||||||
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
|
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
if (LibIntl_STATIC)
|
||||||
|
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARY}" "${CoreFoundation_FRAMEWORK}")
|
||||||
|
endif()
|
||||||
if (LibIntl_INCLUDE_DIR)
|
if (LibIntl_INCLUDE_DIR)
|
||||||
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
|
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user