[PATCH] D43168: Don't use -ldl on BSD
Dimitry Andric via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 11 07:51:41 PST 2018
dim added a comment.
It looks like test-suite has some sort of special handling for test executables, where it uses LDFLAGS instead of target_link_libraries():
# Creates a new executable build target. Use this instead of `add_executable`.
# It applies CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS. Creates a .test file if
# necessary, registers the target with the TEST_SUITE_TARGETS list and makes
# sure we build the required dependencies for compiletime measurements
# and support the TEST_SUITE_PROFILE_USE mode.
macro(llvm_test_executable target)
add_executable(${target} ${ARGN})
append_target_flags(COMPILE_FLAGS ${target} ${CFLAGS})
append_target_flags(COMPILE_FLAGS ${target} ${CPPFLAGS})
append_target_flags(COMPILE_FLAGS ${target} ${CXXFLAGS})
# Note that we cannot use target_link_libraries() here because that one
# only interprets inputs starting with '-' as flags.
append_target_flags(LINK_LIBRARIES ${target} ${LDFLAGS})
I am unsure what the reason is that `add_executable` and `target_link_libraries` cannot be used. So maybe there is an easy way in CMake to transform a list of libraries in the form of e.g. `CMAKE_DL_LIBS` to linker flags? Or must we do that manually with some sort of for loop?
Repository:
rT test-suite
https://reviews.llvm.org/D43168
More information about the llvm-commits
mailing list