[CMake] Again multiple subdirs

Rolf Eike Beer eike at sf-mail.de
Tue Feb 7 03:31:46 EST 2012


> add_library (a
>      ${project_SOURCE_DIR}/common/common
>      ${project_SOURCE_DIR}/a/a}
>
> add_library (b
>      ${project_SOURCE_DIR}/common/common
>      ${project_SOURCE_DIR}/b/b}
>
>
> This results in a double compilation of common.c. One time for liba and
> the other one for libb.
>
> What is the best way to force common.c to be compiled just ones?

Create a static library from it.

Eike


More information about the CMake mailing list