[CMake] check_function_exists frailty

Jack Poulson jack.poulson at gmail.com
Wed Jan 19 01:44:21 EST 2011


I have no idea why this would occur, but with CMake 2.8.2 on x86_64 I'm
getting strange behavior with check_function_exists. Namely, if I perform
the sequence

set(CMAKE_REQUIRED_LIBRARIES ${MATH_LIBS})
check_function_exists(daxpy HAVE_DAXPY)

whether or not /usr/lib/libpthread.a or /usr/lib/libpthread.so is in the
list changes the answer, even though daxpy is defined in a completely
different library!

Output with libpthread.so:

-- 
MATH_LIBS=/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_scalapack_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_blacs_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_intel_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_intel_thread.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_core.a;/opt/intel/Compiler/11.1/072/lib/intel64/libguide.a;/opt/intel/Compiler/11.1/072/lib/intel64/libiomp5.a;/usr/lib/libpthread.so
-- Looking for daxpy
-- Looking for daxpy - found

Output with libpthread.a:

-- 
MATH_LIBS=/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_scalapack_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_blacs_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_intel_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_intel_thread.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_core.a;/opt/intel/Compiler/11.1/072/lib/intel64/libguide.a;/opt/intel/Compiler/11.1/072/lib/intel64/libiomp5.a;/usr/lib/libpthread.a
-- Looking for daxpy
-- Looking for daxpy - not found


Any ideas what would be causing this strange behavior? And while I'm on the
subject, should check_function_exist work with dynamic libraries? I had to
give up some portability and force find_library to search for the static MKL
libraries just to get the libpthread.so case to work.

I apologize in advance if I've missed something obvious...

Jack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110119/925ab5e2/attachment.htm>


More information about the CMake mailing list