Fwd: using a target with try_run

Ian Monroe ian at monroe.nu
Wed Mar 11 20:52:01 CET 2009


On Wed, Mar 11, 2009 at 2:39 PM, Alexander Neundorf <neundorf at kde.org> wrote:
> On Wednesday 11 March 2009, Ian Monroe wrote:
>> Seems to be impossible to use try_run in any sort of portable way
>> since you can't use target_link_libraries and include_directories with
>> it. Right now I have it rigged up, but I actually give it direct GCC
>> commands.
>>
>> So is it possible to use a target with try_run? Or is try_run pretty
>> much just useless?
>
> TRY_RUN() and TRY_COMPILE() are relatively low-level, "normal" users shouldn't
> use them.
> There are cmake modules like CheckCSourceRuns.cmake which wrap it, they are
> intended for "end users".
> Is there something you want to do what you can't do with check_c_source_runs()
> or check_cxx_source_runs() ?
>
> Alex
>

Well I didn't know that it existed. :)

The documentation for check_cxx_source_runs() says "macro which checks
if the source code compiles". It says the same thing for
CHECK_CXX_SOURCE_COMPILES so I'm guessing the docs are just wrong?
Since I do need to run it and see what the exit variable is.

In which case I'm kinda confused what "variable to store the result, 1
for success, empty for failure" means. If the program returns a 0 the
variable is 1? Heh.

Ian


More information about the Kde-buildsystem mailing list