MantisBT - CMake
View Issue Details
0013551CMakeDocumentationpublic2012-09-20 08:382016-06-10 14:31
Sylwester Arabas 
Kitware Robot 
normaltextalways
closedmoved 
 
 
0013551: CMAKE_COMPILER_IS_GNUCXX: mention in the documentation when it starts to be available
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
$ 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
No tags attached.
Issue History
2012-09-20 08:38Sylwester ArabasNew Issue
2016-06-10 14:28Kitware RobotNote Added: 0042123
2016-06-10 14:28Kitware RobotStatusnew => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042123)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.