Skip to content

Commit 909b726

Browse files
committed
refactor: fix antlr static path on windows
1 parent 178c64d commit 909b726

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

thirdparty/antlr/CMakeLists.txt

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,16 @@ apply_patch_once("antlr4_fix" "${ANTLR_SRC_DIR}" "${ANTLR_PATCH}")
55
set(WITH_STATIC_CRT OFF CACHE BOOL "Use dynamic CRT for antlr4" FORCE)
66
add_subdirectory(antlr4/runtime/Cpp/)
77

8-
add_library(antlr4 UNKNOWN IMPORTED GLOBAL)
9-
if(MSVC)
10-
set(_antlr4_lib_name "antlr4-runtime-static.lib")
11-
else()
12-
set(_antlr4_lib_name "libantlr4-runtime.a")
13-
endif()
14-
set_target_properties(
15-
antlr4 PROPERTIES
16-
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/antlr4/runtime/Cpp/runtime/src/"
17-
IMPORTED_LOCATION "${EXTERNAL_LIB_DIR}/${_antlr4_lib_name}"
18-
)
19-
if(WIN32)
20-
set_property(TARGET antlr4 PROPERTY INTERFACE_COMPILE_DEFINITIONS "ANTLR4CPP_STATIC")
21-
endif()
22-
add_dependencies(antlr4 antlr4_static)
8+
target_include_directories(antlr4_static INTERFACE
9+
"${CMAKE_CURRENT_SOURCE_DIR}/antlr4/runtime/Cpp/runtime/src/"
10+
)
2311

2412
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
2513
target_compile_options(antlr4_static PRIVATE -Wno-unknown-pragmas -Wno-unqualified-std-cast-call)
2614
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
2715
target_compile_options(antlr4_static PRIVATE -Wno-unknown-pragmas -Wno-unqualified-std-cast-call -Wno-attributes -Wno-implicit-fallthrough)
28-
endif()
16+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
17+
target_compile_definitions(antlr4_static INTERFACE ANTLR4CPP_STATIC)
18+
endif ()
19+
20+
add_library(antlr4 ALIAS antlr4_static)

0 commit comments

Comments
 (0)