summaryrefslogtreecommitdiff
blob: 9c8e6abb2358a108eb5993c3cb73c978f498f631 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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)