cmake/bochs: more strict dependency handling for libfailboch_external

The configure step for libfailbochs_external could be executed parallel
to other build steps, which required the files produced by the configure
step. Therefore a race-condition occurred. By giving the configure step
an explicit target name, more correct dependencies could be modeled
within bochs.cmake.

Change-Id: If2d7dafdace23b0eba6efcdff3ed0bfca2423048
This commit is contained in:
Christian Dietrich
2014-10-21 12:39:42 +02:00
parent 8fcbc7eeae
commit 7ee105016c
3 changed files with 11 additions and 2 deletions

View File

@ -85,10 +85,11 @@ if(BUILD_BOCHS)
# Use cmake's external project feature to build fail library
include(ExternalProject)
set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure)
ExternalProject_Add(
libfailbochs_external
SOURCE_DIR ${bochs_src_dir}
CONFIGURE_COMMAND ${bochs_src_dir}/configure ${bochs_configure_params} --prefix=${bochs_install_prefix}
CONFIGURE_COMMAND MAKEFLAGS="" ${bochs_src_dir}/configure ${bochs_configure_params} --prefix=${bochs_install_prefix}
PREFIX ${bochs_src_dir}
BUILD_COMMAND $(MAKE) -C ${bochs_src_dir} ${bochs_build_CXX} ${bochs_build_LIBTOOL} libfailbochs.a
## Put install command here, to prevent cmake calling make install
@ -110,7 +111,12 @@ if(BUILD_BOCHS)
# FIXME: see FIXME above
#target_link_libraries(fail-client libfailbochs fail ${bochs_library_dependencies})
target_link_libraries(fail-client ${bochs_src_dir}/libfailbochs.a fail ${bochs_library_dependencies})
add_dependencies(libfailbochs_external-configure fail-protoc)
add_dependencies(libfailbochs_external libfailbochs_external-configure)
add_dependencies(fail-client libfailbochs_external)
add_dependencies(fail-sal libfailbochs_external-configure)
add_dependencies(fail-comm libfailbochs_external-configure)
add_dependencies(fail-util libfailbochs_external-configure)
# /FIXME
install(TARGETS fail-client RUNTIME DESTINATION bin)

View File

@ -34,5 +34,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(PROTOBUF_IMPORT_DIRS ${PROTOBUF_IMPORT_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTOS})
add_custom_target(fail-protoc
DEPENDS ${PROTO_SRCS} ${PROTO_HDRS}
)
add_library(fail-comm ${SRCS} ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(fail-comm ${PROTOBUF_LIBRARY})

View File

@ -7,7 +7,7 @@ set(SRCS
)
add_library(fail-efw ${SRCS})
add_dependencies(fail-efw fail-comm)
add_dependencies(fail-efw fail-protoc)
target_link_libraries(fail-efw fail-comm)
target_link_libraries(fail-efw fail-util) # WallclockTimer