Added find_package for stb

This commit is contained in:
Dawid Pietrykowski 2023-06-05 19:27:52 +02:00
parent 133701c417
commit b7a9ac3e93

View File

@ -103,17 +103,10 @@ if(NOT WIN32)
endif() endif()
# Find stb_image # Find stb_image
find_path(stb_image_INCLUDE_DIR stb_image.h find_package(Stb REQUIRED)
HINTS
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include/stb
${CMAKE_CURRENT_SOURCE_DIR}/lib
${CMAKE_CURRENT_SOURCE_DIR}
"/usr/include/stb"
${stb_image_ROOT})
if(stb_image_INCLUDE_DIR) if(Stb_INCLUDE_DIR)
message(STATUS "stb_image_INCLUDE_DIR: ${stb_image_INCLUDE_DIR}") message(STATUS "Stb_INCLUDE_DIR: ${Stb_INCLUDE_DIR}")
else() else()
message(FATAL_ERROR "stb_image not found") message(FATAL_ERROR "stb_image not found")
endif() endif()
@ -123,7 +116,7 @@ add_subdirectory(src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src
${GLFW_INCLUDE_DIR} ${GLFW_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
${stb_image_INCLUDE_DIR} ${Stb_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}) ${GLEW_INCLUDE_DIR})
target_link_directories(${PROJECT_NAME} PUBLIC ${GLFW_LIB_DIR} ${GLEW_LIBRARIES}) target_link_directories(${PROJECT_NAME} PUBLIC ${GLFW_LIB_DIR} ${GLEW_LIBRARIES})
target_link_libraries(${PROJECT_NAME} glfw OpenGL::GL GLEW::GLEW) target_link_libraries(${PROJECT_NAME} glfw OpenGL::GL GLEW::GLEW)