[CMake] cmake trouble

Eric Clark eclark at ara.com
Mon Oct 22 13:42:29 EDT 2012


Andreas,

I just replied to a message from another gentleman on here and I may be way off base. But, I tried to do this once and it did not work. The only way that I could get it to work was to add another project() call between the two... I could have had some other issues because it has been quite a while since I had this problem and I do not remember the specific error that I got, so I am by no means saying anyone is wrong because I am sure that many of you are way more familiar with CMake than I am, this is a learning experience for me as well. I was just trying to help the guy out and when I looked at his original posting I saw "test" as the same name being passed to add_executable and add_library... I went back to look at the code again and he did have one called "test" and the other called "fan" that was my mistake and my misreading it.

My apologies for saying the wrong thing, I was only trying to help...

Eric

> -----Original Message-----
> From: Andreas Pakulat [mailto:apaku at gmx.de]
> Sent: Monday, October 22, 2012 12:17 PM
> To: Eric Clark
> Cc: 张峰; cmake at cmake.org
> Subject: Re: [CMake] cmake trouble
> 
> Hi,
> 
> On Mon, Oct 22, 2012 at 6:04 PM, Eric Clark <eclark at ara.com> wrote:
> >
> > First off, you cannot call both add_executable and add_library in the
> > same CMakeLists file.
> 
> I think there's something missing here, but its perfectly possible to have one
> or more library and executable targets specified in the same cmake file. So
> this works just fine:
> 
> add_library(foo bar.cpp)
> add_executable(bar foo.cpp)
> 
> There are build-systems that have such limitations, but cmake is not one.
> 
> Andreas


More information about the CMake mailing list