[CMake] Determining Compiler Name and Version

Filipe Sousa filipe at ipb.pt
Mon Sep 4 18:25:57 EDT 2006


Daniel J. Hilferty wrote:
> I would like to have the compiler name and version appear in the 
> directory name of the libraries output path like: 
> 
> SET(LIBRARY_OUTPUT_PATH 
> ${CMAKE_SYSTEM_NAME}-${COMPILER_NAME}-${COMPILER_VERSION})
> 
> Is there any way to easily detect the compiler name and version without 
> testing every variable MSVC, MSVC80....  
> 
> Thanks,
> 
> Dan

You can get the compiler name by inspecting the variables
CMAKE_CXX_COMPILER and CMAKE_C_COMPILER. For the version you have to
call the compiler with some parameter that gives you the version (gcc
--version). Use EXECUTE_PROCESS to invoke the compiler and STRING to
parse the output.


-- 
Filipe Sousa

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20060904/5dd3f707/signature.pgp


More information about the CMake mailing list