Hi
My exports header file for a C/C++ project has the following
definitions:
#if defined(WIN32) || defined(WIN64)
#ifndef LIB_EXPORT
#ifdef lib_EXPORTS
#define LIB_EXPORT __declspec(dllexport)
#else
#define LIB_EXPORT __declspec(dllimport)
#endif
#endif
#endif
where lib_EXPORTS is automatically defined by cmake when the shared
library is build. However, this aproach works only with a shared
library, when I try to build the static version I get a compilation
error with Visual Studio 2010, since LIB_EXPORT is
__declspec(dllimport).
An workaround is to define in the CMakeLists.txt file another compiler
variable when the static version is build and set in the exports header
LIB_EXPORT to an empty define when the static library is build. However,
this must be done each time a program is build with the static version
of the library, which makes this approach cumbersome.
Is there a better way to define the exports header file in order to be
able to build and compile with other program either the shared or the
static version of a library ?
thanks
Bogdan
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake