Structure CMakeLists like other examples. Produce a bin in opengl_examples

This commit is contained in:
Matt McWilliams 2024-03-30 16:00:38 -04:00
parent 87d366c2a7
commit 0989efa30f
2 changed files with 8 additions and 10 deletions

View File

@ -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}
)
target_link_libraries(opengl_example GL GLU glut)

View File

@ -9,5 +9,5 @@ bash compile.sh
Run the binary.
```bash
./build/opengl_example
./build/bin/opengl_example
```