On 2008-04-22 21:48-0400 Amitha Perera wrote:

Horacio Sanson wrote:
The problem is that in linux I have to add the sctp library (i.e.
-lsctp) if not compilation fails and in FreeBSD adding that library
would cause the compiler to complain.

if there is a better way to do this I am eager to learn it.

Not necessarily "better", but if sctp exists on Linux, but not on FreeBSD (or more generally, if sctp should be linked against whenever it is found), an option is

find_library( SCTP_LIBRARY sctp )

target_link_libraries( your_exec ${SCTP_LIBRARY} )

Good idea, but I believe you would also need the following modification to
the above logic

find_library( SCTP_LIBRARY sctp )
if(SCTP_LIBRARY)
  target_link_libraries( your_exec ${SCTP_LIBRARY} )
endif(SCTP_LIBRARY)

The reason for the extra logic is that if libsctp is not found then
SCTP_LIBRARY with be set to "SCTP_LIBRARY-NOTFOUND" which would screw up "target_link_libraries" without the "if" protection.

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
__________________________
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to