简体   繁体   English

如何静态链接除 cygwin1.dll 之外的每个 .dll?

[英]How to static link every .dll except cygwin1.dll?

cmake_minimum_required(VERSION 3.5)

project(Photomosaics LANGUAGES CXX)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(Photomosaics main.cpp)
add_definitions( -DMAGICKCORE_QUANTUM_DEPTH=16 )
add_definitions( -DMAGICKCORE_HDRI_ENABLE=0 )
find_package(ImageMagick COMPONENTS Magick++ MagickCore)
include_directories(${ImageMagick_INCLUDE_DIRS})
target_link_libraries(Photomosaics ${ImageMagick_LIBRARIES})

I have been trying to produce an executable that only requires cygwin1.dll to run with cygwin, but it reports that it is missing cygautotrace-3.dll cygbz2-1.dll cygcario-2.dll and many, many others.我一直在尝试生成一个只需要cygwin1.dll才能与 cygwin 一起运行的可执行文件,但它报告说它缺少cygautotrace-3.dll cygbz2-1.dll cygcario-2.dll和许多其他的。

The program does run as intended when running in the bin directory of cygwin.该程序在 cygwin 的 bin 目录中运行时确实按预期运行。 But I want it to only require cygwin1.dll to run and have all other .dll files baked into the program.但我希望它只需要运行cygwin1.dll并将所有其他.dll文件放入程序中。 What am I doing wrong?我究竟做错了什么?

It is not really a proper fix, but I just started using eclipse and manually defined the library I needed.这不是真正的正确修复,但我刚刚开始使用 eclipse 并手动定义了我需要的库。 Then used the options within the IDE to static link everything except cygwin1.dll.然后使用 IDE 中的选项静态链接除 cygwin1.dll 之外的所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM