I have the following CMake script, it works:
find_path(
GLES_SDK_INCLUDE_DIR
NAMES "GLES2/gl2.h"
PATHS "${CMAKE_FRAMEWORK_PATH}/include")
But this one returns a -NOTFOUND
:
find_path(
GLES_SDK_INCLUDE_DIR
NAMES "gl2.h"
PATHS "${CMAKE_FRAMEWORK_PATH}/include/GLES2")
Why? Any idea?
Turning my comment into an answer
In your first case CMake just does find the header in the default paths.
CMAKE_FRAMEWORK_PATH
seems a strange choice as an additional search path since the variable contains a "list of directories specifying a search path for OS X frameworks used by the find_library(), find_package(), find_path(), and find_file() commands."
I've given your example an try on my Ubuntu distribution and I could reproduce your problem with the flowing test:
CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(FindGL2)
unset(GLES_SDK_INCLUDE_DIR CACHE)
find_path(
GLES_SDK_INCLUDE_DIR
NAMES "GLES2/gl2.h"
PATHS "${CMAKE_FRAMEWORK_PATH}/include"
)
message(STATUS "GLES2/gl2.h => ${GLES_SDK_INCLUDE_DIR}")
unset(GLES_SDK_INCLUDE_DIR CACHE)
find_path(
GLES_SDK_INCLUDE_DIR
NAMES "gl2.h"
PATHS "${CMAKE_FRAMEWORK_PATH}/include/GLES2"
)
message(STATUS "gl2.h => ${GLES_SDK_INCLUDE_DIR}")
Gives
-- GLES2/gl2.h => /usr/include
-- gl2.h => GLES_SDK_INCLUDE_DIR-NOTFOUND
Solution
Use PATH_SUFFIXES "include/GLES2"
or just PATH_SUFFIXES "GLES2"
instead:
find_path(
GLES_SDK_INCLUDE_DIR
NAMES "gl2.h"
PATH_SUFFIXES "GLES2"
)
message(STATUS "gl2.h => ${GLES_SDK_INCLUDE_DIR}")
Does give:
-- gl2.h => /usr/include/GLES2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With