[Cmake] Forcing the use of C++ compiler for .c files

Dekeyser, Kris Kris.Dekeyser at lms.be
Wed Aug 11 11:29:09 EDT 2004


Hi,

We currently have some legacy C++ code. Most of these files use extension
.c, but they really contain C++ code. CMake however automatically selects
the CMAKE_C_COMPILER to compile the files, which causes an error. Forcing
CMake to use the C++ compiler doesn't work either, because CMake detects
that it is not a C Compiler, but C++ compiler.

The only solution I found is to hack the
${CMAKE_ROOT}/Modules/CMakeTestCCompiler.cmake and disable the C++ check.

However, we do need to compile another project with the C Compiler and not
with the C++ compiler, so we end up to hack/unhack the test file all the
time.

Is there another - better - way to force the usuage of the C++ compiler in
CMake for certain files? If not, could it be added?

Best regards,
Kris
+-+-+- Email Confidentiality Footer +-+-+- 
Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this message (or responsible for delivery
of the message to such person), you may not print, retain, copy nor
disseminate this message or any part of it to anyone and you should notify
the sender by reply email and destroy this message. Neglecting this clause
could be a breach of confidence. Please advise immediately if you or your
employer does not consent to Internet email for messages of this kind.
Opinions, conclusions and other information in this message that are not
related to the official business of my firm shall be understood as neither
given nor endorsed by it.



More information about the Cmake mailing list