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.

77 lines
2.7 KiB

diff -Nur gdl-0.9.2.orig/CMakeLists.txt gdl-0.9.2/CMakeLists.txt
--- gdl-0.9.2.orig/CMakeLists.txt 2011-12-22 20:18:17.000000000 +0000
+++ gdl-0.9.2/CMakeLists.txt 2011-12-22 20:32:20.000000000 +0000
@@ -94,6 +94,8 @@
set(GDL_DATA_DIR "/share/gnudatalanguage" CACHE PATH "Choose data install directory relative to CMAKE_INSTALL_PREFIX")
+set(BUNDLED_ANTLR OFF CACHE BOOL "Use bundled ANTLR grammar ?")
+set(ANTLRDIR "" CACHE PATH "Specify the system ANTLR directory tree")
# check for 64-bit OS
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
@@ -143,9 +145,15 @@
# 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)
+if(BUNDLED_ANTLR)
+ # SA: whithout it compilation of antlr fails if there's a conflicting
+ # version of antlr in system-wide directories
+ include_directories(src)
+else(BUNDLED_ANTLR)
+ find_package(ANTLR QUIET)
+ set(LIBRARIES ${LIBRARIES} ${ANTLR_LIBRARIES})
+ include_directories(${ANTLR_INCLUDE_DIR})
+endif(BUNDLED_ANTLR)
# Ncurses MANDATORY
# -DNCURSESDIR=DIR
diff -Nur gdl-0.9.2.orig/CMakeModules/FindANTLR.cmake gdl-0.9.2/CMakeModules/FindANTLR.cmake
--- gdl-0.9.2.orig/CMakeModules/FindANTLR.cmake 1970-01-01 01:00:00.000000000 +0100
+++ gdl-0.9.2/CMakeModules/FindANTLR.cmake 2011-12-22 21:03:34.000000000 +0000
@@ -0,0 +1,11 @@
+
+
+find_library(ANTLR_LIBRARIES NAMES antlr)
+find_path(ANTLR_INCLUDE_DIR NAMES antlr/ANTLRUtil.hpp)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ANTLR DEFAULT_MSG ANTLR_LIBRARIES ANTLR_INCLUDE_DIR)
+
+mark_as_advanced(
+ANTLR_LIBRARIES
+ANTLR_INCLUDE_DIR
+)
diff -Nur gdl-0.9.2.orig/src/CMakeLists.txt gdl-0.9.2/src/CMakeLists.txt
--- gdl-0.9.2.orig/src/CMakeLists.txt 2011-12-22 20:18:17.000000000 +0000
+++ gdl-0.9.2/src/CMakeLists.txt 2011-12-22 20:31:27.000000000 +0000
@@ -224,9 +224,8 @@
widget.cpp
)
-add_subdirectory(antlr)
-include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/antlr ${CMAKE_BINARY_DIR})
+include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR})
link_directories(${LINK_DIRECTORIES})
if(PYTHON_MODULE) #libgdl
@@ -237,8 +236,13 @@
add_executable(gdl ${SOURCES})
endif(PYTHON_MODULE)
-add_dependencies(gdl antlr) # be sure that antlr is built before gdl
-target_link_libraries(gdl antlr) # link antlr against gdl
+if(BUNDLED_ANTLR)
+ add_subdirectory(antlr)
+ include_directories(${CMAKE_SOURCE_DIR}/src/antlr)
+ add_dependencies(gdl antlr) # be sure that antlr is built before gdl
+ target_link_libraries(gdl antlr) # link antlr against gdl
+endif(BUNDLED_ANTLR)
+
target_link_libraries(gdl ${LIBRARIES})
add_definitions(-DHAVE_CONFIG_H)