You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.8 KiB

  1. # This program source code file is part of KICAD, a free EDA CAD application.
  2. #
  3. # Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  4. # Copyright (C) 2010 Kicad Developers, see AUTHORS.txt for contributors.
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License
  8. # as published by the Free Software Foundation; either version 2
  9. # of the License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, you may find one here:
  18. # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. # or you may search the http://www.gnu.org website for the version 2 license,
  20. # or you may write to the Free Software Foundation, Inc.,
  21. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. #
  23. # Function make_lexer
  24. # is a standard way to invoke TokenList2DsnLexer.cmake.
  25. # Extra arguments are treated as source files which depend on the generated
  26. # outHeaderFile
  27. function( make_lexer inputFile outHeaderFile outCppFile enum )
  28. add_custom_command(
  29. OUTPUT ${outHeaderFile}
  30. ${outCppFile}
  31. COMMAND ${CMAKE_COMMAND}
  32. -Denum=${enum}
  33. -DinputFile=${inputFile}
  34. -DoutHeaderFile=${outHeaderFile}
  35. -DoutCppFile=${outCppFile}
  36. -P ${CMAKE_MODULE_PATH}/TokenList2DsnLexer.cmake
  37. DEPENDS ${inputFile}
  38. ${CMAKE_MODULE_PATH}/TokenList2DsnLexer.cmake
  39. COMMENT "TokenList2DsnLexer.cmake creating:
  40. ${outHeaderFile} and
  41. ${outCppFile} from
  42. ${inputFile}"
  43. )
  44. # extra_args, if any, are treated as source files (typically headers) which
  45. # are known to depend on the generated outHeader.
  46. foreach( extra_arg ${ARGN} )
  47. set_source_files_properties( ${extra_arg}
  48. PROPERTIES OBJECT_DEPENDS ${outHeaderFile}
  49. )
  50. endforeach()
  51. endfunction()
  52. # Is a macro instead of function so there's a higher probability that the
  53. # scope of CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA is global
  54. macro( add_conffiles )
  55. if( ${ARGC} STREQUAL "0" )
  56. # remove the file when user passes no arguments, which he should do exactly once at top
  57. file( REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conffiles )
  58. else()
  59. foreach( filename ${ARGV} )
  60. file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/conffiles "${filename}\n" )
  61. endforeach()
  62. set( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_CURRENT_BINARY_DIR}/conffiles )
  63. endif()
  64. endmacro( add_conffiles )