[CMake] CMAKE_C_COMPILE_OBJECT <FLAGS> vs <INCLUDES>

Robert Maynard robert.maynard at kitware.com
Fri Jul 1 09:09:20 EDT 2016


Sorry I had misread that you where still having this problem with
CMake 3.4,  not that it had resolved your issue.

On Thu, Jun 30, 2016 at 4:36 PM, Sam Cristall <cristall at eleveneng.com> wrote:
> Hi Robert,
>
> Yes, we are adding the Keil C8051 compiler, which is very old and uses a very unique command line syntax compared to the others supported by CMake.  Also, it's Windows only but Wine works -- so we optionally add Wine on non-Windows platforms.  An example would be:
>
> wine C51.exe INCDIR(/path/to/dir/1/, /path/to/dir/2/) DEBUG DEFINE(FOO_FLAG) OBJECT(/path/to/output.obj) /path/to/source.c
>
> To achieve this, we use a wrapper cmake script with the following:
>
> set(CMAKE_C_COMPILE_OBJECT
> "cmake\
>  -DWINE=${WINE}\
>  -DCOMPILER=<CMAKE_C_COMPILER>\
>  -DSOURCE=<SOURCE>\
>  -DINCLUDES=\"<INCLUDES>\"\
>  -DFLAGS=\"<DEFINES> <FLAGS>\"\
>  -DOBJECT=<OBJECT>\
>  -P \"${CMAKE_CURRENT_LIST_DIR}/C8051Compile.cmake\""
> )
>
> It was important that <INCLUDES> be separate, as its form is significantly different than most compilers.  Prior to cmake 3.4, it would be very difficult to handle this, since <FLAGS> would append the includes as a list of directories, and there is no CMAKE_INCLUDE_FLAG suffix variable (need a closing bracket for INCDIR).
>
>
>> On Jun 30, 2016, at 2:23 PM, Robert Maynard <robert.maynard at kitware.com> wrote:
>>
>> Hi,
>>
>> Can you explain what the goal of your compilation wrappers are? Are
>> you trying to add a new compiler?
>>
>>
>>
>> On Wed, Jun 29, 2016 at 1:41 PM, Sam Cristall <cristall at eleveneng.com> wrote:
>>> Looks like this was just a change in CMake 3.4.  Updated to latest, and everything is working.
>>>> On Jun 28, 2016, at 5:19 PM, Sam Cristall <cristall at eleveneng.com> wrote:
>>>>
>>>> I'm trying to implement a cross compilation wrapper and hit a snag with CMAKE_C_COMPILE_OBJECT.  I've found that on OSX / Linux (Makefile Generator), <INCLUDES> and <FLAGS> work as expected, however on Windows (MinGW Makefile Generator), <FLAGS> has both the flags and includes, whereas <INCLUDES> is undefined.  Is this expected?
>>>>
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>>
>>> CMake Support: http://cmake.org/cmake/help/support.html
>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/cmake
>


More information about the CMake mailing list