[CMake] Project structure

kent williams nkwmailinglists at gmail.com
Fri Mar 13 16:29:46 EDT 2009


It's not very elegant, but this will have the desired effect:

1. make sure the library SUBDIR is in your CMakeLists.txt before any
other subdir that depends on it.
2. use add_custom_command to copy the library, once built, into each subdir.
3. use install in each subdir to install the library where you want it.

On Fri, Mar 13, 2009 at 1:11 PM, Daniele Galdi
<daniele.galdi at over-look.org> wrote:
> Hi Alex,
>
> first of all thanks for the reply.
>
> The reason is simple, I want to distribute each tool with all the libraries
> needed to run.
>
> You said that the library will be installed only once...is it possible to
> decide where install the library
> within the "CMakeFile" of each single tools? It's ok for me build one by one
> each single tool, but what
> I really want is to decide each time where install the shared lib.
>
> Hope I've been clear
>
> \Daniele
>
>
> On 13 Mar, 2009, at 6:43 PM, Alexander Neundorf wrote:
>
>> On Friday 13 March 2009, Daniele Galdi wrote:
>>>
>>> Hi,
>>>
>>> I have a project structure like this in my cmake project.
>>>
>>> project/src/core-lib
>>> project/src/tool1
>>> project/src/tool2
>>> project/src/tool3
>>>
>>> the core library is a shared library. Each tool links this lib, what i
>>> want to achieve is decide
>>> where install the core-lib in each tool. eg. tool1 install core-lib
>>> under /usr/lib/tool1, tool2
>>> will install the core-lib in /usr/lib/tool2 etc...
>>>
>>> Is this scenario possibile with cmake?
>>
>> No, not really.
>> If this is all within one project, the library will be installed only
>> once.
>> You can try to setup three separate projects, then they can install to
>> whereever you want.
>> Why do you actually want to do that ?
>>
>> Alex
>
> _______________________________________________
> 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