Integrated gettext into the build system

This commit is contained in:
Snaipe 2015-07-28 22:44:28 +02:00
parent e0d93f53c7
commit 1bc6bf59fe
6 changed files with 23 additions and 6 deletions

View file

@ -2,17 +2,30 @@ cmake_minimum_required(VERSION 3.2.2)
cmake_policy(SET CMP0048 NEW)
project(Criterion VERSION 1.2.2)
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
set(GettextTranslate_ALL)
set(GettextTranslate_GMO_BINARY)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/.cmake/Modules/")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -g -std=gnu11")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-no-undefined")
find_package(Gettext)
if (GETTEXT_FOUND)
include(GettextTranslate)
add_subdirectory(po)
set(ENABLE_NLS 1)
endif ()
include(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
find_package(PCRE)
find_package(Gettext REQUIRED)
find_package(Libcsptr)
configure_file(
@ -63,7 +76,6 @@ set(INTERFACE_FILES
)
add_subdirectory(samples)
#add_subdirectory(po)
include_directories(include src)
add_library(criterion SHARED ${SOURCE_FILES} ${INTERFACE_FILES})
@ -80,7 +92,7 @@ if (PCRE_FOUND)
target_link_libraries(criterion pcre)
endif()
install(FILES ${INTERFACE_FILES} DESTINATION include/insight)
install(FILES ${INTERFACE_FILES} DESTINATION include/criterion)
install(TARGETS criterion
LIBRARY DESTINATION lib
)

1
po/CMakeLists.txt Normal file
View file

@ -0,0 +1 @@
GettextTranslate()

View file

@ -1,7 +1,7 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
DOMAIN = Criterion
# These two variables depend on the location of this directory.
subdir = po

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: criterion 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-30 12:07+0200\n"
"POT-Creation-Date: 2015-07-28 22:17+0200\n"
"PO-Revision-Date: 2015-04-03 17:58+0200\n"
"Last-Translator: <franklinmathieu@gmail.com>\n"
"Language-Team: French\n"

View file

@ -1,6 +1,10 @@
#ifndef CONFIG_H_IN_
# define CONFIG_H_IN_
# define VERSION "${PACKAGE_VERSION}"
#cmakedefine ENABLE_NLS @ENABLE_NLS@
# define LOCALEDIR "${LOCALEDIR}"
# define PACKAGE "${PROJECT_NAME}"
# define VERSION "${PROJECT_VERSION}"
#endif /* !CONFIG_H_IN_ */