[Cmake] ar+ranlib detection
William A. Hoffman
billlist at nycap . rr . com
Thu, 09 Oct 2003 11:26:59 -0400
This does look like a problem. However, the problem is
a bit complicated.
Basically, the FIND_PROGRAM command looks like this:
FIND_PROGRAM(CMAKE_AR NAMES ar PATHS /bin /usr/bin /usr/local/bin)
FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib PATHS /bin /usr/bin /usr/local/bin)
And it works by looking in the paths specified to the command first,
then in the environment variable $PATH. So, you get the bad behavior
where cmake made find something not in your path.
One option to fix this would be to change the order, so that FIND_PROGRAM
looks in the PATH first then in the other paths passed into the command.
However, this may produce different results than cmake has in the past.
A better option would be to specifically ask for the system path in the command,
so cmake list writers could decide where to put the path.
Something like this:
FIND_PROGRARM(CMAKE_AR_NAMES ar PATHS SYSTEMPATH /bin /usr/bin /usr/local/bin)
You could not use $ENV(PATH) because path can be ; or : separated depending on the OS.
I will enter this as a bug.
For now, if you want a quick fix, you can change this file:
CMake/Modules/CMakeDetermineCCompiler.cmake
And remove the extra paths for CMAKE_AR and CMAKE_RANLIB. For those programs
it makes sense that cmake should not have extra paths anyway. So, I will check
in the fix to cvs cmake, and it should be in the next 1.8.2 release.
Thanks for the report.
-Bill
At 09:37 AM 10/9/2003, Doug Henry wrote:
>I have a development toolchain built independently of my linux distro.
>For example, binutils and gcc are in a dir called /server/tools/bin.
>This path is first in my bash PATH. When I run cmake my compilers get
>detected according to my path, but the binutils (ar, ranlib, etc) are
>always detected in /usr/bin. Shouldn't they also be detected from the
>path search order? Is there a way I can fix this without having to
>manually change it through ccmake?
>
>Thanks
>
>
>_______________________________________________
>Cmake mailing list
>Cmake at www . cmake . org
>http://www . cmake . org/mailman/listinfo/cmake