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

Tron Thomas tron.thomas at verizon.net
Sun Nov 23 12:29:30 EST 2008


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")

However, CTest never looks in the right directory to find the 
executable.  It will produce output like the follow when trying to 
execute the test:

  1/  1 Testing TestRunner                    Could not find executable 
TestRunner.app/Content/MacOS/TestRunner
Looked in the following places:
TestRunner.app/Content/MacOS/TestRunner
TestRunner.app/Content/MacOS/TestRunner
TestRunner.app/Content/MacOS/Debug/TestRunner
TestRunner.app/Content/MacOS/Debug/TestRunner
Debug/TestRunner.app/Content/MacOS/TestRunner
Debug/TestRunner.app/Content/MacOS/TestRunner
Unable to find executable: TestRunner.app/Content/MacOS/TestRunner

For the way I have the project configured, the correct path for Debug 
version of the executable would be:
${EXECUTABLE_OUTPUT_PATH}/build/Debug/TestRunner.app/Content/MacOS/TestRunner

What can I do that will allow the CTest application to run the test 
exectuable?



More information about the CMake mailing list