<div dir="ltr">You can also do compiler flags on a per target basis using `<span style="color:rgb(0,0,0)">set_target_properties`</span>:<br><div><br></div><div><a href="http://www.cmake.org/pipermail/cmake/2006-July/009992.html">http://www.cmake.org/pipermail/cmake/2006-July/009992.html</a><br>
</div><div><br></div><div>I would be concerned about colliding -O flags though. I don't know what the resolution on that is, or if it causes an error, if there is already a -O2 (for instance) given by the default ubuntu build flags. I'm not sure this flag is passed explicitly on the farm or not, but if it is, I don't know what will happen. Just something to look out for and test out I guess.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 22, 2013 at 2:10 PM, Austin Hendrix <span dir="ltr"><<a href="mailto:ahendrix@willowgarage.com" target="_blank">ahendrix@willowgarage.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Most of the documentation I was reading regarding CMAKE_BUILD_TYPE<br>
says that it should not be set by packages, and should be set by users<br>
at configure or build time, so I was hesitant to use it for exactly<br>
the reasons you describe.<br>
<br>
Since setting CMAKE_BUILD_TYPE seems like a bad idea, and the packages<br>
I'm building should have optimizations turned on regardless of whether<br>
they're built by a user from source or on the farm, and I don't care<br>
about the other flags that are set by the Release build type, I did a<br>
little more digging and found that I can add the optimization flag to<br>
my build with:<br>
<br>
add_definitions(-O3)<br>
<br>
Which is set for my project and all subdirectories, but shouldn't<br>
affect other cmake packages in the same workspace.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
-Austin<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Thu, Jul 18, 2013 at 11:17 AM, Tully Foote <<a href="mailto:tfoote@osrfoundation.org">tfoote@osrfoundation.org</a>> wrote:<br>
> I believe the buildfarm already runs Release.<br>
><br>
> In general you don't want to set the build type from CMake that should be a<br>
> setting of the environment so that the person building the packages can<br>
> choose what build type they want.  It is very ugly to be required to patch<br>
> the source of a repo to change the build type.  As we move toward supporting<br>
> cross compilation and leveraging the out of source builds, we need to get<br>
> better about not putting build parameters into the source.<br>
><br>
> The correct place to force this setting for the debians for example is in<br>
> the debian/rules file.<br>
><br>
> Tully<br>
><br>
><br>
> On Thu, Jul 18, 2013 at 9:24 AM, William Woodall <<a href="mailto:william@osrfoundation.org">william@osrfoundation.org</a>><br>
> wrote:<br>
>><br>
>> If you set the CMAKE_BUILD_TYPE, you should do it in a already defined<br>
>> guard:<br>
>><br>
>> if(NOT DEFINED CMAKE_BUILD_TYPE)<br>
>>   set(CMAKE_BUILD_TYPE Release)<br>
>> endif()<br>
>><br>
>> That way it can still be explicitly overridden if desired.<br>
>><br>
>><br>
>> On Thu, Jul 18, 2013 at 12:31 AM, Ruben Smits<br>
>> <<a href="mailto:ruben.smits@intermodalics.eu">ruben.smits@intermodalics.eu</a>> wrote:<br>
>>><br>
>>> Hi Austin,<br>
>>><br>
>>><br>
>>> On Thu, Jul 18, 2013 at 4:25 AM, Austin Hendrix<br>
>>> <<a href="mailto:ahendrix@willowgarage.com">ahendrix@willowgarage.com</a>> wrote:<br>
>>>><br>
>>>> I have a few packages containing realtime controllers that were<br>
>>>> previously built with:<br>
>>>> set(ROS_BUILD_TYPE Release), which among other things enabled<br>
>>>> optimizations as part of the build process.<br>
>>>><br>
>>>> Since the catkin doesn't supply a replacement for ROS_BUILD_TYPE, I've<br>
>>>> omitted it when catkinizing packages, but I'm discovering now that<br>
>>>> packages compiled on the build farm are not sufficiently optimized for<br>
>>>> my use case.<br>
>>>><br>
>>>> Is there a way to enable optimizations or the Release build type,<br>
>>>> either on the farm as a whole, in bloom, or in my packages?<br>
>>>><br>
>>><br>
>>> For plain cmake packages or catkin you can use the CMAKE_BUILD_TYPE<br>
>>> variable which takes the exact same values as rosbuilds ROS_BUILD_TYPE<br>
>>> variable:<br>
>>><br>
>>> set(CMAKE_BUILD_TYPE Release)<br>
>>><br>
>>> see <a href="http://www.cmake.org/Wiki/CMake_Useful_Variables#Compilers_and_Tools" target="_blank">http://www.cmake.org/Wiki/CMake_Useful_Variables#Compilers_and_Tools</a><br>
>>> for more info<br>
>>><br>
>>> Ruben<br>
>>><br>
>>>><br>
>>>> -Austin<br>
>>>> _______________________________________________<br>
>>>> Ros-release mailing list<br>
>>>> <a href="mailto:Ros-release@code.ros.org">Ros-release@code.ros.org</a><br>
>>>> <a href="https://code.ros.org/mailman/listinfo/ros-release" target="_blank">https://code.ros.org/mailman/listinfo/ros-release</a><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Ruben Smits, Phd<br>
>>> Chief Technology Officer<br>
>>> Intermodalics BVBA<br>
>>> <a href="tel:%2B32479511786" value="+32479511786">+32479511786</a><br>
>>> <a href="http://www.intermodalics.eu" target="_blank">www.intermodalics.eu</a><br>
>>><br>
>>> _______________________________________________<br>
>>> Ros-release mailing list<br>
>>> <a href="mailto:Ros-release@code.ros.org">Ros-release@code.ros.org</a><br>
>>> <a href="https://code.ros.org/mailman/listinfo/ros-release" target="_blank">https://code.ros.org/mailman/listinfo/ros-release</a><br>
>>><br>
>><br>
>><br>
>><br>
>> --<br>
>> William Woodall<br>
>> ROS Development Team<br>
>> <a href="mailto:william@osrfoundation.org">william@osrfoundation.org</a><br>
>> <a href="http://williamjwoodall.com/" target="_blank">http://williamjwoodall.com/</a><br>
>><br>
>> _______________________________________________<br>
>> Ros-release mailing list<br>
>> <a href="mailto:Ros-release@code.ros.org">Ros-release@code.ros.org</a><br>
>> <a href="https://code.ros.org/mailman/listinfo/ros-release" target="_blank">https://code.ros.org/mailman/listinfo/ros-release</a><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> Ros-release mailing list<br>
> <a href="mailto:Ros-release@code.ros.org">Ros-release@code.ros.org</a><br>
> <a href="https://code.ros.org/mailman/listinfo/ros-release" target="_blank">https://code.ros.org/mailman/listinfo/ros-release</a><br>
><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>William Woodall<div>ROS Development Team</div><div><a href="mailto:william@osrfoundation.org" target="_blank">william@osrfoundation.org</a></div><div>
<a href="http://williamjwoodall.com/" target="_blank">http://williamjwoodall.com/</a></div>
</div>