Skip to content

Commit

Permalink
Use CMake-provided 'StbImage_FOUND', not incorrect manual 'STB_IMAGE_…
Browse files Browse the repository at this point in the history
…FOUND' (#3660)
  • Loading branch information
rcurtin committed Mar 25, 2024
1 parent 24e6c93 commit 4f92ca7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions CMake/FindStbImage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ find_path(STB_IMAGE_INCLUDE_DIR_1
PATHS ${STB_IMAGE_SEARCH_PATHS} ${STB_IMAGE_INCLUDE_DIR})

if(STB_IMAGE_INCLUDE_DIR_1)
set(STB_IMAGE_FOUND YES)
set(STB_IMAGE_INCLUDE_DIR "${STB_IMAGE_INCLUDE_DIR_1}" CACHE PATH
"stb_image include directory")

Expand All @@ -32,7 +31,6 @@ else ()
PATH_SUFFIXES stb/)

if(STB_IMAGE_INCLUDE_DIR_2)
set(STB_IMAGE_FOUND YES)
set(STB_IMAGE_INCLUDE_DIR "${STB_IMAGE_INCLUDE_DIR_2}" CACHE PATH
"stb_image include directory")

Expand All @@ -47,7 +45,6 @@ endif ()

# Checks 'REQUIRED'.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(StbImage
REQUIRED_VARS STB_IMAGE_INCLUDE_DIR)
find_package_handle_standard_args(StbImage REQUIRED_VARS STB_IMAGE_INCLUDE_DIR)

mark_as_advanced(STB_IMAGE_INCLUDE_DIR)
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,14 @@ if (NOT DOWNLOAD_DEPENDENCIES)
find_package(StbImage)
else()
find_package(StbImage)
if (NOT STB_IMAGE_FOUND)
if (NOT StbImage_FOUND)
get_deps(https://mlpack.org/files/stb.tar.gz stb stb.tar.gz)
set(STB_IMAGE_INCLUDE_DIR ${GENERIC_INCLUDE_DIR})
find_package(StbImage REQUIRED)
endif()
endif()

if (STB_IMAGE_FOUND)
if (StbImage_FOUND)
set(STB_AVAILABLE "1")
set(MLPACK_INCLUDE_DIRS ${MLPACK_INCLUDE_DIRS} "${STB_IMAGE_INCLUDE_DIR}")

Expand Down

0 comments on commit 4f92ca7

Please sign in to comment.