From 535e9d0e2da2f307b0df77f8f65702f5b7b161d1 Mon Sep 17 00:00:00 2001 From: Valient Gough Date: Mon, 5 Sep 2016 21:09:30 +0200 Subject: [PATCH] update gettext install config --- CMakeLists.txt | 25 ++++++++++++------------- po/CMakeLists.txt | 4 ++++ 2 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 po/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index aa37223..0770270 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,8 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") option (BUILD_SHARED_LIBS "build shared libraries" OFF) -option (USE_INTERNAL_TINYXML "use build-in TinyXML2" ON) +option (USE_INTERNAL_TINYXML "use built-in TinyXML2" ON) +option (ENABLE_NLS "Compile with Native Language Support (using gettext)" ON) # We need C++ 11 if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.0) @@ -31,6 +32,8 @@ else () endif() endif () +add_definitions( -DPACKAGE="encfs" ) + # http://www.cmake.org/Wiki/CMake_RPATH_handling#Mac_OS_X_and_the_RPATH if (APPLE) set(CMAKE_MACOSX_RPATH ON) @@ -65,7 +68,6 @@ else () endif () find_program (POD2MAN pod2man) -include (FindGettext) # Check for include files and stdlib properties. include (CheckIncludeFileCXX) @@ -115,6 +117,14 @@ configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake include_directories (${CMAKE_BINARY_DIR}) include_directories (${CMAKE_SOURCE_DIR}) +# Translations +if (ENABLE_NLS) + add_subdirectory(po) + + add_definitions(-DENABLE_NLS) + add_definitions(-DLOCALEDIR="${CMAKE_INSTALL_PREFIX}/share/locale") +endif (ENABLE_NLS) + set(SOURCE_FILES encfs/autosprintf.cpp encfs/base64.cpp @@ -205,17 +215,6 @@ if (POD2MAN) DESTINATION share/man/man1) endif (POD2MAN) -# Translations -if (GETTEXT_FOUND) - file(GLOB po_files "po/*.po") - foreach(pofile ${po_files}) - get_filename_component(lang ${pofile} NAME_WE) - #message("-- Found gettext PO file for ${lang}: ${pofile}") - - gettext_process_po_files(${lang} ALL PO_FILES ${pofile}) - endforeach() -endif (GETTEXT_FOUND) - # Tests enable_testing() add_test (NAME checkops diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..719436f --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,4 @@ +find_package (Gettext REQUIRED) + +file (GLOB POFILES *.po) +GETTEXT_CREATE_TRANSLATIONS (encfs.pot ALL ${POFILES})