FindTBB.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ################################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ################################################################################
  16. # - Try to find the TBB library
  17. # Once done this will define
  18. #
  19. # TBB_FOUND - system has the TBB library
  20. # TBB_INCLUDE_DIR - the TBB include directory
  21. # TBB_LIBRARIES - The libraries needed to use TBB
  22. IF (NOT TBB_FOUND)
  23. SET (tbb_lib "tbb")
  24. IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
  25. IF (WIN32)
  26. IF (${ARCH64BIT} EQUAL 1)
  27. SET (osdir "Win64")
  28. ELSE()
  29. SET (osdir "Win32")
  30. ENDIF()
  31. SET (tbbver "1.2.8")
  32. ELSE()
  33. SET (osdir "unknown")
  34. SET (tbbver "unknown")
  35. ENDIF()
  36. IF (NOT ("${osdir}" STREQUAL "unknown"))
  37. FIND_PATH (TBB_INCLUDE_DIR NAMES tbb/tbb.h PATHS "${EXTERNALS_DIRECTORY}/tbb/${tbbver}/include" NO_DEFAULT_PATH)
  38. FIND_LIBRARY (TBB_LIBRARIES NAMES ${tbb_lib} PATHS "${EXTERNALS_DIRECTORY}/tbb/${tbbver}/lib/${osdir}" NO_DEFAULT_PATH)
  39. ENDIF()
  40. ENDIF()
  41. if (USE_NATIVE_LIBRARIES)
  42. # if we didn't find in externals, look in system include path
  43. FIND_PATH (TBB_INCLUDE_DIR NAMES tbb/tbb.h)
  44. FIND_LIBRARY (TBB_LIBRARIES NAMES ${tbb_lib})
  45. endif()
  46. include(FindPackageHandleStandardArgs)
  47. find_package_handle_standard_args(TBB DEFAULT_MSG
  48. TBB_LIBRARIES
  49. TBB_INCLUDE_DIR
  50. )
  51. MARK_AS_ADVANCED(TBB_INCLUDE_DIR TBB_LIBRARIES)
  52. ENDIF()