aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Trueg <sebastian@trueg.de>2008-02-11 17:29:18 +0000
committerSebastian Trueg <sebastian@trueg.de>2008-02-11 17:29:18 +0000
commite5c7745dccc9b29354812f53edb77163574028ae (patch)
treeeb17ef52f9a7f25352b0f5dd17d9358a8910a9ed
parent6e0c6f603d7a6eaedab6eb909591fb1cfa32f413 (diff)
downloadextra-cmake-modules-e5c7745dccc9b29354812f53edb77163574028ae.tar.gz
extra-cmake-modules-e5c7745dccc9b29354812f53edb77163574028ae.tar.bz2
Make it possible to get the result from the nepomuk code gen call
svn path=/trunk/KDE/kdelibs/; revision=773741
-rw-r--r--modules/NepomukMacros.cmake64
1 files changed, 43 insertions, 21 deletions
diff --git a/modules/NepomukMacros.cmake b/modules/NepomukMacros.cmake
index 9476cf64..18aeca27 100644
--- a/modules/NepomukMacros.cmake
+++ b/modules/NepomukMacros.cmake
@@ -18,32 +18,54 @@
#
# In addition to the parameters an arbitrary number of template filenames can be set as arguments
#
+# In case of success NEPOMUK_RESOURCES_GENERATED is true, otherwise false
+#
macro(NEPOMUK_GENERATE_FROM_ONTOLOGY ontofile targetdir out_headers out_sources out_includes)
+ # init
+ set(NEPOMUK_RESOURCES_GENERATED false)
+
FIND_PROGRAM(RCGEN nepomuk-rcgen PATHS ${BIN_INSTALL_DIR})
+
if(NOT RCGEN)
- message( FATAL_ERROR "Failed to find the KMetaData source generator" )
- endif(NOT RCGEN)
- FILE(TO_NATIVE_PATH ${RCGEN} RCGEN)
+ message(STATUS "Failed to find the Nepomuk source generator" )
- execute_process(
- COMMAND ${RCGEN} --listheaders --prefix ${targetdir}/ --ontologies ${ontofile}
- OUTPUT_VARIABLE ${out_headers}
- )
-
- execute_process(
- COMMAND ${RCGEN} --listsources --prefix ${targetdir}/ --ontologies ${ontofile}
- OUTPUT_VARIABLE ${out_sources}
- )
-
- execute_process(
- COMMAND ${RCGEN} --listincludes --ontologies ${ontofile}
- OUTPUT_VARIABLE ${out_includes}
- )
-
- execute_process(
- COMMAND ${RCGEN} --writeall --templates ${ARGN} --target ${targetdir}/ --ontologies ${ontofile}
- )
+ else(NOT RCGEN)
+
+ FILE(TO_NATIVE_PATH ${RCGEN} RCGEN)
+
+ execute_process(
+ COMMAND ${RCGEN} --listheaders --prefix ${targetdir}/ --ontologies ${ontofile}
+ OUTPUT_VARIABLE ${out_headers}
+ RESULT_VARIABLE rcgen_result
+ )
+
+ # If the first call succeeds it is very very likely that the rest will, too
+ if(${rcgen_result} EQUAL 0)
+
+ execute_process(
+ COMMAND ${RCGEN} --listsources --prefix ${targetdir}/ --ontologies ${ontofile}
+ OUTPUT_VARIABLE ${out_sources}
+ )
+
+ execute_process(
+ COMMAND ${RCGEN} --listincludes --ontologies ${ontofile}
+ OUTPUT_VARIABLE ${out_includes}
+ )
+
+ execute_process(
+ COMMAND ${RCGEN} --writeall --templates ${ARGN} --target ${targetdir}/ --ontologies ${ontofile}
+ )
+
+ set(NEPOMUK_RESOURCES_GENERATED true)
+
+ else(${rcgen_result} EQUAL 0)
+
+ message(STATUS "Failed to generate Nepomuk resource classes.")
+
+ endif(${rcgen_result} EQUAL 0)
+
+ endif(NOT RCGEN)
endmacro(NEPOMUK_GENERATE_FROM_ONTOLOGY)