123r789
123r789

Reputation: 1790

How to generate .dll file with cmake?

I am trying to generate dll file with the source file in cmake. It is giving configured done and generated done.But the .dll and .lib files are not generated. Please provide solution for this problem.

My cmake configuration in root is :

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(mydll C)

INCLUDE_DIRECTORIES(../common/include) 

ADD_SUBDIRECTORY(mydll bin)

cmake configuration in mydll directory is :

SET(my_lib_src dllmain.cpp mydll.cpp funcs.def)

ADD_LIBRARY(mydll  SHARED ${my_lib_src})

SET_TARGET_PROPERTIES(mydll PROPERTIES LINKER_LANGUAGE C)

Upvotes: 4

Views: 5636

Answers (1)

Pierre Fourgeaud
Pierre Fourgeaud

Reputation: 14510

I will make it as a response, not in comment.

You problem here is that you are not compiling your solution, you are just generating it...

It seems that you can build your project with the command line :

cmake --build <dir> [options] [-- [native-options]]

    <dir>          = Project binary directory to be built.
    --target <tgt> = Build <tgt> instead of default targets.
    --config <cfg> = For multi-configuration tools, choose <cfg>.
    --clean-first  = Build target 'clean' first, then build.
                     (To clean only, use --target 'clean'.)
    --use-stderr   =  Don't merge stdout/stderr.
    --             = Pass remaining options to the native tool

But I didn't try it...

Upvotes: 2

Related Questions