From 77716ee398d329e93af0565b07dbdfc945425c56 Mon Sep 17 00:00:00 2001 From: DGarry82 Date: Mon, 29 Mar 2021 18:04:42 +0300 Subject: [PATCH] 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 --- cli/CMakeLists.txt | 6 +++++- test/CMakeLists.txt | 6 +++++- tools/CMakeLists.txt | 8 ++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index d8d21aa90..49b44316c 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -24,7 +24,11 @@ if (USE_Z3) target_link_libraries(cppcheck ${Z3_LIBRARIES}) endif() if (WIN32 AND NOT BORLAND) - target_link_libraries(cppcheck Shlwapi.lib) + if(NOT MINGW) + target_link_libraries(cppcheck Shlwapi.lib) + else() + target_link_libraries(cppcheck shlwapi) + endif() endif() if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2) target_link_libraries(cppcheck tinyxml2) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 88f3a9291..6b8f2aff6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -20,7 +20,11 @@ if (BUILD_TESTS) target_link_libraries(testrunner ${Z3_LIBRARIES}) endif() if (WIN32 AND NOT BORLAND) - target_link_libraries(testrunner Shlwapi.lib) + if(NOT MINGW) + target_link_libraries(testrunner Shlwapi.lib) + else() + target_link_libraries(testrunner shlwapi) + endif() endif() if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2) target_link_libraries(testrunner tinyxml2) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 303b8d55f..4176b897f 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -18,9 +18,13 @@ add_executable(dmake EXCLUDE_FROM_ALL ) target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp) if (WIN32 AND NOT BORLAND) - target_link_libraries(dmake Shlwapi.lib) + if(NOT MINGW) + target_link_libraries(dmake Shlwapi.lib) + else() + target_link_libraries(dmake shlwapi) + endif() endif() add_custom_target(run-dmake $ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - DEPENDS dmake) \ No newline at end of file + DEPENDS dmake)