[CMake] I have discovered a bug (probably)

Ivan Hrasko abhrasko at gmail.com
Tue Aug 5 15:57:45 EDT 2014


1. This is the code
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.10 FATAL_ERROR)
PROJECT(CMake_Version_Tutorial C CXX Fortran)

if(DEFINED CMAKE_C_COMPILER_VERSION)
    message(STATUS "C version is defined.")
else()
    message(STATUS "C version is not defined.")
endif()

if(DEFINED CMAKE_CXX_COMPILER_VERSION)
    message(STATUS "C++ version is defined.")
else()
    message(STATUS "C++ version is not defined.")
endif()

if(DEFINED CMAKE_Fortran_COMPILER_VERSION)
    message(STATUS "Fortran version is defined.")
else()
    message(STATUS "Fortran version is not defined.")
endif()

2. I have run this code on Windows 7 (32-bit) using tdm-gcc GNU compilers
(32-bit) with three versions of CMake (cmake -G "MinGW Makefiles"):

a) with cmake 2.8.10.2 and cmake 2.8.12.2 i got this output:
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- The Fortran compiler identification is GNU
...
-- C version is defined.
-- C++ version is defined.
-- Fortran version is not defined.
-- Configuring done
-- Generating done
...

b) but with cmake 3.0.0 i got this:
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- The Fortran compiler identification is GNU
...
-- C version is defined.
-- C++ version is defined.
-- Fortran version is defined.
-- Configuring done
-- Generating done
...

3.  You can see there is a difference between Fortran version is defined
(cmake 3.0.0) and Fortran version is not defined (cmake 2.8.x.x).
So behaviour of CMake has changed a lot and I think it is a bug and can
cause problems if someone relies on it. I have also information
about this "surprise" behaviour on Linux when used with Intel compilers.
-- 
Ivan Hrasko
<abhrasko at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140805/5afe6549/attachment-0001.html>


More information about the CMake mailing list