|
Notes |
|
|
(0015624)
|
|
Alex Neundorf
|
|
2009-03-10 17:43
|
|
If you set the environment variable CXX before running cmake the first time, you can also force cmake to use this compiler and nothing else.
Or you could set CMAKE_CXX_COMPILER when running cmake:
cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++ ...
Does this solve your problem ?
Alex |
|
|
|
(0015643)
|
|
stephan Aiche
|
|
2009-03-11 06:24
|
|
It is not directly a problem it is more a suggestion for an improvment of CMake. I know that I can specify my compiler by setting CXX or CMAKE_CXX_COMPILER. But this is for those who use the CMakeLists.txt.
What I suggested was a way for those guys who write the CMakeLists.txt to specify their own priority of for the compilers. eg. prefer g++ or intel-compilers ..
Stephan |
|
|
|
(0020727)
|
|
Alex Neundorf
|
|
2010-05-12 16:34
|
|
You can do the following in your toplevel CMakeLists.txt, before the first call to project():
set(CMAKE_GENERATOR_CC icc gcc)
set(CMAKE_GENERATOR_CXX icpc g++)
project(MyProject)
This is not completely obvious, maybe more like an undocumented internal variable, but it works.
It will make cmake first search for the Intel compilers, then the GNU ones.
After that you can test which one has been found:
if ("${CMAKE_C_COMPILER_ID}" MATCHES Intel)
...
endif().
And you have, as mentioned in my first comment, also the option to just set the compiler directly when invoking cmake.
So I think there is no need for extra changes in cmake.
Alex
|
|