-
Notifications
You must be signed in to change notification settings - Fork 29
Description
When building a project using CMake with MSYS2 MinGW64 on Windows, the CMake script for a shared library (blosc_shared) does not correctly set the IMPORTED_IMPLIB property, causing a warning message during the build process. This issue arises when linking the shared library with CMake, as it does not provide the necessary import library (.dll.a) that MinGW64 expects.
Cause of the Issue:
The error occurs because CMake does not set the IMPORTED_IMPLIB property for the imported target blosc_shared. On Windows, MinGW64 expects an import library (.dll.a) for shared libraries, but this is not provided, leading to a linker failure when trying to build dependent targets like blosc_filter.dll.
CMake Command used:
cmake -G "MinGW Makefiles" ..
cmake --build .
Linker error:
[ 53%] Completed 'project_blosc'
[ 53%] Built target project_blosc
[ 60%] Building C object CMakeFiles/blosc_filter_shared.dir/src/blosc_filter.c.obj
mingw32-make[2]: *** No rule to make target 'blosc_shared-NOTFOUND', needed by 'libblosc_filter.dll'. Stop.
mingw32-make[1]: *** [CMakeFiles\Makefile2:114: CMakeFiles/blosc_filter_shared.dir/all] Error 2
mingw32-make: *** [Makefile:145: all] Error 2
Suggested Fix (for Win):
set_property(TARGET blosc_shared PROPERTY IMPORTED_IMPLIB ${BLOSC_INSTALL_DIR}/lib/libblosc.dll.a)