Cmake 3.15.3 with GCC Compiler - Linking Libraries with `lib` as Their Postfix in Windows
I'm using CMake 3.15.3
on Windows.
I use MinGW Make
Generator.
I wrote the following:
link_directories(${CMAKE_SOURCE_DIR}/Lib/)
...SomeCode...
target_link_libraries(MyExeName libSomeLib001.lib libSomeLib002.lib)
Pay attention that those library names starts with lib
.
Now, when I tried to build I saw error which says the linker couldn't find -lSomeLib001
and -lSomeLib002
.
Namely, something removed the lib
from the naming.
If I want to the linklibs.rsp
of the target I could see the lib
is indeed missing.
If I manually added lib
in linklibs.rsp
the build went fine.
So, I guess this behavior makes sense under POSIX
system but bot under Windows.