[CMake] Adding a project to a solution.
Josef Karthauser
joe.karthauser at geomerics.com
Thu Oct 25 11:48:32 EDT 2007
> -----Original Message-----
> From: David Cole [mailto:david.cole at kitware.com]
> Sent: 25 October 2007 16:28
> To: Josef Karthauser
> Cc: cmake at cmake.org
> Subject: Re: [CMake] Adding a project to a solution.
>
> This code....:
> PROJECT(Project)
> TARGET_LINK_LIBRARIES(Project Library)
>
> ...doesn't make sense.
>
> The first argument to TARGET_LINK_LIBRARIES should be a cmake target
> name (first arg to ADD_EXECUTABLE, ADD_LIBRARY or ADD_CUSTOM_TARGET)
> not a cmake project name...
>
> It should be something like:
> PROJECT(Project)
> ADD_LIBRARY(ProjectLib lib1.cxx lib2.cxx .....)
> TARGET_LINK_LIBRARIES(ProjectLib Library)
If I understand correctly, Project label get used to create sln files,
but otherwise aren't used for anything. This means that actually what I
had wasn't wrong, as I would generate a Project.sln and a Project.vcproj
in my Project/ subdirectory - this sounds reasonable to me.
> The generated *.vcproj files map one-to-one with cmake targets. (There
> is one .vcproj file for each ADD_EXECUTABLE, ADD_LIBRARY and
> ADD_CUSTOM_TARGET command...)
>
> Each project statement should map to a .sln file that contains any
> necessary .vcproj files.
I've got that. However, the .sln file doesn't appear to reference the
.vcproj files for objects specified in the target_link_libraries. I
would expect these to get added too.
So, for your (modification of my) example above, the Project.sln file
will have a link to ProjectLib.vcproj, but it should also have a link to
Library.vcproj (in whatever directory it lives in) to be a complete
solution. It doesn't appear from my experimentation that this works -
or otherwise something I'm doing is breaking it.
> The top level project statement is the one that generates the top
> level .sln file with the ALL_BUILD target that builds *everything*...
That I understand, however the sub-projects also want the linked
libraries added to their solutions.
Does that make sense, or am I smoking crack?
Joe
More information about the CMake
mailing list