[CMake] Differentiate between Linux and FreeBSD

Pau Garcia i Quiles pgquiles at elpauer.org
Wed Apr 23 04:39:03 EDT 2008


Quoting Horacio Sanson <hsanson at gmail.com>:

Either you have not re-run CMake or your CMake is broken. Did you  
install it from Ubuntu packages?

> On Wed, Apr 23, 2008 at 1:53 PM, Alan W. Irwin
> <irwin at beluga.phys.uvic.ca> wrote:
>> 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)
>>
> Running this CMake script gives me:
>
> CMake Error: Error required internal CMake variable not set, cmake may
> be not be built correctly.
> Missing variable is:
> CMAKE_FIND_LIBRARY_PREFIXES
>
> I have cmake from Kubuntu Hardy Heron installed.
>
> Horacio
>>  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 at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)



More information about the CMake mailing list