[Cmake] Using Cross GCC with VC++ ide

Nitin Gupta ngupta at GlobespanVirata . com
Tue, 17 Jun 2003 16:18:53 +0530


The dependency part I have implemented and its
working correctly now.

As I mentioned earlier, we use a the GCC cross compiler
and VC++ IDE for browsing and editing. Till now
we have been using commercial VC++ plugin which would
set the appropriate environment so that VC++ would invoke
<target>-gcc and other tools(<target>-linker etc). To do
the same with CMake I need to write <target>.cmake which
is similar to Modules\Platform\Windows-cl.cmake and redefines
all the cache variables as desired. The example of this would
be: sparclet-aout.cmake


INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)

SET (CMAKE_BUILD_TOOL msdev CACHE INTERNAL 
     "What is the target build tool cmake is generating for.")

SET (CMAKE_SYSTEM "Win32" CACHE INTERNAL 
     "What system is this.  Result of uname.")

SET (CMAKE_CXX_COMPILER  sparclet-aout-g++ CACHE STRING 
     "Name of C++ compiler used.")

SET (CMAKE_C_COMPILER  sparclet-aout-gcc CACHE STRING 
     "Name of C compiler used.")

...
...

I would include this file in all my projects at top level.

Others who want to use CMake for some other cross development
on Win with VC++ only needs to write <target>.cmake say for
arm-elf-gcc  they need to write arm-elf.cmake and CMake would
oblige with appropriate DSPs and DSWs. [Ofcourse CMake would
emit CUSTOM BUILD for each source file in DSPs.]

Would CMake community like to checkin these changes in mainline
too? May be in some major release as suggested by you!

Regards,
Nitin

> -----Original Message-----
> From: cmake-admin at public . kitware . com
> [mailto:cmake-admin at public . kitware . com]On Behalf Of Bill Hoffman
> Sent: Monday, June 16, 2003 11:45 PM
> To: Nitin Gupta; cmake at public . kitware . com
> Cc: cmake at public . kitware . com
> Subject: RE: [Cmake] Using Cross GCC with VC++ ide
> 
> 
> It is on the board to add the FindDependencies to the c API.
> However, this will most likely not be in cmake until the
> next major release.   So, in the long run that is the way to go,
> but for now, I would stick with what you have working.
> 
> I am not sure I understand the next thing you are talking about.
> What is <target> ?  
> 
> -Bill
>   
> 
> At 11:09 AM 6/16/2003, Nitin Gupta wrote:
> >Thanks a lot for helping this out! It works.
> >
> >Now I'm working towards creating an instance of
> >cmDependInformation by invoking FindDependencies(char *)
> >for each file from the plugin. Then pass the set of file
> >(; separated) to SourceFileSetProperty. For this I think
> >I need to add the a function pointer to cmCAPI cmStaticCAPI
> >in cmcpluginapi.cxx; say char * cmFindDependencies(char *).
> >Or is there already a way of doing this?
> >
> >Then I plan to populate the source file property of each file
> >so that cmLocalVisualStudio6Generator::WriteDSPFile invokes
> >WriteCustomRule() with appropriate args. I think this should
> >take care of all the issues of cross building and browsing
> >in VC++.
> >
> >Since all the build configuration can be kept in a <target>.cmake file
> >in Modules dir as CMake already does of other platforms. It will be good
> >to hide all this extra processing in plugin/cmake itself and the
> >developer need not do extra effort of writing an extra custom
> >command for each source file in its CMakeLists.txt file. Only thing one
> >would need to do is include <target>.cmake file at the top of its
> >CMakeList.txt. So for that the plugin should be able to extract
> >Include files, C flags, link flags, defines, output dir etc.
> >
> >Please let me know your views about this solution.
> >
> >Thanks and Regards,
> >Nitin
> >
> >
> >> -----Original Message-----
> >> From: cmake-admin at public . kitware . com
> >> [mailto:cmake-admin at public . kitware . com]On Behalf Of Bill Hoffman
> >> Sent: Friday, June 13, 2003 7:56 PM
> >> To: Nitin Gupta; cmake at public . kitware . com
> >> Subject: RE: [Cmake] Using Cross GCC with VC++ ide
> >>
> >>
> >> Try this:
> >>
> >> Instead of calling SourceFileAddDepend, use SourceFileSetProperty,
> >> and the property is OBJECT_DEPENDS, and the value would be
> >> the depend.
> >>
> >> Something like this:
> >> info->CAPI->SourceFileSetProperty((void *)
> >>    sf,"OBJECT_DEPENDS", "C:\\ngupta\\test_cmake\\include\\hello.h");
> >>
> >> I think that will work.
> >>
> >> -Bill
> >>
> >>