[latexila] Check for ITS Tool installation in CMake file



commit 02af93ea9e49e878b90b2f326586e1ea3a3cfd1d
Author: Nathan Samson <nathansamson gmail com>
Date:   Thu Aug 4 00:52:44 2011 +0200

    Check for ITS Tool installation in CMake file

 CMakeLists.txt                |    2 ++
 cmake/FindItstool.cmake       |   10 ++++++++++
 cmake/itstool.cmake           |    2 +-
 data/templates/CMakeLists.txt |    2 +-
 4 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 86f3d09..a24e60c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,8 @@ set (BUILD_VALA ON CACHE BOOL "Generate the C code from Vala files")
 set (GETTEXT_PACKAGE "latexila")
 set (LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/share/locale")
 find_package (Gettext REQUIRED)
+list (APPEND CMAKE_MODULE_PATH "${latexila_SOURCE_DIR}/cmake")
+find_package (Itstool REQUIRED)
 
 set (SCHEMA_DIR "${CMAKE_INSTALL_PREFIX}/share")
 set (ICONS_DIR "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor")
diff --git a/cmake/FindItstool.cmake b/cmake/FindItstool.cmake
new file mode 100644
index 0000000..e013736
--- /dev/null
+++ b/cmake/FindItstool.cmake
@@ -0,0 +1,10 @@
+FIND_PROGRAM(ITSTOOL_EXECUTABLE itstool)
+
+IF (ITSTOOL_EXECUTABLE)
+   SET(ITSTOOL_FOUND TRUE)
+ELSE ()
+   SET(ITSTOOL_FOUND FALSE)
+   IF (Itstool_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "Itstool not found")
+   ENDIF ()
+ENDIF ()
diff --git a/cmake/itstool.cmake b/cmake/itstool.cmake
index 6850ae3..0594dbe 100644
--- a/cmake/itstool.cmake
+++ b/cmake/itstool.cmake
@@ -29,7 +29,7 @@ function (itstool target_name src_dir tmp_dir install_dir po_dir)
 			OUTPUT ${lang_files}
 			COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file}
 			COMMAND mkdir -p ${tmp_dir}/${lang}
-			COMMAND itstool -m ${mo_file} -o ${tmp_dir}/${lang}/ ${path_files}
+			COMMAND ${ITSTOOL_EXECUTABLE} -m ${mo_file} -o ${tmp_dir}/${lang}/ ${path_files}
 			DEPENDS ${po_file}
 		)
 
diff --git a/data/templates/CMakeLists.txt b/data/templates/CMakeLists.txt
index 951be92..69a7bb7 100644
--- a/data/templates/CMakeLists.txt
+++ b/data/templates/CMakeLists.txt
@@ -56,7 +56,7 @@ foreach (po_file ${po_files})
 		OUTPUT ${lang_files}
 		COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file}
 		COMMAND mkdir -p ${tmp_dir}/${lang}-xml ${tmp_dir}/${lang}
-		COMMAND itstool -i ${src_dir}/templates.its -m ${mo_file} -o ${tmp_dir}/${lang}-xml/ ${path_files}
+		COMMAND ${ITSTOOL_EXECUTABLE} -i ${src_dir}/templates.its -m ${mo_file} -o ${tmp_dir}/${lang}-xml/ ${path_files}
 		COMMAND ${src_dir}/gen_tex.sh ${tmp_dir}/${lang}-xml ${tmp_dir}/${lang}
 		DEPENDS ${po_file}
 	)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]