Skip to content

CMAKE: WIN32: Wrong symlink created for import library #783

@carlo-bramini

Description

@carlo-bramini

I tried to update the libpng packages for CYGWIN and the MinGW-w64 cross compilers and I noticed something wrong.
Into the /lib directory, it is created a symlink to the libpng16.dll.a import library, but the extension is not correct:

Image

As you can see, there is a libpng.dll instead of libpng.dll.a.
The error into CMakeLists.txt is located here:

libpng/CMakeLists.txt

Lines 817 to 821 in 0f07f70

if(NOT WIN32 OR CYGWIN OR MINGW)
create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png_shared)
install(FILES "$<TARGET_LINKER_FILE_DIR:png_shared>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif()

Actually, CMAKE_SHARED_LIBRARY_SUFFIX is equal to .dll and not to .dll.a.
This is the reason because the wrong name is assigned to the symlink.
The right variable to use here should be CMAKE_IMPORT_LIBRARY_SUFFIX.
Technically, it should be a very easy fix, at least in theory.
However, since there is this if() statement:
if(NOT WIN32 OR CYGWIN OR MINGW)

it is possible that this code is also executed for something different that CYGWIN and MINGW because the NOT WIN32 condition.
So, I'm not sure how to fix it because I don't understand what you wanted to do exactly.
If you could give me some advices, I will test it and I can contribute a PR with the fix if you want.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions