CMake: add target-level dependencies for conflict-set-object
The custom command that links conflict-set.o depends on $<TARGET_OBJECTS:conflict-set-object>, but that generator expression does not create a target-level dependency. With the Unix Makefiles generator, parallel builds can start building the consuming libraries before the object library's build rule is available, producing: gmake[3]: *** No rule to make target 'CMakeFiles/conflict-set-object.dir/ConflictSet.cpp.o', needed by 'conflict-set.o'. Stop. Add add_dependencies() so that conflict-set and conflict-set-static cannot build until conflict-set-object has produced its object files. Closes #47
This commit is contained in:
@@ -139,6 +139,7 @@ add_custom_command(
|
|||||||
COMMAND_EXPAND_LISTS)
|
COMMAND_EXPAND_LISTS)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} SHARED ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.o)
|
add_library(${PROJECT_NAME} SHARED ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.o)
|
||||||
|
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-object)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY
|
${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/radix_tree")
|
"${CMAKE_CURRENT_BINARY_DIR}/radix_tree")
|
||||||
@@ -155,6 +156,7 @@ if(HAS_VERSION_SCRIPT)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(${PROJECT_NAME}-static STATIC ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.o)
|
add_library(${PROJECT_NAME}-static STATIC ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.o)
|
||||||
|
add_dependencies(${PROJECT_NAME}-static ${PROJECT_NAME}-object)
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
set_target_properties(${PROJECT_NAME}-static PROPERTIES LINKER_LANGUAGE CXX)
|
set_target_properties(${PROJECT_NAME}-static PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
else()
|
else()
|
||||||
|
|||||||
Reference in New Issue
Block a user