aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-06-02 15:04:01 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-06-06 00:58:57 +0200
commit420379330e6056e4086ec1394fc666d74e3f2fa9 (patch)
tree9ef2e27a7b9f6d47d52b47c519272567ea9933cf
parent21c9db1861825cdc7f89e90bf166115a2581b663 (diff)
downloadrneovim-420379330e6056e4086ec1394fc666d74e3f2fa9.tar.gz
rneovim-420379330e6056e4086ec1394fc666d74e3f2fa9.tar.bz2
rneovim-420379330e6056e4086ec1394fc666d74e3f2fa9.zip
cmake/FindLibIntl.cmake: handle passive case explicitly
If check_c_source_compiles() succeeded (HAVE_WORKING_LIBINTL is set) then the result of find_xxx() doesn't matter. This happens on systems (linux+glibc) where libintl is available passively. This allows `find_package(LibIntl REQUIRED)` to work and will still correctly fail (REQUIRED) on systems lacking libintl.
-rw-r--r--cmake/FindLibIntl.cmake12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmake/FindLibIntl.cmake b/cmake/FindLibIntl.cmake
index f8442566a9..738ae39983 100644
--- a/cmake/FindLibIntl.cmake
+++ b/cmake/FindLibIntl.cmake
@@ -34,9 +34,8 @@ if (LibIntl_INCLUDE_DIR)
set(CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
endif()
-# This is required because some operating systems don't have a separate
-# libintl--it is built into glibc. So we only need to specify the library
-# if one was actually found.
+# On some systems (linux+glibc) libintl is passively available.
+# So only specify the library if one was found.
if (LibIntl_LIBRARY)
set(CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}")
endif()
@@ -53,6 +52,13 @@ int main(int argc, char** argv) {
}" HAVE_WORKING_LIBINTL)
if (HAVE_WORKING_LIBINTL)
+ # On some systems (linux+glibc) libintl is passively available.
+ # If HAVE_WORKING_LIBINTL then we consider the requirement satisfied.
+ # Unset REQUIRED so that libfind_process(LibIntl) can proceed.
+ if(LibIntl_FIND_REQUIRED)
+ unset(LibIntl_FIND_REQUIRED)
+ endif()
+
check_variable_exists(_nl_msg_cat_cntr HAVE_NL_MSG_CAT_CNTR)
endif()