[CMake] (no subject)

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Mar 31 12:47:50 EDT 2008


On 2008-03-31 11:36+0200 cgen.cmake at laposte.net wrote:

> Hello cmake users.
> I choose cmake to build a big project. This project contains Fortran 77 (the most numerous), C, and C++ source files, and only one executable built from all source files.
> It works well with gnu g77 compiler. But with Absoft compiler, the option -fPIC is used at linking without i ask it. So I get an error : ERROR: Unrecognized arguments: -fPIC I do not find this option in Absoft compiler documentation. I would like to remove -fPIC in linking option but i do not know how.
> Any idea ? Thanks in advance for any answer.
> best regards Christophe

Try

SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "")

I am not sure that will work, but I notice that variable is set to "-fPIC"
quite a few places in ..../Modules/Platform where CMake stores customizations
for particular compilers/linkers.

The problem with setting the CMAKE_SHARED_LIBRARY_Fortran_FLAGS variable is
it only works if you always use the absoft compiler.  A much better approach
would be to have a quick look at the *Fortran* files in ..../Modules to see
how Fortran compiler/linker customization is set up then follow those rules
to set up your own absoft-specific customization file.

PLplot does this as follows:

# Location where PLplot cmake build system first looks for cmake modules.
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)

We then put our two specific compiler customizations in
cmake/modules/Platform/.  These are customization files for windows
compilers and nothing to do with absoft, but you could similarly make your
absoft CMake customizations in your own software project this way.

Once you are satisfied with your absoft customization, then I would urge you
to donate your file to CMake so others will benefit as well.  (IIRC, Arjen
Markus did this for his two PLplot windows compiler customization files for
PLplot a couple of years ago, but apparently the results were lost in the
CMake bug tracker so we will probably make the attempt to donate that work
again once we have verified it works for CMake cvs)

N.B. CMake 2.4.8 Fortran support really sucks (you will require a number of
ugly Fortran workarounds if you use 2.4.8) so I advise you strongly to use
the CMake cvs version (which I checked above for absoft customizations) or
else the recently released CMake 2.6.0 Beta.

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