[CMake] try_run understanding.

Ricardo Tiago rtiago at gmail.com
Fri Aug 20 11:51:43 EDT 2010


Hi all,

How can I use try_run with multiple source files?

Something like: gcc  foo.c foo_fn.c -o newfoo

So far I've came up with the following..

try_run (RUN_RESULT_VAR COMPILE_RESULT_VAR
            ${CMAKE_BINARY_DIR}
            ${CMAKE_CURRENT_SOURCE_DIR}/foodir/foo.c
            CMAKE_FLAGS
              -DINCLUDE_DIRECTORIES:STRING=${CMAKE_CURRENT_SOURCE_DIR}/foodir/
            COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT_VAR)

Thanks!


More information about the CMake mailing list