MantisBT - CMake |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0006251 | CMake | CMake | public | 2008-01-16 16:14 | 2013-03-04 08:38 |
|
Reporter | Andreas Pakulat | |
Assigned To | Brad King | |
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | | OS | | OS Version | |
Product Version | | |
Target Version | CMake 2.8.10 | Fixed in Version | CMake 2.8.10 | |
|
Summary | 0006251: Provide compiler version information |
Description | It would be cool if there was a CMAKE_CXX_COMPILER_VERSION variable available in cmake. Something like that is already available for MSVC, as there are separate MSVC80, MSVC71 and so on. Unfortunately there's nothing like that for other compilers, like gcc.
Often its useful to be able to check which version of a compiler is used, for example to enable some compiler flag - or in the case of boost libraries to be able to actually find the right libs. |
Steps To Reproduce | |
Additional Information | |
Tags | No tags attached. |
Relationships | has duplicate | 0011682 | closed | Brad King | [enhancement] Add GNU versions for CMakeLists.txt processing, just like MSVC_VERSION | has duplicate | 0011937 | closed | Brad King | Need determination of Intel C++ compiler version | has duplicate | 0012408 | closed | Brad King | CMake should have a variable for the compiler version |
|
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2008-01-16 16:14 | Andreas Pakulat | New Issue | |
2008-01-17 15:17 | Bill Hoffman | Note Added: 0010172 | |
2008-01-17 15:17 | Bill Hoffman | Status | new => assigned |
2008-01-17 15:17 | Bill Hoffman | Assigned To | => Brad King |
2008-01-17 15:48 | Brad King | Note Added: 0010173 | |
2008-01-17 16:42 | Andreas Pakulat | Note Added: 0010174 | |
2011-01-11 08:41 | Brad King | Relationship added | has duplicate 0011682 |
2011-01-11 10:33 | Maddes | Note Added: 0024586 | |
2011-01-11 10:39 | Maddes | Note Added: 0024587 | |
2011-01-11 10:42 | Maddes | Note Edited: 0024586 | bug_revision_view_page.php?bugnote_id=24586#r92 |
2011-01-11 10:43 | Maddes | Note Edited: 0024586 | bug_revision_view_page.php?bugnote_id=24586#r93 |
2011-01-11 10:43 | Maddes | Note Edited: 0024586 | bug_revision_view_page.php?bugnote_id=24586#r94 |
2011-01-11 10:44 | Maddes | Note Edited: 0024587 | bug_revision_view_page.php?bugnote_id=24587#r96 |
2011-01-11 10:45 | Maddes | Note Edited: 0024587 | bug_revision_view_page.php?bugnote_id=24587#r97 |
2011-01-11 10:47 | Maddes | Note Edited: 0024587 | bug_revision_view_page.php?bugnote_id=24587#r98 |
2011-01-11 10:48 | Maddes | Note Edited: 0024587 | bug_revision_view_page.php?bugnote_id=24587#r99 |
2011-01-11 10:48 | Maddes | Note Edited: 0024587 | bug_revision_view_page.php?bugnote_id=24587#r100 |
2011-01-11 10:54 | Maddes | Note Edited: 0024586 | bug_revision_view_page.php?bugnote_id=24586#r101 |
2011-01-11 10:55 | Maddes | Note Edited: 0024587 | bug_revision_view_page.php?bugnote_id=24587#r102 |
2011-01-11 10:59 | Maddes | Note Edited: 0024587 | bug_revision_view_page.php?bugnote_id=24587#r103 |
2011-01-11 11:01 | Maddes | Note Edited: 0024587 | bug_revision_view_page.php?bugnote_id=24587#r104 |
2011-01-11 11:02 | Maddes | Note Edited: 0024587 | bug_revision_view_page.php?bugnote_id=24587#r105 |
2011-02-08 17:59 | Maddes | Note Added: 0025347 | |
2011-02-08 17:59 | Maddes | Note Edited: 0025347 | bug_revision_view_page.php?bugnote_id=25347#r194 |
2011-02-08 18:00 | Maddes | Note Edited: 0024587 | bug_revision_view_page.php?bugnote_id=24587#r195 |
2012-04-19 12:12 | David Cole | Note Added: 0029256 | |
2012-04-19 13:53 | Brad King | Note Added: 0029259 | |
2012-04-19 13:53 | Brad King | Assigned To | Brad King => |
2012-04-19 13:53 | Brad King | Status | assigned => backlog |
2012-04-19 13:55 | Brad King | Relationship added | has duplicate 0011937 |
2012-04-19 13:57 | Brad King | Relationship added | has duplicate 0012408 |
2012-09-03 17:01 | Rolf Eike Beer | Note Added: 0030902 | |
2012-09-03 17:24 | David Cole | Note Added: 0030904 | |
2012-09-03 17:24 | David Cole | Status | backlog => resolved |
2012-09-03 17:24 | David Cole | Fixed in Version | => CMake 2.8.10 |
2012-09-03 17:24 | David Cole | Resolution | open => fixed |
2012-09-03 17:24 | David Cole | Assigned To | => Brad King |
2012-09-03 17:24 | David Cole | Target Version | => CMake 2.8.10 |
2013-03-04 08:38 | Robert Maynard | Note Added: 0032448 | |
2013-03-04 08:38 | Robert Maynard | Status | resolved => closed |
Notes |
|
(0010172)
|
Bill Hoffman
|
2008-01-17 15:17
|
|
Does the new compiler id stuff do this? |
|
|
(0010173)
|
Brad King
|
2008-01-17 15:48
|
|
CMake HEAD in CVS has a CMAKE_<lang>_COMPILER_ID variable that gets set to the vendor name for known compilers. It does not contain the version. However the logic used to compute the ID can be extended to extract version information too. |
|
|
(0010174)
|
Andreas Pakulat
|
2008-01-17 16:42
|
|
Boost uses <compiler><major><minor> mostly, i.e. msvc80, msvc71, gcc34, gcc42. But sometimes also has mgw, il (for mingw and intel compiler). So if CMAKE_<LANG>_COMPILER_ID can provide exactly that string it would be really helpful. |
|
|
(0024586)
|
Maddes
|
2011-01-11 10:33
(edited on: 2011-01-11 10:54) |
|
I think the approach mentioned in 0011682 of having multiple version variables has advantages over the approach here of having one generic string variable.
Having multiple specific variables allow for complex checks, also they are filled with version numbers only.
Using more generic variable names like CMAKE_<lang>_COMPILER_[MAJOR|MINOR|PATCHLEVEL] would make them re-useable for other compilers too.
A single string variable with text and numbers as mentioned here, maybe with different formats, can be very hard to parse.
|
|
|
(0024587)
|
Maddes
|
2011-01-11 10:39
(edited on: 2011-02-08 18:00) |
|
The boost format is inaccurate and not great for conditions (<, <=, >, >=).
The MSVC compiler version has nothing to do with the Visual Studio release name. MSVC compiler come also with Windows SDK and other Microsoft products.
So for correct decisions the compiler version (e.g. 1310, 1400, etc.) has to be taken in account.
Also you can easily map the MSVC_VERSION to a boost compiler version yourself. See their visualc.hpp header file near the end (URL: http://www.boost.org/doc/libs/1_41_0/boost/config/compiler/visualc.hpp [^] )
Put the CMake mapping code in a separate text file and include it whenever necessary (see CMake's include at http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:include [^]).
|
|
|
(0025347)
|
Maddes
|
2011-02-08 17:59
|
|
Found an easy workaround for GNU C/CXX:
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE C_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "C version is >${C_VERSION}<" )
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
OUTPUT_VARIABLE CXX_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "CXX version is >${CXX_VERSION}<" )
Now you can use VERSION_LESS/EQUAL/GREATER with C_VERSION and CXX_VERSION.
Maybe this can be implemented in CMake directly.
|
|
|
(0029256)
|
David Cole
|
2012-04-19 12:12
|
|
Is this issue "fixed" now that the feature is mostly there in 2.8.8... or are you keeping it open to remember to finish off the few IDE generators that are still missing this information? |
|
|
(0029259)
|
Brad King
|
2012-04-19 13:53
|
|
CMake 2.8.8 defines variables like CMAKE_C_COMPILER_VERSION but they are documented for internal use only. They are needed to choose version-dependent compiler flags for a few toolchains. However, they are not provided for all toolchains by all generators.
Currently the version information is computed at the same time as the compiler identification. Some generators (VS, Xcode) do not perform the identification step because they generate project files specifying the build and let the native build tool map attributes to the real compiler command lines. For these generators the version information is not computed.
Additional work is needed to compute the compiler version everywhere. It should probably be done during the compiler ABI detection step (when not done during the id step) since it is similar to the id check but runs everywhere.
|
|
|
(0030902)
|
Rolf Eike Beer
|
2012-09-03 17:01
|
|
A lot of that stuff has happened for 2.8.9 and beyond that. Can we export the results as CMake variables now? |
|
|
(0030904)
|
David Cole
|
2012-09-03 17:24
|
|
CMAKE_CXX_COMPILER_VERSION and CMAKE_C_COMPILER_VERSION are now available everywhere.
CMAKE_Fortran_COMPILER_VERSION is available where it is possible to determine it without knowing it in advance... |
|
|
(0032448)
|
Robert Maynard
|
2013-03-04 08:38
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|