MantisBT - CMake
View Issue Details
0015067CMakeCMakepublic2014-08-07 06:562016-06-10 14:31
Alexander Jones 
Kitware Robot 
normalminoralways
closedmoved 
LinuxCentOS6.5
CMake 3.0 
 
0015067: include does not find files in current directory if module path discovered through CMAKE_PREFIX_PATH
Setup:

someprefix/share/mytest/cmake/MyTestConfig.cmake:

  include(somethingspecific)

---

someprefix/share/mytest/cmake/somethingspecific.cmake:

  message("Hello, World!")

---

somesourcecode/CMakeLists.txt

  cmake_minimum_required(VERSION 3.0)

  find_package(MyTest REQUIRED CONFIG)

---

Build with

cmake .. -DCMAKE_PREFIX_PATH=someprefix

CMake Error at (snip)/someprefix/share/mytest/cmake/MyTestConfig.cmake:1 (include):
  include could not find load file:

    somethingspecific
Call Stack (most recent call first):
  CMakeLists.txt:3 (find_package)


This is the setup LLVM has for its config, and it does not work in our setup for the same reason.

Manually adding someprefix/share/mytest/cmake to the CMAKE_MODULE_PATH fixes this, but is that not implied from someprefix being on the CMAKE_PREFIX_PATH?

Our scenario is that we have many isolated package installations distributed across many prefixes, each with an entry on CMAKE_PREFIX_PATH.

Thanks
No tags attached.
gz cmakebugtest.tar.gz (556) 2014-08-07 06:56
https://public.kitware.com/Bug/file/5222/cmakebugtest.tar.gz
Issue History
2014-08-07 06:56Alexander JonesNew Issue
2014-08-07 06:56Alexander JonesFile Added: cmakebugtest.tar.gz
2014-08-07 09:21Brad KingNote Added: 0036574
2014-08-07 09:24Brad KingNote Added: 0036575
2016-06-10 14:29Kitware RobotNote Added: 0042602
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0036574)
Brad King   
2014-08-07 09:21   
CMAKE_MODULE_PATH is the search path for include().
CMAKE_PREFIX_PATH is a search path for find_package() and related commands.

They are completely independent. Neither implies the other.
(0036575)
Brad King   
2014-08-07 09:24   
LLVM 3.5 has improved support for CMake applications. When using LLVM 3.5 you can do something like:

 find_package(LLVM REQUIRED CONFIG)
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
 include(AddLLVM)

See

 http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project [^]

(which has been updated recently).
(0042602)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.