[CMake] How to use CMake with icc via configuration options when needing interprocedural optimization?

Rolf Eike Beer eike at sf-mail.de
Fri Feb 10 08:02:20 EST 2012


> Thank you so much for the hint. Setting the environment variable CXX from
> within my CMakeLists.txt via
> SET(ENV{CXX} "icpc")
> but before any call to project() or enable_language() seems indeed to do
> the trick.
>
> Setting CMAKE_CXX_FLAGS_RELEASE or CMAKE_CXX_FLAGS_DEBUG at this stage
> however does not work. This apparently needs to go after the project()
> statement.
> I could of course set the environment cxx-flags in the same way as above.
> This would somewhat sacrifice the nice RELEASE / DEBUG distinction but
> maybe this can be done by some if-statements (there certainly is a way to
> query the CMAKE_BUILD_TYPE variable, right?).

if (CMAKE_BUILD_TYPE STREQUAL Debug) ...

But noone stops you to put another if(Intel) behind the project() call to
finish what you began before the project().

Eike


More information about the CMake mailing list