[CMake] find_file unexpected finds

Jörg Kreuzberger j.kreuzberger at procitec.de
Fri May 8 09:02:26 EDT 2015


Hi!

i have a problem with find_file, finding files in directory structures not part of the PATHS option and no other CMAKE VARIABLES relevant to find_file set.

I use find_file to find external libraries in different versions, they are located in different git repos.
each repo has its find script
E.g.

<base>/libexternv1/cmake/FindLibExternV1.cmake
<base>/libexternv1/lib/win/alib.lib
<base>/libexternv2/cmake/FindLibExternV2.cmake
<base>/libexternv2/lib/win/alib.lib
<base>/project/CMakeLists.txt -> the CMAKE_SOURCE_DIR

the project now includes the correct FinLibExternV2.cmake (using include( ../libexternv1/cmake/FindLibExternV2.cmake )
in FindLibExternV2, the lib search with findfile

find_file( <VAR > alib.lib PATHS ${CMAKE_CURRENT_LIST_DIR}/../lib/win/alib.lib )

My problem is: it always finds the lib from the libexternv1 directory, seems to ignore the PATHS hint. FindLibExternV1.cmake is never included.

Environment: CMAKE 3.2.2 and Visual Studio Generator 2013 x64 on Win7



More information about the CMake mailing list