<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.26.0">
</HEAD>
<BODY>
I don't think the test should enable the C language, at least not for the entire project because that might cause weird and unexpected problems. It would be nice if the module could look at whether the C language or the C++ language were enabled (or both) and select the appropriate compiler for the setting. I don't know how easy that would be to do, but from the user's point-of-view it would be the most convenient.<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<BR>
<BR>
</TD>
</TR>
</TABLE>
A fair alternative might be to allow the user to supply the language with the check, e.g., <BR>
TEST_BIG_ENDIAN( VARIABLE_NAME CXX )<BR>
<BR>
Are either of those doable?<BR>
<BR>
On Wed, 2009-07-08 at 12:08 +0200, Eric Noulard wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
2009/7/8 <<A HREF="mailto:gryan@akoostix.com">gryan@akoostix.com</A>>:
> Hi! I have a project specified as CXX explicitly, and it requires knowing
> the endian of the machine. I can't seem to use the TEST_BIG_ENDIAN module,
> because it's a .c compilation and I get a
>
> ... /CheckIncludeFile.c". TRY_COMPILE only works for enabled languages.
> Currently enabled languages are: CXX
> See PROJECT command for help enabling other languages.
>
> Error.
>
> Am I doing something wrong, or is that by design somehow? I can always
> just let CMake determine the project type itself, but it seems like there
> should be a way to do an endian check for a CXX project.
I did face the same issue and did manually add
ENABLE_LANGUAGE(C)
in my main CMakeLists.txt
may be the module assuming C has been enabled should
test CMAKE_C_COMPILER_WORKS before going on.
Whether they should automatically ENABLE_LANGUAGE(C) is questionable?
Now since most C programs can be compiled with a C++ compiler
may be the module should directly use C++ compiler if C is not enabled?
What's your opinion?
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>