From 3085ab070161f7ea0dca1612c2eeaf10a3cb845e Mon Sep 17 00:00:00 2001 From: jean-christophe81 <98889244+jean-christophe81@users.noreply.github.com> Date: Tue, 10 Sep 2024 10:57:30 +0200 Subject: [PATCH] usse of crt static link and fix regex name agent configuration (#1679) (#1685) --- CMakeListsWindows.txt | 3 +++ agent/src/config.cc | 6 +++--- agent/src/config_win.cc | 6 +++--- custom-triplets/x64-windows.cmake | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CMakeListsWindows.txt b/CMakeListsWindows.txt index 86a3f82d221..88352ea1e1f 100644 --- a/CMakeListsWindows.txt +++ b/CMakeListsWindows.txt @@ -41,6 +41,9 @@ add_definitions("-DCOLLECT_MAJOR=${COLLECT_MAJOR}") add_definitions("-DCOLLECT_MINOR=${COLLECT_MINOR}") add_definitions("-DCOLLECT_PATCH=${COLLECT_PATCH}") +if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded") +endif() # There is a bug with grpc. It is not put in the triplet directory. So we have # to search for its plugin. diff --git a/agent/src/config.cc b/agent/src/config.cc index cd46ce23742..d15de69aead 100644 --- a/agent/src/config.cc +++ b/agent/src/config.cc @@ -121,10 +121,10 @@ config::config(const std::string& path) { _endpoint = json_config.get_string("endpoint"); // pattern schema doesn't work so we do it ourselves - if (!RE2::FullMatch(_endpoint, "[\\w\\.:]+:\\w+")) { + if (!RE2::FullMatch(_endpoint, "[\\w\\.\\-:]+:\\w+")) { throw exceptions::msg_fmt( - "bad format for endpoint {}, it must match to the regex: " - "[\\w\\.:]+:\\w+", + "bad format for endpoint {}, it must match the regex: " + "[\\w\\.\\-:]+:\\w+", _endpoint); } _log_level = diff --git a/agent/src/config_win.cc b/agent/src/config_win.cc index faa95415ea3..9fe35068904 100644 --- a/agent/src/config_win.cc +++ b/agent/src/config_win.cc @@ -72,11 +72,11 @@ config::config(const std::string& registry_key) { _endpoint = get_sz_reg_or_default("endpoint", ""); // pattern schema doesn't work so we do it ourselves - if (!RE2::FullMatch(_endpoint, "[\\w\\.:]+:\\w+")) { + if (!RE2::FullMatch(_endpoint, "[\\w\\.\\-:]+:\\w+")) { RegCloseKey(h_key); throw exceptions::msg_fmt( - "bad format for endpoint {}, it must match to the regex: " - "[\\w\\.:]+:\\w+", + "bad format for endpoint {}, it must match the regex: " + "[\\w\\.\\-:]+:\\w+", _endpoint); } _log_level = diff --git a/custom-triplets/x64-windows.cmake b/custom-triplets/x64-windows.cmake index 17a9406b348..2d6d206970c 100644 --- a/custom-triplets/x64-windows.cmake +++ b/custom-triplets/x64-windows.cmake @@ -1,5 +1,5 @@ set(VCPKG_TARGET_ARCHITECTURE x64) -set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_CRT_LINKAGE static) set(VCPKG_LIBRARY_LINKAGE static) #set(VCPKG_CMAKE_SYSTEM_NAME windows)