[CMake] TEST_BIG_ENDIAN fails for a CXX project

Eric Noulard eric.noulard at gmail.com
Wed Jul 8 06:08:42 EDT 2009


2009/7/8  <gryan at akoostix.com>:
> 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?

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list