> > 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.
>
> Maybe you explained it upthread but why not put your top-level
> CMakeLists.txt in [whatever]?
Because I have two (more or less) independent projects, that joins the same
root! And I want to have two build process and packages created by cpack in the
end.
> You could also set a myProjectRoot and point it to
> "${CMAKE_SOURCE_DIR}/../..". If you don't like the .. in your path, use
> get_filename_component to normalize that path.
That's an option, that hurts less. My intention is to make the build process as
logical and convenient as possible to convince people to switch to cmake. So
reading ${MY_PROJECT_ROOT} is ok, but having ${CMAKE_SOURCE_DIR} would be
better at least, because it is documented. I am afraid that people write their
first CMakeLists.txt from a tutorial, add it with ADD_SUBDIRECORY() to the
projects CMakeLists.txt and nothing works as expected, as their
CMAKE_SOURCE_DIR is placed somewhere, but not at the root they expected.
-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