Skip to content

Commit

Permalink
Add include dirs direclty to cpp targets
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Nobles <[email protected]>
  • Loading branch information
Nick Nobles authored and parrt committed Jul 24, 2024
1 parent b3bb743 commit 17f3f5e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions runtime/Cpp/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ if (NOT ANTLR_BUILD_SHARED AND NOT ANTLR_BUILD_STATIC)
message(FATAL_ERROR "Options ANTLR_BUILD_SHARED and ANTLR_BUILD_STATIC can't both be OFF")
endif()

include_directories(
set(libantlrcpp_INCLUDE_INSTALL_DIR "include/antlr4-runtime")

set(libantlrcpp_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/runtime/src
${PROJECT_SOURCE_DIR}/runtime/src/atn
${PROJECT_SOURCE_DIR}/runtime/src/dfa
Expand All @@ -34,9 +36,15 @@ file(GLOB libantlrcpp_SRC

if (ANTLR_BUILD_SHARED)
add_library(antlr4_shared SHARED ${libantlrcpp_SRC})
target_include_directories(antlr4_shared PUBLIC
"$<BUILD_INTERFACE:${libantlrcpp_INCLUDE_DIRS}>"
"$<INSTALL_INTERFACE:${libantlrcpp_INCLUDE_INSTALL_DIR}>")
endif()
if (ANTLR_BUILD_STATIC)
add_library(antlr4_static STATIC ${libantlrcpp_SRC})
target_include_directories(antlr4_static PUBLIC
"$<BUILD_INTERFACE:${libantlrcpp_INCLUDE_DIRS}>"
"$<INSTALL_INTERFACE:${libantlrcpp_INCLUDE_INSTALL_DIR}>")
endif()

if (CMAKE_HOST_UNIX)
Expand Down Expand Up @@ -185,7 +193,7 @@ if (TARGET antlr4_static)
endif()

install(DIRECTORY "${PROJECT_SOURCE_DIR}/runtime/src/"
DESTINATION "include/antlr4-runtime"
DESTINATION "${libantlrcpp_INCLUDE_INSTALL_DIR}"
COMPONENT dev
FILES_MATCHING PATTERN "*.h"
)

0 comments on commit 17f3f5e

Please sign in to comment.