# Cross-compile OpenAL using MinGW in CMake?

**URL:** <https://discourse.cmake.org/t/cross-compile-openal-using-mingw-in-cmake/4942>\
**Category:** Code\
**Tags:** os:linux, gen:makefiles\
**Created:** [February 1, 2022, 5:54pm UTC](https://discourse.cmake.org/t/cross-compile-openal-using-mingw-in-cmake/4942 "2022-02-01T17:54:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fruit](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/c2a13f/32.png) [@Fruit](https://discourse.cmake.org/u/Fruit)\
**Post date:** [February 1, 2022, 5:54pm UTC](https://discourse.cmake.org/t/cross-compile-openal-using-mingw-in-cmake/4942/1 "2022-02-01T17:54:07Z")

</div>

Hello

I am quite novice to CMake. I am trying to cross compile a project which uses OpenAL, using MinGW in my CMake file. However I am struggling to find a way to add the OpenAL headers and DLL for the target platform. I have OpenAL headers installed on my main machine (manjaro, arch based unix distro), and I also happen to have the `OpenAL32.dll` file. But what I don’t know, is how to add the **target system headers** , and how to **link the DLL**. The project I’m trying to compile has an `FindOpenAL.cmake` file , which has the following setup:

```auto
if (WIN32 OR MINGW)
    if (OPENAL_SDK_ROOT)
        set(OPENAL_SEARCH_PATHS ${OPENAL_SDK_ROOT})
    else ()
        if (WIN32)
            file(
                GLOB
                OPENAL_SEARCH_PATHS

                "C:/OpenAL*"
                "D:/OpenAL*"
                "E:/OpenAL*"
                "C:/Lib*/OpenAL*"
                "D:/Lib*/OpenAL*"
                "E:/Lib*/OpenAL*"
            )
        endif ()
    endif ()

    find_library(
        OPENAL_LIBS

        NAMES
            OpenAL al openal OpenAL32
        HINTS
            ENV OPENALDIR
            ENV OPENAL_SDK_PATH
        PATH_SUFFIXES
            lib64 lib libs64 libs libs/Win64
        PATHS
            ${OPENAL_SEARCH_PATHS}
        REQUIRED
        NO_DEFAULT_PATH
    )

    if (WIN32)
        # find DLL
        find_file(
            OPENAL_DLL

            NAMES
                soft_oal.dll
                OpenAL32.dll
            HINTS
                ENV OPENALDIR
                ENV OPENAL_SDK_PATH
            PATH_SUFFIXES
                bin bin/Win64
            PATHS
                ${OPENAL_SEARCH_PATHS}
        )
    endif ()

```

So to reiterate my Q: H_ow would I specify the target system OpenAL headers and DLL file in this cmake?_
