[CMake] Can't run Cocoa test application in CTest

Bill Hoffman bill.hoffman at kitware.com
Sun Nov 23 12:49:37 EST 2008


Tron Thomas wrote:
> On Mac OS X, I want to build a graphical test application to be added as 
> a test in a project configured by CMake.  However, I am unable to add 
> this application as a test in CMake because it Mac OS X builds the 
> program as an application bundle, and CMake is unable to find the 
> correct path to the executable to run it.
> 
> On Mac OS X, an application bundle is basically a directory structure.  
> Say the test application is called TestRunner, the root of the 
> application bundle would be called TestRunner.app.  The path to the 
> executable with in the bundle would be:
> 
> TestRunner.app/Content/MacOS/TestRunner
> 
> I cannot correctly specify the path to CTest when using the ADD_TEST 
> command in CMake.  I tried something like:
> ADD_TEST(TestRunner "TestRunner.app/Content/MacOS/TestRunner")
> 
You should be able to do this:

add_test(TestRunner TestRunner)

All that should be needed is the name of the executable target given to 
the add_executable command.  CMake should then figure out how to call 
the executable.

-Bill


More information about the CMake mailing list