[CMake] OpenMP detection/support

Crni Gorac cgorac at gmail.com
Sat Jul 29 04:49:55 EDT 2006


Am trying to switch from autotools to cmake on a project employing
multi-threading; the project is able to use OpenMP for multi-threading
if appropriate compiler available, otherwise it uses POSIX threads
directly.  I can see there exist support for detecting pthreads
library within cmake, and I'm interested is there any kind of support
available for detecting OpenMP capable compiler?  Also, is there a
support with cmake for generating makefiles, or makefile rules that
will make possible to select choosing between compiling project with
various option (choosing between OpenMP and POSIX threads in my case),
for example to put something in CMakeLists.txt file so that I could
select threads approach when generating makefiles, like for example:
  threads=openmp cmake .
or alternatively to select appropriate target when running make:
  make openmp

Thanks.


More information about the CMake mailing list