View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012325CMakeModulespublic2011-07-08 13:272011-07-08 14:41
ReporterDan Thill 
Assigned ToAlex Neundorf 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformWindowsOSWindows XP-64 SP2OS Version5.2.3790
Product VersionCMake 2.8.4 
Target VersionFixed in Version 
Summary0012325: FindDCMTK: Does not work when CMAKE_MODULE_PATH has been modified.
DescriptionWhen FindDCMTK includes FindPackageHandleStandardArgs, this will fail if CMAKE_MODULE_PATH has been modified (under some circumstances). This was discovered when I was making my own copy of FindDCMTK with some bug fixes and putting it into my local source directory in order to override the stock one.
Steps To Reproduce1) Make a copy of FindDCMTK.cmake and put into your local source directory.
2) In CMakeLists.txt, do the following:

-------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_MODULE_PATH})

PROJECT(SomeProject)

FIND_PACKAGE(DCMTK)

-------------------------------------------

You will get the following error:


CMake Error at FindDCMTK.cmake:136 (include):
  include could not find load file:

    [full path to src directory]/FindPackageHandleStandardArgs.cmake
Call Stack (most recent call first):
  CMakeLists.txt:8 (FIND_PACKAGE)


CMake Error at FindDCMTK.cmake:137 (find_package_handle_standard_args):
  Unknown CMake command "find_package_handle_standard_args".
Call Stack (most recent call first):
  CMakeLists.txt:8 (FIND_PACKAGE)
Additional InformationFix is modify FindDCMTK.cmake:135 and change:

include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)

to

include(FindPackageHandleStandardArgs)

TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0027019)
Dan Thill (reporter)
2011-07-08 13:45

Obviously, the example I listed above is weird and can easily be fixed by me since I'm making my own copy. However, you can also see that if a user were trying to override FindPackageHandleStandardArgs by changing the CMAKE_MODULE_PATH and leaving FindDCMTK in the default location, FindDCMTK would not pick up the other version since it's bypassing the INCLUDE() search path machinery. This seems counterintuitive to me.
(0027020)
Alex Neundorf (developer)
2011-07-08 14:11

It has the fixed path to FindPackageHandleStandardArgs.cmake so it gets exactly the one it expects, i.e. the one shipping with the same version of cmake.
If somebody wants it to use a different version, he has to provide copies of both files, so the dependencies are ok.
Otherwise FindDCMTK.cmake might get a FindPackageHandleStandardArgs.cmake which does not support the features it expects and this would lead to a cmake error.

Alex
(0027021)
Dan Thill (reporter)
2011-07-08 14:34

Fair enough. I've just noticed this same construct in other modules and realized this must be the rationale.
(0027022)
Alex Neundorf (developer)
2011-07-08 14:41

So I'm closing this one if you don't mind.

Alex

 Issue History
Date Modified Username Field Change
2011-07-08 13:27 Dan Thill New Issue
2011-07-08 13:45 Dan Thill Note Added: 0027019
2011-07-08 14:11 Alex Neundorf Note Added: 0027020
2011-07-08 14:34 Dan Thill Note Added: 0027021
2011-07-08 14:41 Alex Neundorf Note Added: 0027022
2011-07-08 14:41 Alex Neundorf Assigned To => Alex Neundorf
2011-07-08 14:41 Alex Neundorf Status new => closed
2011-07-08 14:41 Alex Neundorf Resolution open => no change required


Copyright © 2000 - 2018 MantisBT Team