[CMake] TRY_RUN generates commands ...

Brad King brad.king at kitware.com
Thu Mar 24 09:30:52 EST 2005


Radek Kotesovec wrote:
> Hello,
> is possible to view what commands CMake command 'TRY_RUN' generates?
> 
> Something like:
> 
> CMakeLists.txt :
> TRY_RUN(run_res compile_res ${BINDIR} hello_world.cpp)
> 
> bash:
> cmake --verbose .<enter>
> ...
> building TRY_RUN(run_res compile_res ${BINDIR} hello_world.cpp):
> c++ -o hello_world.o -c hello_world.cpp
> c++ hello_world.o -o hello_world
> ./hello_world
> ...

The TRY_COMPILE command has an OUTPUT_VARIABLE argument that you can use 
to get the output of the build stored in a variable.  This feature is 
missing from TRY_RUN in CMake 2.0 but is fixed in the CVS version.  If 
you are having problems with a particular try-run then you can run cmake 
with the --debug-trycompile option and it will leave the build tree of 
the last try command on disk for you to inspect.

-Brad


More information about the CMake mailing list