CMake find_path() don't find what it should

57 views Asked by At

I work on linux ubuntu 20.04 but i try in ubuntu 22.04 too

I have this part of CMakelist:

if(EXISTS "${MYPROJECT_ROOT_DIR}/build/include/config.hpp")
  Message("the file exist ${MYPROJECT_ROOT_DIR}/build/include/config.hpp")
endif()


  find_path(
    MYPROJECT_INCLUDE_DIR
    NAMES config.hpp
    PATHS ${MYPROJECT_ROOT_DIR}/build
    PATH_SUFFIXES include
    NO_DEFAULT_PATH
    REQUIRED
  )

${MYPROJECT_ROOT_DIR} is a absolut path that my user has access

The config.hpp file does exist in the requested path (the message appears correctly and when I search in the folder I see it appear).

But with the find_path command i have this error:

 Could not find MYPROJECT_INCLUDE_DIR using the following files: config.hpp

Can someone explain with find_path doesn't work as expected?

My version of Cmake : cmake version 3.27.6

0

There are 0 answers