[cmake-developers] find_package without REQUIRED can cause fatal error now

Chris developerchris at rebel.com.au
Wed Apr 24 23:17:23 EDT 2013

Alexander Neundorf <neundorf at ...> writes:

> > 
> > We need to figure out what tells find_package to look for and
> > load KActivitiesConfig.cmake from a path with no drive letter
> > in the first place.
> Is it this one http://public.kitware.com/Bug/view.php?id=10994 ?
> Alex
> --
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> Please keep messages on-topic and check the CMake FAQ at:
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

It appears the issue is in the find_package function it is incorrectly
changing the CMAKE_CURRENT_LIST_FILE and dropping the drive letter and colon

cmake called with...

cmake -G "MinGW Makefiles"  -DBUILD_doc=OFF -DCMAKE_INSTALL_PREFIX="r:/"

macro_optional_find_package(KActivities 6.1.0) is called from
q:/kate/CMakeLists.txt at that point CMAKE_CURRENT_LIST_FILE is set to

macro_optional_find_package calls find_package(KActivities) at that point
CMAKE_CURRENT_LIST_FILE is still set to q:/kate/CMakeLists.txt

when find_package calls r:\lib\cmake\KActivities\KActivitiesConfig.cmake

The call stack below shows that change occuring.

I cannot find any point where the change occurs. I can only assume its
inside find_package()

log output with extra messages inserted

-- Found the KDE4 kconfig_compiler preprocessor: r://bin/kconfig_compiler.exe
-- Found automoc4: R:/bin/automoc4.exe
-- CMAKE_CURRENT_LIST_FILE : q:/kate/CMakeLists.txt
-- finding package KActivities 6.1.0 CMAKE_CURRENT_LIST_FILE :
-- setting rootDir : /lib/cmake/KActivities and myDir :
/lib/cmake/KActivities taken from CMAKE_CURRENT_LIST_FILE :
CMake Error at /lib/cmake/KActivities/KActivitiesLibraryTargets.cmake:63
  The imported target "kactivities" references the file


  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained


  but not all the files it references.

Call Stack (most recent call first):
  /lib/cmake/KActivities/KActivitiesConfig.cmake:20 (include)
  r:/share/apps/cmake/modules/MacroOptionalFindPackage.cmake:34 (find_package)
  CMakeLists.txt:17 (macro_optional_find_package)


More information about the cmake-developers mailing list