[CMake] RE: Re: changing object file extension from ".o"

Matthew McCormick matthew.m.mccormick at gmail.com
Wed Nov 7 18:10:34 EST 2007


---------- Forwarded message ----------
From: Matthew McCormick <matthew.m.mccormick at gmail.com>
Date: Nov 7, 2007 5:10 PM
Subject: Re: RE: Re: changing object file extension from ".o"
To: a.neundorf-work at gmx.net

The mex compiler is really a bunch of scripts, shell scripts in unix and
mostly a perl script in Windows, that acts as a frontend to a compiler that
you can choose.  It does the linking of Matlab API's and whatnot
to the shared library, a "MEX-file" that you create.

It is possible to call the compilers and do the extra linking directly, with
some work, but I would like to use the mex
script for portability across versions, ease of use, and cross platform reasons.

I already do quite a bit of tweaking to the default behavior, e.g.,

SET(CMAKE_CXX_COMPILER
"${MATLAB_DIR}/bin/mex.bat"
CACHE FILEPATH
"Use Matlab's mex.bat directly, set up compiler and options there"
FORCE
)
SET(CMAKE_C_COMPILER
"${MATLAB_DIR}/bin/mex.bat"
CACHE FILEPATH
"Use Matlab's mex.bat directly, set up compiler and options there"
FORCE
)
ENDIF(WIN32)

SET(CMAKE_CXX_COMPILE_OBJECT
"mkdir -p <OBJECT_DIR>; <CMAKE_CXX_COMPILER> -outdir <OBJECT_DIR> <FLAGS> -c
<SOURCE> "
)
SET(CMAKE_C_COMPILE_OBJECT
"mkdir -p <OBJECT_DIR>; <CMAKE_C_COMPILER> -outdir <OBJECT_DIR> <FLAGS> -c
<SOURCE> "
)
SET(CMAKE_CXX_CREATE_SHARED_MODULE
"<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> -output <TARGET>
<OBJECTS> <LINK_LIBRARIES>"
)
SET(CMAKE_C_CREATE_SHARED_MODULE
"<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> -output <TARGET>
<OBJECTS> <LINK_LIBRARIES>"
)

What kind of file and where would I add it to cmake?

Thanks :-)

On 11/7/07, Alexander Neundorf < a.neundorf-work at gmx.net> wrote:
>
> On Wednesday 07 November 2007, Matthew McCormick wrote:
> > > > Hi,
> > > >
> > > > Having difficulty changing the object file extension.  In my
> > > > CMakeLists.txtI have
> > > >
> > > > SET(CMAKE_C_OUTPUT_EXTENSION ".obj")
> > > > SET(CMAKE_CXX_OUTPUT_EXTENSION ".obj")
> > > >
> > > > but I still get *.o object files.
> > >
> > > Yes, that's too late in the cmake language setup process. What do you
> > > need that for ?
> > >
> > > Alex
> >
> > I'm trying to work with a compiler where you cannot specify the object
> > extension, the Matlab mex (pseudo) compiler.
> > I tried this,
> >
> > $ CMAKE_C_OUTPUT_EXTENSION=".obj" CMAKE_CXX_OUTPUT_EXTENSION=".obj"
> ccmake
> > ../convert_visualsonics_2_mat_src/
> >
> > but it didn't work.
>
> Yes, this doesn't work.
> I know that Matlab has this mex compiler what does it exactly do ?
> Maybe you need to add a file to cmake so it can handle this compiler.
>
> Alex
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20071107/3619fcc4/attachment-0001.htm


More information about the CMake mailing list