FindBoost: Does not find Boost DLLs on MinGW since 3.17
Trying to build the urtde library that requires boost does not work anymore since CMake version 3.17. It outputs the following error message:
CMake Error at C:/CodingXP/cmake-3.22.0-windows-x86_64/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Boost (missing: system thread program_options) (found
version "1.66.0")
Call Stack (most recent call first):
C:/CodingXP/cmake-3.22.0-windows-x86_64/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/CodingXP/cmake-3.22.0-windows-x86_64/share/cmake-3.22/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args)
CMakeLists.txt:65 (find_package)
Building the library with CMake 3.16 works. The problem is caused by the following change in CMake 3.17
When using MinGW tools, the find_library() command no longer finds .dll files by default. Instead, it expects .dll.a import libraries to be available.
I have not found any solution to fix this. Adding set(CMAKE_FIND_LIBRARY_SUFFIXES .dll ${CMAKE_FIND_LIBRARY_SUFFIXES})
does not solve the issue. Because MinGW can link to DLL files there are no .a files available. What is the recommended way to solve this?
Edited by Brad King