[CMake] DLL import/export flag differentiation

Brandon Van Every bvanevery at gmail.com
Sun Nov 25 02:47:03 EST 2007


On Nov 24, 2007 7:53 PM, Nicholas Yue <yue.nicholas at gmail.com> wrote:
>
>   I understand that there is no per target DEFINITIONS setup so I'd like to
> hear advice from experience cmake user how I should configure my build.

There is, however, a REMOVE_DEFINITIONS command, which you could use
judiciously to achieve the effect.  You'd have to be careful though.

>   The library needs the -DDLL_EXPORT while the application must not have
> that set so that it imports the exported symbols.

If that's the extent of your problem, then it's easy.  Remember that
order of appearance in CMakeLists.txt does matter.  You'd do:
ADD_DEFINITIONS, ADD_LIBRARY, REMOVE_DEFINITIONS, ADD_EXECUTABLE.


Cheers,
Brandon Van Every


More information about the CMake mailing list