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

Alexander Neundorf a.neundorf-work at gmx.net
Wed Nov 7 18:20:04 EST 2007


On Thursday 08 November 2007, Matthew McCormick wrote:
> ---------- 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?

It seems it would be Modules/Platform/mex.cmake which would be read when cmake 
checks the language support.

Alex


More information about the CMake mailing list