MantisBT - CMake
View Issue Details
0008291CMakeCMakepublic2008-12-13 17:232016-06-10 14:30
tron_thomas 
Philip Lowman 
highminoralways
closedmoved 
CMake-2-6 
 
0008291: CMake won't configure CxxTest dependencies correctly for Xcode
I am using CxxTest for unit testing in a project that is configured with CMake.

Here is an example of a macro used to define a unit test application in the project:

macro(AddCxxTest Name)
    set(TestRunnerDirectory ${BuildPath}/${Name}Source)

    set(TestRunner ${TestRunnerDirectory}/${Name}.cpp)
    
    set(TestRunnerCommand ${EXECUTABLE_OUTPUT_PATH}/${Name})
    
    add_custom_command(OUTPUT ${TestRunner}
        COMMAND ${CMAKE_COMMAND} -E make_directory ${TestRunnerDirectory}
        COMMAND ${PERL_EXECUTABLE} ${CxxTestGen} ${CxxTestGenFlags}
            -o ${TestRunner} ${ARGN}
        DEPENDS ${ARGN}
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

    add_executable(${Name} ${TestRunner} ${ARGN})
        
    set_target_properties(${Name} PROPERTIES COMPILE_FLAGS
        "-I${CxxTestDirectory}")

    add_test(${Name} ${TestRunnerCommand})
        
    add_dependencies(TestAll ${Name})
endmacro(AddCxxTest)

A test is often created like this:

file(GLOB Tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Tests/*.h)

AddCxxTest(SomeUnitTest ${Tests})

CMake will then successfully create the SomeUnitTest target for the project. With make files on Linux, and Visual Studio on Windows everything works fine.
When changes to the header files located in the Tests directory that are used to define the tests for the unit test are made, the SomeUnitTest target will rebuild when building everything.

However, with Xcode on Mac OS X, no dependency changes will be detected and the SomeUnitTest target will not rebuild. It has to be cleaned before a build all will pick up the header file changes for the target.

CMake should be able to configure the project such that header file changes for the target should result in the executable being rebuilt on Xcode.
No tags attached.
Issue History
2008-12-13 17:23tron_thomasNew Issue
2008-12-14 10:20Bill HoffmanStatusnew => assigned
2008-12-14 10:20Bill HoffmanAssigned To => David Cole
2010-08-29 01:34Kovarththanan RajaratnamCategoryCCMake => CMake
2010-09-09 17:52David ColePrioritynormal => high
2010-11-10 21:09David ColeTarget Version => CMake 2.8.4
2011-01-04 13:05David ColeNote Added: 0024399
2011-01-04 13:05David ColeTarget VersionCMake 2.8.4 =>
2012-08-13 15:06David ColeStatusassigned => new
2012-08-13 15:06David ColeNote Added: 0030585
2012-08-13 15:07David ColeStatusnew => backlog
2012-08-13 15:23David ColeAssigned ToDavid Cole =>
2012-08-18 15:34Philip LowmanAssigned To => Philip Lowman
2012-08-18 15:34Philip LowmanStatusbacklog => assigned
2016-06-10 14:27Kitware RobotNote Added: 0041483
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0024399)
David Cole   
2011-01-04 13:05   
Unsetting "target version" field:

Not enough time left to investigate/fix this one before CMake 2.8.4 -- is this still a problem using CMake 2.8.3? Or is it perhaps fixed at this point?

What if you use full absolute path names for all file DEPENDS clauses? Is this still an issue?
(0030585)
David Cole   
2012-08-13 15:06   
Sending old, not-recently-updated issues to the backlog.

(The age of the bug alone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0041483)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.