Repository: pytorch
Issue: CMake Error at CMakeLists.txt:10 (find_package) in C++
Labels: module: build,triaged

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

## To Reproduce

Steps to reproduce the behavior:

1. Go to the eclipse-workspace and run `cmake -G "Eclipse CDT4 - Unix Makefiles" ./` to create a Eclipse project.

## Expected behavior
It should create a CMake project with Eclipse. 
## Environment
I am just running a simple code, 

#include <torch/torch.h>
#include <iostream>
```

int main() {
  torch::Tensor tensor = torch::rand({2, 3});
  std::cout << tensor << std::endl;
}

```

 - PyTorch Version (e.g., 1.0): C++ torch, stable version
 - OS (e.g., Linux): Ubuntu 18
 - How you installed PyTorch (`conda`, `pip`, source): NA
 - Build command you used (if compiling from source): NA
 - Python version: NA
 - CUDA/cuDNN version: None
 - GPU models and configuration: None
 - Any other relevant information: NA

## Additional context
I have the `CMakeLists.txt` file which includes: 

```
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(test)

set(Torch_DIR "/home/afshin/libtorch/share;${Torch_DIR}")

find_package(Torch REQUIRED)

add_executable(test test.cpp)
target_link_libraries(test "${TORCH_LIBRARIES}")
set_property(TARGET test PROPERTY CXX_STANDARD 11)

```

I get the following log and error:
```

-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:6 (find_package):
  By not providing "FindTorch.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Torch", but
  CMake did not find one.

  Could not find a package configuration file provided by "Torch" with any of
  the following names:

    TorchConfig.cmake
    torch-config.cmake

  Add the installation prefix of "Torch" to CMAKE_PREFIX_PATH or set
  "Torch_DIR" to a directory containing one of the above files.  If "Torch"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
See also "/home/afshin/eclipse-workspace/test_cmake/CMakeFiles/CMakeOutput.log".

```

I also searched for `CMakeLists.txt` using locate command, but I could not find anything. Apparently, it also cannot find `TorchConfig.cmake` and torch-config.cmake files. I added the corresponding path into the CMakeLists.txt file by:

`set(Torch_DIR "/home/afshin/libtorch/share;${Torch_DIR}")
`
but, no success. I guess `TorchConfig.cmake` should have be created in the compile time which is not. 
I appreciate any help. 

Thsank,
Afshin


cc @malfet @seemethere @walterddr