[CMake] Platform specific output file advice

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Sep 16 00:06:00 EDT 2007


On 2007-09-16 13:23+1000 Nicholas Yue wrote:

> Hi,
>
>  I have been successfully using CMake with SWIG to compile language
> extensions for Java/Python/Ruby on Linux.
>
> -- for RUBY
> SWIG_ADD_MODULE ( ribclient ruby ribclient.i ParameterList.cpp )
> SWIG_LINK_LIBRARIES ( ribclient utils 3delight ruby )
>
> -- for Java
> SWIG_ADD_MODULE ( ribclient java RIBClient.i ParameterList.cpp )
> SWIG_LINK_LIBRARIES ( ribclient utils 3delight )
>
>  The build produces *.so file on both Linux and OSX but on OSX, Ruby
> extension must end with .bundle and Java extension must be prefix with
> 'lib" and postfix with ".jnilib"
>
>  Manually renaming the file works as the content has been correctly
> compile by the Makefiles generated by CMake.
>
>  My question is should this be abstracted out into CMake as it should
> handle cross platform build or should I use/write a macro to do that?
>
>  If I have to manually intervene, could someone point me to an
> example of how one should rename a given file from within a CMake
> configuration file like CMakeLists.txt.

If its a target (sounds like the case here) then you can use
SET_TARGET_PROPERTIES.  From the documentation of that command....

"The PREFIX and SUFFIX properties override the default target
name prefix (such as "lib") and suffix (such as ".so")"

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list