'CMake's find_path finds path on Windows but not on macOS

I have a cmake project for a third-party library which targets both Windows and macOS (let's call it Foo) which I hope to include with a cmake Find module. The library stashes its includes in ${CMAKE_SOURCE_DIR}/ThirdParty/include/Foo, and I'm calling find_path to define Foo_INCLUDE_DIR as follows:

find_path(Foo_INCLUDE_DIR
        NAMES "Foo/version.hpp"
        PATHS "${CMAKE_SOURCE_DIR}/ThirdParty/include"
        NO_DEFAULT_PATH
        )

Now, the problem is that even though the project has the same exact dir tree on both macOS and Windows, the above call sets Foo_INCLUDE_DIR as Foo_INCLUDE_DIR-NOTFOUND".

Does anyone have any idea why the above call to find_path only works on Windows?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source