<div dir="ltr"><div><div><div>Thank you Jakub for reply. The build environment is used by group of colleges distributed across the glob. Therefore I would like to avoid new rules<br>like enter new shell before build as this will change the way how they are  doing the daily job (means: cmake .. ; make ).  Since build with cmake<br>
is two stage process, first cmake and second make, any shell variables set in cmake call via:   set( ENV{PATH} ... will be lost in the context of make process.<br><br></div>The working solution is to use wrapper which will get options without quotation and pass to scl with using of quota. I will go with this option if can't provide<br>
</div>quotation with using of CMAKE_C_COMPILE_OBJECT. The issue that i see right now is that rule defined by CMAKE_C_COMPILE_OBJECT is lost in try_compile call<br><br></div>Best regards, Tomasz Majchrowski.<br><div><div><div>
<div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-12 8:26 GMT+01:00 Jakub Zakrzewski <span dir="ltr"><<a href="mailto:jzakrzewski@e2e.ch" target="_blank">jzakrzewski@e2e.ch</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi.<br>
What scl enable devtoolset-2 does, is basically change the environment for the command. I use one of two techniques to make it working. When doing manual builds, I simply:<br>
scl enable devtoolset-2 bash<br>
And do everything from the new shell. On our CI, I put the following in build script (before calling cmake):<br>
. /opt/rh/devtoolset-2/enable<br>
As there is no magic but only environment variables involved, you can probably set them all using -DCMAKE_... options. Just look at the script and set, what you need.<br>
Remember, that devtoolset-2 is really just GNU Toolset in 4.8 version installed in non-standard location.<br>
<br>
--<br>
Gruesse,<br>
Jakub<br>
<br>
<br>
<br>
<br>
<br>
From: CMake [mailto:<a href="mailto:cmake-bounces@cmake.org">cmake-bounces@cmake.org</a>] On Behalf Of Tomasz Majchrowski<br>
Sent: Dienstag, 11. März 2014 19:44<br>
To: <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><br>
Subject: [CMake] wrapper around real compiler<br>
<div class=""><div class="h5"><br>
Dear All,<br>
I found cmake provides many techniques to integrate tools like distcc, ccache into the build system. In particular variables like the following could be used:<br>
<br>
-D CMAKE_C_COMPILER="ccache" -D CMAKE_C_COMPILER_ARG1="gcc"<br>
The picture becomes more complicated when the tools around the real compiler requires "special" syntax. As an example the RedHat's scl is such a one as it's requires quotation of the complete compiler line:<br>

<br>
 scl enable devtoolset-2 'g++ -o output_file source_file...'<br>
Details: <a href="https://access.redhat.com/site/documentation/en-US/Red_Hat_Developer_Toolset/2/html/User_Guide/sect-GCC-CPP.html" target="_blank">https://access.redhat.com/site/documentation/en-US/Red_Hat_Developer_Toolset/2/html/User_Guide/sect-GCC-CPP.html</a><br>

<br>
I was playing with build rules, however didn't success on try_compile which seems to ignore them.<br>
<br>
set ( CMAKE_C_COMPILE_OBJECT    "<CMAKE_C_COMPILER> enable devtoolset-2 ' gcc <DEFINES> <FLAGS> -frandom-seed=<SOURCE>/ -o <OBJECT> -c <SOURCE>' ")<br>
The only working one that I found is to use small bash script which will act as yet another wrapper.<br>
Anyway this solution do not looks "elegant" and I would like to avoid.<br>
<br>
<br>
Can anyone suggest a good method how to cope with this issue ?<br>
--<br>
Pozdrawiam/Best regards/Mit freundlichen Grüßen, Tomasz Majchrowski,<br>
Information Technology and Services Consultant and Contractor<br clear="all"><br>-- <br>Pozdrawiam/Best regards/<span>Mit freundlichen Grüßen, Tomasz Majchrowski</span>,<br>Information Technology and Services Consultant and Contractor

</div></div></blockquote></div></div></div></div></div></div></div>