View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015331CMakeModulespublic2014-12-31 02:452014-12-31 05:15
ReporterAmiGO 
Assigned To 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionwon't fix 
PlatformLinuxOSFedoraOS Version20
Product VersionCMake 2.8.12.2 
Target VersionFixed in Version 
Summary0015331: Impossible to use Modules from GIT as project-local module because of CMAKE_CURRENT_LIST_DIR
DescriptionCMake package: cmake-2.8.12.2-2.fc20.x86_64

Here is the details:

https://github.com/Kitware/CMake/blob/master/Modules/FindLibLZMA.cmake [^]

Line 57:
 include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
Line 66:
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)

CMAKE_CURRENT_LIST_DIR causes CMake to search for CheckLibraryExists and FindPackageHandleStandardArgs in directory where the FindLibLZMA was placed.

So if I want to include FindLibLZMA in project-local CMake modules directory CMake will fail.

Sometimes before it looks like include(FindPackageHandleStandardArgs) and observed behaviour was correct but now it's broken.
Steps To Reproduce1. Untar demo project from attachment;
2. Run cmake ./ in project directory;

CMake will fail with the following message:

CMake Error at cmake/FindLibLZMA.cmake:67 (include):
  include could not find load file:

    /home/AmiGO/soft/sources/zbackup/demo/cmake/FindPackageHandleStandardArgs.cmake
Call Stack (most recent call first):
  CMakeLists.txt:6 (find_package)


CMake Error at cmake/FindLibLZMA.cmake:68 (FIND_PACKAGE_HANDLE_STANDARD_ARGS):
  Unknown CMake command "FIND_PACKAGE_HANDLE_STANDARD_ARGS".
Call Stack (most recent call first):
  CMakeLists.txt:6 (find_package)


-- Configuring incomplete, errors occurred!

3. Comment line 67 and uncomment line 66;
4. Run cmake ./ again.

Now all becomes normal.
Additional InformationYou should probably need to introduce something like ${CMAKE_MODULE_VENDOR_PATH} that will unwind to /usr/share/cmake/Modules and use it in GIT modules instead of ${CMAKE_CURRENT_LIST_DIR}.
TagsNo tags attached.
Attached Files? file icon demo.tar.xz [^] (1,768 bytes) 2014-12-31 02:45

 Relationships

  Notes
(0037538)
Rolf Eike Beer (developer)
2014-12-31 05:15

This works exactly as intended. If you use a module that is shipped with any recent version of CMake it will use the other modules it depends on exactly from that version of CMake because it can rely on their interface.

If you want a Module that behaves differently then you should not only put a modified e.g. CheckLibraryExists.cmake in your project, but also a modified e.g. FindLZMA.cmake. If you copy modules from CMake git to your project you need to modify them anyway as you have to replace the license stub with the full BSD license. You can then also modify the include.

 Issue History
Date Modified Username Field Change
2014-12-31 02:45 AmiGO New Issue
2014-12-31 02:45 AmiGO File Added: demo.tar.xz
2014-12-31 05:15 Rolf Eike Beer Note Added: 0037538
2014-12-31 05:15 Rolf Eike Beer Status new => closed
2014-12-31 05:15 Rolf Eike Beer Resolution open => won't fix
2014-12-31 05:15 Rolf Eike Beer Category CMake => Modules


Copyright © 2000 - 2018 MantisBT Team