Skip to content

Fix TestBigEndian to work if C is not enabled

Uwe Koloska requested to merge kolewu/cmake:fix-test_big_endian into master

Without this patch when only CXX is enabled the macro gives the following error:

-- Check if the system is big endian
-- Searching 16 bit integer
-- Using unsigned short
CMake Error at /usr/share/cmake/Modules/TestBigEndian.cmake:56 (try_compile):
  Unknown extension ".c" for file

    /data/koloska/projekte/AQA/aqa_metrics/build/CMakeFiles/CMakeTmp/TestEndianess.c

  try_compile() works only for enabled languages.  Currently these are:

    CXX

  See project() command to enable other languages.
Call Stack (most recent call first):
  source/audio/CMakeLists.txt:3 (test_big_endian)


-- Check if the system is big endian - failed

The patch utilizes the fact, that a C++ compiler can compile normal C code, so we only have to trick the cmake magic to use the other compiler.

Merge request reports