mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-18 12:37:55 +08:00
2ef381ddf7
* Update antlr4 to version 4.11.1 and use GitHub instead of website downloads * Remove unused patch files * Run x-add-version * Remove single-use variable and enforce vcpkg version * x-add-version * Use VERSION variable which is generated by vcpkg from vcpkg.json * Add quotes, remove variable-used-once. * Minimize patch. * Update version database. Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
94 lines
3.3 KiB
Diff
94 lines
3.3 KiB
Diff
diff --git a/runtime/Cpp/runtime/CMakeLists.txt b/runtime/Cpp/runtime/CMakeLists.txt
|
|
index a4e4d1c..19cc21c 100644
|
|
--- a/runtime/Cpp/runtime/CMakeLists.txt
|
|
+++ b/runtime/Cpp/runtime/CMakeLists.txt
|
|
@@ -25,15 +25,21 @@ file(GLOB libantlrcpp_SRC
|
|
"${PROJECT_SOURCE_DIR}/runtime/src/tree/xpath/*.cpp"
|
|
)
|
|
|
|
+if(BUILD_SHARED_LIBS)
|
|
add_library(antlr4_shared SHARED ${libantlrcpp_SRC})
|
|
+else()
|
|
add_library(antlr4_static STATIC ${libantlrcpp_SRC})
|
|
+endif()
|
|
|
|
# Make sure to link against threads (pthreads) library in order to be able to
|
|
# make use of std::call_once in the code without producing runtime errors
|
|
# (see also https://github.com/antlr/antlr4/issues/3708 and/or https://stackoverflow.com/q/51584960).
|
|
find_package(Threads REQUIRED)
|
|
+if(BUILD_SHARED_LIBS)
|
|
target_link_libraries(antlr4_shared Threads::Threads)
|
|
+else()
|
|
target_link_libraries(antlr4_static Threads::Threads)
|
|
+endif()
|
|
|
|
if (ANTLR_BUILD_CPP_TESTS)
|
|
include(FetchContent)
|
|
@@ -70,8 +76,11 @@ if (ANTLR_BUILD_CPP_TESTS)
|
|
endif()
|
|
|
|
if(APPLE)
|
|
+ if(BUILD_SHARED_LIBS)
|
|
target_link_libraries(antlr4_shared ${COREFOUNDATION_LIBRARY})
|
|
+ else()
|
|
target_link_libraries(antlr4_static ${COREFOUNDATION_LIBRARY})
|
|
+ endif()
|
|
endif()
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
@@ -93,26 +102,32 @@ set(static_lib_suffix "")
|
|
|
|
if (WIN32)
|
|
set(static_lib_suffix "-static")
|
|
+ if(BUILD_SHARED_LIBS)
|
|
target_compile_definitions(antlr4_shared PUBLIC ANTLR4CPP_EXPORTS)
|
|
+ else()
|
|
target_compile_definitions(antlr4_static PUBLIC ANTLR4CPP_STATIC)
|
|
+ endif()
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
set(extra_share_compile_flags "-MP /wd4251")
|
|
set(extra_static_compile_flags "-MP")
|
|
endif()
|
|
endif()
|
|
|
|
+if(BUILD_SHARED_LIBS)
|
|
set_target_properties(antlr4_shared
|
|
PROPERTIES VERSION ${ANTLR_VERSION}
|
|
SOVERSION ${ANTLR_VERSION}
|
|
OUTPUT_NAME antlr4-runtime
|
|
COMPILE_FLAGS "${disabled_compile_warnings} ${extra_share_compile_flags}")
|
|
|
|
+else()
|
|
set_target_properties(antlr4_static
|
|
PROPERTIES VERSION ${ANTLR_VERSION}
|
|
SOVERSION ${ANTLR_VERSION}
|
|
OUTPUT_NAME "antlr4-runtime${static_lib_suffix}"
|
|
COMPILE_PDB_NAME "antlr4-runtime${static_lib_suffix}"
|
|
COMPILE_FLAGS "${disabled_compile_warnings} ${extra_static_compile_flags}")
|
|
+endif()
|
|
|
|
if (ANTLR_BUILD_CPP_TESTS)
|
|
# Copy the generated binaries to dist folder (required by test suite)
|
|
@@ -130,18 +145,21 @@ if (ANTLR_BUILD_CPP_TESTS)
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:antlr4_static> ${CMAKE_HOME_DIRECTORY}/dist)
|
|
endif()
|
|
|
|
+if(BUILD_SHARED_LIBS)
|
|
install(TARGETS antlr4_shared
|
|
EXPORT antlr4-targets
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
+else()
|
|
install(TARGETS antlr4_static
|
|
EXPORT antlr4-targets
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
+endif()
|
|
install(DIRECTORY "${PROJECT_SOURCE_DIR}/runtime/src/"
|
|
DESTINATION "include/antlr4-runtime"
|
|
COMPONENT dev
|