Hi,

On Wed, Jan 9, 2013 at 1:17 AM, kgardenia42 <[email protected]> wrote:
> I am trying to write a CMakeLists.txt where the same source files are
> compiled separately to both a C library and a C++ library.
>
> So, lets say I have foo.c, bar.c and baz.c and I would like to build
> mylib.a and mylib++.a
>
> My intuition is to use one CMakefile and add multiple targets for each
> library I want to build.  Does that seem like a reasonable approach?
> Other suggestions welcome.  Also, can anyone point me to an open
> source library that uses cmake and builds both a C and C++ version.

I'd say this does not make any sense. The mylib++.a will still be a C
library because all the compiled code in it will be C code unless your
c files are somehow using a preprocessor macro to enable C and C++
code. And if they I'd say you'd be better off to split the files into
a .c and a .cpp one and drop the macro.

A C++ program can link to C libraries just fine, so there's really no
need for that that I can see right now.

Andreas
--

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

Reply via email to