I have no idea why this would occur, but with CMake 2.8.2 on x86_64 I&#39;m getting strange behavior with check_function_exists. Namely, if I perform the sequence<div><br></div><div>set(CMAKE_REQUIRED_LIBRARIES ${MATH_LIBS})</div>
<div>check_function_exists(daxpy HAVE_DAXPY)</div><div><br></div><div>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!</div>
<div><br></div><div>Output with libpthread.so:</div><div><br></div><div><div>-- 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</div>
<div>-- Looking for daxpy</div><div>-- Looking for daxpy - found</div></div><div><br></div><div><div>Output with libpthread.a:</div><div><br></div><div><div>-- 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</div>
<div>-- Looking for daxpy</div><div>-- Looking for daxpy - not found</div></div></div><div><br></div><div><br>Any ideas what would be causing this strange behavior? And while I&#39;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.</div>
<div><br></div><div>I apologize in advance if I&#39;ve missed something obvious...</div><div><br>Jack</div>