[CMake] Re: Sharing code between projects

kitts kitts.mailinglists at gmail.com
Tue Aug 28 12:02:26 EDT 2007


On Tuesday 28 Aug 2007 9:10:47 pm Matthew Woehlke wrote:
> The way I did this was to use the somewhat dubious solution:
>
> IF(PROJECT STREQUALS FOO)
>    ADD_DIRECTORY(foo)
> ELSEIF(PROJECT STREQUAL BAR)
>    ADD_DIRECTORY(bar)
> ELSE(PROJECT STREQUALS FOO)
>    MESSAGE(FATAL_ERROR "You didn't tell me what PROJECT to build!")
> ENDIF(PROJECT STREQUALS FOO)
>
> ...and then, obviously, add e.g. '-DPROJECT:STRING=FOO' to your initial
> cmake run.
>
> My source tree looks like:
>
> build-foo/
> build-bar/
> src/
>    common/
>    foo/
>    bar/

This is interesting. I am still thinking of something such because by 
generating a KDevelop3 project (or doing it manually), KDevelop refuses to 
add the common folder sources as part of the project. KDevelop becomes simply 
an editor around these files and does not offer all goodies such as code 
completion, code navigation, documentation etc.

I didn't want to bring in an unintuitive directory structure to aid this. 
Still confused! :-)
-- 
Cheers!
kitts


More information about the CMake mailing list