[Piglit] [PATCH] CMake: compile with debug info on by default

nobled nobled at dreamwidth.org
Wed Nov 16 14:32:40 PST 2011


Jose Fonseca <jfonseca at vmware.com> wrote:
>
>
> ----- Original Message -----
>> This makes debugging crashes feasible out of the box.
>> ---
>>  CMakeLists.txt |    4 ++++
>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/CMakeLists.txt b/CMakeLists.txt
>> index 5a97486..87a5668 100644
>> --- a/CMakeLists.txt
>> +++ b/CMakeLists.txt
>> @@ -41,6 +41,10 @@ if(NOT import_numpy_error_code EQUAL 0)
>>       message(FATAL_ERROR "numpy library not found")
>>  endif(NOT import_numpy_error_code EQUAL 0)
>>
>> +# Default to compiling with debug information (`gcc -g`):
>> +SET(CMAKE_BUILD_TYPE Debug CACHE STRING
>> +     "May be one of: None Debug RelWithDebInfo Release MinSizeRel"
>> FORCE)
>> +
>
> I don't oppose debug build by default, given that piglit does not include benchmarks.
>
> But I think this will force Debug build regardless of user request.
Oops, you're right. I don't know what I was thinking adding the
'FORCE' option there. Fixed patch attached, with the FAQ's workaround
for the CMake-GUI setting it to "" in the cache first.


>
> Please follow the instructions in
> http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_change_the_default_build_mode_and_see_it_reflected_in_the_GUI.3F
>
>
> Another alternative is choose "RelWithDebInfo" by default, i.e., -O2 & -g
>
>
> Jose
>

---
 CMakeLists.txt |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a97486..5817d1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,12 @@ if(NOT import_numpy_error_code EQUAL 0)
 	message(FATAL_ERROR "numpy library not found")
 endif(NOT import_numpy_error_code EQUAL 0)

+# Default to compiling with debug information (`gcc -g`):
+if(NOT CMAKE_BUILD_TYPE)
+	SET(CMAKE_BUILD_TYPE Debug CACHE STRING
+	"May be one of: None Debug RelWithDebInfo Release MinSizeRel" FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+
 if (NOT MSVC)
 	CHECK_C_COMPILER_FLAG("-Wall" C_COMPILER_FLAG_WALL)
 	IF (C_COMPILER_FLAG_WALL)
-- 
1.7.4.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-CMake-compile-with-debug-info-on-by-default.patch
Type: text/x-patch
Size: 1069 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20111116/67b81373/attachment.bin>


More information about the Piglit mailing list