[CMake] linux cmake with intel compiler

Tim Gallagher tim.gallagher at gatech.edu
Wed May 18 09:29:46 EDT 2011


There's two ways we do it. If you are starting with a clean cache (first time you run ccmake), if you do:

CC=icc FC=ifort ccmake /path/to/source

It will set it up using Intel compilers.

We also do:

include(CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(icc "Intel C Compiler")
CMAKE_FORCE_CXX_COMPILER(icpc "Intel C++ Compiler")
CMAKE_FORCE_Fortran_COMPILER(ifort "Intel Fortran Compiler")

Lastly, when using the Intel compiler, we add:

if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
   if(NOT CMAKE_Fortran_FLAGS_RELEASE)
      set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -xhost" CACHE STRING "" FORCE)
   endif()
  set(CMAKE_Fortran_FLAGS_DEBUG
      "${CMAKE_Fortran_FLAGS_DEBUG} -check noarg_temp_created -C -traceback" CA\
CHE STRING "" FORCE)
  set(CMAKE_Fortran_FLAGS_DEBUGHEAVY
      "${CMAKE_Fortran_FLAGS_DEBUG} -check noarg_temp_created -fpe0 -warn align\
ments -warn declarations -warn general -warn interfaces -warn truncated_source \
-warn uncalled -warn uninitialized -warn usage -common_args -warn unused -fp-st\
ack-check -check bounds -check uninit -check format" CACHE STRING "" FORCE)
   mark_as_advanced(CMAKE_Fortran_FLAGS_DEBUGHEAVY)
endif()

Hope that helps,

Tim

----- Original Message -----
From: "Eric Noulard" <eric.noulard at gmail.com>
To: "gekso" <ev.93kso at gmail.com>
Cc: cmake at cmake.org
Sent: Wednesday, May 18, 2011 7:09:07 AM
Subject: Re: [CMake] linux cmake with intel compiler

2011/5/18 gekso <ev.93kso at gmail.com>:
> Hello! Does anyone know how to use Intel Compiler with cmake on linux
> ("Unix Makefiles")?
> I've tried to set CC, CXX environment variables before cmake - no
> effect.

What do you mean by "no-effect" ?
gcc is found and used?

$ source /opt/intel/Compiler/11.1/064/bin/iccvars.sh
$ CC=/path/to/icc CXX=/path/to/icpc cmake /path/to/source

works for me on Linux for several project using CMake including CMake itself?
Test done with CMake 2.8.3.

Which version of CMake are you using?

> Call of intel compiler environment - no effect too..

Same question what does "no effect" mean ?
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list