Hi Matt,

okay. Error message is from me, indicating that the CMake compiler test
failed to detect the C99 / C11 capabilities, it does not technically
mean the compiler cannot do it.  And not being an CMake expert is no
help here, but I think I got it now almost right:

Index: CMakeLists.txt
===================================================================
--- ../CMakeLists.txt   (revision 3592)
+++ ../CMakeLists.txt   (working copy)
@@ -55,9 +55,16 @@
 # Set default C++ flags.
 include(CheckCCompilerFlag)
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -O3")
+
 CHECK_C_COMPILER_FLAG("-std=gnu11" COMPILER_SUPPORTS_GNU11)
-if(CMAKE_C_STANDARD_COMPUTED_DEFAULT EQUAL "90")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
+CHECK_C_COMPILER_FLAG("-std=gnu99" COMPILER_SUPPORTS_GNU99)
+
+if(COMPILER_SUPPORTS_GNU11)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
+elseif(COMPILER_SUPPORTS_GNU99)
+   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
+else()
+   message( SEND_ERROR "Compiler doesm't seem to support at least gnu99, might 
cause problems" )
 endif()
 # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")

Key to success is to delete CMakeCache.txt in the build directory, as it
seems it caches the result of the variable even if you remove the
calculation of the variable (which I did, but I did not knew it was the
script itself which calculated and cached it).

Give it a try.

Regards,
Danilo



On 27.05.2018 20:12, Matt Roberts wrote:
> Hi Danilo,
>
> When I try your patch on Ubuntu Trusty or Raspbian Stretch, it fails
> trying to get either C11 or C99 support during the initial 'cmake' run.
>
> The error during 'cmake' is just the 'else' message:  "Compiler
> doesm't seem to support at least gnu99, might cause problems"
>
> On Ubuntu, the gcc is: gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
>
> On Raspbian: gcc (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516
>
> According to the man page, C99 and C11 support on gcc is still
> considered "incomplete" and "experimental."  FWIW.
>
> 73,
> Matt
>
>
> ------------------------------------------------------------------------------
>
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Freetel-codec2 mailing list
> Freetel-codec2@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freetel-codec2


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freetel-codec2 mailing list
Freetel-codec2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freetel-codec2

Reply via email to