[CMake] multiple cmake files in one directory
th.tom at gmx.de
th.tom at gmx.de
Thu Sep 24 05:28:41 EDT 2009
To make a long story short:
What I did is, I write
SET (CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../..)
in the starting CMakeLists.txt in [whatever]/build/project1/
But it looks a bit ugly to me ...
-tom
This is not nice in my eyes, but it is
> > On Wednesday 23 September 2009 10:25:37 am th.tom at gmx.de wrote:
> > > hm, right - this would solve my problem, but sadly writing everything
> in
> > > one CMakeLists.txt file was not a clever idea, as the projects should
> be
> > > build independently.
> > >
> > > Another solution I had (someone posted that) is creating a
> subdirectory
> > for
> > > every project and place the specific CMakeLists.txt file there.
> However,
> > > this would change the CMAKE_SOURCE_DIR to the projects subdirectory;
> > what
> > > is kind of nasty.
> > >
> > > Any ideas to change the root back?
> >
> > A subdirectory per project sounds good, but why is CMAKE_SOURCE_DIR a
> > problem
> > then? Its just a variable pointing to some directory.
>
> Maybe I did not get the point of CMAKE_SOURCE_DIR :-/
> What I do is creating a directory "packages\project1" here I place the
> starting CMakeLists.txt file and another subdirectory "build".
>
> The CMakeLists.txt consists of
>
> ADD_SUBDIRECTORY(../../myfirstdir)
> ADD_SUBDIRECTORY(../../myseconddir)
> ADD_SUBDIRECTORY(../../mythirddir)
>
> Within the "build" directory I start "cmake ..".
>
> What I think is happening is that the CMAKE_SOURCE_DIR is set to
> [whatever]\package\project1
>
> This is not what I want, as the source root (where all
> CMakeLists.txt-files written up until now depend on) is [whatever].
>
> So the solution would be to change _all_ ${CMAKE_SOURCE_DIR} to
> ${CMAKE_SOURCE_DIR}\..\.. or not to use ${CMAKE_SOURCE_DIR} and to navigate by
> relative paths.
>
> Both are not very nice.
>
> However is there another better solution for that? Or do I miss the point
> somewhere?
>
> -tom
>
> _______________________________________________
> 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
More information about the CMake
mailing list