[CMake] Adding a project to a solution.

David Cole david.cole at kitware.com
Thu Oct 25 11:27:58 EDT 2007


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)

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.

The top level project statement is the one that generates the top
level .sln file with the ALL_BUILD target that builds *everything*...


HTH,
David


On 10/25/07, Josef Karthauser <joe.karthauser at geomerics.com> wrote:
>
>
>
>
> Hi there again J,
>
>
>
> With respect to the Visual Studio generators, I'm wondering what logic cmake
> uses to determine which projects to add to the solution file.  I had assumed
> that anything which was linked as a library was automatically added, but it
> isn't.  Is there an easy way of adding dependences from sibling directories
> to a solution?
>
>
>
> Example,
>
>
>
>    Test/
>
>                 Library/
>
>                 Project/
>
>
>
> Project uses Library, like so:
>
>
>
>                 Project/CMakeLists.txt:
>
>                                 PROJECT(Project)
>
>                                 TARGET_LINK_LIBRARIES(Project Library)
>
>
>
> However Library.vcproj doesn't show up in Project's solution file.   Can I
> specify that it should, or do I need to hack code?
>
>
>
> Thanks J
>
> Joe
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list