On 12/11/2012 04:20 PM, Ilias Miroslav wrote:
> I appreciate your efforts resulting into the introduction of
> the CMAKE_[C|CXX]_COMPILER_VERSION variables

Thanks.

> However, I  would need also the CMAKE_Fortran_COMPILER_VERSION variable.

It was not left out by accident.  It cannot be computed using the same
approach.  The C/C++ compiler version detection works by using the
preprocessor to transform the version macros for each compiler into
string literals encoded in a binary.  AFAICT this is not possible with
Fortran.  Even though we can preprocess the files, there is no way to
get a compile-time-computed string literal into the binary because the
compiler will not evaluate expressions in static initializers.  As a
result all we can do with the preprocessor in Fortran is select from a
list of hand-coded strings for the compiler identification, not version.

A different method, such as trying to run the compiler binary with a
vendor-specific version query flag, will be needed for Fortran.  Only
recently was enough infrastructure added to know the full path to the
compiler binary in all generators (including the IDEs) in order to be
able to run it.  I don't remember off the top of my head if detection
of the full path to the compiler works for Fortran yet.

> For that reason I was searching for macros setting CMAKE_C_COMPILER_VERSION

The line closest to what you are looking for is in the module
Modules/CMakeDetermineCompilerId.cmake in the function
CMAKE_DETERMINE_COMPILER_ID_CHECK:

  set(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}")

However:

> Would it be possible to distribute also CMake source files which are
> setting the MAKE_[C|CXX]_COMPILER_VERSION  variables?

The logic cannot be factored out into separately-distributable modules,
especially not to run with older CMake versions.  It is dependent on
a lot of infrastructure added to both Modules/*.cmake and C++ sources.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to