[CMake] Generated file and parallel build.
Óscar Fuentes
ofv at wanadoo.es
Sun Sep 21 23:49:23 EDT 2008
Several libraries depends on a generared header file. For enabling
parallel builds I need to state that dependency, and I do it with
set_source_files_properties. This happens inside a macro:
macro(add_llvm_library name)
if( LLVM_SOURCE_COMMON_DEPENDS )
set_source_files_properties( ${ARGN}
PROPERTIES OBJECT_DEPENDS ${LLVM_SOURCE_COMMON_DEPENDS}
)
endif( LLVM_SOURCE_COMMON_DEPENDS )
add_library( ${name} ${ARGN} )
....
where LLVM_SOURCE_COMMON_DEPENDS contains the name of the custom target
that is used to trigger the custom command that generates the file:
add_custom_command(OUTPUT ${path_to_intrinsics_gen}
COMMAND tblgen -gen-intrinsic ... -o ${path_to_intrinsics_gen}
DEPENDS tblgen
COMMENT "Building intrinsics.gen...")
add_custom_target(intrinsics_gen ALL
DEPENDS ${path_to_intrinsics_gen})
set(LLVM_SOURCE_COMMON_DEPENDS ${LLVM_SOURCE_COMMON_DEPENDS} intrinsics_gen )
This doesn't work. The parallel build tries to compile the sources
that depends on intrinsics_gen before executing the custom command. I've
tried to use ${path_to_intrinsics_gen} (that is, the custom command
output) instead of intrinsics_gen, to no avail.
What I'm doing wrong?
CMake 2.6.1 -G "Unix Makefiles".
--
Oscar
More information about the CMake
mailing list