[CMake] What combinations must be set for *_LINKER_FLAGS?

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Jul 27 02:23:09 EDT 2006


One of our PLplot developers with access to Mac OS X ran into the following
error message for the shared libraries for that platform:

ld: common symbols not allowed with MH_DYLIB output format with the -
multi_module option

I have no idea what constraints there are for Mac OS X linking, but
fortunately, he was able to make an inspired guess and get around the
problem by setting CMAKE_SHARED_LINKER_FLAGS to "-single_module".  I don't
know for sure, but I assume he did that with a -D option.

To make this a permanent fix I am thinking of doing the following:

if(APPLE)
   set(CMAKE_SHARED_LINKER_FLAGS "-single_module" CACHE INTERNAL "")
endif(APPLE)

Is 'CACHE INTERNAL ""' the correct way to set this variable?

What about all the related *_LINKER_FLAGS variables that show up in
CMakeCache.txt?  Is it necessary to set all of DEBUG, MINSIZEREL, RELEASE,
and RELWITHDEBINFO variations as well or is CMAKE_SHARED_LINKER_FLAGS a
"master switch" for all those variations?  We don't want to lose the ability
to link on Mac OS X just when we make a release.

Aside from this one linking issue with the "-single_module" workaround,
everything else seems fine on our Mac OS X platform.  That's an excellent
result when you realize all testing of our new CMake build system was done
on Linux up to now.

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 Yorick front-end to PLplot (yplot.sf.net); 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