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}")


--
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Jun 18, 2008, at 4:48 PM, Emmanuel Blot wrote:

Is there some CMake macro to report the version of the GCC compiler version? It seems these macros exist for the CL compiler, but I've not found the matching macros for GCC.

Some warnings are produced w/ GCC 4, but the matching warning shut- off option only exists for GCC 4 (not for GCC3). I'd like to enable the -Wno-... option switch only for build built with gcc 4, and do nothing with GCC 3.

Thanks,
Manu

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to