[CMake] GCC version variable

Martin Apel martin.apel at simpack.de
Thu Jun 19 05:28:37 EDT 2008


Mike Jackson wrote:
> This is taken from a FindBoost.cmake file I had laying around. Adjust 
> for your needs:
>
>          EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
>                     ARGS --version
>                     OUTPUT_VARIABLE _boost_COMPILER_VERSION
>                 )
>                 STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.[0-9] .*" 
> "\\1\\2"
>                    _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
>                 SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
>
>
Don't use this regular expression to find out the GCC version!
I filed a bug report for FindBoost.cmake 
(http://public.kitware.com/Bug/view.php?id=7097) some weeks ago, that 
this doesn't work reliably.
I built GCC myself with a suffix of -32, which confuses the regular 
expression above. As a workaround I modified my local FindBoost.cmake to 
use
  STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.[0-9].*" "\\1\\2"  
_boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
Note the blank after the initial ".*"!


Regards,

Martin

____________
Virus checked by G DATA AntiVirus
Version: AVKA 18.302 from 18.06.2008
Virus news: www.antiviruslab.com



More information about the CMake mailing list