[CMake] OpenMP detection/support

William A. Hoffman billlist at nycap.rr.com
Sat Jul 29 11:09:01 EDT 2006


I am not sure what makes a compiler OpenMP compatible, but you can
use TRY_COMPILE and TRY_RUN to test code fragments.   Most likely that
is what your autotools stuff was doing.  It should be pretty easy
to move the autotools over to cmake.   CMake is very good at having cmake
time options.  The SET, IF, and OPTION commands would be worth looking at.

http://www.cmake.org/HTML/Documentation.html

That should be a good start, if you have more specific questions, just post them.


-Bill


At 04:49 AM 7/29/2006, Crni Gorac wrote:
>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.
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list