Skip to content

Instantly share code, notes, and snippets.

@Tacha-S
Created January 25, 2017 06:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Tacha-S/05a83e27fa6313402f0551f016085664 to your computer and use it in GitHub Desktop.
Save Tacha-S/05a83e27fa6313402f0551f016085664 to your computer and use it in GitHub Desktop.
# Locates the tensorflow library and include dirs.
include(FindPackageHandleStandardArgs)
unset(TENSORFLOW_FOUND)
find_path(Tensorflow_INCLUDE_DIR
NAMES
tensorflow/core
tensorflow/cc
third_party
HINTS
/usr/include/tensorflow
/usr/local/include/tensorflow)
find_library(Tensorflow_LIBRARY NAMES tensorflow
HINTS
/usr/lib
/usr/local/lib)
# set Tensorflow_FOUND
find_package_handle_standard_args(Tensorflow DEFAULT_MSG Tensorflow_INCLUDE_DIR Tensorflow_LIBRARY)
# set external variables for usage in CMakeLists.txt
if(TENSORFLOW_FOUND)
set(Tensorflow_LIBRARIES ${Tensorflow_LIBRARY})
set(Tensorflow_INCLUDE_DIRS ${Tensorflow_INCLUDE_DIR})
endif()
# hide locals from GUI
mark_as_advanced(Tensorflow_INCLUDE_DIR Tensorflow_LIBRARY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment