CMakeLists.txt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ################################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ################################################################################
  16. SET(XSD_SOURCE_DIR ${HPCC_SOURCE_DIR}/initfiles/componentfiles/configxml)
  17. SET(XSD_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR}/XSD )
  18. SET(XML_TARGET_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xml )
  19. FILE(MAKE_DIRECTORY ${XSD_TARGET_DIR})
  20. # get all *.xsd.in and *.xsd files
  21. FILE(GLOB XSD_TEMPLATE_FILES RELATIVE "${XSD_SOURCE_DIR}" "${XSD_SOURCE_DIR}/*.xsd.in")
  22. FILE(GLOB XSD_FILES RELATIVE "${XSD_SOURCE_DIR}" "${XSD_SOURCE_DIR}/*.xsd")
  23. # Skip some files which cause problem
  24. LIST(REMOVE_ITEM XSD_FILES "ftslave_linux.xsd")
  25. # process and copy *.xsd.in files
  26. FOREACH( XSD_TEMPLATE_FILE ${XSD_TEMPLATE_FILES} )
  27. STRING(REGEX REPLACE "(.*).in" "\\1" XSD_FILE "${XSD_TEMPLATE_FILE}")
  28. CONFIGURE_FILE(${XSD_SOURCE_DIR}/${XSD_TEMPLATE_FILE} ${XSD_TARGET_DIR}/${XSD_FILE})
  29. ENDFOREACH()
  30. # copy *.xsd.in files
  31. FOREACH( XSD_FILE ${XSD_FILES} )
  32. CONFIGURE_FILE(${XSD_SOURCE_DIR}/${XSD_FILE} ${XSD_TARGET_DIR}/${XSD_FILE} COPYONLY)
  33. ENDFOREACH()
  34. # create complete *.xsd file list
  35. FOREACH( XSD_TEMPLATE_FILE ${XSD_TEMPLATE_FILES} )
  36. STRING(REGEX REPLACE "(.*).in" "\\1" XSD_FILE "${XSD_TEMPLATE_FILE}")
  37. SET(XSD_FILES ${XSD_FILES} ${XSD_FILE})
  38. ENDFOREACH()
  39. # Set dependencies
  40. GET_PROPERTY(Current_Targets GLOBAL PROPERTY DOC_TARGETS)
  41. SET(XSLTPROC_DEPENDENCIES)
  42. FOREACH(T ${Current_Targets})
  43. IF("${T}" MATCHES "xsd_to_xml" )
  44. LIST(APPEND XSLTPROC_DEPENDENCIES ${T})
  45. ENDIF()
  46. ENDFOREACH()
  47. # create MakeFiles to generate xsd file to xml file
  48. XSD_TO_XML("${XSD_FILES}" ${XSD_TARGET_DIR} ${XML_TARGET_DIR})