Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/cmake/Modules/FindTBB.cmake

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /cmake/Modules/FindTBB.cmake (Version 11.3.0) and /cmake/Modules/FindTBB.cmake (Version 11.0.p1)


  1 # - Find ThreadingBuildingBlocks include dirs  <<   1 # Module for locating Intel's Threading Building Blocks (TBB).
  2 # Use this module by invoking find_package wit <<   2 #
  3 #  find_package(TBB                            <<   3 # Customizable variables:
  4 #    [REQUIRED]             # Fail with error  <<   4 #   TBB_ROOT_DIR
  5 #    )                      #                  <<   5 #     Specifies TBB's root directory.
  6 # Once done, this will define                  <<   6 #
  7 #                                              <<   7 # Read-only variables:
  8 #  TBB_FOUND - system has TBB                  <<   8 #   TBB_FOUND
  9 #  TBB_INCLUDE_DIRS - the TBB include director <<   9 #     Indicates whether the library has been found.
 10 #  TBB_LIBRARIES - TBB libraries to be lined,  <<  10 #
 11 #                  malloc proxy                <<  11 #   TBB_INCLUDE_DIRS
 12 #  TBB::tbb - imported target for the TBB libr <<  12 #      Specifies TBB's include directory.
 13 #                                              <<  13 #
 14 #  TBB_VERSION_MAJOR - Major Product Version N <<  14 #   TBB_LIBRARIES
 15 #  TBB_VERSION_MINOR - Minor Product Version N <<  15 #     Specifies TBB libraries that should be passed to target_link_libararies.
 16 #  TBB_INTERFACE_VERSION - Engineering Focused <<  16 #
 17 #  TBB_COMPATIBLE_INTERFACE_VERSION - The olde <<  17 #   TBB_<COMPONENT>_LIBRARIES
 18 #                                     still su <<  18 #     Specifies the libraries of a specific <COMPONENT>.
 19 #                                     focused  <<  19 #
 20 #                                              <<  20 #   TBB_<COMPONENT>_FOUND
 21 #  TBB_MALLOC_FOUND - system has TBB malloc li <<  21 #     Indicates whether the specified <COMPONENT> was found.
 22 #  TBB_MALLOC_INCLUDE_DIRS - the TBB malloc in <<  22 #
 23 #  TBB_MALLOC_LIBRARIES - The TBB malloc libra <<  23 #
 24 #  TBB::malloc - imported target for the TBB m <<  24 # Copyright (c) 2012 Sergiu Dotenco
 25 #                                              <<  25 #
 26 #  TBB_MALLOC_PROXY_FOUND - system has TBB mal <<  26 # Permission is hereby granted, free of charge, to any person obtaining a copy
 27 #  TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB mal <<  27 # of this software and associated documentation files (the "Software"), to deal
 28 #  TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc <<  28 # in the Software without restriction, including without limitation the rights
 29 #  TBB::malloc_proxy - imported target for the <<  29 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 30 #                                              <<  30 # copies of the Software, and to permit persons to whom the Software is
 31 #                                              <<  31 # furnished to do so, subject to the following conditions:
 32 # This module reads hints about search locatio <<  32 #
 33 #  ENV TBB_ARCH_PLATFORM - for eg. set it to " <<  33 # The above copyright notice and this permission notice shall be included in all
 34 #  ENV TBB_ROOT or just TBB_ROOT - root direct <<  34 # copies or substantial portions of the Software.
 35 #  ENV TBB_BUILD_PREFIX - specifies the build  <<  35 #
 36 #                         libraries. Should be <<  36 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 37 #                         and optionally...    <<  37 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 38 #  ENV TBB_BUILD_DIR - if build directory is d <<  38 # FITNESS FOR A PARTTBBLAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 39 #                                              <<  39 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 40 #                                              <<  40 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 41 # Modified by Robert Maynard from the original <<  41 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 42 #                                              <<  42 # SOFTWARE.
 43 #--------------------------------------------- <<  43 
 44 # This file is part of the CMake build system  <<  44 INCLUDE (FindPackageHandleStandardArgs)
 45 #     (Object-oriented Graphics Rendering Engi <<  45 
 46 # For the latest info, see http://www.ogre3d.o <<  46 #------------------------------------------------------------------------------#
 47 #                                              <<  47 #
 48 # The contents of this file are placed in the  <<  48 #   Paths
 49 # free to make use of it in any way you like.  <<  49 #
 50 #--------------------------------------------- <<  50 #------------------------------------------------------------------------------#
 51 #                                              <<  51 
 52 #============================================= <<  52 IF(CMAKE_VERSION VERSION_GREATER 2.8.7)
 53 # Copyright 2010-2012 Kitware, Inc.            <<  53     SET(_TBB_CHECK_COMPONENTS ON)
 54 # Copyright 2012      Rolf Eike Beer <eike@sf- <<  54 ELSE()
 55 #                                              <<  55     SET(_TBB_CHECK_COMPONENTS OFF)
 56 # Distributed under the OSI-approved BSD Licen <<  56 ENDIF()
 57 # see accompanying file COPYING-CMAKE-SCRIPTS  <<  57 
 58 #                                              <<  58 FIND_PATH(TBB_ROOT_DIR
 59 # This software is distributed WITHOUT ANY WAR <<  59   NAMES include/tbb/tbb.h
 60 # implied warranty of MERCHANTABILITY or FITNE <<  60   PATHS ENV TBBROOT
 61 # See the License for more information.        <<  61         ENV TBB40_INSTALL_DIR
 62 #============================================= <<  62         ENV TBB30_INSTALL_DIR
 63                                                <<  63         ENV TBB22_INSTALL_DIR
 64 #============================================= <<  64         ENV TBB21_INSTALL_DIR
 65 #  FindTBB helper functions and macros         <<  65         ENV TBB_ROOT_DIR
 66 #                                              <<  66   DOC "TBB root directory")
 67                                                <<  67 
 68 # Use TBBConfig.cmake if possible.             <<  68 FIND_PATH(TBB_INCLUDE_DIR
 69                                                <<  69   NAMES tbb/tbb.h
 70 set(_tbb_find_quiet)                           <<  70   HINTS ${TBB_ROOT_DIR}
 71 if (TBB_FIND_QUIETLY)                          <<  71   PATH_SUFFIXES include
 72   set(_tbb_find_quiet QUIET)                   <<  72   DOC "TBB include directory")
 73 endif ()                                       <<  73 
 74 set(_tbb_find_components)                      <<  74 #------------------------------------------------------------------------------#
 75 set(_tbb_find_optional_components)             <<  75 #
 76 foreach (_tbb_find_component IN LISTS TBB_FIND <<  76 #   Library suffixes
 77   if (TBB_FIND_REQUIRED_${_tbb_find_component} <<  77 #
 78     list(APPEND _tbb_find_components "${_tbb_f <<  78 #------------------------------------------------------------------------------#
 79   else ()                                      <<  79 
 80     list(APPEND _tbb_find_optional_components  <<  80 IF(MSVC11)
 81   endif ()                                     <<  81   SET(_TBB_COMPILER vc11)
 82 endforeach ()                                  <<  82 ELSEIF(MSVC10)
 83 unset(_tbb_find_component)                     <<  83   SET(_TBB_COMPILER vc10)
 84 find_package(TBB CONFIG ${_tbb_find_quiet}     <<  84 ELSEIF(MSVC90)
 85   COMPONENTS ${_tbb_find_components}           <<  85   SET(_TBB_COMPILER vc9)
 86   OPTIONAL_COMPONENTS ${_tbb_find_optional_com <<  86 ELSEIF(MSVC80)
 87 unset(_tbb_find_quiet)                         <<  87   SET(_TBB_COMPILER vc8)
 88 unset(_tbb_find_components)                    <<  88 ELSEIF(WIN32)
 89 unset(_tbb_find_optional_components)           <<  89   SET(_TBB_COMPILER vc_mt)
 90 if (TBB_FOUND)                                 <<  90 ENDIF(MSVC11)
 91   return ()                                    <<  91 
 92 endif ()                                       <<  92 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
 93                                                <<  93   SET(_TBB_POSSIBLE_LIB_SUFFIXES lib/intel64/${_TBB_COMPILER})
 94 #============================================= <<  94   SET(_TBB_POSSIBLE_BIN_SUFFIXES bin/intel64/${_TBB_COMPILER})
 95 # Fix the library path in case it is a linker  <<  95 ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
 96 #============================================= <<  96   SET(_TBB_POSSIBLE_LIB_SUFFIXES lib/ia32/${_TBB_COMPILER})
 97 function(tbb_extract_real_library library real <<  97   SET(_TBB_POSSIBLE_BIN_SUFFIXES bin/ia32/${_TBB_COMPILER})
 98   if(NOT UNIX OR NOT EXISTS ${library})        <<  98 ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
 99     set(${real_library} "${library}" PARENT_SC <<  99 
100     return()                                   << 100 LIST(APPEND _TBB_POSSIBLE_LIB_SUFFIXES lib/$ENV{TBB_ARCH_PLATFORM})
101   endif()                                      << 101 
102                                                << 102 IF(UNIX)
103   #Read in the first 4 bytes and see if they a << 103     FOREACH(_VERSION 4.7 4.4 4.1)
104   set(_elf_magic "7f454c46")                   << 104         IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
105   file(READ ${library} _hex_data OFFSET 0 LIMI << 105             LIST(APPEND _TBB_POSSIBLE_LIB_SUFFIXES lib/intel64/gcc${_VERSION})
106   if(_hex_data STREQUAL _elf_magic)            << 106         ELSE()
107     #we have opened a elf binary so this is wh << 107             LIST(APPEND _TBB_POSSIBLE_LIB_SUFFIXES lib/ia32/gcc${_VERSION})
108     #we should link to                         << 108         ENDIF()
109     set(${real_library} "${library}" PARENT_SC << 109     ENDFOREACH()
110     return()                                   << 110 ENDIF()
111   endif()                                      << 111 
112                                                << 112 #------------------------------------------------------------------------------#
113   file(READ ${library} _data OFFSET 0 LIMIT 10 << 113 #
114   if("${_data}" MATCHES "INPUT \\(([^(]+)\\)") << 114 #   TBB library
115     #extract out the .so name from REGEX MATCH << 115 #
116     set(_proper_so_name "${CMAKE_MATCH_1}")    << 116 #------------------------------------------------------------------------------#
117                                                << 117 
118     #construct path to the real .so which is p << 118 FIND_LIBRARY(TBB_LIBRARY_RELEASE
119     #as the input file                         << 119   NAMES tbb
120     get_filename_component(_so_dir "${library} << 120   HINTS ${TBB_ROOT_DIR}
121     set(${real_library} "${_so_dir}/${_proper_ << 121   PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
122   else()                                       << 122   DOC "TBB release library")
123     #unable to determine what this library is  << 123 
124     #and pass it unmodified.                   << 124 FIND_LIBRARY(TBB_LIBRARY_DEBUG
125     set(${real_library} "${library}" PARENT_SC << 125   NAMES tbb_debug
126   endif()                                      << 126   HINTS ${TBB_ROOT_DIR}
127 endfunction()                                  << 127   PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
128                                                << 128   DOC "TBB debug library")
129 #============================================= << 129 
130 # Do the final processing for the package find << 130 IF(TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)
131 #============================================= << 131     IF(NOT TBB_LIBRARY)
132 macro(findpkg_finish PREFIX TARGET_NAME)       << 132         SET(TBB_LIBRARY optimized ${TBB_LIBRARY_RELEASE} debug ${TBB_LIBRARY_DEBUG}
133   if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBR << 133             CACHE DOC "TBB library" FORCE)
134     set(${PREFIX}_FOUND TRUE)                  << 134     ENDIF(NOT TBB_LIBRARY)
135     set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_IN << 135     LIST(APPEND _TBB_ALL_LIBS optimized ${TBB_LIBRARY_RELEASE} debug ${TBB_LIBRARY_DEBUG})
136     set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRA << 136 ELSE()
137   else ()                                      << 137     IF(TBB_LIBRARY_DEBUG)
138     if (${PREFIX}_FIND_REQUIRED AND NOT ${PREF << 138         IF(NOT TBB_LIBRARY)
139       message(FATAL_ERROR "Required library ${ << 139             SET(TBB_LIBRARY ${TBB_LIBRARY_DEBUG} CACHE FILEPATH "TBB library" FORCE)
140     endif ()                                   << 140         ENDIF(NOT TBB_LIBRARY)
141   endif ()                                     << 141         LIST(APPEND _TBB_ALL_LIBS ${TBB_LIBRARY_DEBUG})
142                                                << 142     ENDIF(TBB_LIBRARY_DEBUG)
143   if (NOT TARGET "TBB::${TARGET_NAME}")        << 143 
144     if (${PREFIX}_LIBRARY_RELEASE)             << 144     IF(TBB_LIBRARY_RELEASE)
145       tbb_extract_real_library(${${PREFIX}_LIB << 145         IF(NOT TBB_LIBRARY)
146     endif ()                                   << 146             SET(TBB_LIBRARY ${TBB_LIBRARY_RELEASE} CACHE FILEPATH "TBB library" FORCE)
147     if (${PREFIX}_LIBRARY_DEBUG)               << 147         ENDIF(NOT TBB_LIBRARY)
148       tbb_extract_real_library(${${PREFIX}_LIB << 148         LIST(APPEND _TBB_ALL_LIBS ${TBB_LIBRARY_RELEASE})
149     endif ()                                   << 149     ENDIF()
150     add_library(TBB::${TARGET_NAME} UNKNOWN IM << 150 ENDIF(TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)
151     set_target_properties(TBB::${TARGET_NAME}  << 151 
152       INTERFACE_INCLUDE_DIRECTORIES "${${PREFI << 152 
153     if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_ << 153 #------------------------------------------------------------------------------#
154       set_target_properties(TBB::${TARGET_NAME << 154 #
155         IMPORTED_LOCATION "${real_release}"    << 155 #   Components
156         IMPORTED_LOCATION_DEBUG "${real_debug} << 156 #
157         IMPORTED_LOCATION_RELEASE "${real_rele << 157 #------------------------------------------------------------------------------#
158     elseif (${PREFIX}_LIBRARY_RELEASE)         << 158 
159       set_target_properties(TBB::${TARGET_NAME << 159 SET(_TBB_POSSIBLE_COMPONENTS preview malloc malloc_proxy)
160         IMPORTED_LOCATION "${real_release}")   << 160 
161     elseif (${PREFIX}_LIBRARY_DEBUG)           << 161 FOREACH(_TBB_COMPONENT ${TBB_FIND_COMPONENTS})
162       set_target_properties(TBB::${TARGET_NAME << 162 
163         IMPORTED_LOCATION "${real_debug}")     << 163     STRING(REPLACE "_debug" "" _TBB_COMPONENT ${_TBB_COMPONENT})
164     endif ()                                   << 164     STRING(TOUPPER ${_TBB_COMPONENT} _TBB_COMPONENT_UPPER)
165   endif ()                                     << 165     SET(_TBB_LIBRARY_BASE TBB_${_TBB_COMPONENT_UPPER}_LIBRARY)
166                                                << 166 
167   #mark the following variables as internal va << 167     IF(${_TBB_COMPONENT} MATCHES "malloc*")
168   mark_as_advanced(${PREFIX}_INCLUDE_DIR       << 168         SET(_TBB_LIBRARY_NAME tbb${_TBB_COMPONENT})
169                    ${PREFIX}_LIBRARY           << 169     ELSE()
170                    ${PREFIX}_LIBRARY_DEBUG     << 170         SET(_TBB_LIBRARY_NAME tbb_${_TBB_COMPONENT})
171                    ${PREFIX}_LIBRARY_RELEASE)  << 171     ENDIF()
172 endmacro()                                     << 172 
173                                                << 173     FIND_LIBRARY(${_TBB_LIBRARY_BASE}_RELEASE
174 #============================================= << 174         NAMES ${_TBB_LIBRARY_NAME}
175 # Generate debug names from given release name << 175         HINTS ${TBB_ROOT_DIR}
176 #============================================= << 176         PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
177 macro(get_debug_names PREFIX)                  << 177         DOC "TBB ${_TBB_COMPONENT} release library")
178   foreach(i ${${PREFIX}})                      << 178 
179     set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i << 179     FIND_LIBRARY(${_TBB_LIBRARY_BASE}_DEBUG
180   endforeach()                                 << 180         NAMES ${_TBB_LIBRARY_NAME}_debug
181 endmacro()                                     << 181         HINTS ${TBB_ROOT_DIR}
182                                                << 182         PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
183 #============================================= << 183         DOC "TBB ${_TBB_COMPONENT} debug library")
184 # See if we have env vars to help us find tbb  << 184 
185 #============================================= << 185     MARK_AS_ADVANCED (${_TBB_LIBRARY_BASE} ${_TBB_LIBRARY_BASE}_DEBUG)
186 macro(getenv_path VAR)                         << 186 
187    set(ENV_${VAR} $ENV{${VAR}})                << 187     # default assumption
188    # replace won't work if var is blank        << 188     SET(TBB_${_TBB_COMPONENT_UPPER}_FOUND ON)
189    if (ENV_${VAR})                             << 189     SET(TBB_${_TBB_COMPONENT}_FOUND ON)
190      string( REGEX REPLACE "\\\\" "/" ENV_${VA << 190 
191    endif ()                                    << 191     IF(${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE)
192 endmacro()                                     << 192         SET(${_TBB_LIBRARY_BASE}
193                                                << 193             debug ${${_TBB_LIBRARY_BASE}_DEBUG}
194 #============================================= << 194             optimized ${${_TBB_LIBRARY_BASE}_RELEASE} CACHE STRING
195 # Couple a set of release AND debug libraries  << 195             "TBB ${_TBB_COMPONENT} library")
196 #============================================= << 196         LIST(APPEND _TBB_ALL_LIBS
197 macro(make_library_set PREFIX)                 << 197             optimized ${${_TBB_LIBRARY_BASE}_RELEASE}
198   if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG)   << 198             debug ${${_TBB_LIBRARY_BASE}_DEBUG})
199     set(${PREFIX} optimized ${${PREFIX}_RELEAS << 199         LIST(APPEND TBB_FOUND_COMPONENTS ${_TBB_LIBRARY_BASE} ${_TBB_LIBRARY_BASE}_debug)
200   elseif (${PREFIX}_RELEASE)                   << 200         SET(TBB_${_TBB_COMPONENT_UPPER}_LIBRARY ${${_TBB_LIBRARY_BASE}_RELEASE})
201     set(${PREFIX} ${${PREFIX}_RELEASE})        << 201     ELSEIF(${_TBB_LIBRARY_BASE}_DEBUG)
202   elseif (${PREFIX}_DEBUG)                     << 202         SET(${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_DEBUG})
203     set(${PREFIX} ${${PREFIX}_DEBUG})          << 203         LIST(APPEND _TBB_ALL_LIBS ${${_TBB_LIBRARY_BASE}_DEBUG})
204   endif ()                                     << 204         LIST(APPEND TBB_FOUND_COMPONENTS ${_TBB_LIBRARY_BASE})
205 endmacro()                                     << 205         SET(TBB_${_TBB_COMPONENT_UPPER}_LIBRARY ${${_TBB_LIBRARY_BASE}_DEBUG})
206                                                << 206     ELSEIF(${_TBB_LIBRARY_BASE}_RELEASE)
207                                                << 207         SET(${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_RELEASE}
208 #============================================= << 208             CACHE FILEPATH "TBB ${_TBB_COMPONENT} library")
209 #  Now to actually find TBB                    << 209         LIST(APPEND _TBB_ALL_LIBS ${${_TBB_LIBRARY_BASE}_RELEASE})
210 #                                              << 210         LIST(APPEND TBB_FOUND_COMPONENTS ${_TBB_LIBRARY_BASE}_debug)
211                                                << 211         SET(TBB_${_TBB_COMPONENT_UPPER}_LIBRARY ${${_TBB_LIBRARY_BASE}_RELEASE})
212 # Get path, convert backslashes as ${ENV_${var << 212     ELSE()
213 getenv_path(TBB_ROOT)                          << 213         # Component missing: record it for a later report
214                                                << 214         LIST(APPEND _TBB_MISSING_COMPONENTS ${_TBB_COMPONENT})
215 # initialize search paths                      << 215         SET(TBB_${_TBB_COMPONENT}_FOUND OFF)
216 set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT << 216         SET(TBB_${_TBB_COMPONENT_UPPER}_FOUND OFF)
217 set(TBB_INC_SEARCH_PATH "")                    << 217     ENDIF()
218 set(TBB_LIB_SEARCH_PATH "")                    << 218 
219                                                << 219     IF(${_TBB_LIBRARY_BASE})
220                                                << 220         # setup the TBB_<COMPONENT>_LIBRARIES variable
221 # If user built from sources                   << 221         SET(TBB_${_TBB_COMPONENT_UPPER}_LIBRARIES ${${_TBB_LIBRARY_BASE}})
222 set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX})   << 222     ELSE()
223 if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT)         << 223         LIST(APPEND _TBB_MISSING_LIBRARIES ${_TBB_LIBRARY_BASE})
224   getenv_path(TBB_BUILD_DIR)                   << 224     ENDIF()
225   if (NOT ENV_TBB_BUILD_DIR)                   << 225 
226     set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/buil << 226 ENDFOREACH(_TBB_COMPONENT ${TBB_FIND_COMPONENTS})
227   endif ()                                     << 227 
228                                                << 228 #------------------------------------------------------------------------------#
229   # include directory under ${ENV_TBB_ROOT}/in << 229 #
230   list(APPEND TBB_LIB_SEARCH_PATH              << 230 #   Standard variables
231     ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_r << 231 #
232     ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_d << 232 #------------------------------------------------------------------------------#
233 endif ()                                       << 233 IF(_TBB_ALL_LIBS)
234                                                << 234     SET(TBB_LIBRARIES ${_TBB_ALL_LIBS})
235                                                << 235 ENDIF()
236 # For Windows, let's assume that the user migh << 236 
237 # TBB packages from the main website. These us << 237 IF(TBB_INCLUDE_DIR)
238 # structure (at least for automatically findin << 238     SET(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
239 # on platform and compiler, but we'll do our b << 239 ENDIF()
240 # Not adding the same effort for the precompil << 240 
241 # have different versions for CC compiler vers << 241 IF(DEFINED _TBB_MISSING_COMPONENTS AND _TBB_CHECK_COMPONENTS)
242 # will never adequately match the user's setup << 242     IF(NOT TBB_FIND_QUIETLY)
243 # to detect the "best" version to use. The use << 243         MESSAGE(STATUS "One or more TBB components were not found:")
244 # select the right files. (Chances are the dis << 244         # Display missing components indented, each on a separate line
245 # custom version of tbb, anyway, so the proble << 245         FOREACH(_TBB_MISSING_COMPONENT ${_TBB_MISSING_COMPONENTS})
246 if (WIN32 AND MSVC)                            << 246             MESSAGE(STATUS "  " ${_TBB_MISSING_COMPONENT})
247   set(COMPILER_PREFIX "vc7.1")                 << 247         ENDFOREACH(_TBB_MISSING_COMPONENT ${_TBB_MISSING_COMPONENTS})
248   if (MSVC_VERSION EQUAL 1400)                 << 248     ENDIF(NOT TBB_FIND_QUIETLY)
249     set(COMPILER_PREFIX "vc8")                 << 249 ENDIF(DEFINED _TBB_MISSING_COMPONENTS AND _TBB_CHECK_COMPONENTS)
250   elseif(MSVC_VERSION EQUAL 1500)              << 250 
251     set(COMPILER_PREFIX "vc9")                 << 251 #------------------------------------------------------------------------------#
252   elseif(MSVC_VERSION EQUAL 1600)              << 252 #
253     set(COMPILER_PREFIX "vc10")                << 253 #   Library's version
254   elseif(MSVC_VERSION EQUAL 1700)              << 254 #
255     set(COMPILER_PREFIX "vc11")                << 255 #------------------------------------------------------------------------------#
256   elseif(MSVC_VERSION EQUAL 1800)              << 256 
257     set(COMPILER_PREFIX "vc12")                << 257 SET(_TBB_VERSION_HEADER ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h)
258   elseif(MSVC_VERSION GREATER_EQUAL 1900)      << 258 
259     set(COMPILER_PREFIX "vc14")                << 259 IF(EXISTS ${_TBB_VERSION_HEADER})
260   endif ()                                     << 260     FILE(READ ${_TBB_VERSION_HEADER} _TBB_VERSION_CONTENTS)
261                                                << 261 
262   # for each prefix path, add ia32/64\${COMPIL << 262     STRING(REGEX REPLACE ".*#define TBB_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1"
263   foreach (dir IN LISTS TBB_PREFIX_PATH)       << 263         TBB_VERSION_MAJOR "${_TBB_VERSION_CONTENTS}")
264     if (CMAKE_CL_64)                           << 264     STRING(REGEX REPLACE ".*#define TBB_VERSION_MINOR[ \t]+([0-9]+).*" "\\1"
265       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 265         TBB_VERSION_MINOR "${_TBB_VERSION_CONTENTS}")
266       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 266 
267       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 267     SET(TBB_VERSION ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR})
268       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 268     SET(TBB_VERSION_COMPONENTS 2)
269     else ()                                    << 269 ENDIF()
270       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 270 
271       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 271 IF(WIN32)
272     endif ()                                   << 272     FIND_PROGRAM(LIB_EXECUTABLE NAMES lib
273   endforeach ()                                << 273         HINTS
274 endif ()                                       << 274             "$ENV{VS110COMNTOOLS}/../../VC/bin"
275                                                << 275             "$ENV{VS100COMNTOOLS}/../../VC/bin"
276 # For OS X binary distribution, choose libc++  << 276             "$ENV{VS90COMNTOOLS}/../../VC/bin"
277 # and above and AppleClang                     << 277             "$ENV{VS71COMNTOOLS}/../../VC/bin"
278 if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND    << 278             "$ENV{VS80COMNTOOLS}/../../VC/bin"
279     NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0 << 279         DOC "Library manager")
280   set (USE_LIBCXX OFF)                         << 280 
281   cmake_policy(GET CMP0025 POLICY_VAR)         << 281     MARK_AS_ADVANCED (LIB_EXECUTABLE)
282                                                << 282 ENDIF()
283   if (POLICY_VAR STREQUAL "NEW")               << 283 
284     if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleC << 284 MACRO(GET_LIB_REQUISITES LIB REQUISITES)
285       set (USE_LIBCXX ON)                      << 285   IF(LIB_EXECUTABLE)
286     endif ()                                   << 286     GET_FILENAME_COMPONENT(_LIB_PATH ${LIB_EXECUTABLE} PATH)
287   else ()                                      << 287 
288     if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" << 288     IF(MSVC)
289       set (USE_LIBCXX ON)                      << 289       # Do not redirect the output
290     endif ()                                   << 290       UNSET(ENV{VS_UNICODE_OUTPUT})
291   endif ()                                     << 291     ENDIF()
292                                                << 292 
293   if (USE_LIBCXX)                              << 293     EXECUTE_PROCESS(COMMAND ${LIB_EXECUTABLE} /nologo /list ${LIB}
294     foreach (dir IN LISTS TBB_PREFIX_PATH)     << 294       WORKING_DIRECTORY ${_LIB_PATH}/../../Common7/IDE
295       list (APPEND TBB_LIB_SEARCH_PATH ${dir}/ << 295       OUTPUT_VARIABLE _LIB_OUTPUT ERROR_QUIET)
296     endforeach ()                              << 296 
297   endif ()                                     << 297     STRING(REPLACE "\n" ";" "${REQUISITES}" "${_LIB_OUTPUT}")
298 endif ()                                       << 298     LIST(REMOVE_DUPLICATES ${REQUISITES})
299                                                << 299   ENDIF()
300 # check compiler ABI                           << 300 ENDMACRO()
301 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")      << 301 
302   set(COMPILER_PREFIX)                         << 302 IF(_TBB_ALL_LIBS)
303   if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_L << 303     # collect lib requisites using the lib tool
304     list(APPEND COMPILER_PREFIX "gcc4.8")      << 304     FOREACH(_TBB_COMPONENT ${_TBB_ALL_LIBS})
305   endif()                                      << 305         GET_LIB_REQUISITES(${_TBB_COMPONENT} _TBB_REQUISITES)
306   if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_L << 306     ENDFOREACH(_TBB_COMPONENT)
307     list(APPEND COMPILER_PREFIX "gcc4.7")      << 307 ENDIF()
308   endif()                                      << 308 
309   if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_L << 309 IF(NOT TBB_BINARY_DIR)
310     list(APPEND COMPILER_PREFIX "gcc4.4")      << 310     SET(_TBB_UPDATE_BINARY_DIR ON)
311   endif()                                      << 311 ELSE()
312   list(APPEND COMPILER_PREFIX "gcc4.1")        << 312     SET(_TBB_UPDATE_BINARY_DIR OFF)
313 elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")  << 313 ENDIF()
314   set(COMPILER_PREFIX)                         << 314 
315   if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_L << 315 SET(_TBB_BINARY_DIR_HINTS ${_TBB_POSSIBLE_BIN_SUFFIXES})
316     list(APPEND COMPILER_PREFIX "gcc4.8")      << 316 
317   endif()                                      << 317 IF(_TBB_REQUISITES)
318   if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_L << 318   FIND_FILE(TBB_BINARY_DIR NAMES ${_TBB_REQUISITES}
319     list(APPEND COMPILER_PREFIX "gcc4.7")      << 319     HINTS ${TBB_ROOT_DIR}
320   endif()                                      << 320     PATH_SUFFIXES ${_TBB_BINARY_DIR_HINTS} NO_DEFAULT_PATH)
321   list(APPEND COMPILER_PREFIX "gcc4.4")        << 321 ENDIF()
322 else() # Assume compatibility with 4.4 for oth << 322 
323   list(APPEND COMPILER_PREFIX "gcc4.4")        << 323 IF(TBB_BINARY_DIR AND _TBB_UPDATE_BINARY_DIR)
324 endif ()                                       << 324   SET(_TBB_BINARY_DIR ${TBB_BINARY_DIR})
325                                                << 325   UNSET(TBB_BINARY_DIR CACHE)
326 # if platform architecture is explicitly speci << 326 
327 set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM}) << 327   IF(_TBB_BINARY_DIR)
328 if (TBB_ARCH_PLATFORM)                         << 328     GET_FILENAME_COMPONENT(TBB_BINARY_DIR ${_TBB_BINARY_DIR} PATH)
329   foreach (dir IN LISTS TBB_PREFIX_PATH)       << 329   ENDIF()
330     list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${T << 330 ENDIF()
331     list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib << 331 
332   endforeach ()                                << 332 SET(TBB_BINARY_DIR ${TBB_BINARY_DIR} CACHE PATH "TBB binary directory")
333 endif ()                                       << 333 
334                                                << 334 MARK_AS_ADVANCED(TBB_INCLUDE_DIR TBB_LIBRARY TBB_LIBRARY_RELEASE
335 foreach (dir IN LISTS TBB_PREFIX_PATH)         << 335   TBB_LIBRARY_DEBUG TBB_BINARY_DIR)
336   foreach (prefix IN LISTS COMPILER_PREFIX)    << 336 
337     if (CMAKE_SIZEOF_VOID_P EQUAL 8)           << 337 IF(NOT _TBB_CHECK_COMPONENTS)
338       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 338     SET(_TBB_FPHSA_ADDITIONAL_ARGS HANDLE_COMPONENTS)
339       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 339 ENDIF()
340       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 340 
341       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 341 LIST(APPEND _TBB_FPHSA_ADDITIONAL_ARGS VERSION_VAR TBB_VERSION)
342     else ()                                    << 342 
343       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 343 FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB
344       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 344     REQUIRED_VARS
345       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 345         TBB_ROOT_DIR
346       list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 346         TBB_INCLUDE_DIR
347     endif ()                                   << 347         TBB_LIBRARY
348   endforeach()                                 << 348         ${_TBB_MISSING_LIBRARIES}
349 endforeach ()                                  << 349     HANDLE_COMPONENTS
350                                                << 350         ${_TBB_FPHSA_ADDITIONAL_ARGS})
351 # add general search paths                     << 
352 foreach (dir IN LISTS TBB_PREFIX_PATH)         << 
353   list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib $ << 
354     ${dir}/Libs)                               << 
355   list(APPEND TBB_INC_SEARCH_PATH ${dir}/inclu << 
356     ${dir}/include/tbb)                        << 
357 endforeach ()                                  << 
358                                                << 
359 set(TBB_LIBRARY_NAMES tbb)                     << 
360 get_debug_names(TBB_LIBRARY_NAMES)             << 
361                                                << 
362                                                << 
363 find_path(TBB_INCLUDE_DIR                      << 
364           NAMES tbb/tbb.h                      << 
365           PATHS ${TBB_INC_SEARCH_PATH})        << 
366                                                << 
367 find_library(TBB_LIBRARY_RELEASE               << 
368              NAMES ${TBB_LIBRARY_NAMES}        << 
369              PATHS ${TBB_LIB_SEARCH_PATH})     << 
370 find_library(TBB_LIBRARY_DEBUG                 << 
371              NAMES ${TBB_LIBRARY_NAMES_DEBUG}  << 
372              PATHS ${TBB_LIB_SEARCH_PATH})     << 
373 make_library_set(TBB_LIBRARY)                  << 
374                                                << 
375 findpkg_finish(TBB tbb)                        << 
376                                                << 
377 #if we haven't found TBB no point on going any << 
378 if (NOT TBB_FOUND)                             << 
379   return()                                     << 
380 endif ()                                       << 
381                                                << 
382 #============================================= << 
383 # Look for TBB's malloc package                << 
384 set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc)        << 
385 get_debug_names(TBB_MALLOC_LIBRARY_NAMES)      << 
386                                                << 
387 find_path(TBB_MALLOC_INCLUDE_DIR               << 
388           NAMES tbb/tbb.h                      << 
389           PATHS ${TBB_INC_SEARCH_PATH})        << 
390                                                << 
391 find_library(TBB_MALLOC_LIBRARY_RELEASE        << 
392              NAMES ${TBB_MALLOC_LIBRARY_NAMES} << 
393              PATHS ${TBB_LIB_SEARCH_PATH})     << 
394 find_library(TBB_MALLOC_LIBRARY_DEBUG          << 
395              NAMES ${TBB_MALLOC_LIBRARY_NAMES_ << 
396              PATHS ${TBB_LIB_SEARCH_PATH})     << 
397 make_library_set(TBB_MALLOC_LIBRARY)           << 
398                                                << 
399 findpkg_finish(TBB_MALLOC tbbmalloc)           << 
400                                                << 
401 #============================================= << 
402 # Look for TBB's malloc proxy package          << 
403 set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_p << 
404 get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES << 
405                                                << 
406 find_path(TBB_MALLOC_PROXY_INCLUDE_DIR         << 
407           NAMES tbb/tbbmalloc_proxy.h          << 
408           PATHS ${TBB_INC_SEARCH_PATH})        << 
409                                                << 
410 find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE  << 
411              NAMES ${TBB_MALLOC_PROXY_LIBRARY_ << 
412              PATHS ${TBB_LIB_SEARCH_PATH})     << 
413 find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG    << 
414              NAMES ${TBB_MALLOC_PROXY_LIBRARY_ << 
415              PATHS ${TBB_LIB_SEARCH_PATH})     << 
416 make_library_set(TBB_MALLOC_PROXY_LIBRARY)     << 
417                                                << 
418 findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_prox << 
419                                                << 
420                                                << 
421 #============================================= << 
422 #parse all the version numbers from tbb        << 
423 if(NOT TBB_VERSION)                            << 
424   if (EXISTS "${TBB_INCLUDE_DIR}/oneapi/tbb/ve << 
425     file(STRINGS                               << 
426       "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h << 
427       TBB_VERSION_CONTENTS                     << 
428       REGEX "VERSION")                         << 
429   else()                                       << 
430     #only read the start of the file           << 
431     file(STRINGS                               << 
432       "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h"    << 
433       TBB_VERSION_CONTENTS                     << 
434       REGEX "VERSION")                         << 
435   endif()                                      << 
436                                                << 
437   string(REGEX REPLACE                         << 
438     ".*#define TBB_VERSION_MAJOR ([0-9]+).*" " << 
439     TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS} << 
440                                                << 
441   string(REGEX REPLACE                         << 
442     ".*#define TBB_VERSION_MINOR ([0-9]+).*" " << 
443     TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS} << 
444                                                << 
445   string(REGEX REPLACE                         << 
446         ".*#define TBB_INTERFACE_VERSION ([0-9 << 
447         TBB_INTERFACE_VERSION "${TBB_VERSION_C << 
448                                                << 
449   string(REGEX REPLACE                         << 
450         ".*#define TBB_COMPATIBLE_INTERFACE_VE << 
451         TBB_COMPATIBLE_INTERFACE_VERSION "${TB << 
452                                                << 
453   set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_ << 
454                                                << 
455 endif()                                        << 
456                                                << 
457 include(FindPackageHandleStandardArgs)         << 
458 find_package_handle_standard_args(TBB          << 
459   REQUIRED_VARS TBB_INCLUDE_DIR TBB_LIBRARY    << 
460   VERSION_VAR TBB_VERSION)                     <<