[CMake] Changing the default compiler of VC++

Andreas Pakulat apaku at gmx.de
Mon May 4 09:05:18 EDT 2009


On 04.05.09 17:56:14, ankit jain wrote:
> 2009/5/4 Andreas Pakulat <apaku at gmx.de>
> > On 04.05.09 17:28:48, ankit jain wrote:
> > > Actually I am porting my code on windows but since windows don't
> > understand
> > > the unix libraries iam using third party toolkit mks earlier to build the
> > > code and linking all the headers and libraries of mksnt.
> > >
> > > but now i am not using mks and directly building the code using visual
> > > studio .net 2003. since VC++ uses cl compiler by defualt i want to change
> > it
> > > through cmakelist variable CMAKE_C_COMPILER and CXX variable to the
> > compiler
> > > used by mks i.e cxx.
> > >
> > > But when iam doing so it is still using cl. I am not getting from where
> > it
> > > is taking cl complier and not changing to whatever i want.
> > >
> > > It might feel auckward to some of you that why iam changing to mks
> > compiler
> > > becuase  iwant to check my code whether without opening mks bash if iam
> > > direclty using its compiler will it work or not..
> > >
> > > I request you all to tell me how it can de done so that my VC++ takes cxx
> > > compiler of mks toolkit rather its default cl compiler...
> >
> > I think you can't or I'm misunderstanding what you really want to do. VC++
> > _always_ uses cl as VC++ == cl+link basically. You might be able to get
> > cmake to use the mks compiler by providing an environment in which cl is
> > not available in PATH but the mks compiler.
> >
> > However its not quite clear wether you're already doing that (build your
> > code with mks) and now want to build the same code with cl/VC++ or
> > something else?
> >
> 
> Thanks Andreas for your reply. I already build the code using mks. now i
> want to build the code using cl/VC++. since it gives lots of errors of not
> founding fiels like strings.h unistd.h

Then you need to fix those errors, either your environment is incorrectly
setup (make sure to use the Visual studio command prompt link to get a
properly setup command prompt from where you can run cmake) or the
compiler lacks some of these headers. In the latter case you'll have to
adjust your code and use whatever facilities cl provides. However strings.h
and unistd.h are both part of VC++ so I guess its the broken environment.

> so i thought its good to link it with mks compiler and give path to the
> libraries and header used my mks for windows.. i hope you got it..

That simply won't work and won't help you at all.

Andreas

-- 
You like to form new friendships and make new acquaintances.


More information about the CMake mailing list