Hi all,<div><br></div><div>I've posted this question here:</div><div><br></div><div><a href="http://stackoverflow.com/questions/15804525/how-can-i-programmatically-configure-compiler-for-cmake-via-python-on-windows/15815937">http://stackoverflow.com/questions/15804525/how-can-i-programmatically-configure-compiler-for-cmake-via-python-on-windows/15815937</a></div>
<div><br></div><div>The question is:</div><div><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
I have a python build script I'm using to build a number of projects that are configured via CMake on windows. Previously, we used MSVC to build these projects, and everything was fine. I want to try to incorporate ICC into the build now, via these python scripts. I can choose the native compiler directly in the UI if necessary, but I'd rather do everything programmatically.</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
Problem is, it's failing with either syntax errors, or just not paying attention to the cmake options.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
I can set:</p><pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;width:auto;max-height:600px;line-height:17.600000381469727px">
<code style="margin:0px;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif">"CMAKE_CXX_COMPILER:PATH":"C:/Program Files (x86)/Intel/Composer XE 2013/bin/intel64/icl.exe",
"CMAKE_C_COMPILER:PATH":"C:/Program Files (x86)/Intel/Composer XE 2013/bin/intel64/icl.exe"
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
And that's part of a <code style="margin:0px;padding:1px 5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial">cmakeItems</code> array that's then fed into the generation:</p>
<pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;width:auto;max-height:600px;line-height:17.600000381469727px">
<code style="margin:0px;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif">generate(x86Generator, cmakeItems, osName, buildTarget)
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
where the other options are set via command line switches (for <code style="margin:0px;padding:1px 5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial">x86generator</code> and <code style="margin:0px;padding:1px 5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial">buildTarget</code>) or by default (ie, <code style="margin:0px;padding:1px 5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial">osName</code> is detected in the script itself).</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
Before trying anything, I'm running this from a command line prompt where I've run</p><pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;width:auto;max-height:600px;line-height:17.600000381469727px">
<code style="margin:0px;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif">iclvars intel64
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
in the icc bin directory to ensure that all of the icc variables are properly configured, and I can type <code style="margin:0px;padding:1px 5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial">icl</code> on the command line and confirm that it's in the path.</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
Running the above means that the C compiler remains the default msvc compiler.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
I've also tried running:</p><pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;width:auto;max-height:600px;line-height:17.600000381469727px">
<code style="margin:0px;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif">set(CMAKE_C_COMPILER_INIT icl)
set(CMAKE_CXX_COMPILER_INIT icl)
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
but that's giving me a syntax error on the icl portion. I thought that maybe it's a path issue, but doing:</p><pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;width:auto;max-height:600px;line-height:17.600000381469727px">
<code style="margin:0px;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif">set(CMAKE_C_COMPILER_INIT "C:\Program Files (x86)\Intel\Composer XE 2013\bin\intel64\icl")
set(CMAKE_CXX_COMPILER_INIT "C:\Program Files (x86)\Intel\Composer XE 2013\bin\intel64\icl")
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
is also giving me a syntax error.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.600000381469727px">
So how can I programmatically set the C/CXX compiler from a python script calling cmake?</p></div>