mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-10 20:09:01 +08:00
c168ce4e76
* [antlr4] Update to 4.10.1 * x-add-version * update portfile.cmake * x-add-version Co-authored-by: LilyWangLL <v-lilywang@microsoft.com>
98 lines
3.5 KiB
Diff
98 lines
3.5 KiB
Diff
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
|
|
index baf46ca..80fa49a 100644
|
|
--- a/runtime/CMakeLists.txt
|
|
+++ b/runtime/CMakeLists.txt
|
|
@@ -23,10 +23,13 @@ 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()
|
|
|
|
-set(LIB_OUTPUT_DIR "${CMAKE_HOME_DIRECTORY}/dist") # put generated libraries here.
|
|
+#set(LIB_OUTPUT_DIR "${CMAKE_HOME_DIRECTORY}/dist") # put generated libraries here.
|
|
message(STATUS "Output libraries to ${LIB_OUTPUT_DIR}")
|
|
|
|
# make sure 'make' works fine even if ${LIB_OUTPUT_DIR} is deleted.
|
|
@@ -34,8 +37,11 @@ add_custom_target(make_lib_output_dir ALL
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIB_OUTPUT_DIR}
|
|
)
|
|
|
|
+if(BUILD_SHARED_LIBS)
|
|
add_dependencies(antlr4_shared make_lib_output_dir)
|
|
+else()
|
|
add_dependencies(antlr4_static make_lib_output_dir)
|
|
+endif()
|
|
|
|
if (ANTLR_BUILD_CPP_TESTS)
|
|
include(FetchContent)
|
|
@@ -70,11 +76,17 @@ if (ANTLR_BUILD_CPP_TESTS)
|
|
endif()
|
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
+ if(BUILD_SHARED_LIBS)
|
|
target_link_libraries(antlr4_shared ${UUID_LIBRARIES})
|
|
+ else()
|
|
target_link_libraries(antlr4_static ${UUID_LIBRARIES})
|
|
+ endif()
|
|
elseif(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")
|
|
@@ -96,7 +108,7 @@ if(WIN32)
|
|
set(extra_share_compile_flags "-DANTLR4CPP_EXPORTS")
|
|
set(extra_static_compile_flags "-DANTLR4CPP_STATIC")
|
|
endif(WIN32)
|
|
-if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
+if(0)
|
|
if(WITH_STATIC_CRT)
|
|
target_compile_options(antlr4_shared PRIVATE "/MT$<$<CONFIG:Debug>:d>")
|
|
target_compile_options(antlr4_static PRIVATE "/MT$<$<CONFIG:Debug>:d>")
|
|
@@ -116,6 +128,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
set(extra_static_compile_flags "-DANTLR4CPP_STATIC -MP")
|
|
endif()
|
|
|
|
+if(BUILD_SHARED_LIBS)
|
|
set_target_properties(antlr4_shared
|
|
PROPERTIES VERSION ${ANTLR_VERSION}
|
|
SOVERSION ${ANTLR_VERSION}
|
|
@@ -126,25 +139,27 @@ set_target_properties(antlr4_shared
|
|
RUNTIME_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}
|
|
ARCHIVE_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}
|
|
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}"
|
|
ARCHIVE_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}
|
|
COMPILE_FLAGS "${disabled_compile_warnings} ${extra_static_compile_flags}")
|
|
-
|
|
+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"
|