Bartlett, Roscoe A wrote:
Here is some CMake code that I wrote to determine this:



# Determine compiler version

INCLUDE(CheckCXXSourceCompiles)

CHECK_CXX_SOURCE_COMPILES(
"
int main() {
#ifdef __sun
  // This is the SUN!
#else
  THIS IS NOT THE SUN
#endif
  return 0;
}
"
Trilinos_USING_SUN_COMPILER
)


This is already done in CMake 2.6. See Modules/CMakeCCompilerId.c.in, it is even better than the above because it works when cross compiling. It does not use a try-run, but rather a try-compile, and then it looks for strings in the executable that was created.

Anyway, it is already done, and it sets the following variables:

CMAKE_C_COMPILER_ID
CMAKE_CXX_COMPILER_ID
CMAKE_Fortran_COMPILER_ID

-Bill
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to