Commit 42037933 authored by Justin M. Keyes's avatar Justin M. Keyes

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.
parent 21c9db18
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment