Просмотр исходного кода

CMake: Add support for libintl

This basically just links everything to libintl if USE_NLS is
on. It would be better to just link those targets that are
actually translated, but doing so is a huge PITA.

Also move the include_directories() for the build-tree include/
directory to the top of the CMakeLists.txt, otherwise it only
gets passed after Intl_INCLUDE_DIRS, which means we will built
against installed apt-pkg headers (if any) instead of our own.

Gbp-Dch: ignore
Julian Andres Klode лет назад: 10
Родитель
Сommit
cede4eda68
1 измененных файлов с 9 добавлено и 3 удалено
  1. 9 3
      CMakeLists.txt

+ 9 - 3
CMakeLists.txt

@@ -4,6 +4,9 @@
 # set minimum version
 project(apt)
 cmake_minimum_required(VERSION 3.4.0)
+# Generic header locations
+include_directories(${PROJECT_BINARY_DIR}/include)
+
 
 enable_testing()
 
@@ -27,6 +30,12 @@ include(TestBigEndian)
 find_package(Threads)
 find_package(LFS REQUIRED)
 
+if(USE_NLS)
+  find_package(Intl REQUIRED)
+  link_libraries(${Intl_LIBRARIES})
+  include_directories(${Intl_INCLUDE_DIRS})
+endif()
+
 # Add large file support
 add_compile_options(${LFS_COMPILE_OPTIONS})
 add_definitions(${LFS_DEFINITIONS})
@@ -166,9 +175,6 @@ endif()
 configure_file(CMake/config.h.in ${PROJECT_BINARY_DIR}/include/config.h)
 configure_file(CMake/apti18n.h.in ${PROJECT_BINARY_DIR}/include/apti18n.h)
 
-# Generic header locations
-include_directories(${PROJECT_BINARY_DIR}/include)
-
 # Add our subdirectories
 add_subdirectory(vendor)
 add_subdirectory(apt-pkg)