[CMake] Disable pretty output
Mike Jackson
imikejackson at gmail.com
Mon May 19 12:43:20 EDT 2008
I _think_ that cmake defaults to a "Release" build if
CMAKE_BUILD_TYPE is not given. Someone from the CMake dev team can
correct me one way or the other.
Also try something like the following:
IF ( CMAKE_BUILD_TYPE MATCHES Debug )
ADD_DEFINITIONS(-Wall)
ENDIF ( CMAKE_BUILD_TYPE MATCHES Debug )
If you build a Release, then CMake will already add the "NDEBUG"
definition for you. So in your case, what you want is this maybe:
IF ( CMAKE_BUILD_TYPE MATCHES Debug )
ADD_DEFINITIONS(-Wall -D_DEBUG)
ENDIF ( CMAKE_BUILD_TYPE MATCHES Debug )
HTH
--
Mike Jackson Senior Research Engineer
Innovative Management & Technology Services
On May 19, 2008, at 12:35 PM, David Sveningsson wrote:
> Mike Jackson skrev:
>> make VERBOSE=1 will show EVERYTHING that is being done.
>
> Ok, that works.
>
> Now I found some errors which I'm having. My code must be compiled
> with either NDEBUG or _DEBUG defined. I thought this would work:
>
> set( CMAKE_CXX_FLAGS "-Wall -O2 -DNDEBUG" )
> set( CMAKE_CXX_FLAGS_DEBUG "-Wall -g -D_DEBUG" )
> set( CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG" )
>
> I now understand that the debug and release flags is appended to
> CMAKE_CXX_FLAGS. However I would like it to default to the release
> flags so that if no build type is specified release is used.
> Compilation fails if neither/both is defined.
>
> As I understood CMAKE_BUILD_TYPE cannot be used for this purpose
> becauuse it might not be initialized and might be changed.
>
> Btw, there is lots of stuff in my CMakeLists.txt that isn't really
> portable, I'm still learning alot about cmake and target GNU/Linux
> with regular makefiles. I won't use CMake to replace a static MSVC
> project yet.
>
>> On May 19, 2008, at 11:51 AM, David Sveningsson wrote:
>>> Hi, more newbie questions. The GNU Makefiles generated CMake has
>>> some nice colored output, progress etc. However I would like to
>>> disable this and see each command that is run (debugging purpose).
>>>
>
>
>
> --
>
>
> //*David Sveningsson [eXt]*
>
> Freelance coder | Game Development Student
> http://sidvind.com
>
> Thou shalt make thy program's purpose and structure clear to thy
> fellow man by using the One True Brace Style, even if thou likest
> it not, for thy creativity is better used in solving problems than
> in creating beautiful new impediments to understanding.
More information about the CMake
mailing list