Skip to content

Commit 77716ee

Browse files
DGarry82Igor Rondarev
andauthored
fix w64-mingw32-ld linking error (#3184)
* fix w64-mingw32-ld linking error use shlwapi instead of Shlwapi.lib in mingw-w64 build environment (prevents "/usr/bin/x86_64-w64-mingw32-ld: cannot find -lShlwapi" error) * same MinGW shlwapi fix for {tests,tools}/CMakeLists.txt Co-authored-by: Igor Rondarev <igor.rondarev@gmail.com>
1 parent cddaa6d commit 77716ee

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

cli/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ if (USE_Z3)
2424
target_link_libraries(cppcheck ${Z3_LIBRARIES})
2525
endif()
2626
if (WIN32 AND NOT BORLAND)
27-
target_link_libraries(cppcheck Shlwapi.lib)
27+
if(NOT MINGW)
28+
target_link_libraries(cppcheck Shlwapi.lib)
29+
else()
30+
target_link_libraries(cppcheck shlwapi)
31+
endif()
2832
endif()
2933
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
3034
target_link_libraries(cppcheck tinyxml2)

test/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ if (BUILD_TESTS)
2020
target_link_libraries(testrunner ${Z3_LIBRARIES})
2121
endif()
2222
if (WIN32 AND NOT BORLAND)
23-
target_link_libraries(testrunner Shlwapi.lib)
23+
if(NOT MINGW)
24+
target_link_libraries(testrunner Shlwapi.lib)
25+
else()
26+
target_link_libraries(testrunner shlwapi)
27+
endif()
2428
endif()
2529
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
2630
target_link_libraries(testrunner tinyxml2)

tools/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ add_executable(dmake EXCLUDE_FROM_ALL
1818
)
1919
target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp)
2020
if (WIN32 AND NOT BORLAND)
21-
target_link_libraries(dmake Shlwapi.lib)
21+
if(NOT MINGW)
22+
target_link_libraries(dmake Shlwapi.lib)
23+
else()
24+
target_link_libraries(dmake shlwapi)
25+
endif()
2226
endif()
2327

2428
add_custom_target(run-dmake $<TARGET_FILE:dmake>
2529
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
26-
DEPENDS dmake)
30+
DEPENDS dmake)

0 commit comments

Comments
 (0)