[latexila] CMake: find glib-compile-resources executable



commit 6939a50722ae822570ab1331b707966539cce6d2
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Fri Jul 6 02:57:53 2012 +0200

    CMake: find glib-compile-resources executable

 CMakeLists.txt             |    2 ++
 cmake/Findgresources.cmake |   10 ++++++++++
 cmake/gresource.cmake      |    4 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cef693d..338ea07 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -104,6 +104,8 @@ configure_file (
 add_definitions (-include config.h)
 
 # Resources
+find_package (gresources REQUIRED)
+
 gresource (
 	"${latexila_SOURCE_DIR}/data/images/stock-icons" # resource dir
 	"stock-icons.gresource.xml" # resource file
diff --git a/cmake/Findgresources.cmake b/cmake/Findgresources.cmake
new file mode 100644
index 0000000..f2d6e79
--- /dev/null
+++ b/cmake/Findgresources.cmake
@@ -0,0 +1,10 @@
+find_program (gresources_executable glib-compile-resources)
+
+if (gresources_executable)
+	set (gresources_FOUND true)
+else ()
+	set (gresources_FOUND false)
+	if (gresources_FIND_REQUIRED)
+		message (FATAL_ERROR "glib-compile-resources not found")
+	endif ()
+endif ()
diff --git a/cmake/gresource.cmake b/cmake/gresource.cmake
index efa37ff..fd9c76b 100644
--- a/cmake/gresource.cmake
+++ b/cmake/gresource.cmake
@@ -17,7 +17,7 @@ function (gresource resource_dir resource_file output_dir output_file)
 	execute_process (
 		OUTPUT_VARIABLE _files
 		WORKING_DIRECTORY ${resource_dir}
-		COMMAND glib-compile-resources --generate-dependencies ${resource_file}
+		COMMAND ${gresources_executable} --generate-dependencies ${resource_file}
 	)
 
 	string (REPLACE "\n" ";" files ${_files})
@@ -32,6 +32,6 @@ function (gresource resource_dir resource_file output_dir output_file)
 		OUTPUT ${output}
 		DEPENDS "${resource_dir}/${resource_file}" ${depends}
 		WORKING_DIRECTORY ${resource_dir}
-		COMMAND glib-compile-resources --generate-source --target=${output} ${resource_file}
+		COMMAND ${gresources_executable} --generate-source --target=${output} ${resource_file}
 	)
 endfunction ()



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