Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm7: cmake fix linking #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions clang_delta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@ include_directories(${CLANG_INCLUDE_DIRS}) # only works for LLVM post-4.0

link_directories(${LLVM_LIBRARY_DIRS})

llvm_map_components_to_libnames(LLVM_LIBS
coverage
irreader
mcparser
objcarcopts
option
passes
profiledata
support
)
find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config DOC "llvm-config executable")
if (NOT LLVM_CONFIG_EXECUTABLE STREQUAL "LLVM_CONFIG_EXECUTABLE-NOTFOUND")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think NOT LLVM_CONFIG_EXECUTABLE should be sufficient.

False if the constant is 0, OFF, NO, FALSE, N, IGNORE, NOTFOUND, the empty string, or ends in the suffix -NOTFOUND.

https://cmake.org/cmake/help/v3.0/command/if.html

execute_process(
COMMAND ${LLVM_CONFIG_EXECUTABLE} --libs coverage irreader mcparser objcarcopts option passes profiledata support
OUTPUT_VARIABLE LLVM_LIBS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()

set(CLANG_LIBS
clangStaticAnalyzerFrontend
Expand Down Expand Up @@ -242,11 +240,7 @@ add_executable(clang_delta
git_version.h
)

# ENE, LLVM 6.0: LLVM_LIBS end up in the link command line anyway. I'm not
# quite sure why! But if you list LLVM_LIBS here, the `clang_delta' binary
# can end up with dynamic link errors when it runs (multiply defined symbols).
#
target_link_libraries(clang_delta ${CLANG_LIBS})
target_link_libraries(clang_delta ${CLANG_LIBS} ${LLVM_LIBS})

# Custom target for running clang_delta tests
#
Expand Down