Warning, /frameworks/kdelibs4support/cmake/modules/NepomukMacros.cmake is written in an unsupported language. File is not indexed.

0001 # This file contains the following macros:
0002 #
0003 # NEPOMUK_GENERATE_FROM_ONTOLOGY
0004 # Parameters:
0005 #   ontofile     - Path to the NRL ontology defining the resources to be generated.
0006 #   targetdir    - Folder to which the generated sources should be written.
0007 #   out_headers  - Variable which will be filled with the names of all generated headers.
0008 #   out_sources  - Variable which will be filled with the names of all generated sources.
0009 #   out_includes - Variable which will be filled with complete include statements of all 
0010 #                  generated resource classes.
0011 #
0012 # In addition to the parameters an arbitrary number of template filenames can be set as arguments
0013 #
0014 # In case of success NEPOMUK_RESOURCES_GENERATED is true, otherwise false
0015 
0016 # (C) 2007 Sebastian Trueg <trueg@kde.org>
0017 
0018 
0019 macro(NEPOMUK_GENERATE_FROM_ONTOLOGY ontofile targetdir out_headers out_sources out_includes)
0020 
0021   # init
0022   set(NEPOMUK_RESOURCES_GENERATED false)
0023 
0024   find_program(RCGEN nepomuk-rcgen PATHS ${KDE4_BIN_INSTALL_DIR} ${BIN_INSTALL_DIR} NO_DEFAULT_PATH)
0025 
0026   if(NOT RCGEN)
0027 
0028     message(STATUS "Failed to find the Nepomuk source generator" )
0029 
0030   else(NOT RCGEN)
0031 
0032     FILE(TO_NATIVE_PATH ${RCGEN} RCGEN)
0033 
0034     execute_process(
0035       COMMAND ${RCGEN} --listheaders --prefix ${targetdir}/ --ontologies ${ontofile}
0036       OUTPUT_VARIABLE ${out_headers}
0037       RESULT_VARIABLE rcgen_result
0038       )
0039 
0040     # If the first call succeeds it is very very likely that the rest will, too
0041     if(${rcgen_result} EQUAL 0)
0042 
0043       execute_process(
0044         COMMAND ${RCGEN} --listsources --prefix ${targetdir}/ --ontologies ${ontofile}
0045         OUTPUT_VARIABLE ${out_sources}
0046         )
0047       
0048       execute_process(
0049         COMMAND ${RCGEN} --listincludes --ontologies ${ontofile}
0050         OUTPUT_VARIABLE ${out_includes}
0051         )
0052 
0053       execute_process(
0054         COMMAND ${RCGEN} --writeall --templates ${ARGN} --target ${targetdir}/ --ontologies ${ontofile}
0055         )
0056 
0057       set(NEPOMUK_RESOURCES_GENERATED true)
0058 
0059     else(${rcgen_result} EQUAL 0)
0060 
0061       message(STATUS "Failed to generate Nepomuk resource classes.")
0062 
0063     endif(${rcgen_result} EQUAL 0)
0064 
0065   endif(NOT RCGEN)
0066   
0067 endmacro(NEPOMUK_GENERATE_FROM_ONTOLOGY)