74df4bc0cd2e2291b3c22e6536183a3537fed0eb
[alexxy/gromacs.git] / src / GetCompilerInfo.cmake
1 # This macro gets the version string for a compiler, and also extracts
2 # compiler flags.
3 #
4 # Parameters:
5 #   LANGUAGE       - C or CXX, the compiler to check for
6 #   BUILD_COMPILER - [output variable] string with compiler path, ID and
7 #                    some compiler-provided information
8 #   BUILD_FLAGS    - [output variable] flags for the compiler
9 #
10 macro(get_compiler_info LANGUAGE BUILD_COMPILER BUILD_FLAGS)
11     set(${BUILD_COMPILER} "${CMAKE_${LANGUAGE}_COMPILER} ${CMAKE_${LANGUAGE}_COMPILER_ID} ${CMAKE_${LANGUAGE}_COMPILER_VERSION}")
12     string(TOUPPER ${CMAKE_BUILD_TYPE} _build_type)
13     set(${BUILD_FLAGS} "${CMAKE_${LANGUAGE}_FLAGS} ${CMAKE_${LANGUAGE}_FLAGS_${_build_type}}")
14 endmacro()