[CMake] Determining good GCC parameters

Antti S. Lankila alankila at bel.fi
Tue Aug 22 16:27:41 EDT 2006


Alexander Neundorf wrote:
> Datum: Tue, 22 Aug 2006 13:06:39 +0300
> Von: "Antti S. Lankila" <alankila at bel.fi>
> An: cmake at cmake.org
> Betreff: [CMake] Determining good GCC parameters
>
> ...
>   
>> 1) how would I find out the version of GCC I'm running on?
>>     
>
> In KDE we are currently doing this:
>
> # get the gcc version
> exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info)
>    
> string (REGEX MATCH " [34]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
>
> # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here:
> if (NOT _gcc_version)
>    string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
> endif (NOT _gcc_version)
>   

Ok, so no ready magic variable to look for, but instead some manual 
work. At any rate, this one does solve the GCC version problem. Thank you.

-- 
Antti


More information about the CMake mailing list