Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
514 views
in Technique[技术] by (71.8m points)

c++ - How do I get CMake to create a dll and its matching lib file?

I'm using CMake to create a shared library via Visual Studio 2010. The solution outputs a dll file, but not a matching lib file. How do I tell CMake to generate the lib file so I can link other projects to the dll?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First of all check that you have at least one exported symbol in your shared library. Visual Studio does not generate the .lib file if dll does not exports symbols.

Next, check your cmake files - probably you have set CMAKE_ARCHIVE_OUTPUT_DIRECTORY variable or ARCHIVE_OUTPUT_DIRECTORY property of the shared library target. If these variable/property is set then Visual Studio will output .lib files into the different directory specified by that variable/property. (There also can be configuration-specific versions like ARCHIVE_OUTPUT_DIRECTORY_Release.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...