Revert to old TBB finding.

This commit is contained in:
Tadas Baltrusaitis 2017-02-15 12:36:20 -05:00
parent 6a066587ec
commit 7a8e6e8cc3

View file

@ -1,303 +1,293 @@
# The MIT License (MIT) # Module for locating Intel's Threading Building Blocks (TBB).
#
# Customizable variables:
# TBB_ROOT_DIR
# Specifies TBB's root directory.
#
# Read-only variables:
# TBB_FOUND
# Indicates whether the library has been found.
#
# TBB_INCLUDE_DIRS
# Specifies TBB's include directory.
#
# TBB_LIBRARIES
# Specifies TBB libraries that should be passed to target_link_libararies.
#
# TBB_<COMPONENT>_LIBRARIES
# Specifies the libraries of a specific <COMPONENT>.
#
# TBB_<COMPONENT>_FOUND
# Indicates whether the specified <COMPONENT> was found.
#
#
# Copyright (c) 2013, 2014 Sergiu Dotenco
# #
# Copyright (c) 2015 Justus Calvin
#
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights # in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is # copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: # furnished to do so, subject to the following conditions:
# #
# The above copyright notice and this permission notice shall be included in all # The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software. # copies or substantial portions of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # FITNESS FOR A PARTTBBLAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
# INCLUDE (FindPackageHandleStandardArgs)
# FindTBB
# -------
#
# Find TBB include directories and libraries.
#
# Usage:
#
# find_package(TBB [major[.minor]] [EXACT]
# [QUIET] [REQUIRED]
# [[COMPONENTS] [components...]]
# [OPTIONAL_COMPONENTS components...])
#
# where the allowed components are tbbmalloc and tbb_preview. Users may modify
# the behavior of this module with the following variables:
#
# * TBB_ROOT_DIR - The base directory the of TBB installation.
# * TBB_INCLUDE_DIR - The directory that contains the TBB headers files.
# * TBB_LIBRARY - The directory that contains the TBB library files.
# * TBB_<library>_LIBRARY - The path of the TBB the corresponding TBB library.
# These libraries, if specified, override the
# corresponding library search results, where <library>
# may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug,
# tbb_preview, or tbb_preview_debug.
# * TBB_USE_DEBUG_BUILD - The debug version of tbb libraries, if present, will
# be used instead of the release version.
#
# Users may modify the behavior of this module with the following environment
# variables:
#
# * TBB_INSTALL_DIR
# * TBBROOT
# * LIBRARY_PATH
#
# This module will set the following variables:
#
# * TBB_FOUND - Set to false, or undefined, if we havent found, or
# dont want to use TBB.
# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
# not available.
# * TBB_VERSION - The full version string
# * TBB_VERSION_MAJOR - The major version
# * TBB_VERSION_MINOR - The minor version
# * TBB_INTERFACE_VERSION - The interface version number defined in
# tbb/tbb_stddef.h.
# * TBB_<library>_LIBRARY_RELEASE - The path of the TBB release version of
# <library>, where <library> may be tbb, tbb_debug,
# tbbmalloc, tbbmalloc_debug, tbb_preview, or
# tbb_preview_debug.
# * TBB_<library>_LIBRARY_DEGUG - The path of the TBB release version of
# <library>, where <library> may be tbb, tbb_debug,
# tbbmalloc, tbbmalloc_debug, tbb_preview, or
# tbb_preview_debug.
#
# The following varibles should be used to build and link with TBB:
#
# * TBB_INCLUDE_DIRS - The include directory for TBB.
# * TBB_LIBRARIES - The libraries to link against to use TBB.
# * TBB_LIBRARIES_RELEASE - The release libraries to link against to use TBB.
# * TBB_LIBRARIES_DEBUG - The debug libraries to link against to use TBB.
# * TBB_DEFINITIONS - Definitions to use when compiling code that uses
# TBB.
# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that
# uses TBB.
# * TBB_DEFINITIONS_DEBUG - Definitions to use when compiling debug code that
# uses TBB.
#
# This module will also create the "tbb" target that may be used when building
# executables and libraries.
include(FindPackageHandleStandardArgs) IF (CMAKE_VERSION VERSION_GREATER 2.8.7)
SET (_TBB_CHECK_COMPONENTS FALSE)
ELSE (CMAKE_VERSION VERSION_GREATER 2.8.7)
SET (_TBB_CHECK_COMPONENTS TRUE)
ENDIF (CMAKE_VERSION VERSION_GREATER 2.8.7)
if(NOT TBB_FOUND) FIND_PATH (TBB_ROOT_DIR
NAMES include/tbb/tbb.h
PATHS ENV TBBROOT
ENV TBB40_INSTALL_DIR
ENV TBB30_INSTALL_DIR
ENV TBB22_INSTALL_DIR
ENV TBB21_INSTALL_DIR
ENV ICPP_COMPILER13
ENV ICPP_COMPILER14
PATH_SUFFIXES tbb
DOC "TBB root directory")
################################## FIND_PATH (TBB_INCLUDE_DIR
# Check the build type NAMES tbb/tbb.h
################################## HINTS ${TBB_ROOT_DIR}
PATH_SUFFIXES include
if(NOT DEFINED TBB_USE_DEBUG_BUILD) DOC "TBB include directory")
if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug|RelWithDebInfo|RELWITHDEBINFO|relwithdebinfo)")
set(TBB_BUILD_TYPE DEBUG)
else()
set(TBB_BUILD_TYPE RELEASE)
endif()
elseif(TBB_USE_DEBUG_BUILD)
set(TBB_BUILD_TYPE DEBUG)
else()
set(TBB_BUILD_TYPE RELEASE)
endif()
##################################
# Set the TBB search directories
##################################
# Define search paths based on user input and environment variables
set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT})
# Define the search directories based on the current platform
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB"
"C:/Program Files (x86)/Intel/TBB")
# Set the target architecture IF (DEFINED TBB_COMPILER)
if(CMAKE_SIZEOF_VOID_P EQUAL 8) SET (_TBB_COMPILER ${TBB_COMPILER})
set(TBB_ARCHITECTURE "intel64") ELSEIF (MSVC12)
else() SET (_TBB_COMPILER vc12)
set(TBB_ARCHITECTURE "ia32") ELSEIF (MSVC11)
endif() SET (_TBB_COMPILER vc11)
ELSEIF (MSVC10)
SET (_TBB_COMPILER vc10)
ELSEIF (MSVC90)
SET (_TBB_COMPILER vc9)
ELSEIF (MSVC80)
SET (_TBB_COMPILER vc8)
ELSEIF (MINGW)
SET (_TBB_COMPILER mingw)
ELSEIF (WIN32)
SET (_TBB_COMPILER vc_mt)
ENDIF (DEFINED TBB_COMPILER)
# Set the TBB search library path search suffix based on the version of VC IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
if(WINDOWS_STORE) SET (_TBB_POSSIBLE_LIB_SUFFIXES lib/intel64/${_TBB_COMPILER})
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui") SET (_TBB_POSSIBLE_BIN_SUFFIXES bin/intel64/${_TBB_COMPILER})
elseif(MSVC14) ELSE (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14") SET (_TBB_POSSIBLE_LIB_SUFFIXES lib/ia32/${_TBB_COMPILER})
elseif(MSVC12) SET (_TBB_POSSIBLE_BIN_SUFFIXES bin/ia32/${_TBB_COMPILER})
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12") ENDIF (CMAKE_SIZEOF_VOID_P EQUAL 8)
elseif(MSVC11)
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11")
elseif(MSVC10)
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10")
endif()
# Add the library path search suffix for the VC independent version of TBB LIST (APPEND _TBB_POSSIBLE_LIB_SUFFIXES lib/$ENV{TBB_ARCH_PLATFORM})
list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") FIND_LIBRARY (TBB_LIBRARY_RELEASE
# OS X NAMES tbb
set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") HINTS ${TBB_ROOT_DIR}
PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
# TODO: Check to see which C++ library is being used by the compiler. DOC "TBB release library")
if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0)
# The default C++ library on OS X 10.9 and later is libc++
set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib")
else()
set(TBB_LIB_PATH_SUFFIX "lib")
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Linux
set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
# TODO: Check compiler version to see the suffix should be <arch>/gcc4.1 or
# <arch>/gcc4.1. For now, assume that the compiler is more recent than
# gcc 4.4.x or later.
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4")
endif()
endif()
##################################
# Find the TBB include dir
##################################
find_path(TBB_INCLUDE_DIRS tbb/tbb.h
HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
PATHS ${TBB_DEFAULT_SEARCH_DIR}
PATH_SUFFIXES include)
################################## FIND_LIBRARY (TBB_LIBRARY_DEBUG
# Set version strings NAMES tbb_debug
################################## HINTS ${TBB_ROOT_DIR}
PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
DOC "TBB debug library")
if(TBB_INCLUDE_DIRS) IF (TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)
file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file) SET (TBB_LIBRARY optimized ${TBB_LIBRARY_RELEASE} debug ${TBB_LIBRARY_DEBUG}
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" CACHE DOC "TBB library")
TBB_VERSION_MAJOR "${_tbb_version_file}") ELSEIF (TBB_LIBRARY_RELEASE)
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" SET (TBB_LIBRARY ${TBB_LIBRARY_RELEASE} CACHE DOC "TBB library")
TBB_VERSION_MINOR "${_tbb_version_file}") ENDIF (TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
TBB_INTERFACE_VERSION "${_tbb_version_file}")
set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
endif()
################################## IF (TBB_LIBRARY_DEBUG)
# Find TBB components LIST (APPEND _TBB_ALL_LIBS ${TBB_LIBRARY_DEBUG})
################################## ENDIF (TBB_LIBRARY_DEBUG)
if(TBB_VERSION VERSION_LESS 4.3) IF (TBB_LIBRARY_RELEASE)
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb) LIST (APPEND _TBB_ALL_LIBS ${TBB_LIBRARY_RELEASE})
else() ENDIF (TBB_LIBRARY_RELEASE)
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
endif()
# Find each component FOREACH (_TBB_COMPONENT ${TBB_FIND_COMPONENTS})
foreach(_comp ${TBB_SEARCH_COMPOMPONENTS}) STRING (TOUPPER ${_TBB_COMPONENT} _TBB_COMPONENT_UPPER)
if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};") SET (_TBB_LIBRARY_BASE TBB_${_TBB_COMPONENT_UPPER}_LIBRARY)
# Search for the libraries IF (${_TBB_COMPONENT} STREQUAL preview)
find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp} SET (_TBB_LIBRARY_NAME tbb_${_TBB_COMPONENT})
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} ELSE (${_TBB_COMPONENT} STREQUAL preview)
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH SET (_TBB_LIBRARY_NAME tbb${_TBB_COMPONENT})
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}) ENDIF (${_TBB_COMPONENT} STREQUAL preview)
find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug FIND_LIBRARY (${_TBB_LIBRARY_BASE}_RELEASE
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} NAMES ${_TBB_LIBRARY_NAME}
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH HINTS ${TBB_ROOT_DIR}
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}) PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
DOC "TBB ${_TBB_COMPONENT} release library")
if(TBB_${_comp}_LIBRARY_DEBUG) FIND_LIBRARY (${_TBB_LIBRARY_BASE}_DEBUG
list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}") NAMES ${_TBB_LIBRARY_NAME}_debug
endif() HINTS ${TBB_ROOT_DIR}
if(TBB_${_comp}_LIBRARY_RELEASE) PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES}
list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}") DOC "TBB ${_TBB_COMPONENT} debug library")
endif()
if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY)
set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}")
endif()
if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}") MARK_AS_ADVANCED (${_TBB_LIBRARY_BASE} ${_TBB_LIBRARY_BASE}_DEBUG)
set(TBB_${_comp}_FOUND TRUE)
else()
set(TBB_${_comp}_FOUND FALSE)
endif()
# Mark internal variables as advanced SET (TBB_${_TBB_COMPONENT_UPPER}_FOUND TRUE)
mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
mark_as_advanced(TBB_${_comp}_LIBRARY)
endif() IF (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE)
endforeach() SET (${_TBB_LIBRARY_BASE}
debug ${${_TBB_LIBRARY_BASE}_DEBUG}
optimized ${${_TBB_LIBRARY_BASE}_RELEASE} CACHE DOC
"TBB ${_TBB_COMPONENT} library")
ELSEIF (${_TBB_LIBRARY_BASE}_DEBUG)
SET (${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_DEBUG})
ELSEIF (${_TBB_LIBRARY_BASE}_RELEASE)
SET (${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_RELEASE}
CACHE DOC "TBB ${_TBB_COMPONENT} library")
ELSE (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE)
# Component missing: record it for a later report
LIST (APPEND _TBB_MISSING_COMPONENTS ${_TBB_COMPONENT})
SET (TBB_${_TBB_COMPONENT_UPPER}_FOUND FALSE)
ENDIF (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE)
################################## IF (${_TBB_LIBRARY_BASE}_DEBUG)
# Set compile flags and libraries LIST (APPEND _TBB_ALL_LIBS ${${_TBB_LIBRARY_BASE}_DEBUG})
################################## ENDIF (${_TBB_LIBRARY_BASE}_DEBUG)
set(TBB_DEFINITIONS_RELEASE "") IF (${_TBB_LIBRARY_BASE}_RELEASE)
set(TBB_DEFINITIONS_DEBUG "-DTBB_USE_DEBUG=1") LIST (APPEND _TBB_ALL_LIBS ${${_TBB_LIBRARY_BASE}_RELEASE})
ENDIF (${_TBB_LIBRARY_BASE}_RELEASE)
if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
set(TBB_DEFINITIONS "${TBB_DEFINITIONS_${TBB_BUILD_TYPE}}")
set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
elseif(TBB_LIBRARIES_RELEASE)
set(TBB_DEFINITIONS "${TBB_DEFINITIONS_RELEASE}")
set(TBB_LIBRARIES "${TBB_LIBRARIES_RELEASE}")
elseif(TBB_LIBRARIES_DEBUG)
set(TBB_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}")
set(TBB_LIBRARIES "${TBB_LIBRARIES_DEBUG}")
endif()
find_package_handle_standard_args(TBB SET (TBB_${_TBB_COMPONENT}_FOUND ${TBB_${_TBB_COMPONENT_UPPER}_FOUND})
REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
HANDLE_COMPONENTS
VERSION_VAR TBB_VERSION)
################################## IF (${_TBB_LIBRARY_BASE})
# Create targets # setup the TBB_<COMPONENT>_LIBRARIES variable
################################## SET (TBB_${_TBB_COMPONENT_UPPER}_LIBRARIES ${${_TBB_LIBRARY_BASE}})
LIST (APPEND TBB_LIBRARIES ${${_TBB_LIBRARY_BASE}})
ELSE (${_TBB_LIBRARY_BASE})
LIST (APPEND _TBB_MISSING_LIBRARIES ${_TBB_LIBRARY_BASE})
ENDIF (${_TBB_LIBRARY_BASE})
ENDFOREACH (_TBB_COMPONENT ${TBB_FIND_COMPONENTS})
if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND) LIST (APPEND TBB_LIBRARIES ${TBB_LIBRARY})
add_library(tbb SHARED IMPORTED) SET (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
set_target_properties(tbb PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS}
IMPORTED_LOCATION ${TBB_LIBRARIES})
if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
set_target_properties(tbb PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:TBB_USE_DEBUG=1>"
IMPORTED_LOCATION_DEBUG ${TBB_LIBRARIES_DEBUG}
IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_DEBUG}
IMPORTED_LOCATION_RELEASE ${TBB_LIBRARIES_RELEASE}
IMPORTED_LOCATION_MINSIZEREL ${TBB_LIBRARIES_RELEASE}
)
elseif(TBB_LIBRARIES_RELEASE)
set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARIES_RELEASE})
else()
set_target_properties(tbb PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}"
IMPORTED_LOCATION ${TBB_LIBRARIES_DEBUG}
)
endif()
endif()
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES) IF (DEFINED _TBB_MISSING_COMPONENTS AND _TBB_CHECK_COMPONENTS)
IF (NOT TBB_FIND_QUIETLY)
MESSAGE (STATUS "One or more TBB components were not found:")
# Display missing components indented, each on a separate line
FOREACH (_TBB_MISSING_COMPONENT ${_TBB_MISSING_COMPONENTS})
MESSAGE (STATUS " " ${_TBB_MISSING_COMPONENT})
ENDFOREACH (_TBB_MISSING_COMPONENT ${_TBB_MISSING_COMPONENTS})
ENDIF (NOT TBB_FIND_QUIETLY)
ENDIF (DEFINED _TBB_MISSING_COMPONENTS AND _TBB_CHECK_COMPONENTS)
unset(TBB_ARCHITECTURE) # Determine library's version
unset(TBB_BUILD_TYPE)
unset(TBB_LIB_PATH_SUFFIX)
unset(TBB_DEFAULT_SEARCH_DIR)
endif() SET (_TBB_VERSION_HEADER ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h)
IF (EXISTS ${_TBB_VERSION_HEADER})
FILE (READ ${_TBB_VERSION_HEADER} _TBB_VERSION_CONTENTS)
STRING (REGEX REPLACE ".*#define TBB_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1"
TBB_VERSION_MAJOR "${_TBB_VERSION_CONTENTS}")
STRING (REGEX REPLACE ".*#define TBB_VERSION_MINOR[ \t]+([0-9]+).*" "\\1"
TBB_VERSION_MINOR "${_TBB_VERSION_CONTENTS}")
SET (TBB_VERSION ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR})
SET (TBB_VERSION_COMPONENTS 2)
ENDIF (EXISTS ${_TBB_VERSION_HEADER})
IF (WIN32)
FIND_PROGRAM (LIB_EXECUTABLE NAMES lib
HINTS "$ENV{VS120COMNTOOLS}/../../VC/bin"
"$ENV{VS110COMNTOOLS}/../../VC/bin"
"$ENV{VS100COMNTOOLS}/../../VC/bin"
"$ENV{VS90COMNTOOLS}/../../VC/bin"
"$ENV{VS71COMNTOOLS}/../../VC/bin"
"$ENV{VS80COMNTOOLS}/../../VC/bin"
DOC "Library manager")
MARK_AS_ADVANCED (LIB_EXECUTABLE)
ENDIF (WIN32)
MACRO (GET_LIB_REQUISITES LIB REQUISITES)
IF (LIB_EXECUTABLE)
GET_FILENAME_COMPONENT (_LIB_PATH ${LIB_EXECUTABLE} PATH)
IF (MSVC)
# Do not redirect the output
UNSET (ENV{VS_UNICODE_OUTPUT})
ENDIF (MSVC)
EXECUTE_PROCESS (COMMAND ${LIB_EXECUTABLE} /nologo /list ${LIB}
WORKING_DIRECTORY ${_LIB_PATH}/../../Common7/IDE
OUTPUT_VARIABLE _LIB_OUTPUT ERROR_QUIET)
STRING (REPLACE "\n" ";" "${REQUISITES}" "${_LIB_OUTPUT}")
LIST (REMOVE_DUPLICATES ${REQUISITES})
ENDIF (LIB_EXECUTABLE)
ENDMACRO (GET_LIB_REQUISITES)
IF (_TBB_ALL_LIBS)
# collect lib requisites using the lib tool
FOREACH (_TBB_COMPONENT ${_TBB_ALL_LIBS})
GET_LIB_REQUISITES (${_TBB_COMPONENT} _TBB_REQUISITES)
ENDFOREACH (_TBB_COMPONENT)
ENDIF (_TBB_ALL_LIBS)
IF (NOT TBB_BINARY_DIR)
SET (_TBB_UPDATE_BINARY_DIR TRUE)
ELSE (NOT TBB_BINARY_DIR)
SET (_TBB_UPDATE_BINARY_DIR FALSE)
ENDIF (NOT TBB_BINARY_DIR)
SET (_TBB_BINARY_DIR_HINTS ${_TBB_POSSIBLE_BIN_SUFFIXES})
IF (_TBB_REQUISITES)
FIND_FILE (TBB_BINARY_DIR NAMES ${_TBB_REQUISITES}
HINTS ${TBB_ROOT_DIR}
PATH_SUFFIXES ${_TBB_BINARY_DIR_HINTS} NO_DEFAULT_PATH)
ENDIF (_TBB_REQUISITES)
IF (TBB_BINARY_DIR AND _TBB_UPDATE_BINARY_DIR)
SET (_TBB_BINARY_DIR ${TBB_BINARY_DIR})
UNSET (TBB_BINARY_DIR CACHE)
IF (_TBB_BINARY_DIR)
GET_FILENAME_COMPONENT (TBB_BINARY_DIR ${_TBB_BINARY_DIR} PATH)
IF (TBB_BINARY_DIR)
SET (TBB_BINARY_DIR ${TBB_BINARY_DIR} CACHE PATH "TBB binary directory")
ENDIF (TBB_BINARY_DIR)
ENDIF (_TBB_BINARY_DIR)
ENDIF (TBB_BINARY_DIR AND _TBB_UPDATE_BINARY_DIR)
MARK_AS_ADVANCED (TBB_INCLUDE_DIR TBB_LIBRARY TBB_LIBRARY_RELEASE
TBB_LIBRARY_DEBUG)
IF (NOT _TBB_CHECK_COMPONENTS)
SET (_TBB_FPHSA_ADDITIONAL_ARGS HANDLE_COMPONENTS)
ENDIF (NOT _TBB_CHECK_COMPONENTS)
IF (CMAKE_VERSION VERSION_GREATER 2.8.2)
LIST (APPEND _TBB_FPHSA_ADDITIONAL_ARGS VERSION_VAR TBB_VERSION)
ENDIF (CMAKE_VERSION VERSION_GREATER 2.8.2)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (TBB REQUIRED_VARS TBB_ROOT_DIR
TBB_INCLUDE_DIR TBB_LIBRARY ${_TBB_MISSING_LIBRARIES}
${_TBB_FPHSA_ADDITIONAL_ARGS})