[CMake] MSYS EXEC_PROGRAM() or EXECUTE_PROCESS() fails
Brad King
brad.king at kitware.com
Tue Sep 12 16:24:58 EDT 2006
Brad King wrote:
> Peter Visser wrote:
>> I just "discovered" cmake, I find cmake easy to setup and it works
>> fantastic.
>> However, a small problem occurs. I'm using: cmake 2.4-patch3 under
>> MSYS-1.0.10.
>>
>> The problem occurs when using EXEC_PROGRAM() or EXECUTE_PROCESS().
>> Instead of "sh.exe" from MSYS being used to execute the program
>> "cmd.exe" from windows is being used.
>> This results in an error if the binary doesn't run under windows
>> natively e.g. wx-config. ( e.g. FIND_PACKAGE(wxWidgets) will not work)
>> It can be solved by
>> Changing:
>> EXEC_PROGRAM(wx-config
>> ARGS "--cxxflags"
>> OUTPUT_VARIABLE wxWidgets_CXX_FLAGS
>> RETURN_VALUE RET)
>> Into:
>> EXEC_PROGRAM(sh
>> ARGS "wx-config --cxxflags"
>> OUTPUT_VARIABLE wxWidgets_CXX_FLAGS
>> RETURN_VALUE RET)
>>
>> Most likely I'm doing something wrong, is there a switch/macro or
>> calling cmake with an argument to solve this?
>
> CMake is a windows program that happens to know how to generate MSYS
> makefiles. It does not try to reproduce the native build behavior for
> EXEC* commands during processing of CMakeLists.txt code. Windows
> programs do not know how to interpret #! lines in scripts they execute.
> You'll have to invoke it using the second form. It should work
> everywhere anyway.
Oops, I meant "we'll have to invoke it using the second form". We'll
fix the find script.
Thanks,
-Brad
More information about the CMake
mailing list