vendredi 23 septembre 2016

Merged Library with LIB.EXE throws LINK : fatal error LNK1104: cannot open file 'PocoFoundationmt.lib'

So, I'm building a static C++11 Windows Library A.lib which uses 'PocoFoundationmt.lib' and a few other third party libraries and I don't want to have the Test application (Z.exe) which uses A.lib to have a long list of all libraries in the linker command. So, I want to merge all the third party libraries into a composite.lib

The project for A.lib is generated by cmake and the CMakeLists.txt file has the following lines:

add_library(A STATIC ${SOURCES})

target_link_libraries(A PRIVATE PocoFoundationmt.lib OtherStaticLibs.lib)

Now, after I build A.lib, I execute LIB.EXE to combine libraries as suggested in a lot of threads:

eg. Linking static libraries to other static libraries

LIB.EXE /OUT:composite.lib A.lib PocoFoundationmt.lib OtherStaticLibs.lib

However, when I link the composite.lib to my Test application, it always throws this error :

LINK : fatal error LNK1104: cannot open file 'PocoFoundationmt.lib'

A lot of threads suggested to combine libraries this way. Is this the correct approach or do I have to mention all libraries in the linker input parameter of my Test app (Z.exe) ?

Aucun commentaire:

Enregistrer un commentaire