From 479ec49eefe02443ae977e4accff39f10bdcdb08 Mon Sep 17 00:00:00 2001 From: duongtd Date: Tue, 2 Dec 2025 10:41:01 +0700 Subject: [PATCH] fix file cmake --- CMakeLists.txt | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64366c2..9a859c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,11 +27,27 @@ target_include_directories(xmlrpcpp $ ) +# --- Cài đặt thư viện vào hệ thống khi chạy make install --- install(TARGETS xmlrpcpp - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib + EXPORT xmlrpcpp-targets + ARCHIVE DESTINATION lib # Thư viện tĩnh .a + LIBRARY DESTINATION lib # Thư viện động .so + RUNTIME DESTINATION bin # File thực thi (nếu có) + INCLUDES DESTINATION include # Cài đặt include ) -install(DIRECTORY include/ - DESTINATION include/ +install( + DIRECTORY include/ + DESTINATION include/ +) + +# --- Xuất export set xmlrpcpp-targets thành file CMake module --- +# --- Tạo file lib/cmake/xmlrpcpp/xmlrpcpp-targets.cmake --- +# --- File này chứa cấu hình giúp project khác có thể dùng --- +# --- Find_package(xmlrpcpp REQUIRED) --- +# --- Target_link_libraries(my_app PRIVATE xmlrpcpp::xmlrpcpp) --- +install(EXPORT xmlrpcpp-targets + FILE xmlrpcpp-targets.cmake + NAMESPACE xmlrpcpp:: + DESTINATION lib/cmake/xmlrpcpp )