Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating .dll using CMake

Tags:

c

windows

dll

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.

like image 979
javaMan Avatar asked Jun 27 '11 21:06

javaMan


1 Answers

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 ...)
like image 167
bdonlan Avatar answered Oct 30 '22 01:10

bdonlan