From 411236aca6ec937b25e25cdc9066b17f4310f702 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Tue, 22 Oct 2024 18:16:42 +0200 Subject: [PATCH] fix runtime libs --- CMakeLists.txt | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc34cc1e5a5..8c65eeff301 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ option(VCPKG_USE_OPENCV2 "Use legacy OpenCV 2" OFF) option(VCPKG_USE_OPENCV3 "Use legacy OpenCV 3" OFF) option(VCPKG_USE_OPENCV4 "Use OpenCV 4" ON) option(USE_NSIS "Use NSIS as a CPack backend on Windows" ON) +option(SKIP_INSTALL_RUNTIME_LIBS "Do not install runtime libs" OFF) if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET}) message(STATUS "Setting default vcpkg target triplet to $ENV{VCPKG_DEFAULT_TRIPLET}") @@ -67,11 +68,7 @@ if(ENABLE_OPENCV) endif() endif() -if(NOT CMAKE_HOST_SYSTEM_PROCESSOR AND NOT WIN32) - execute_process(COMMAND "uname" "-m" OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR OUTPUT_STRIP_TRAILING_WHITESPACE) -endif() - -if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86") +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^x86" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^AMD64") set(IS_X86 TRUE) else() set(IS_X86 FALSE) @@ -672,13 +669,14 @@ if(ENABLE_CSHARP_WRAPPER) add_subdirectory(src/csharp) endif() -set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) -include(InstallRequiredSystemLibraries) - -install( +if (NOT SKIP_INSTALL_RUNTIME_LIBS) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) + include(InstallRequiredSystemLibraries) + install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${INSTALL_BIN_DIR} -) + ) +endif() if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg.json) file(READ ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg.json VCPKG_JSON_STRING)