mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-12 00:15:39 +08:00
14b0cf90e8
* Added port for OpenDNP3 library * Added usage note * Handle library linkage setting * Removed deprecated vcpkg_common_functions include * Indicated that OpenDNP3 will fail to build on UWP targets * [opendnp3] Export cmake files and force to build static in Windows * [opendnp3] Fix include export-cmake name Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
141 lines
4.8 KiB
Diff
141 lines
4.8 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 1381bab..e184423 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -104,20 +104,54 @@ include_directories(./cpp/tests/libs/src)
|
|
# ---- openpal library ----
|
|
file(GLOB_RECURSE openpal_SRC ./cpp/libs/src/openpal/*.cpp ./cpp/libs/src/openpal/*.h ./cpp/libs/include/openpal/*.h)
|
|
add_library(openpal ${LIB_TYPE} ${openpal_SRC})
|
|
-install(TARGETS openpal DESTINATION lib)
|
|
set_target_properties(openpal PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION})
|
|
clang_format(openpal)
|
|
clang_tidy(openpal)
|
|
|
|
+include(CMakePackageConfigHelpers)
|
|
+write_basic_package_version_file(openpal-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion)
|
|
+
|
|
+install(
|
|
+ TARGETS openpal
|
|
+ EXPORT openpal-config
|
|
+ DESTINATION lib
|
|
+)
|
|
+
|
|
+install(
|
|
+ EXPORT openpal-config
|
|
+ DESTINATION share/openpal
|
|
+)
|
|
+
|
|
# ---- opendnp3 library ----
|
|
file(GLOB_RECURSE opendnp3_SRC ./cpp/libs/src/opendnp3/*.cpp ./cpp/libs/src/opendnp3/*.h ./cpp/libs/include/opendnp3/*.h)
|
|
add_library(opendnp3 ${LIB_TYPE} ${opendnp3_SRC})
|
|
target_link_libraries(opendnp3 openpal)
|
|
-install(TARGETS opendnp3 DESTINATION lib)
|
|
+
|
|
set_target_properties(opendnp3 PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION})
|
|
clang_format(opendnp3 EXCLUDES ".*/gen/.*" ".*/objects/.*")
|
|
clang_tidy(opendnp3)
|
|
|
|
+write_basic_package_version_file(opendnp3-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion)
|
|
+
|
|
+set(PROJECT_NAME opendnp3)
|
|
+set(FIND_DEPENDS "find_dependency(openpal)")
|
|
+configure_package_config_file(opendnp3-config.cmake.in opendnp3-config.cmake
|
|
+ INSTALL_DESTINATION share/opendnp3
|
|
+ PATH_VARS PROJECT_NAME FIND_DEPENDS
|
|
+)
|
|
+
|
|
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/opendnp3-config.cmake DESTINATION share/opendnp3)
|
|
+
|
|
+install(
|
|
+ TARGETS opendnp3
|
|
+ EXPORT opendnp3-targets
|
|
+ DESTINATION lib
|
|
+)
|
|
+install(
|
|
+ EXPORT opendnp3-targets
|
|
+ DESTINATION share/opendnp3
|
|
+)
|
|
+
|
|
if(DNP3_DECODER)
|
|
file(GLOB_RECURSE dnp3decode_SRC ./cpp/libs/src/dnp3decode/*.cpp ./cpp/libs/src/dnp3decode/*.h ./cpp/libs/include/dnp3decode/*.h)
|
|
add_library(dnp3decode ${LIB_TYPE} ${dnp3decode_SRC})
|
|
@@ -144,8 +178,7 @@ if(DNP3_TLS)
|
|
set(asiopal_link_libraries "${asiopal_link_libraries};${OPENSSL_LIBRARIES}")
|
|
endif()
|
|
|
|
-target_link_libraries(asiopal ${asiopal_link_libraries})
|
|
-install(TARGETS asiopal DESTINATION lib)
|
|
+target_link_libraries(asiopal PUBLIC ${asiopal_link_libraries})
|
|
set_target_properties(asiopal PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION})
|
|
if(FLOCK)
|
|
add_definitions(-DUSE_FLOCK)
|
|
@@ -153,6 +186,32 @@ endif()
|
|
clang_format(asiopal)
|
|
clang_tidy(asiopal)
|
|
|
|
+install(
|
|
+ TARGETS asiopal
|
|
+ EXPORT asiopal-targets
|
|
+ DESTINATION lib
|
|
+)
|
|
+
|
|
+write_basic_package_version_file(asiopal-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion)
|
|
+
|
|
+set(PROJECT_NAME asiopal)
|
|
+if (DNP3_TLS)
|
|
+ set(FIND_DEPENDS "find_dependency(openpal)\nfind_dependency(OpenSSL)")
|
|
+else()
|
|
+ set(FIND_DEPENDS "find_dependency(openpal)")
|
|
+endif()
|
|
+configure_package_config_file(opendnp3-config.cmake.in asiopal-config.cmake
|
|
+ INSTALL_DESTINATION share/asiopal
|
|
+ PATH_VARS PROJECT_NAME FIND_DEPENDS
|
|
+)
|
|
+
|
|
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asiopal-config.cmake DESTINATION share/asiopal)
|
|
+
|
|
+install(
|
|
+ EXPORT asiopal-targets
|
|
+ DESTINATION share/asiopal
|
|
+)
|
|
+
|
|
# ---- asiodnp3 library ----
|
|
file(GLOB_RECURSE asiodnp3_HPP ./cpp/libs/src/asiodnp3/*.h ./cpp/libs/include/asiodnp3/*.h)
|
|
if(DNP3_TLS)
|
|
@@ -161,12 +220,33 @@ else()
|
|
file(GLOB asiodnp3_CPP ./cpp/libs/src/asiodnp3/*.cpp)
|
|
endif()
|
|
add_library(asiodnp3 ${LIB_TYPE} ${asiodnp3_HPP} ${asiodnp3_CPP})
|
|
-target_link_libraries(asiodnp3 asiopal opendnp3)
|
|
-install(TARGETS asiodnp3 DESTINATION lib)
|
|
+target_link_libraries(asiodnp3 PUBLIC asiopal opendnp3)
|
|
set_target_properties(asiodnp3 PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION})
|
|
clang_format(asiodnp3)
|
|
clang_tidy(asiodnp3)
|
|
|
|
+install(
|
|
+ TARGETS asiodnp3
|
|
+ EXPORT asiodnp3-targets
|
|
+ DESTINATION lib
|
|
+)
|
|
+
|
|
+write_basic_package_version_file(asiopal-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion)
|
|
+
|
|
+set(PROJECT_NAME asiodnp3)
|
|
+set(FIND_DEPENDS "find_dependency(asiopal)\nfind_dependency(opendnp3)")
|
|
+configure_package_config_file(opendnp3-config.cmake.in asiodnp3-config.cmake
|
|
+ INSTALL_DESTINATION share/asiopal
|
|
+ PATH_VARS PROJECT_NAME FIND_DEPENDS
|
|
+)
|
|
+
|
|
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asiodnp3-config.cmake DESTINATION share/asiodnp3)
|
|
+
|
|
+install(
|
|
+ EXPORT asiodnp3-targets
|
|
+ DESTINATION share/asiodnp3
|
|
+)
|
|
+
|
|
if(DNP3_JAVA)
|
|
file(GLOB_RECURSE opendnp3java_SRC ./java/cpp/*.h ./java/cpp/*.cpp)
|
|
add_library(opendnp3java SHARED ${opendnp3java_SRC})
|