find_package(glfw3 REQUIRED)

include_directories (${CMAKE_CURRENT_SOURCE_DIR})

if(AddressSanitizer)
    link_libraries("-fsanitize=address")
endif()
add_executable(HelloWorld HelloWorld.c ../ExampleAndTestDeps/GL/gl3w.c)
add_executable(RenderCacheExample RenderCacheExample.c ../ExampleAndTestDeps/GL/gl3w.c)
add_executable(Playground Playground.c ../ExampleAndTestDeps/GL/gl3w.c)
add_executable(NestedClipping NestedClipping.c ../ExampleAndTestDeps/GL/gl3w.c)

if(AddressSanitizer)
    set_target_properties(HelloWorld PROPERTIES COMPILE_FLAGS "-std=c89 -pedantic -fsanitize=address -Wunused")
    set_target_properties(RenderCacheExample PROPERTIES COMPILE_FLAGS "-std=c89 -pedantic -fsanitize=address -Wunused")
    set_target_properties(Playground PROPERTIES COMPILE_FLAGS "-fsanitize=address -Wunused")
    set_target_properties(NestedClipping PROPERTIES COMPILE_FLAGS "-fsanitize=address -Wunused")
else()
    set_target_properties(HelloWorld PROPERTIES COMPILE_FLAGS "-std=c89 -pedantic")
endif()
target_link_libraries(HelloWorld ${TARPDEPS} glfw)
target_link_libraries(RenderCacheExample ${TARPDEPS} glfw)
target_link_libraries(Playground ${TARPDEPS} glfw)
target_link_libraries(NestedClipping ${TARPDEPS} glfw)
