opengl-tutorials / ogl

http://www.opengl-tutorial.org
2.71k stars 926 forks source link

Using cmake within build directory doesn't work #72

Closed cvlvxi closed 2 years ago

cvlvxi commented 6 years ago

I was following:

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/

Specifically the linux section and was unable to cmake & build the project:

$ mkdir build
$ cd build
$ cmake ..
CMake Error at CMakeLists.txt:9 (message):
  Please select another Build Directory ! (and give it a clever name, like
  bin_Visual2012_64bits/)
-- Configuring incomplete, errors occurred!
See also "/home/beb/VCGS/glfw/ogl/CMakeFiles/CMakeOutput.log".
See also "/home/beb/VCGS/glfw/ogl/CMakeFiles/CMakeError.log".

Not sure if I'm doing this incorrectly or if the tutorial is out of date?

Please advise.

JomaskTsai commented 2 years ago

hi, this is how I solved it.

add "set(PROJECT_SOURCE_DIR ${CMAKE_BINARY_DIR}/build/)" after "find_package(OpenGL REQUIRED)" in the CMakeLists.txt.

cvlvxi commented 2 years ago

ta