[CMake] CMAKE_TOOLCHAIN_FILE / testing with 'wine'
Mathieu Malaterre
mathieu.malaterre at gmail.com
Tue Aug 19 16:19:23 EDT 2008
On Tue, Aug 19, 2008 at 10:19 PM, Alexander Neundorf
<a.neundorf-work at gmx.net> wrote:
> On Tuesday 19 August 2008, Mathieu Malaterre wrote:
> ...
>> Is this the correct way of doing it ?
>> 1. The way to differenciate a cross compiled project from a regular
>> cmake one is by checking the value of CMAKE_TOOLCHAIN_FILE
>
> IF(CMAKE_CROSSCOMPILING)
>
> (since you could in theory also set up the handful of required variables in
> another way).
cool
>> 2. I can always safely append '.exe' to the executable name ?
>
> Better use ${CMAKE_EXECUTABLE_SUFFIX}
fantastic !
This is now working great. I can generate mingw32 and gcc -m32 on my
linux debian amd64 box. In one case the toolchain will explicitely
specify that tests need to be run via an emulator, while in the other
there is no such need (32bits on amd64 works fine with the proper
libs).
So in my mingw32 I simply added:
FIND_PROGRAM(WINE_EXECUTABLE
NAMES wine
)
set(TARGET_SYSTEM_EMULATOR ${WINE_EXECUTABLE})
and tests becomes:
ADD_TEST(${name} ${TARGET_SYSTEM_EMULATOR}
${GDCM_Common_TESTS}${CMAKE_EXECUTABLE_SUFFIX} ${name})
--
Mathieu
More information about the CMake
mailing list