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

Tron Thomas tron.thomas at verizon.net
Sun Nov 23 13:44:31 EST 2008


I tried that originally, and it does not work.  When add_executable is 
used to create an application bundle on MacOS X, it does not simple 
build an executable program.  It creates an entire directory structure 
that bundles up the exectuable.  CTest does not seem to understand how 
to deal with this bundle; it expects a runnable executable as the name 
for the second argument to add_test.

Bill Hoffman wrote:
> 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