Unidata / UDUNITS-2

API and utility for arithmetic manipulation of units of physical quantities
http://www.unidata.ucar.edu/software/udunits
Other
62 stars 36 forks source link

CMake build creates scanner and parser with debug #69

Open schwehr opened 6 years ago

schwehr commented 6 years ago

It would be great to have an option to easily enable debug flex and bison output, but I don't think the default should be for debugging builds. lib/CMakeLists.txt has the flex option -d for debug and the bison build has -t for debug. The debug bison build with 3.0.2 on debian testing likes to emit a lot of extra newlines to stderr that I was unable to figure out how to disable.

IF(UNIX)
    add_custom_command(
        OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/scanner.c
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        COMMAND ${UD_FLEX} -d -Put -o scanner.c scanner.l
        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l)
    add_custom_command(
        OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/parser.c
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        COMMAND ${UD_BISON} -t -p ut -o parser.c parser.y
        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/parser.y)
    set_source_files_properties(parser.c
        PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scanner.c)
endif()
schwehr commented 6 years ago

https://github.com/Unidata/UDUNITS-2/pull/74/commits/5452323a98a2685ec53792461890d397421fa700 in PR #74