[CMake] mixed compilation with two compilers

Dominik Szczerba dominik at itis.ethz.ch
Tue Feb 15 11:23:52 EST 2011


I need to compile a few subprojects (each is a subfolder with one
library and a corresponding CMakeLists.txt) with the Intel compiler
while the rest of the libraries (organized the same way), including
the executable, using the system compiler (GNU on linux, VC on
Windows). I tried two solutions to no avail:

1) In the subfolder's CMakeLists.txt do like:

	SET(CMAKE_CXX_COMPILER ${INTEL_CXX_COMPILER})
	SET(CMAKE_CXX_FLAGS_DEBUG ${INTEL_CXX_FLAGS_DEBUG})

While this substitutes the CMAKE_CXX* variables correctly with
INTEL_CXX* ones (confirmed by MESSAGE) the actual compilation still
takes place using parent CMAKE_CXX_* variables. This is very
surprising as many other CMake commands respect the subfolder scope.

2) Properties. There is a way to have ADDITIONAL compile flags, but
not CUSTOM. There seems to be no property for the compiler itself.

The compilation has to be mixed, and no post-processing (like some
converting scripts) are allowed. Is this possible or this is a dead
end?

Best regards,
Dominik


More information about the CMake mailing list