[LLVMdev] cmake/ninja build failing

Seth Cantrell seth.cantrell at gmail.com
Wed Feb 12 20:15:47 PST 2014


Well, I updated to cmake 2.8.12.2 but the result of changing that COMPILE_FLAGS to COMPILE_OPTIONS is that quotes are applied incorrectly: quotes are added surrounding the entire set of flags rather than around each individual item in the list. Obviously the build doesn't work (with the compiler looking for files named " -m64 ... ") but checking the relevant build command in build.ninja at least shows me that the relevant path is indeed getting added via set_target_compile_flags: the path is now part of one of these quoted strings.

On Feb 12, 2014, at 11:01 AM, Brad King <brad.king at kitware.com> wrote:

> On 02/12/2014 02:04 AM, Seth Cantrell wrote:
>>>  set(DARWIN_iossim_CFLAGS 
>>>   -mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR})
>> 
>> where IOSSIM_SDK_DIR is the path including spaces and parens.
> 
> It looks like the _CFLAGS values are used in the module
> cmake/Modules/CompilerRTUtils.cmake:
> 
> function(set_target_compile_flags target)
>   foreach(arg ${ARGN})
>     set(argstring "${argstring} ${arg}")
>   endforeach()
>   set_property(TARGET ${target} PROPERTY COMPILE_FLAGS "${argstring}")
> endfunction()
> 
> but that makes no attempt to escape or quote anything.
> 
> The COMPILE_FLAGS target property was a very early CMake feature
> and is treated as a raw string to put on the command line.  That
> is why it needs manual escaping.
> 
> CMake 2.8.12 added the COMPILE_OPTIONS property and supporting command:
> 
> http://www.cmake.org/cmake/help/v2.8.12/cmake.html#prop_tgt:COMPILE_OPTIONS
> http://www.cmake.org/cmake/help/v2.8.12/cmake.html#command:target_compile_options
> 
> The property holds a ;-list of options to be passed to the compiler.
> CMake handles conversion to a command-line string with all needed
> escaping.
> 
> -Brad
> 





More information about the llvm-dev mailing list