Hi Michael, <div><br></div><div>To apply the flag on a specific target, consider looking at: <a href="https://github.com/commontk/Log4Qt/blob/patched/CMakeLists.txt#L116">https://github.com/commontk/Log4Qt/blob/patched/CMakeLists.txt#L116</a></div>
<div><br></div><div>Hth</div><div>Jc<br><br><div class="gmail_quote">On Mon, Jun 18, 2012 at 8:23 PM, Michael Jackson <span dir="ltr"><<a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks everyone for the help. I really have a typo in my CMake code so thanks for every one for finding that. Basically we build a few libraries which other parts of our code depend on. One particular library has to be a shared library but links statically to the other libraries in order to avoid some STL issues that are on VS 2008 and 2010. I bet these issues are not around on GCC with Linux so I bet I need to basically put in a safeguard to only build shared libraries on Linux and no-where else but I need to test that theory.<br>
I like the source files properties idea but I would need to apply that to just about every source file in our project. For now an all encompassing -fPIC for everything should solve the issue for the moment until a better fix in the form of a rewritten API can be put in.<br>
<br>
Thanks everyone for helping<br>
<div class="im HOEnZb">___________________________________________________________<br>
Mike Jackson Principal Software Engineer<br>
BlueQuartz Software Dayton, Ohio<br>
<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a> <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
<br>
</div><div class="HOEnZb"><div class="h5">On Jun 18, 2012, at 8:09 PM, Alain Leblanc wrote:<br>
<br>
><br>
> Starting to dislike the gmail program.<br>
><br>
> So here's a corrected message , to the list this time:<br>
><br>
> =======================================<br>
><br>
> This is how I've been doing for years. Doesn't mean it's the right way :)<br>
><br>
> Here -O3 and -DLINUX don't apply to your case, and ${SRC_FILES} has been assigned with the file() command. Using ${UNIX}, but ${LINUX} would work as well, maybe.<br>
><br>
> if (${UNIX})<br>
> set (EXTRA_OPTIONS "-O3 -Wno-deprecated -fPIC -DLINUX")<br>
> endif (${UNIX})<br>
> .<br>
> .<br>
> .<br>
> set_source_files_properties(${SRC_FILES}<br>
> PROPERTIES<br>
> COMPILE_FLAGS "${EXTRA_OPTIONS}")<br>
><br>
><br>
><br>
> On 06/18/2012 05:09 PM, Michael Jackson wrote:<br>
>> Linux really wants to have -fPIC for some of my code and I am trying to detect linux and then add this flag for my project but I am having no luck.<br>
>><br>
>> if (LINUX)<br>
>> set(CMAKE_CXX_FLAGS ${CMAKE_CSS_FLAGS} "-fPIC")<br>
>> endif()<br>
>><br>
>> Is this NOT the way I should be doing this? It doesn't really "fell" correct but nothing else (including this) seems to work.<br>
>><br>
>> Help?<br>
>><br>
>> Thanks<br>
>> ___________________________________________________________<br>
>> Mike Jackson Principal Software Engineer<br>
>> BlueQuartz Software Dayton, Ohio<br>
>> <a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a> <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
>><br>
>> --<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>
><br>
> --<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>
<br>
--<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>+1 919 869 8849<br><br>
</div>