On Fri, Jul 3, 2009 at 3:31 PM, Robert Dailey <[email protected]> wrote:

> On Fri, Jul 3, 2009 at 2:54 PM, James Bigler <[email protected]>wrote:
>
>> On Wed, Jul 1, 2009 at 4:34 PM, Robert Dailey <[email protected]> wrote:
>>
>>> Hi,
>>> If I have the following CMakeLists.txt:
>>>
>>> cmake_minimum_required( VERSION 2.6.4 )
>>>
>>> project( project1 )
>>> add_executable( project1 source1.cpp )
>>>
>>> project( project2 )
>>> add_executable( project2 source2.cpp )
>>>
>>> project( project3 )
>>> add_executable( project3 source3.cpp )
>>>
>>> If I create visual studio 2008 files with this, I end up getting the
>>> following project files:
>>>
>>> project1.vcproj
>>> project2.vcproj
>>> project3.vcproj
>>> project3.sln
>>>
>>> The problem here is that I want the SLN file to be named project1.sln
>>> (after the first call to project() ). Is there a way I can tell CMake which
>>> call to project() in the same directory will generate the "master" project
>>> file? Note that if I add a dummy project to the end of the file:
>>>
>>> project( foo )
>>>
>>> I get:
>>> project1.vcproj
>>> project2.vcproj
>>> project3.vcproj
>>> foo.sln
>>>
>>> So it gives me some limited control over the naming, but it isn't ideal.
>>>
>>>
>> I typically only do one project in my setups, and I name the project what
>> I want to show up in VS.  I then have lots of add_executables and other
>> targets that show up as "projects" in the VS solution.  I'm not sure what
>> you are trying to gain by having lots of project() calls.
>>
>
> What you are doing sounds like:
>
> project( foo )
> add_library( foo STATIC foo1.cpp )
> add_library( foo STATIC foo2.cpp )
> add_library( foo STATIC foo3.cpp )
>
> Is this true? If it is, you can't do this in v2.6.4. CMake will fail
> because you are creating multiple libraries with the same name. What exactly
> is it you are doing?
>

Interesting, this seems to work:

project( foo )
add_library( foo1 STATIC foo1.cpp )
add_library( foo2 STATIC foo2.cpp )
add_library( foo3 STATIC foo3.cpp )

This creates a solution called "foo.sln" and 3 projects: "foo1.vcproj",
"foo2.vcproj", "foo3.vcproj". Why does this work? I thought for every
add_library() there must be 1 call to project(). Since I didn't call
project() for foo1, foo2, or foo3, I don't know why it's letting me create
those libraries. Can someone explain this behavior?
_______________________________________________
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

Reply via email to