0

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?

RAM
  • 2,257
  • 2
  • 19
  • 41
  • Probably, the path `ThirdParty/include/Foo` differs from the actual one in case. On Windows paths are **case-insensitive**, so it accepts that path. BTW, if you know the exact include directory, no needs to call `find_path` for locate it. Just use that directory in `target_include_directories` command. – Tsyvarev Mar 06 '22 at 18:42
  • @Tsyvarev thanks for chiming in. Great call on not needing to call `find_path` to locate a file that I already know is there. – RAM Mar 07 '22 at 13:47

0 Answers0