Skip to content

Commit

Permalink
fix: Cpp: correct static library linking depending on the host OS
Browse files Browse the repository at this point in the history
The static linking did not succeed on Windows due to the name of
the static library on Windows, libantlr4-runtime-static.a. The
name libantlr4-runtime.a works on other OSs with no problem.

Signed-off-by: Osama Ahmad <[email protected]>
  • Loading branch information
OsamaAhmad00 committed Nov 4, 2023
1 parent 2e718eb commit e76c811
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions runtime/Cpp/cmake/ExternalAntlr4Cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ if(MSVC)
set(ANTLR4_RUNTIME_LIBRARIES
${ANTLR4_OUTPUT_DIR}/antlr4-runtime.dll)
else()
set(ANTLR4_STATIC_LIBRARIES
${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.a)
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(ANTLR4_STATIC_LIBRARIES
${ANTLR4_OUTPUT_DIR}/libantlr4-runtime-static.a)
else()
set(ANTLR4_STATIC_LIBRARIES
${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.a)
endif()
if(MINGW)
set(ANTLR4_SHARED_LIBRARIES
${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dll.a)
Expand Down

0 comments on commit e76c811

Please sign in to comment.