[LLVMdev] cmake/ninja build failing

Brad King brad.king at kitware.com
Wed Feb 12 08:01:00 PST 2014


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