forked from cjweeks/tensorflow-cmake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindTensorFlow.cmake
36 lines (28 loc) · 1.01 KB
/
FindTensorFlow.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Locates the Tensorflow library and include directories.
include(FindPackageHandleStandardArgs)
unset(TENSORFLOW_FOUND)
if (NOT TensorFlow_INSTALL_ROOT)
set(TensorFlow_INSTALL_ROOT /usr/local)
endif()
find_path(TensorFlow_INCLUDE_DIR
NAMES
tensorflow/core
tensorflow/cc
third_party
HINTS
${TensorFlow_INSTALL_ROOT}/include/google/tensorflow)
find_library(TensorFlow_CC tensorflow_cc
HINTS
${TensorFlow_INSTALL_ROOT}/lib)
find_library(TensorFlow_framework tensorflow_framework
HINTS
${TensorFlow_INSTALL_ROOT}/lib)
# set TensorFlow_FOUND
find_package_handle_standard_args(TensorFlow DEFAULT_MSG TensorFlow_INCLUDE_DIR TensorFlow_CC TensorFlow_framework)
# set external variables for usage in CMakeLists.txt
if(TENSORFLOW_FOUND)
set(TensorFlow_LIBRARIES ${TensorFlow_CC} ${TensorFlow_framework})
set(TensorFlow_INCLUDE_DIRS ${TensorFlow_INCLUDE_DIR})
endif()
# hide locals from GUI
mark_as_advanced(TensorFlow_INCLUDE_DIR TensorFlow_CC TensorFlow_framework)