[CMake] Sharing configuration files?
Hendrik Sattler
post at hendrik-sattler.de
Tue Jun 7 04:17:20 EDT 2011
Zitat von Raymond Wan <r.wan at aist.go.jp>:
> Hi Hendrik,
>
> Thank you for the suggestions!
>
>
> On Tue, Jun 7, 2011 at 17:02, Hendrik Sattler
> <post at hendrik-sattler.de> wrote:
>> Zitat von Raymond Wan <r.wan at aist.go.jp>:
>>> I think/hope so far things are ok... I can compile Y and run it with
>>> no problems. The problem is that X needs access to this generated
>>> configuration file, too. At the very least, it needs to know the size
>>> of an instance of Y in order to allocate memory for it.
>>
>> Did you consider alternatives like giving Y a static function that returns a
>> new instance of Y? That makes your problem void.
>> If this is all within a project that is not going to be separated later,
>> just put the common configuration into the parent directory of both
>
>
> Hmmmmm, I never thought of the first option! So if I am understanding
> your suggestion correctly, this basically means that in X's class
> definition, it has an entry like:
>
> Y* instance_y;
>
> i.e., just a pointer to it. And then X doesn't need to worry about
> the size of Y. I might consider that...
Yes, that's what I meant.
> As for your second option, yes, they are all within the same project
> -- it's just one isn't a subdirectory of the other (they're siblings).
> I honestly thought that it was "bad practice" to have generated
> configuration files outside of the build directory. But if it is ok,
> I might give this second option a try if the first one doesn't work
> out.
I assume you have a toplevel CMakeLists.txt in src/ anyway. Or do you
run cmake for each?
HS
More information about the CMake
mailing list