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>
This commit is contained in:
DGarry82 2021-03-29 18:04:42 +03:00 committed by GitHub
parent cddaa6d671
commit 77716ee398
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 4 deletions

View File

@ -24,7 +24,11 @@ if (USE_Z3)
target_link_libraries(cppcheck ${Z3_LIBRARIES}) target_link_libraries(cppcheck ${Z3_LIBRARIES})
endif() endif()
if (WIN32 AND NOT BORLAND) if (WIN32 AND NOT BORLAND)
if(NOT MINGW)
target_link_libraries(cppcheck Shlwapi.lib) target_link_libraries(cppcheck Shlwapi.lib)
else()
target_link_libraries(cppcheck shlwapi)
endif()
endif() endif()
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2) if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
target_link_libraries(cppcheck tinyxml2) target_link_libraries(cppcheck tinyxml2)

View File

@ -20,7 +20,11 @@ if (BUILD_TESTS)
target_link_libraries(testrunner ${Z3_LIBRARIES}) target_link_libraries(testrunner ${Z3_LIBRARIES})
endif() endif()
if (WIN32 AND NOT BORLAND) if (WIN32 AND NOT BORLAND)
if(NOT MINGW)
target_link_libraries(testrunner Shlwapi.lib) target_link_libraries(testrunner Shlwapi.lib)
else()
target_link_libraries(testrunner shlwapi)
endif()
endif() endif()
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2) if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
target_link_libraries(testrunner tinyxml2) target_link_libraries(testrunner tinyxml2)

View File

@ -18,7 +18,11 @@ add_executable(dmake EXCLUDE_FROM_ALL
) )
target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp) target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp)
if (WIN32 AND NOT BORLAND) if (WIN32 AND NOT BORLAND)
if(NOT MINGW)
target_link_libraries(dmake Shlwapi.lib) target_link_libraries(dmake Shlwapi.lib)
else()
target_link_libraries(dmake shlwapi)
endif()
endif() endif()
add_custom_target(run-dmake $<TARGET_FILE:dmake> add_custom_target(run-dmake $<TARGET_FILE:dmake>