[CMake] FIND_PATH and CMAKE_INSTALL_PREFIX

Clifford Yapp cliffyapp at gmail.com
Thu Sep 2 10:44:34 EDT 2010


I have a setup in CMake where I am deliberately re-setting a few
variables to NOTFOUND in macros in order to allow an option change to
re-populate them.  Unfortunately, I have run into a rather curious
behavior that I'm not quite sure how to disable.

The FIND_* routines on the first configure pass are reporting what I
expect, but on the second pass they are finding already-installed
copies of things in CMAKE_INSTALL_PREFIX.  It seems that this
directory is getting added to the FIND_PATH search list, and I very
definitely don't want this to happen.  Unfortunately, so far I have
not found any way to PREVENT this, and the only workaround involves
manually checking for the presence of CMAKE_INSTALL_PREFIX in the
resulting found items and stripping them out.  This seems like a very
very ugly hack and would require local versions of every Find*.cmake
routine needed by my program - is there any other way to keep
CMAKE_INSTALL_PREFIX out of the search path on repeated passes of
cmake?

Cheers,
CY


More information about the CMake mailing list