[cmake-developers] [CMake 0013551]: CMAKE_COMPILER_IS_GNUCXX: mention in the documentation when it starts to be available

Mantis Bug Tracker mantis at public.kitware.com
Thu Sep 20 08:38:11 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13551 
====================================================================== 
Reported By:                Sylwester Arabas
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13551
Category:                   Documentation
Reproducibility:            always
Severity:                   text
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-09-20 08:38 EDT
Last Modified:              2012-09-20 08:38 EDT
====================================================================== 
Summary:                    CMAKE_COMPILER_IS_GNUCXX: mention in the
documentation when it starts to be available
Description: 
Apparently this variable may only be used after the project() command in
CMakeLists.txt... perhaps that's quite obvious but still mentioning it in the
docs (e.g. just before the list of "Variables for Languages") might save someone
some time. Example below.

HTH,
Sylwester

Steps to Reproduce: 
$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 2.8)

if(CMAKE_COMPILER_IS_GNUCXX)
  message("compiler detected as: GNU compiler")
else()
  message("compiler detected as: non-GNU compiler")
endif()

project(test CXX)

execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" COMMAND "head" "-1"
OUTPUT_VARIABLE CXX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
message("compiler: ${CMAKE_CXX_COMPILER}")
message("version: ${CXX_VERSION}")


$ cmake .
compiler detected as: non-GNU compiler
-- The CXX compiler identification is GNU 4.7.1
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
compiler: /usr/bin/c++
version: c++ (Debian 4.7.1-6) 4.7.1
-- Configuring done
-- Generating done
-- Build files have been written to: /home/slayoo/Temp/test

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-09-20 08:38 Sylwester ArabasNew Issue                                    
======================================================================




More information about the cmake-developers mailing list