|
From: Florent R. <f.r...@fr...> - 2023-07-18 14:17:59
|
Especially for James:
Florent Rougon <f.r...@fr...> wrote:
> if(CMAKE_COMPILER_IS_GNUCXX)
> (...)
>
> set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
> set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
> endif(CMAKE_COMPILER_IS_GNUCXX)
I wonder if a CACHE argument wouldn't be desirable here. My recent
builds were done g++, so this conditional was true for them assuming the
code path was reached; however, upon inspection of CMakeCache.txt in the
SG build dir, I see:
//Flags used by the CXX compiler during RELWITHDEBINFO builds.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
I imagine this value is a CMake default. Maybe the above set() overrides
the cache value in the end during the build, however wouldn't it be more
logical to use CACHE for these set() calls? As I understand it, that
would allow people to override the default flags from the command line,
e.g.:
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -g" ...
to avoid defining NDEBUG even in RelWithDebInfo builds. Of course, I'm
rather dumb at CMake, so... relying on your expertise. :)
Regards
--
Florent
|