1# Copyright (c) 2020-2021 Intel Corporation 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15macro(tbb_remove_compile_flag flag) 16 get_property(_tbb_compile_options DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_OPTIONS) 17 list(REMOVE_ITEM _tbb_compile_options ${flag}) 18 set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_OPTIONS ${_tbb_compile_options}) 19 unset(_tbb_compile_options) 20 if (CMAKE_CXX_FLAGS) 21 string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) 22 endif() 23endmacro() 24 25macro(tbb_install_target target) 26 install(TARGETS ${target} 27 EXPORT TBBTargets 28 LIBRARY 29 DESTINATION ${CMAKE_INSTALL_LIBDIR} 30 NAMELINK_SKIP 31 COMPONENT runtime 32 RUNTIME 33 DESTINATION ${CMAKE_INSTALL_BINDIR} 34 COMPONENT runtime 35 ARCHIVE 36 DESTINATION ${CMAKE_INSTALL_LIBDIR} 37 COMPONENT devel) 38 39 if (BUILD_SHARED_LIBS) 40 install(TARGETS ${target} 41 LIBRARY 42 DESTINATION ${CMAKE_INSTALL_LIBDIR} 43 NAMELINK_ONLY 44 COMPONENT devel) 45 endif() 46endmacro() 47 48macro(tbb_handle_ipo target) 49 if (TBB_IPO_PROPERTY) 50 set_target_properties(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) 51 elseif (TBB_IPO_FLAGS) 52 target_compile_options(${target} PRIVATE ${TBB_IPO_COMPILE_FLAGS}) 53 if (COMMAND target_link_options) 54 target_link_options(${target} PRIVATE ${TBB_IPO_LINK_FLAGS}) 55 else() 56 target_link_libraries(${target} PRIVATE ${TBB_IPO_LINK_FLAGS}) 57 endif() 58 endif() 59endmacro() 60