1-
21# Copyright (c) Meta Platforms, Inc. and affiliates.
32# All rights reserved.
43#
1615#
1716# This will define the following variables:
1817#
19- # EXECUTORCH_FOUND -- True if the system has the ExecuTorch library
20- # EXECUTORCH_INCLUDE_DIRS -- The include directories for ExecuTorch
21- # EXECUTORCH_LIBRARIES -- Libraries to link against
18+ # EXECUTORCH_FOUND -- True if the system has the ExecuTorch library
19+ # EXECUTORCH_INCLUDE_DIRS -- The include directories for ExecuTorch
20+ # EXECUTORCH_LIBRARIES -- Libraries to link against
2221#
23- # The actual values for these variables will be different from what executorch-config.cmake
24- # in executorch pip package gives, but we wanted to keep the contract of exposing these
25- # CMake variables.
22+ # The actual values for these variables will be different from what
23+ # executorch-config.cmake in executorch pip package gives, but we wanted to keep
24+ # the contract of exposing these CMake variables.
2625
2726cmake_minimum_required (VERSION 3.19)
2827
2928set (_root "${CMAKE_CURRENT_LIST_DIR} /../../.." )
3029set (required_lib_list executorch executorch_core portable_kernels)
3130set (EXECUTORCH_LIBRARIES)
32- set (EXECUTORCH_INCLUDE_DIRS ${_root} /include ${_root} /include /executorch/runtime/core/portable_type/c10 ${_root} /lib)
31+ set (EXECUTORCH_INCLUDE_DIRS
32+ ${_root} /include ${_root} /include /executorch/runtime/core/portable_type/c10
33+ ${_root} /lib
34+ )
3335foreach (lib ${required_lib_list} )
3436 set (lib_var "LIB_${lib} " )
3537 add_library (${lib} STATIC IMPORTED )
@@ -40,7 +42,12 @@ foreach(lib ${required_lib_list})
4042 )
4143 set_target_properties (${lib} PROPERTIES IMPORTED_LOCATION "${${lib_var} }" )
4244 target_compile_definitions (${lib} INTERFACE C10_USING_CUSTOM_GENERATED_MACROS)
43- target_include_directories (${lib} INTERFACE ${_root} /include ${_root} /include /executorch/runtime/core/portable_type/c10 ${_root} /lib)
45+ target_include_directories (
46+ ${lib}
47+ INTERFACE ${_root} /include
48+ ${_root} /include /executorch/runtime/core/portable_type/c10
49+ ${_root} /lib
50+ )
4451 list (APPEND EXECUTORCH_LIBRARIES ${lib} )
4552endforeach ()
4653
@@ -111,7 +118,12 @@ foreach(lib ${lib_list})
111118 add_library (${lib} STATIC IMPORTED )
112119 endif ()
113120 set_target_properties (${lib} PROPERTIES IMPORTED_LOCATION "${${lib_var} }" )
114- target_include_directories (${lib} INTERFACE ${_root} /include ${_root} /include /executorch/runtime/core/portable_type/c10 ${_root} /lib)
121+ target_include_directories (
122+ ${lib}
123+ INTERFACE ${_root} /include
124+ ${_root} /include /executorch/runtime/core/portable_type/c10
125+ ${_root} /lib
126+ )
115127 list (APPEND EXECUTORCH_LIBRARIES ${lib} )
116128 endif ()
117129endforeach ()
@@ -123,4 +135,6 @@ if(TARGET cpublas)
123135 cpublas PROPERTIES INTERFACE_LINK_LIBRARIES extension_threadpool
124136 )
125137endif ()
126- target_compile_definitions (extension_threadpool INTERFACE ET_USE_THREADPOOL)
138+ if (TARGET extension_threadpool)
139+ target_compile_definitions (extension_threadpool INTERFACE ET_USE_THREADPOOL)
140+ endif ()
0 commit comments