You should use ExternalProject, and possibly wrapper scripts to set environment variables for the projects that need to use the different compiler. (CC, CXX, FC env vars should be set during the configure stage, or you can pass them in as -D args to cmake)<br>
<br>CMake does not support changing the compiler in a sub-portion of the build tree.<br><br><br><div class="gmail_quote">On Tue, Feb 15, 2011 at 11:23 AM, Dominik Szczerba <span dir="ltr"><<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I need to compile a few subprojects (each is a subfolder with one<br>
library and a corresponding CMakeLists.txt) with the Intel compiler<br>
while the rest of the libraries (organized the same way), including<br>
the executable, using the system compiler (GNU on linux, VC on<br>
Windows). I tried two solutions to no avail:<br>
<br>
1) In the subfolder's CMakeLists.txt do like:<br>
<br>
SET(CMAKE_CXX_COMPILER ${INTEL_CXX_COMPILER})<br>
SET(CMAKE_CXX_FLAGS_DEBUG ${INTEL_CXX_FLAGS_DEBUG})<br>
<br>
While this substitutes the CMAKE_CXX* variables correctly with<br>
INTEL_CXX* ones (confirmed by MESSAGE) the actual compilation still<br>
takes place using parent CMAKE_CXX_* variables. This is very<br>
surprising as many other CMake commands respect the subfolder scope.<br>
<br>
2) Properties. There is a way to have ADDITIONAL compile flags, but<br>
not CUSTOM. There seems to be no property for the compiler itself.<br>
<br>
The compilation has to be mixed, and no post-processing (like some<br>
converting scripts) are allowed. Is this possible or this is a dead<br>
end?<br>
<br>
Best regards,<br>
Dominik<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br>