On 03/04/2012 11:01 AM, Andreas Guther wrote:
> Hello,
>
> thanks for the responses. The problem I have is, that we have more than one
> application in the directory. So if I put an CMakeLists.txt in the Src
> directory I do not have the choice (only by options). I would prefer a
> solution where I change into the application directory I want to build and
> create workspace etc. from there. The created workspace should then also
> build all necessary libraries for the application.
>
> Any ideas on this?
In Application_1/CMakeLists.txt, e.g., do:
SET(Library_1_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../Library_1
CACHE PATH "Library_1 source directory")
...
ADD_SUBDIRECTORY(${Library_1_SOURCE_DIR} Library_1)
Do the same for Library_2 and every other prerequisite project which
- has a source tree external to Application_1
- you want to be built along with the latter
and finally: TARGET_LINK_LIBRARIES(Application_1 Library_1 ...)
If the fallback value of Library_1_SOURCE_DIR once doesn't suit, you
can set it on the command line or in the GUI before (re)configuring.
Regards,
Michael
--
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