mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-10 17:56:36 +01:00
MinGW LLVM compiler flag fixes.
Our CMake code should be rewritten to not expect things as strings that really aren't, but this would entail a whole lot of cross- platform testing, so I'm postponing it for now.
This commit is contained in:
@@ -42,10 +42,25 @@ if (NOT LLVM_CONFIG)
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "all-targets" index)
|
||||
list(APPEND LLVM_FIND_COMPONENTS ${LLVM_TARGETS_TO_BUILD})
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "backend" index)
|
||||
|
||||
llvm_map_components_to_libraries(tmplibs ${LLVM_FIND_COMPONENTS})
|
||||
foreach(lib ${tmplibs})
|
||||
list(APPEND LLVM_LIBRARIES "${LLVM_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endforeach()
|
||||
if(MSVC)
|
||||
foreach(lib ${tmplibs})
|
||||
list(APPEND LLVM_LIBRARIES "${LLVM_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endforeach()
|
||||
else()
|
||||
# Rely on the library search path being set correctly via -L on
|
||||
# MinGW and others, as the library list returned by
|
||||
# llvm_map_components_to_libraries also includes imagehlp and psapi.
|
||||
set(LLVM_LDFLAGS "-L${LLVM_LIBRARY_DIRS}")
|
||||
set(LLVM_LIBRARIES ${tmplibs})
|
||||
|
||||
# When using the CMake LLVM module, LLVM_DEFINITIONS is a list
|
||||
# instead of a string. Later, the list seperators would entirely
|
||||
# disappear, replace them by spaces instead. A better fix would be
|
||||
# to switch to add_definitions() instead of throwing strings around.
|
||||
string(REPLACE ";" " " LLVM_CXXFLAGS "${LLVM_CXXFLAGS}")
|
||||
endif()
|
||||
else()
|
||||
if (NOT FIND_LLVM_QUIETLY)
|
||||
message(WARNING "Could not find llvm-config. Try manually setting LLVM_CONFIG to the llvm-config executable of the installation to use.")
|
||||
|
||||
Reference in New Issue
Block a user