Files
scylladb/cmake/FindANTLR3.cmake
Kefu Chai 58f13dfa0a build: cmake: find ANTLR3 before using it
if ANTLR3's header files are not installed into the /usr/include, or
other directories searched by compiler by default. there are chances,
we cannot build the tree. so we have to find it first. as /opt/scylladb
is the directory where `scylla-antlr35-c++-dev` is installed on
debian derivatives, this directory is added so the find package module
can find the header files.

```
In file included from /home/kefu/dev/scylla/db/legacy_schema_migrator.cc:38:
In file included from /home/kefu/dev/scylla/cql3/util.hh:21:
/home/kefu/dev/scylla/build/cmake/cql3/CqlParser.hpp:55:10: fatal error: 'antlr3.hpp' file not found
         ^~~~~~~~~~~~
```

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-03-04 13:11:25 +08:00

32 lines
624 B
CMake

#
# Copyright 2023-present ScyllaDB
#
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
find_path(ANTLR3_INCLUDE_DIR
NAMES antlr3.hpp
PATHS
/opt/scylladb/include)
mark_as_advanced(
ANTLR3_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ANTLR3
REQUIRED_VARS
ANTLR3_INCLUDE_DIR)
if(ANTLR3_FOUND)
set(ANTLR3_INCLUDE_DIRS ${ANTLR3_INCLUDE_DIR})
if(NOT(TARGET ANTLR3::antlr3))
add_library(ANTLR3::antlr3 INTERFACE IMPORTED)
set_target_properties(ANTLR3::antlr3
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${ANTLR3_INCLUDE_DIRS})
endif()
endif()