<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Please pardon my last message. I found
a thread from 2013-01-09 that kgardenia42 wrote and it pretty
much addresses everything that I need.<br>
<br>
-Jimi<br>
<br>
On 07/14/2013 01:49 PM, Jimi Damon wrote:<br>
</div>
<blockquote cite="mid:51E30EC9.4080001@accesio.com" type="cite">Hi,
<br>
<br>
<br>
I am new-ish to Cmake and hence might be overlooking a simple
solution to this problem. Here's the quick crux of my problem.
<br>
<br>
I have a directory full of .C files that I want to compile to a C
based Shared library and compile to a C++ shared library. In the
original Makefile, it was handled by a simple rule that did the
following
<br>
<br>
g++ $(CXX_FLAGS) file.c -o file.cpp.o
<br>
<br>
vs.
<br>
<br>
gcc $(C_FLAGS) file.c -o file.o
<br>
<br>
What I tried doing in CMAKE was have two targets with one being C
based library, and the other a C++ based. I then tried messing
around with SET_SOURCE_FILES_PROPERTIES and SET_TARGET_PROPERTIES
to change the compiler type for each set.
<br>
<br>
However, Cmake keeps track of the underlying files. So even if I
had
<br>
<br>
file (GLOB c_files RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/*.c" )
<br>
followed by
<br>
<br>
file (GLOB cxx_files RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/*.c" )
<br>
<br>
ADD_LIBRARY( cxx_entries SHARED cxx_files )
<br>
#and
<br>
ADD_LIBRARY( c_entries SHARED c_files )
<br>
<br>
<br>
Then when I used the add_library () commands, it remembered only
one compiler type for both, and hence either both libraries would
be CXX compiled or C compiled.
<br>
<br>
<br>
So, my question is : what is the best way to handle one directory
full of C files so that I can compile both to a C based shared
library and C++ based shared library.
<br>
<br>
I thought about adding a custom rule, but considering that this
will be migrated over to Windows , I am trying to rely on as much
CMake as possible to try to ensure that it will work
cross-platform.
<br>
<br>
Thanks for any suggestions,
<br>
<br>
-Jimi
<br>
<br>
<br>
--
<br>
<br>
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
<br>
<br>
Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
<br>
<br>
Please keep messages on-topic and check the CMake FAQ at:
<a class="moz-txt-link-freetext" href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a>
<br>
<br>
Follow this link to subscribe/unsubscribe:
<br>
<a class="moz-txt-link-freetext" href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a>
<br>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<table>
<tbody>
<tr>
<td>
Jimi Damon<br>
ACCES I/O Products, Inc.<br>
Linux Engineer<br>
<a class="moz-txt-link-abbreviated" href="mailto:jdamon@accesio.com">jdamon@accesio.com</a><br>
(858) 550-9559 x3015<br>
</td>
<td>
<img src="cid:part1.03000303.03020707@accesio.com">
</td>
</tr>
</tbody>
</table>
<table>
</table>
</div>
<div class="moz-signature">-- <br>
<table>
<tbody>
<tr>
<td>
Jimi Damon<br>
ACCES I/O Products, Inc.<br>
Linux Engineer<br>
<a class="moz-txt-link-abbreviated" href="mailto:jdamon@accesio.com">jdamon@accesio.com</a><br>
(858) 550-9559 x3015<br>
</td>
<td>
<img moz-do-not-send="true"
src="http://accesio.com/images/weblogo2.png">
</td>
</tr>
</tbody>
</table>
<table>
</table>
</div>
</body>
</html>