From: Mathias Preiner Date: Sat, 15 Sep 2018 00:23:30 +0000 (-0700) Subject: cmake: FindANTLR: Check if antlr3FileStreamNew is available. X-Git-Tag: cvc5-1.0.0~4545 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=01c979407390b88641aaf6fbd0307fd6d10a8dcb;p=cvc5.git cmake: FindANTLR: Check if antlr3FileStreamNew is available. --- diff --git a/cmake/FindANTLR.cmake b/cmake/FindANTLR.cmake index 79d38854e..135668006 100644 --- a/cmake/FindANTLR.cmake +++ b/cmake/FindANTLR.cmake @@ -32,8 +32,19 @@ if(CHECK_SYSTEM_VERSION) find_library(ANTLR_LIBRARIES NAMES antlr3c) endif() +# Check if antlr3FileStreamNew is available. If not we have to +# define CVC4_ANTLR3_OLD_INPUT_STREAM (src/parser/CMakeLists.txt). +if(ANTLR_INCLUDE_DIR) + include(CheckSymbolExists) + set(CMAKE_REQUIRED_INCLUDES ${ANTLR_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${ANTLR_LIBRARIES}) + check_symbol_exists( + antlr3FileStreamNew "antlr3defs.h" HAVE_ANTLR3_FILE_STREAM_NEW) +endif() + include(FindPackageHandleStandardArgs) find_package_handle_standard_args( ANTLR DEFAULT_MSG ANTLR_BINARY ANTLR_INCLUDE_DIR ANTLR_LIBRARIES) -mark_as_advanced(ANTLR_BINARY ANTLR_INCLUDE_DIR ANTLR_LIBRARIES) +mark_as_advanced(ANTLR_BINARY ANTLR_INCLUDE_DIR ANTLR_LIBRARIES + HAVE_ANTLR3_FILE_STREAM_NEW) diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index d78068f6b..389ebd814 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -1,6 +1,10 @@ set(ANTLR_HOME ${ANTLR_DIR}) find_package(ANTLR REQUIRED) +if(NOT HAVE_ANTLR3_FILE_STREAM_NEW) + add_definitions(-DCVC4_ANTLR3_OLD_INPUT_STREAM) +endif() + # Java runtime is required for ANTLR find_package(Java COMPONENTS Runtime REQUIRED)