[CMake] Automatic visual studio project file inclusion

Manuel Klimek klimek at box4.net
Wed Apr 26 12:56:01 EDT 2006


Hi,

thanks for the prompt answer. I didn't explain my idea correctly:
I'm already using ADD_SUBDIRECTORY, and everything works
fine in the top-level visual studio workspace. Let's show
the visual studio project layout (the rest stays like in the example
further down)

/CMakeLists.txt
PROJECT(root)

/lib/a/CMakeLists.txt
PROJECT(a)

/lib/b/CMakeLists.txt
PROJECT(b)
...

/projects/x/CMakeLists.txt
PROJECT(x)

/projects/y/CMakeLists.txt
PROJECT(y)

Now everything works fine if I open root.sln and start to compile,
but all the projects are in the root solution, too.
But in the workspace projects/x/x.sln, the projects that 
x depends on (a, b, c ...) are not automatically added
to the workspace.
The problem is, that we have quite a lot projects and I
don't want to always open the top-level project file, but
to use the workspaces that compile the executables.
The idea is the same as in unix:
# cd projects/x
# make
to build only x

On Wednesday 26 April 2006 16:20, Bill Hoffman wrote:
> You should be using the SUBDIRS or ADD_SUBDIRECTORY command.
> The external msproject is for including a project NOT configured
> by cmake into a cmake project tree.
>
> At 08:13 AM 4/26/2006, Manuel Klimek wrote:
> >Hi,
> >
> >A little feature request. I don't know if this is
> >allready possible, therefor I post to the list first.
> >Should I file a feature request?
> >
> >It would be nice to have an option to
> >automatically include all vs project files
> >to a solution if a target depends on any
> >target in the project file, adding all
> >dependencies automatically.
> >Example:
> >lib/a/
> >ADD_LIBRARY(a ...)
> >
> >lib/b/
> >ADD_LIBRARY(b ...)
> >TARGET_LINK_LIBRARIES(b a)
> >
> >lib/c/
> >ADD_LIBRARY(c ...)
> >TARGET_LINK_LIBRARIES(c b)
> >
> >projects/x
> >ADD_EXECUTABLE(x)
> >TARGET_LINK_LIBRARIES(x c)
> >now this option would generate:
> >INCLUDE_EXTERNAL_MSPROJECT( a ${a_BINARY_DIR}/a.vcproj )
> >INCLUDE_EXTERNAL_MSPROJECT( b ${b_BINARY_DIR}/b.vcproj a)
> >INCLUDE_EXTERNAL_MSPROJECT( c ${c_BINARY_DIR}/c.vcproj b)
> >ADD_DEPENDENCIES(x c)
> >
> >the above is a lot to maintain if you have many
> >projects building on the same base libraries and some
> >library dependencies change...
> >
> >Greetings,
> >Manuel
> >
> >_______________________________________________
> >CMake mailing list
> >CMake at cmake.org
> >http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list