简体   繁体   中英

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.

The program does run as intended when running in the bin directory of cygwin. But I want it to only require cygwin1.dll to run and have all other .dll files baked into the program. 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. Then used the options within the IDE to static link everything except cygwin1.dll.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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