From 7ee105016c96f762ba6b82073e8b33d5ea8e6851 Mon Sep 17 00:00:00 2001 From: Christian Dietrich Date: Tue, 21 Oct 2014 12:39:42 +0200 Subject: [PATCH] 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 --- cmake/bochs.cmake | 8 +++++++- src/core/comm/CMakeLists.txt | 3 +++ src/core/efw/CMakeLists.txt | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake/bochs.cmake b/cmake/bochs.cmake index 25697045..dda6c097 100644 --- a/cmake/bochs.cmake +++ b/cmake/bochs.cmake @@ -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) diff --git a/src/core/comm/CMakeLists.txt b/src/core/comm/CMakeLists.txt index 850bfc57..b7aece05 100644 --- a/src/core/comm/CMakeLists.txt +++ b/src/core/comm/CMakeLists.txt @@ -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}) diff --git a/src/core/efw/CMakeLists.txt b/src/core/efw/CMakeLists.txt index e0e2fe2c..73f440ab 100644 --- a/src/core/efw/CMakeLists.txt +++ b/src/core/efw/CMakeLists.txt @@ -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