From 0989efa30fb218971e307ba271ddbf9183fcd1a4 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Sat, 30 Mar 2024 16:00:38 -0400 Subject: [PATCH] Structure CMakeLists like other examples. Produce a bin in opengl_examples --- CMakeLists.txt | 16 +++++++--------- README.md | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6faec16..a8f8c41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,15 +5,13 @@ project(OpengGL_Example) set(CMAKE_CXX_STANDARD 17) set(CMAKE_VERBOSE_MAKEFILE ON) -add_executable(opengl_example main.cpp) +set( NAME_SRC + main.cpp +) + +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) +add_executable( opengl_example ${NAME_SRC} ${NAME_HEADERS} ) # Set executable dependency libraries # Equivalent to pass flags -lGL, -lGLU and -lglut -target_link_libraries(opengl_example GL GLU glut) - -# Add target to run executable -add_custom_target(run-ex1 - COMMAND opengl_example - DEPENDS opengl_example - WORKING_DIRECTORY ${CMAKE_PROJECT_DIR} -) \ No newline at end of file +target_link_libraries(opengl_example GL GLU glut) \ No newline at end of file diff --git a/README.md b/README.md index f5fee56..33e1da4 100644 --- a/README.md +++ b/README.md @@ -9,5 +9,5 @@ bash compile.sh Run the binary. ```bash -./build/opengl_example +./build/bin/opengl_example ```