diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake index 0fcacedc..85a7c7a1 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake @@ -36,17 +36,8 @@ else() endif() -if( EXIV2_ENABLE_NLS ) - find_package(Intl) - if(Intl_FOUND) - include_directories(${Intl_INCLUDE_DIRS}) - set(LIBINTL_LIBRARIES ${Intl_LIBRARIES}) - else() - set(LIBINTL_LIBRARIES) - endif() - set( ENABLE_NLS 1 ) - # TODO : This is assuming that Intl is always found. This check should be improved and remove - # the manual check in cmake/generateConfigFile.cmake +if (EXIV2_ENABLE_NLS) + find_package(Intl REQUIRED) endif( ) find_package(Iconv) diff --git a/cmake/generateConfigFile.cmake b/cmake/generateConfigFile.cmake index 39108f4c..d9dff318 100644 --- a/cmake/generateConfigFile.cmake +++ b/cmake/generateConfigFile.cmake @@ -28,8 +28,6 @@ check_function_exists( mmap EXV_HAVE_MMAP ) check_function_exists( munmap EXV_HAVE_MUNMAP ) check_function_exists( strerror_r EXV_HAVE_STRERROR_R ) -# TODO: This check should be removed and rely on the check done in findDependencies.cmake -check_include_file( "libintl.h" EXV_HAVE_LIBINTL_H ) check_include_file( "unistd.h" EXV_HAVE_UNISTD_H ) check_include_file( "memory.h" EXV_HAVE_MEMORY_H ) check_include_file( "process.h" EXV_HAVE_PROCESS_H ) @@ -44,6 +42,6 @@ if ( NOT MINGW AND NOT MSYS AND NOT MSVC ) check_include_file( "regex.h" EXV_HAVE_REGEX_H ) endif() -set(EXV_ENABLE_NLS ${EXV_HAVE_LIBINTL_H}) +set(EXV_ENABLE_NLS ${EXIV2_ENABLE_NLS}) configure_file(cmake/config.h.cmake ${CMAKE_BINARY_DIR}/exv_conf.h @ONLY) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0fbc37fe..491f2c3c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -293,7 +293,8 @@ if( EXIV2_ENABLE_PNG ) endif() if( EXIV2_ENABLE_NLS ) - target_link_libraries( exiv2lib PRIVATE ${LIBINTL_LIBRARIES} ) + target_link_libraries(exiv2lib PRIVATE ${Intl_LIBRARIES}) + target_include_directories(exiv2lib PRIVATE ${Intl_INCLUDE_DIRS}) endif() if( ICONV_FOUND ) @@ -336,7 +337,8 @@ if(EXIV2_BUILD_EXIV2_COMMAND) target_link_libraries( exiv2 PRIVATE exiv2lib ) if( EXIV2_ENABLE_NLS ) - target_link_libraries(exiv2 PRIVATE ${LIBINTL_LIBRARIES}) + target_link_libraries(exiv2 PRIVATE ${Intl_LIBRARIES}) + target_include_directories(exiv2lib PRIVATE ${Intl_INCLUDE_DIRS}) endif() # Copy DLLs from conan packages to the bin folder