Skip to content

Commit 6f5abdb

Browse files
committed
Merge pull request #452 from WebDrake/ldflags
Ensure LLVM LDFLAGS are placed after libraries in build commands. Let's try this – add the removal of the second LLVM_LDFLAGS instance in the LDMD_EXE libraries if new LDMD linker errors pop up.
2 parents 147267d + 9520eb9 commit 6f5abdb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ set_target_properties(
343343
)
344344

345345
# LDFLAGS should actually be in target property LINK_FLAGS, but this works, and gets around linking problems
346-
target_link_libraries(${LDC_LIB} "${LLVM_LDFLAGS}" ${LLVM_LIBRARIES})
346+
target_link_libraries(${LDC_LIB} ${LLVM_LIBRARIES} "${LLVM_LDFLAGS}")
347347
if(WIN32)
348348
target_link_libraries(${LDC_LIB} imagehlp psapi)
349349
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -399,7 +399,7 @@ set_target_properties(
399399
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
400400
COMPILE_FLAGS "${TABLEGEN_CXXFLAGS} ${LDC_CXXFLAGS}"
401401
)
402-
target_link_libraries(gen_gccbuiltins "${LLVM_LDFLAGS}" ${LLVM_LIBRARIES})
402+
target_link_libraries(gen_gccbuiltins ${LLVM_LIBRARIES} "${LLVM_LDFLAGS}")
403403
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
404404
target_link_libraries(gen_gccbuiltins dl)
405405
endif()
@@ -429,7 +429,7 @@ set_target_properties(${LDMD_EXE} PROPERTIES
429429
# use symbols from libdl, ..., so LLVM_LDFLAGS must come _after_ them in the
430430
# command line. Maybe this could be improved using library groups, at least with
431431
# GNU ld.
432-
target_link_libraries(${LDMD_EXE} "${LLVM_LDFLAGS}" ${LLVM_LIBRARIES} "${LLVM_LDFLAGS}")
432+
target_link_libraries(${LDMD_EXE} ${LLVM_LIBRARIES} "${LLVM_LDFLAGS}")
433433

434434
#
435435
# Test and runtime targets. Note that enable_testing() is order-sensitive!

0 commit comments

Comments
 (0)