aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/FindKMetaData.cmake1
-rw-r--r--modules/KMetaDataMacros.cmake49
2 files changed, 50 insertions, 0 deletions
diff --git a/modules/FindKMetaData.cmake b/modules/FindKMetaData.cmake
index 3355d60f..1cdb801b 100644
--- a/modules/FindKMetaData.cmake
+++ b/modules/FindKMetaData.cmake
@@ -19,6 +19,7 @@ FIND_PATH(KMETADATA_INCLUDE_DIR
FIND_LIBRARY(KMETADATA_LIBRARIES
NAMES
kmetadata
+ kmetadatatools
PATHS
/usr/lib
/usr/local/lib
diff --git a/modules/KMetaDataMacros.cmake b/modules/KMetaDataMacros.cmake
new file mode 100644
index 00000000..7e4215e9
--- /dev/null
+++ b/modules/KMetaDataMacros.cmake
@@ -0,0 +1,49 @@
+# This file contains the following macros:
+#
+# KMETADATA_GENERATE_FROM_ONTOLOGY
+#
+
+
+#
+# KMETADATA_GENERATE_FROM_ONTOLOGY
+# (C) 2007 Sebastian Trueg <trueg@kde.org>
+#
+# Parameters:
+# ontofile - Path to the NRL ontology defining the resources to be generated.
+# targetdir - Folder to which the generated sources should be written.
+# out_headers - Variable which will be filled with the names of all generated headers.
+# out_sources - Variable which will be filled with the names of all generated sources.
+# out_includes - Variable which will be filled with complete include statements of all
+# generated resource classes.
+#
+# In addition to the parameters an arbitrary number of template filenames can be set as arguments
+#
+macro(KMETADATA_GENERATE_FROM_ONTOLOGY ontofile targetdir out_headers out_sources out_includes)
+
+ FIND_PROGRAM(RCGEN kmetadata_rcgen PATHS ${BIN_INSTALL_DIR})
+ if(RCGEN-NOTFOUND)
+ message( FATAL_ERROR "Failed to find the KMetaData source generator" )
+ endif(RCGEN-NOTFOUND)
+
+ FILE(TO_NATIVE_PATH ${RCGEN} RCGEN)
+
+ execute_process(
+ COMMAND ${RCGEN} --listheaders --prefix ${targetdir}/ ${ontofile}
+ OUTPUT_VARIABLE ${out_headers}
+ )
+
+ execute_process(
+ COMMAND ${RCGEN} --listsources --prefix ${targetdir}/ ${ontofile}
+ OUTPUT_VARIABLE ${out_sources}
+ )
+
+ execute_process(
+ COMMAND ${RCGEN} --listincludes ${ontofile}
+ OUTPUT_VARIABLE ${out_includes}
+ )
+
+ execute_process(
+ COMMAND ${RCGEN} --writeall --templates ${ARGN} ${targetdir}/ ${ontofile}
+ )
+
+endmacro(KMETADATA_GENERATE_FROM_ONTOLOGY)