[CMake] help with space in CMAKE_CXX_FLAGS

Philip Lowman philip at yhbt.com
Tue Oct 6 23:24:32 EDT 2009


On Tue, Oct 6, 2009 at 9:16 PM, Philip Lowman <philip at yhbt.com> wrote:

> On Tue, Oct 6, 2009 at 12:49 PM, Philip Lowman <philip at yhbt.com> wrote:
>
>> I'm trying to do the following but CMake  treats each space in a filename
>> as a separate flag:
>>
>> set(sxsoverride "${CMAKE_CURRENT_SOURCE_DIR}/target_sxs.h")
>> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FI ${sxsoverride}"
>>
>> It fails if there are spaces in the path as CMake seems to expand the
>> entry.  Anyone have any ideas?  Seems buggy to me:
>>
>> Cmtrycompile CMakeError.log:
>>
>> ... /FI "C:/Documents" /FI "and" ...
>> (etc.)
>>
>
> Of course now that I try this at home, I can't replicate my own problem...
>

Found it!  I guess not a lot of people add quotes to CMAKE_C_FLAGS (due to
spaces in a path) and then run compile tests.  Patch attached to bugtracker.
http://public.kitware.com/Bug/view.php?id=9670

Also, for any that are curious, I'm using /FI to workaround this *very*
annoying Microsoft problem that anyone using Visual Studio 2005 should
probably be made aware of, if they aren't already:

http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-vc/11078/Breaking-change-in-MS-DLL-s

"/FI" workaround documented here:
http://tedwvc.wordpress.com/2009/08/10/avoiding-problems-with-vc2005-sp1-security-update-kb971090/

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091006/f913b7fe/attachment.htm>


More information about the CMake mailing list