summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Preiner <mathias.preiner@gmail.com>2018-09-14 17:23:30 -0700
committerMathias Preiner <mathias.preiner@gmail.com>2018-09-22 16:30:59 -0700
commit01c979407390b88641aaf6fbd0307fd6d10a8dcb (patch)
tree61c71ee19c2faaed6df9080cbed498a97bd960bd
parent56c3c3d40bb83fe3e49e878e5098e929feb7d32e (diff)
cmake: FindANTLR: Check if antlr3FileStreamNew is available.
-rw-r--r--cmake/FindANTLR.cmake13
-rw-r--r--src/parser/CMakeLists.txt4
2 files changed, 16 insertions, 1 deletions
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)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback