[CMake] FIND_PROGRAM() behavior
Michael Wild
themiwi at gmail.com
Sat Feb 7 11:41:36 EST 2009
Do you start the GUI from the command line or from Finder? If the
latter, the problem is clear: Mac OS X never runs ~/.bashrc (or
similar) when you log in. Only when you start a new shell, those files
get processed. That means that /sw/bin is not on your PATH by default.
You can change that by adding /sw/bin to your PATH in ~/.MacOSX/
Environment.plist. Read more here: http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html
But honestly, I wouldn't do that. I would rather do
find_program( PYTHON_EXECUTABLE python PATHS /sw/bin )
This searches first in /sw/bin and the in all standard paths
(including /usr/bin). Or just launch CMake from the command line...
This way you are sure that CMake will see your environment as you use
it from the command line.
Michael
On 7. Feb, 2009, at 17:13, Bill Spotz wrote:
> Ah, I think I (sort of) see the problem. Running from the command
> line, I pick up /sw/bin/python like I hope. Running the Mac OS X
> GUI, I get the unexpected behavior. But I still don't understand
> the GUI behavior.
>
> Thanks.
>
> On Feb 7, 2009, at 9:06 AM, Michael Wild wrote:
>
>> Have you tried using the following?
>>
>> find_program( PYTHON_EXECUTABLE python PATHS ENV PATH )
>>
>> Works for me as advertised.
>>
>>
>> Michael
>>
>> On 6. Feb, 2009, at 20:47, Bill Spotz wrote:
>>
>>> No. /sw/bin/python is a symlink to /sw/bin/python2.5, which is an
>>> executable. The /sw directory is where, on Darwin, the fink project
>>> installs software (debian-style) by default.
>>>
>>> On Feb 6, 2009, at 12:54 PM, David Cole wrote:
>>>
>>>> Is /sw/bin/python a symlink to /usr/bin/python?
>>>>
>>>>
>>>> On Fri, Feb 6, 2009 at 12:39 PM, Bill Spotz <wfspotz at sandia.gov>
>>>> wrote:
>>>> Hello,
>>>>
>>>> Because FIND_PACKAGE(PythonInterp) wasn't behaving exactly the
>>>> way I
>>>> wanted it to, I was playing around with the following (at the very
>>>> beginning of my CMakeLists.txt file):
>>>>
>>>> FIND_PROGRAM(PYTHON_EXECUTABLE python)
>>>> MESSAGE("PYTHON_EXECUTABLE is " ${PYTHON_EXECUTABLE})
>>>> FIND_PROGRAM(SWIG_EXECUTABLE swig)
>>>> MESSAGE("SWIG_EXECUTABLE is " ${SWIG_EXECUTABLE})
>>>>
>>>> On my system, the following executables exist:
>>>>
>>>> /sw/bin/python
>>>> /usr/bin/python
>>>> /sw/bin/swig
>>>> /usr/bin/swig
>>>>
>>>> and /sw/bin comes first in my PATH environment variable. I would
>>>> expect to get the same paths to both python and swig, but I don't.
>>>> Instead, I get the output
>>>>
>>>> PYTHON_EXECUTABLE is /usr/bin/python
>>>> SWIG_EXECUTABLE is /sw/bin/swig
>>>>
>>>> I make sure to delete my cache file before running cmake, so I
>>>> don't
>>>> think it is a caching issue. Why else might it behave like this?
>>>>
>>>> Thanks
>>>
>>>
>>
>>
>
> ** Bill Spotz **
> ** Sandia National Laboratories Voice: (505)845-0170 **
> ** P.O. Box 5800 Fax: (505)284-0154 **
> ** Albuquerque, NM 87185-0370 Email: wfspotz at sandia.gov **
>
>
>
>
>
>
More information about the CMake
mailing list