Potential find_library() issue in CMake 3.9rc5
CMake 3.9rc5, on Windows x64, using the VC14 generator.
I'm using a variant of this module to find TBB: https://github.com/cmake-basis/find-modules/blob/master/FindTBB.cmake
The module as described in its header section uses 'TBB_ROOT' as a hint. I am defining TBB_ROOT to point to the correct directory before calling find_package(TBB).
With the TBB_DEBUG enabled, flag, it prints this out correctly:
** FindTBB: Initial search paths:
** FindTBB: - Root directory hints = [C:/path/to/tbb/4.4.5]
** FindTBB: - Include path suffixes = [include]
** FindTBB: - Library path suffixes = [lib;lib/intel64/vc14]
The libraries in question are indeed in the "lib/intel64/vc14" directory relative to TBB_ROOT.
However, on CMake 3.9rc5 the call to find_library fails and the libraries are not found.
I've found that if I add NO_PACKAGE_ROOT_PATH
to the following call, it works correctly.
find_library(TBB_${_TBB_COMPONENT}_LIBRARY_RELEASE
NAMES ${_TBB_${_TBB_COMPONENT}_LIB_NAMES_RELEASE}
HINTS ${TBB_ROOT}
PATH_SUFFIXES ${_TBB_LIB_PATH_SUFFIXES}
)
My question is, what wouldn't it work without that flag anyway? From the 3.9rc5 find_library
documentation:
If called from within a find module, search prefix paths unique to the current package being found. Specifically look in the PackageName_ROOT CMake and environment variables. The package root variables are maintained as a stack so if called from nested find modules, root paths from the parent’s find module will be searchd after paths from the current module, i.e. CurrentPackage_ROOT, ENV{CurrentPackage_ROOT}, ParentPackage_ROOT, ENV{ParentPacakge_ROOT}, etc. This can be skipped if NO_PACKAGE_ROOT_PATH is passed.
Am I experiencing a 'bad' interaction between TBB_ROOT being set, and find_library being called without NO_DEFAULT_PATH
first? Is the "HINTS" how relative to TBB_ROOT and that's why it isn't working? Or should it be "PATHS" instead of "HINTS"?
I'm just concerned about potential problems with existing modules.