Jack Morrison wrote: > The conditional here: > > https://github.com/Kitware/CMake/blob/master/Modules/CheckIncludeFiles.cmake > #L42 > > causes me issues when called with CMAKE_HAVE_PTHREAD_H in FindThreads. It > evaluates to false, leaving pthread.h to not be found and FindThreads to > fail. > > What is the purpose of this conditional and why would it cause this > FindThreads call to fail?
The idea is to check if whatever is given in variable is not already defined.
So: VARIABLE contains the name of the target variable that should be set with
the test result. If you call check_influde_files(pthread.h PTHR) then
${VARIABLE} will contains "PTHR".
Now if you have
if ("${VARIABLE}" …
this will become
if (PTHR …
because of the explicit expansion. If the variable PTHR has already been set,
then this will be implicitely expanded by CMake again. So, if PTHR contains
TRUE, then this whole line would be finally expanded to
if (TRUE MATCHES "^PTHR$")
which is false, so the block will not be executed again.
And now I wonder why the whole thing isn't turned into a function ;)
Eike
--
signature.asc
Description: This is a digitally signed message part.
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
