[Libwebsockets] Patch: -O3 set in CMakeLists.txt even when compiling for debug

Andy Green andy at warmcat.com
Thu Oct 15 02:49:51 CEST 2015



On 11 June 2015 09:46:12 GMT+09:00, Bruce Perens <bruce at perens.com> wrote:
>When building with "cmake -DCMAKE_BUILD_TYPE:STRING=Debug", -O3 is
>still
>set. This makes it difficult to debug, since GDB shows some function
>arguments as "optimized out". You actually shouldn't set "-O3" in
>CMakeFiles.txt, since cmake already provides this definition:
>
>// Flags used by the compiler during release builds.
>CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

Thanks, it's pushed.

-Andy

>And arguably, you might want to set CMAKE_C_FLAGS_RELEASE and
>CMAKE_C_FLAGS_DEBUG instead of CMAKE_C_FLAGS.
>
>Patch below.
>
>   Thanks
>
>   Bruce
>
>--- libwebsockets-old/CMakeLists.txt    2015-06-10 12:03:56.520870113
>-0700
>+++ libwebsockets/CMakeLists.txt        2015-06-10 17:34:41.936692691
>-0700
>@@ -402,9 +402,9 @@
>                 set(VISIBILITY_FLAG -fvisibility=hidden)
>     endif()
>     if (UNIX)
>-               set(CMAKE_C_FLAGS "-Wall -Werror -O3 ${VISIBILITY_FLAG}
>${CMAKE_C_FLAGS}" )
>+               set(CMAKE_C_FLAGS "-Wall -Werror ${VISIBILITY_FLAG}
>${CMAKE_C_FLAGS}" )
>     else(UNIX)
>-               set(CMAKE_C_FLAGS "-Wall -O3 ${VISIBILITY_FLAG}
>${CMAKE_C_FLAGS}" )
>+               set(CMAKE_C_FLAGS "-Wall ${VISIBILITY_FLAG}
>${CMAKE_C_FLAGS}" )
>     endif(UNIX)
> endif ()
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list