[cmake-developers] FindThreads_overhaul topic

Brad King brad.king at kitware.com
Tue Oct 7 10:35:24 EDT 2014


Eike,

This fails on a few dashboard machines:

 http://open.cdash.org/testDetails.php?test=286158250&build=3519076
 CMake Error at /.../Modules/FindThreads.cmake:207 (add_library):
   add_library cannot create imported target "CMake::Threads" because another
   target with the same name already exists.

Instead of using a variable like HAVE_CMAKE_THREADS_TARGET,
just test for the target.  Look at FindOpenGL for an example:

 if(OPENGL_FOUND)
   if(NOT TARGET OpenGL::GL)
     add_library(OpenGL::GL UNKNOWN IMPORTED)

> +  add_library(CMake::Threads INTERFACE IMPORTED GLOBAL)

The imported target should not be GLOBAL.

Thanks,
-Brad



More information about the cmake-developers mailing list