javaMan
javaMan

Reputation: 6680

Generating .dll using CMake

I have the following C files in windows XP. optBladWriter.c optWriteNlpEmpsFile.c I would like to generate DLL for this code. I used the command add_library . My make file has the following :

CMAKE_MINIMUM_REQUIRED ( VERSION 2.6)
add_library (optFmg optBladWriter.c optWriteNlpEmpsFile.c) 

after running CMake using command prompt Project.sln is created. I imported it to the visual studio and built it. I got the optFmg.lib file. But I want the optFmg.dll file.

Can you help me in generating the dll file using cmake in the above case. Is there any particular command similar to add_library.

Upvotes: 43

Views: 77421

Answers (1)

bdonlan
bdonlan

Reputation: 231063

As documented, the default type of library is determined by the BUILD_SHARED_LIBS variable. You can explicitly request a shared library with:

add_library(yourlib SHARED file.c ...)

Upvotes: 63

Related Questions