[CMake] Detecting libgcc_s_<variant> in MinGW 32 & 64.

Richard Shaw hobbes1069 at gmail.com
Sun Oct 13 10:35:42 EDT 2013


I have a project I successfully built under mingw32 and I'm now attempting
to build under mingw64.

I am cross compiling under Fedora x86_64...

In order to pull in all the DLLs for CPack I devised the following:

    # Try to grab all the runtime dlls for the windows installer.
    # This will break if the dll names change!
    foreach(RUNTIME
        libgcc_s_sjlj-1.dll
        libgcc_s_seh-1.dll
        libstdc++-6.dll
        libsndfile-1.dll
        ....
        message(STATUS "Checking for ${RUNTIME}")
        find_library(${RUNTIME}_LIB NAMES ${RUNTIME})
        if(${RUNTIME}_LIB-FOUND)
            message(STATUS "runtime found: ${${RUNTIME}_LIB}")
            list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${${RUNTIME}_LIB})
        else()
            message(STATUS "${RUNTIME} not found. Hope nothing breaks!")
        endif()
    endforeach()

The problem is that two different libgcc_s library variants are used...
libgcc_s_sjlj-1.dll w/ mingw32
libgcc_s_seh-1.dll w/ mingw64

I could take them out of the foreach loop and check for them separately but
I was looking for something a bit more elegant which is why I added the
NAMES modifier to find_library.

Is there a way to pass both to the find_library macro? I tried making them
a list but then foreach iterated over them. I tried putting them in quotes
but then it treats them as a string...

Ideas?

Thanks,
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131013/f9aff09b/attachment.htm>


More information about the CMake mailing list