Warning, /graphics/digikam/core/cmake/macros/MacroOpenMP.cmake is written in an unsupported language. File is not indexed.

0001 # A macro wrapper to find OpenMP library
0002 #
0003 # Syntax:  DETECT_OPENMP()
0004 #
0005 # Once done this will be adjusted:
0006 #
0007 # OPENMP_FOUND     - OpenMP detection flag
0008 # OpenMP_CXX_FLAGS - flags to add to the CXX compiler for OpenMP support
0009 #
0010 # SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier, <caulier dot gilles at gmail dot com>
0011 #
0012 # SPDX-License-Identifier: BSD-3-Clause
0013 #
0014 
0015 macro(DETECT_OPENMP)
0016 
0017     message(STATUS "Looking for OpenMP")
0018 
0019     # NOTE: OpenMP under MacOSX do not support multithreading.
0020 
0021     if(NOT APPLE)
0022 
0023         find_package(OpenMP)
0024 
0025         if(OPENMP_FOUND)
0026 
0027             # Adjust some compiler flags depending of Operating system, that standard cmake find script do not set.
0028 
0029             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
0030 
0031             if("${OpenMP_CXX_FLAGS}" STREQUAL "-fopenmp")
0032                 set(OPENMP_LDFLAGS "-lgomp")
0033             endif()
0034 
0035             if("${OpenMP_CXX_FLAGS}" STREQUAL "-xopenmp")
0036                 set(OPENMP_LDFLAGS "-xopenmp")
0037             endif()
0038 
0039             message(STATUS "OpenMP found with CXX flags: ${OpenMP_CXX_FLAGS}")
0040 
0041         else()
0042 
0043             message(STATUS "OpenMP not found")
0044 
0045         endif()
0046 
0047     else()
0048 
0049         message(STATUS "OpenMP under OSX do not support multithreading.")
0050         message(STATUS "OpenMP detection is disabled.")
0051         set(OPENMP_FOUND FALSE)
0052 
0053     endif()
0054 
0055 endmacro()