neundorf at kde.org
Thu Nov 30 17:35:51 GMT 2006
On Thursday 30 November 2006 13:18, Michel Hermier wrote:
> Alexander Neundorf wrote:
> > cmake always searches first in the default dirs and after that in the
> > additional directories given. To change that order you have to call it
> > first with NO_DEFAULT_PATH and then a second time with no extra paths and
> > without NO_DEFAULT_PATH.
> I find this to be wrong. Usually when you give the macro the argument,
> you know what you are expecting. So default arguments should come later.
I did expect this too until I learned that CMake prefers the defaults.
Rationale: e.g. for find_program() it should also find the program which you
would get when you enter the program name on a command line, which will give
you the one from the PATH.
So, that's how it is. Once you know that it works this way, there is a
not-too-hard way to have the other behaviour:
find_path(FOO foo.h dir1 dir2 dir NO_DEFAULT_PATH)
You can submit a feature request to the cmake bug tracker if you want to.
> I was thinking earlier, isn't it possible to make a general macro to
> handle this ?
> Usually the steps to check for a library are always the same.
> - Check for package config on non win32.
> - Search for the includes
> - Search the binary
> Quite always the same steps.
I already thought about this but it's not on the top of my TODO.
Maybe you can give it a try ?
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org - http://www.kde.org
alex AT neundorf.net - http://www.neundorf.net
More information about the kde-core-devel