[CMake] How to use icc on linux with cmake.

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Apr 17 13:37:06 EDT 2007


On 2007-04-17 18:34+0200 cedric wrote:

> Le mardi 17 avril 2007 15:13, Mike Jackson a écrit :
>> On OS X at least, intel provides a shell script that sets the icc
>> variables. After I invoke that shell script located at source /opt/
>> intel/cc/9.1.036/bin/iccvars.sh I then invoke cmake on a clean build
>> directory and cmake seems to pick up everything related to icc for
>> me. Give it a try and let us know.
>
> On linux, this script set PATH and LD_LIBRARY_PATH so icc is usable, but
> actually not used.
> To use it, I had to set CC=icc before running cmake. And I don't know of it's
> the right way to go since I don't know if
> ${CMAKE_ROOT}/Modules/Plateform/Linux-icpc.cmake was include or if
> ${CMAKE_ROOT}/Modules/Plateform/gcc.cmake is still used.
>
> What is the right way to set the compiler ?

I don't have any experience with icc, but I understand it is a C++
compiler rather than a C compiler.  For C++ compilers look at
CMakeDetermineCXXCompiler.cmake. icc is not one of the list (c++ g++ CC aCC
cl bcc xlC) of C++ compilers that are searched for automatically by cmake.
So you have to specify it.  Looking near the top of that file, that is done
using the CXX environment variable (which can include compiler options).
See also comments about the CXX environment variable in
http://www.cmake.org/Wiki/CMake_Useful_Variables.

My understanding is gcc.cmake is only used for either gcc or g++.  Similarly,
I believe Linux-icpc.cmake would only be included if you specified
the icpc compiler (which I believe is the name of an older Intel compiler?).

Finally to make sure your setting of CXX and accompanying compiler options
are doing the right thing, use the -DCMAKE_VERBOSE_MAKEFILE=ON option to
cmake at configuration time or else use

make VERBOSE=1

at build time.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list