Hi list,
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.
If that approach (one CMakeLists.txt to build both libraries) seems
reasonable then how can I override the language per target?
I know that I can force the use of a C++ compiler for source files:
SET_SOURCE_FILES_PROPERTIES( ${mylib_SRCS} PROPERTIES LANGUAGE CXX )
However, this seems to set the language globally and so now all
targets use the C++ compiler.
I couldn't seem to figure out how to do the equivalent thing
per-target. Any suggestions? i.e. is there another way (other than
SET_SOURCE_FILES_PROPERTIES) which could accomplish the "set the
language per target" functionality I need here?
Thanks.
--
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