<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap:break-word"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Whether what you want exactly is possible I dont know. If you are just wanting your C++ test library to be able to test your C source then I would still let them compile as C and just extern “C” { #include <your header> }. When it gets linked all together it should be fine. This is how I usually do testing of my C code with cpputest which is also a C++ library.</div> <br> <div id="bloop_sign_1516212463430073856" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Matt Keeler<br><br></div></div> <br><p class="airmail_on">On January 17, 2018 at 13:05:36, Jimi Damon (<a href="mailto:jdamon@accesio.com">jdamon@accesio.com</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>


<title></title>


<div dir="ltr">Hi,
<div><br></div>
<div>I want to use Gtest for some unit tests on a number of the C
functions that comprise my C executable.  However, Gtest ( And
gMock ) are C++ testing frameworks. </div>
<div><br></div>
<div>What I would like to have is a project for my exe and then a
separate project for my C++ library and be able to change the
source properties to use the language CXX just before
compiling.</div>
<div><br></div>
<div>The problem I'm having is that CMake uses the CXX compiler for
the C files.</div>
<div><br></div>
<div><br></div>
<div>Here's what I would like to have</div>
<div><br></div>
<div>project(cexe)</div>
<div>set(SOURCES foo.c bar.c )</div>
<div>
<div>add_executable( cexe  ${SOURCES} )</div>
</div>
<div><br></div>
<div>project(cpplib)</div>
<div>
<div>set_source_files_properties(${SOURCES} PROPERTIES LANGUAGE CXX
)</div>
</div>
<div>
<div>add_library( cpplib SHARED ${SOURCES} )</div>
</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>Is there a way to do this ?  </div>
<div><br></div>
<div>Can target_compile_options set the compile type for a given
target ? </div>
<div><br></div>
<div><br></div>
<div>In the past I've had to copy the .C files to some renamed .CPP
equivalent and then compile off of that.  </div>
<div><br></div>
<div>I'm hoping that enough new functionality has been added to
Cmake to allow separation between compiles.</div>
<div><br></div>
<div><br></div>
<div>Thanks,</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>
<div><br></div>
--<br>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr"><br>
<table>
<tbody>
<tr>
<td style="vertical-align:top;width:431px">
<div style="font-family:Verdana,"Lucida Sans Unicode","Lucida Sans","DejaVu Sans",sans-serif;color:rgb(0,0,0);width:375px">
<small><span style="font-weight:bold"><span>Jimi</span>
<span>Damon</span></span><br>
<a href="http://accesio.com/go.cgi?p=/contact/contact.html" style="font-weight:bold;text-decoration:none;color:rgb(0,0,136)" target="_blank">ACCES I/O Products, Inc.</a><br>
<span style="font-style:italic;font-weight:bold">Linux
Engineer</span><br>
<a href="mailto:JDamon@accesio.com" style="text-decoration:none;color:rgb(0,0,136)" target="_blank">JDamon@accesio.com</a><br>
<span><span>(858) 550-7320 x3015</span></span><br></small></div>
</td>
<td style="text-align:center;width:346px">
<div style="text-align:center;margin-left:0px;width:339px"><a href="http://accesio.com/" style="text-decoration:none;color:rgb(0,0,136)" target="_blank"><img src="https://mail.google.com/mail/u/1/?ui=2&ik=25da780046&view=fimg&th=14a5619973eb6e26&attid=0.0.1&disp=emb&attbid=ANGjdJ_JtLwbDFSIbILPeAVZHeO8x_MTLvn85jvCOK5AtVfZK1BF9-Qz2NPJput9pNE5YtUa1WsPJcAAY8A-ffStTtVvWFYkQsyUkh924NH7y_aDDAyHta6W-F9Ka1U&sz=w664-h114&ats=1418783753561&rm=14a5619973eb6e26&zw&atsh=1" alt="ACCES I/O Logo" height="34" width="200"><br>
<small><span><span>10623 Roselle Street</span> <span>San
Diego</span> <abbr title="California">CA</abbr>
<span>92121-1506</span></span></small></a></div>
</td>
</tr>
</tbody>
</table>
<br></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<font color="gray" size="1">WARNING - This e-mail or its
attachments may contain controlled technical data or controlled
technology within the definition of the International Traffic in
Arms Regulations (ITAR) or Export Administration Regulations (EAR),
and are subject to the export control laws of the U.S. Government.
Transfer of this data or technology by any means to a foreign
person, whether in the United States or abroad, without an export
license or other approval from the U.S. Government, is prohibited.
The information contained in this document is CONFIDENTIAL and
property of ACCES I/O Products, Inc. Any unauthorized review, use,
disclosure or distribution is prohibited without express written
consent of ACCES I/O Products, Inc. If you are not the intended
recipient, please contact the sender and destroy all copies of the
original message and enclosed attachments.</font>


--  
<br>
<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a>
<br>
<br>Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a>
<br>
<br>Kitware offers various services to support the CMake community. For more information on each offering, please visit:
<br>
<br>CMake Support: <a href="http://cmake.org/cmake/help/support.html">http://cmake.org/cmake/help/support.html</a>
<br>CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html">http://cmake.org/cmake/help/consulting.html</a>
<br>CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html">http://cmake.org/cmake/help/training.html</a>
<br>
<br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
<br>
<br>Follow this link to subscribe/unsubscribe:
<br><a href="https://cmake.org/mailman/listinfo/cmake">https://cmake.org/mailman/listinfo/cmake</a>
<br></div></div></span></blockquote></body></html>