[CMake] cmake trouble
Rolf Eike Beer
eike at sf-mail.de
Mon Oct 22 13:49:20 EDT 2012
Eric Clark wrote:
> > Eric Clark wrote:
> > > Hello,
> > >
> > > First off, you cannot call both add_executable and add_library in the
> >
> > > same CMakeLists file. Here is what I can say about your other questions:
> > Of course you can.
>
> Yes, but only if you call project() twice, correct?
No, even if you don't call project at all (but you need to call project() in a
higher level CMakeLists.txt then).
> Maybe I should have been
> more specific. What I meant was that you cannot create two targets for the
> same project (i.e you cannot build an executable and a dll in the same
> project). In the code that was posted, there was no call to project between
> the call to add_library and add_executable. Certainly there is nothing
> wrong with calling project more than once in a list file, but I have found
> that it is a rare case that you want to do this... This could be just my
> experience, but I can only speak for what I know.
The only thing that does not work then is the projectname_SOURCE_DIR variable
that is set by CMake when you call project(). But otherwise everything is
fine.
Eike
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121022/ec6e6d11/attachment.pgp>
More information about the CMake
mailing list