I have a question about CMake which seems to be commonly asked here, but none of the answers seem to solve my problem.
In the details
subdirectory, there is
CMake docs for add_custom_target:
By default nothing depends on the custom target. Use ADD_DEPENDENCIES to add dependencies to or from other targets.
So I suggest to "connect" the targets with
ADD_DEPENDENCIES( full_out part_out )
EDIT: Working example
As it turned out, you need to set the source file properties for part.out
Here is my working example (tried under Windows with VS2008):
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8 )
project( full )
add_subdirectory( details )
add_custom_command( OUTPUT full.out
COMMAND ${CMAKE_COMMAND} -E copy ./details/part.out full.out
DEPENDS details/part.out
)
add_custom_target( full_out
DEPENDS full.out details/part.out details/part.src
)
set_source_files_properties( details/part.out PROPERTIES GENERATED TRUE )
add_dependencies( full_out part_out )
details/CMakeLists.txt:
cmake_minimum_required(VERSION 2.8 )
project(part)
add_custom_command(OUTPUT part.out
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/part.src part.out
DEPENDS part.src)
add_custom_target(part_out
DEPENDS part.out)
This example worked for all of your 3 stated cases.