Skip to content

Commit

Permalink
Merge pull request #1507 from redstar/cmakellvm
Browse files Browse the repository at this point in the history
LLVM/MSVC: Use library path to search for LLVM libraries.
  • Loading branch information
redstar committed May 20, 2016
2 parents 3cbb83d + 22e2928 commit ed79298
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ if (UNIX AND NOT "${LLVM_LDFLAGS}" STREQUAL "")
# LLVM_LDFLAGS may contain -l-lld which is a wrong library reference (AIX)
string(REPLACE "-l-lld " "-lld " LLVM_LDFLAGS ${LLVM_LDFLAGS})
endif()
separate_arguments(LLVM_LDFLAGS)
if(MSVC)
separate_arguments(LLVM_LDFLAGS WINDOWS_COMMAND "${LLVM_LDFLAGS}")
else()
separate_arguments(LLVM_LDFLAGS UNIX_COMMAND "${LLVM_LDFLAGS}")
endif()
# LLVM_CXXFLAGS may contain -Wcovered-switch-default and -fcolor-diagnostics
# which are clang-only options
if(CMAKE_COMPILER_IS_GNUCXX)
Expand Down Expand Up @@ -557,6 +561,7 @@ set(LDC_LINKERFLAG_LIST "${SANITIZE_LDFLAGS};${WINDOWS_STACK_SIZE};${LIBCONFIG_L
set(tempVar "")
foreach(f ${LDC_LINKERFLAG_LIST})
string (REPLACE "-Wl," "" f ${f})
string (REPLACE "-LIBPATH:" "/LIBPATH:" f ${f})
append("-L\"${f}\"" tempVar)
endforeach(f)
if(MSVC)
Expand Down
3 changes: 2 additions & 1 deletion cmake/Modules/FindLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ if ((WIN32 AND NOT(MINGW OR CYGWIN)) OR NOT LLVM_CONFIG)
llvm_map_components_to_libnames(tmplibs ${LLVM_FIND_COMPONENTS})
endif()
if(MSVC)
set(LLVM_LDFLAGS "-LIBPATH:\"${LLVM_LIBRARY_DIRS}\"")
foreach(lib ${tmplibs})
list(APPEND LLVM_LIBRARIES "${LLVM_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
list(APPEND LLVM_LIBRARIES "${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
endforeach()
else()
# Rely on the library search path being set correctly via -L on
Expand Down

0 comments on commit ed79298

Please sign in to comment.