[CMake] simple project in Visual Studio 2008

Jos.van.den.Oever at panalytical.com Jos.van.den.Oever at panalytical.com
Tue Aug 19 09:10:56 EDT 2008


"Yuri V. Timenkov" <ytimenkov at parallels.com> wrote on 08/19/2008 02:05:04 
PM:

> Are following posts solve your problem?
> 
> http://www.cmake.org/pipermail/cmake/2008-July/023099.html
> http://www.cmake.org/pipermail/cmake/2006-September/011100.html
> http://www.cmake.org/pipermail/cmake/2005-February/006080.html

Yes they do. The tricky point was having to know that the symbol 
${LIBRARYNAME}_EXPORTS is set when building the library.
Then adding something along these lines in the header file solves the 
problem:

#ifdef _WIN32
#  ifdef testc2_EXPORTS
#    define WHATEVER __declspec( dllexport )
#  else
#    define WHATEVER __declspec( dllimport )
#  endif
#else
#  define WHATEVER 
#endif

WHATEVER float LibC2Func();

So now I can get a simple project with one dll and one exe to compile, but 
I still do not understand which program determines whether the .exe should 
link to a .lib or a .dll. Does the Microsoft Visual Studio compiler 
determine this or does CMake inspect the header files?
I find it strange that the linking command depends on the contents of the 
header files. Is there a reason for this?

Cheers,
Jos

 
  
Jos van den Oever - SW Engineering 
 
PANalytical 
Lelyweg 1 
7602 EA Almelo 
The Netherlands 
T   +31 (0)546 528
F   +31 (0)546 534598
Jos.van.den.Oever at panalytical.com
www.PANalytical.com


 PANalytical
The Analytical X-ray Company  

The information contained in this message is confidential and may be 
legally privileged. The message is intended solely for the addressee(s). 
If you are not the intended recipient, you are hereby notified that any 
use, dissemination, or reproduction is strictly prohibited and may be 
unlawful. If you are not the intended recipient, please contact the sender 
by return e-mail and destroy all copies of the original message.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080819/1175d6f8/attachment.htm>


More information about the CMake mailing list