Commit fb472eef authored by Ghislain MARY's avatar Ghislain MARY

Improve detection of antlr3.

parent bda91a73
......@@ -79,7 +79,6 @@ endif(NOT "${HAVE_RES_NDESTROY}" STREQUAL "" AND NOT "${HAVE_RES_GETSERVERS}" ST
find_package(Threads)
find_package(Java)
find_package(Antlr3)
if(${ENABLE_TLS})
......
......@@ -25,8 +25,10 @@
# ANTLR3C_FOUND - system has antlr3c
# ANTLR3C_INCLUDE_DIR - the antlr3c include directory
# ANTLR3C_LIBRARIES - The libraries needed to use antlr3c
# ANTLR3_JAR_FOUND - sytem has antlr.jar
# ANTLR3_JAR_PATH - the antlr.jar path
# ANTLR3_COMMAND - The command to run the antlr jar
# ANTLR3_COMMAND_FOUND - sytem has the command to run the antlr jar
find_package(Java)
include(CMakePushCheckState)
include(CheckIncludeFile)
......@@ -80,14 +82,26 @@ endif(NOT "${ANTLR3C_INCLUDE_DIR}" STREQUAL "")
mark_as_advanced(ANTLR3C_INCLUDE_DIR ANTLR3C_LIBRARIES)
find_file(ANTLR3_JAR_PATH
NAMES antlr.jar antlr3.jar
HINTS _ANTLR3_JAR_ROOT_PATHS
PATH_SUFFIXES share/java
find_file(ANTLR3_COMMAND
NAMES antlr3
HINTS ${_ANTLR3_JAR_ROOT_PATHS}
PATH_SUFFIXES bin
)
if(NOT "${ANTLR3_JAR_PATH}" STREQUAL "")
set(ANTLR3_JAR_FOUND TRUE)
endif(NOT "${ANTLR3_JAR_PATH}" STREQUAL "")
if("${ANTLR3_COMMAND}" STREQUAL "")
# antlr3 command not found, search for the jar file
find_file(ANTLR3_JAR_PATH
NAMES antlr3.jar antlr.jar
HINTS _ANTLR3_JAR_ROOT_PATHS
PATH_SUFFIXES share/java
)
if(NOT "${ANTLR3_JAR_PATH}" STREQUAL "")
set(ANTLR3_COMMAND ${Java_JAVA_EXECUTABLE} -jar ${ANTLR3_JAR_PATH})
set(ANTLR3_COMMAND_FOUND TRUE)
endif(NOT "${ANTLR3_JAR_PATH}" STREQUAL "")
else("${ANTLR3_COMMAND}" STREQUAL "")
set(ANTLR3_COMMAND_FOUND TRUE)
endif("${ANTLR3_COMMAND}" STREQUAL "")
mark_as_advanced(ANTLR3_JAR_PATH)
mark_as_advanced(ANTLR3_COMMAND)
......@@ -46,7 +46,7 @@ set(SDP_GENERATED_SOURCE_FILES
)
add_custom_command(
OUTPUT ${SDP_GENERATED_SOURCE_FILES}
COMMAND ${Java_JAVA_EXECUTABLE} -jar ${ANTLR3_JAR_PATH} -make -Xmultithreaded -fo ${CMAKE_CURRENT_BINARY_DIR}/grammars ${CMAKE_CURRENT_SOURCE_DIR}/grammars/belle_sdp.g
COMMAND ${ANTLR3_COMMAND} -make -Xmultithreaded -fo ${CMAKE_CURRENT_BINARY_DIR}/grammars ${CMAKE_CURRENT_SOURCE_DIR}/grammars/belle_sdp.g
DEPENDS grammars/belle_sdp.g
)
......@@ -58,7 +58,7 @@ set(SIP_MESSAGE_GENERATED_SOURCE_FILES
)
add_custom_command(
OUTPUT ${SIP_MESSAGE_GENERATED_SOURCE_FILES}
COMMAND ${Java_JAVA_EXECUTABLE} -jar ${ANTLR3_JAR_PATH} -make -Xmultithreaded -fo ${CMAKE_CURRENT_BINARY_DIR}/grammars ${CMAKE_CURRENT_SOURCE_DIR}/grammars/belle_sip_message.g
COMMAND ${ANTLR3_COMMAND} -make -Xmultithreaded -fo ${CMAKE_CURRENT_BINARY_DIR}/grammars ${CMAKE_CURRENT_SOURCE_DIR}/grammars/belle_sip_message.g
DEPENDS grammars/belle_sip_message.g
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment