From: Axel Beckert <abe@debian.org>
Date: Fri, 8 Jan 2016 12:00:00 +0000
Subject: Build with Debian's antlr instead of the embedded copy in src/antlr

---
 CMakeLists.txt     | 5 -----
 src/CMakeLists.txt | 7 +++----
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b2d5ae..3f4761b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -225,11 +225,6 @@ check_library_exists(m nexttoward "" HAVE_NEXTTOWARD)
 # mpi
 check_include_file(mpi.h HAVE_MPI_H)
 
-# SA: whithout it compilation of antlr fails if there's a conflicting 
-#     version of antlr in system-wide directories
-include_directories(src)
-
-#-------------------------------MANDATORY MODULES-------------------------------------
 if (NOT WIN32)
     # Ncurses MANDATORY for readline on POSIX
     # -DNCURSESDIR=DIR
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4967d32..809e093 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -215,10 +215,9 @@ endif(HAVE_LIBWXWIDGETS AND WIN32)
 
 #whereami
 add_library(whereami STATIC ${CMAKE_SOURCE_DIR}/src/whereami/src/whereami.c)
-add_subdirectory(antlr)
 add_subdirectory(plplot)
 
-include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/antlr ${CMAKE_BINARY_DIR}/src ${CMAKE_SOURCE_DIR}/src/whereami/src ${CMAKE_BINARY_DIR})
+include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/whereami/src ${CMAKE_BINARY_DIR})
 link_directories(${LINK_DIRECTORIES})
 
 SET(CMAKE_SKIP_RPATH TRUE)
@@ -244,8 +243,8 @@ if(USE_OPENMP)
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
 endif(USE_OPENMP)
 
-add_dependencies(gnudatalanguage plplot antlr whereami) # be sure that antlr is built before gdl
-target_link_libraries(gnudatalanguage plplot antlr whereami) # link antlr against gdl. added librt for mmap (unix only, not osx, apparently)
+add_dependencies(gnudatalanguage plplot whereami)
+target_link_libraries(gnudatalanguage plplot antlr-pic whereami) # link antlr against gdl. added librt for mmap (unix only, not osx, apparently)
 if (MINGW)
 target_link_libraries(gnudatalanguage ws2_32)
 endif (MINGW)
