cmake: static library dependencies

CMake does not support linker groups, which were used to "automatically"
fix circular dependencies between different static FAIL* libraries and
the ordering of dynamic external libraries broke linking.
CMake can however correctly invoke the linker if dependencies are decribed
correctly (even if circular). This required changing all add_dependencies
calls between libraries to target_link_libraries (which creates a link-time
dependency) and linking all experiments to fail-sal.

Change-Id: I3a0d5dddb9b3d963ef538814e20d6b3de85d4ec5
This commit is contained in:
Florian Lukas
2014-02-18 17:20:21 +01:00
parent 3cf2fa082f
commit 396e00ce59
22 changed files with 33 additions and 13 deletions

View File

@ -8,6 +8,7 @@ set(SRCS
add_library(fail-efw ${SRCS})
add_dependencies(fail-efw fail-comm)
target_link_libraries(fail-efw fail-comm)
find_package(LibPCL REQUIRED)
include_directories(${LIBPCL_INCLUDE_DIRS})

View File

@ -102,4 +102,8 @@ endif(CONFIG_FAST_BREAKPOINTS)
add_library(fail-sal ${SRCS})
add_dependencies(fail-sal fail-efw)
target_link_libraries(fail-sal fail-efw fail-util)
foreach(exp ${EXPERIMENTS_ACTIVATED})
target_link_libraries(fail-sal fail-${exp})
endforeach()

View File

@ -67,6 +67,7 @@ mark_as_advanced(FAIL_OBJDUMP)
add_library(fail-util ${SRCS})
add_dependencies(fail-util fail-comm)
target_link_libraries(fail-util fail-comm)
target_link_libraries(fail-util ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${LIB_IBERTY} ${ZLIB_LIBRARIES} dwarf elf)
option(BUILD_LLVM_DISASSEMBLER "Build the LLVM-based disassembler (LLVM 3.3 preferred, for 3.1 and 3.2 read doc/how-to-build.txt)" OFF)

View File

@ -15,7 +15,7 @@ include(FindLLVM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXX_FLAGS} -fno-rtti" )
add_library(fail-llvmdisassembler ${SRCS})
add_dependencies(fail-llvmdisassembler fail-sal)
target_link_libraries(fail-llvmdisassembler fail-sal)
target_link_libraries(fail-llvmdisassembler ${LLVM_LIBS} ${LLVM_LDFLAGS} )
### Tests