title: make errors occur while using MXE CMake for compiling an SDL program
body: <p>Calling <code>i686-w64-mingw32.static-cmake CMakeLists.txt</code> and then <code>make</code> works with programs that do not use any external libaries, however while trying to cross compile a SDL program for windows the following errors occur.</p>
  <p>CMake log.</p>
  <pre><code>== Using MXE wrapper: /home/tp/ext-git/mxe/usr/bin/i686-w64-mingw32.static-cmake
       - cmake version 3.20.1
       - warnings for unused CMAKE_POLICY_DEFAULT variables can be ignored
  == Using MXE toolchain: /home/tp/ext-git/mxe/usr/i686-w64-mingw32.static/share/cmake/mxe-conf.cmake
  == Using MXE runresult: /home/tp/ext-git/mxe/usr/share/cmake/modules/TryRunResults.cmake
  == Adding &quot;-DCMAKE_BUILD_TYPE=Release&quot;
  loading initial cache file /home/tp/ext-git/mxe/usr/share/cmake/modules/TryRunResults.cmake
  -- Configuring done
  CMake Warning (dev) in CMakeLists.txt:
    Policy CMP0111 is not set: An imported target missing its location property
    fails during generation.  Run &quot;cmake --help-policy CMP0111&quot; for policy
    details.  Use the cmake_policy command to set the policy and suppress this
    warning.
  
    IMPORTED_IMPLIB not set for imported target &quot;SDL2::SDL2&quot; configuration
    &quot;Release&quot;.
  This warning is for project developers.  Use -Wno-dev to suppress it.
  
  -- Generating done
  -- Build files have been written to: /home/tp/Desktop
  </code></pre>
  <p>make errors.</p>
  <pre><code>CMakeFiles/untitled.dir/build.make:96: *** target pattern contains no '%'.  Stop.
  make[1]: *** [CMakeFiles/Makefile2:82: CMakeFiles/untitled.dir/all] Error 2
  make: *** [Makefile:91: all] Error 2
  </code></pre>
  <p>My <code>CMakeLists.txt</code></p>
  <pre><code>cmake_minimum_required(VERSION 3.5)
  
  project(untitled LANGUAGES CXX)
  
  set(CMAKE_CXX_STANDARD 11)
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
  find_package(SDL2 REQUIRED)
  
  add_executable(untitled main.cpp)
  target_link_libraries(untitled SDL2::SDL2)
  </code></pre>
  <p>The same <code>CMakeLists.txt</code> file works just fine on *nix though fails here. What is going on?</p>
  <p><strong>EDIT</strong></p>
  <p>New details.</p>
  <p>CMake toolchain file.</p>
  <pre><code># This file is part of MXE. See LICENSE.md for licensing information.
  
  # https://cmake.org/cmake/help/latest
  
  # Can't set `cmake_minimum_required` or `cmake_policy` in toolchain
  # since toolchain is read before CMakeLists.txt
  # See `target-cmake.in` for CMAKE_POLICY_DEFAULT_CMPNNNN
  
  # Check if we are using mxe supplied version
  #   - toolchain is included multiple times so set a guard in
  #     environment to suppress duplicate messages
  if(NOT ${CMAKE_COMMAND} STREQUAL /home/tp/ext-git/mxe/usr/x86_64-pc-linux-gnu/bin/cmake AND NOT DEFINED ENV{_MXE_CMAKE_TOOLCHAIN_INCLUDED})
      message(WARNING &quot;
  ** Warning: direct use of toolchain file is deprecated
  ** Please use prefixed wrapper script instead:
       i686-w64-mingw32.static-cmake [options] &lt;path-to-source&gt;
         - uses mxe supplied cmake version 3.20.1
         - loads toolchain
         - loads common run results
         - sets various policy defaults
      &quot;)
      set(ENV{_MXE_CMAKE_TOOLCHAIN_INCLUDED} TRUE)
  endif()
  
  # Use CACHE variables to allow user setting with `-D`
  # Use CACHE FORCE in rare cases of misconfigured CMakeLists.txt
  #   - e.g include(FindPkgConfig)
  #     https://github.com/mxe/mxe/issues/1023
  #   - projects may still set these in which case FORCE doesn't have
  #     any advantage, just causes inconvenience
  #     https://github.com/mxe/mxe/pull/1621#discussion_r106937505
  # Use normal variables expected to be set by toolchain/system
  #   - projects should test for these values and not try to override
  
  ## General configuration
  set(CMAKE_SYSTEM_NAME Windows)
  set(CMAKE_SYSTEM_PROCESSOR i686 CACHE STRING &quot;System Processor&quot;)
  set(MSYS 1)
  set(CMAKE_EXPORT_NO_PACKAGE_REGISTRY ON)
  # Workaround for https://www.cmake.org/Bug/view.php?id=14075
  set(CMAKE_CROSS_COMPILING ON)
  
  
  ## Library config
  set(BUILD_SHARED_LIBS OFF CACHE BOOL &quot;BUILD_SHARED_LIBS&quot;)
  set(BUILD_STATIC_LIBS ON CACHE BOOL &quot;BUILD_STATIC_LIBS&quot;)
  set(BUILD_SHARED OFF CACHE BOOL &quot;BUILD_SHARED&quot;)
  set(BUILD_STATIC ON CACHE BOOL &quot;BUILD_STATIC&quot;)
  set(LIBTYPE STATIC)
  
  
  ## Paths etc.
  # These MODEs shouldn't be changed by users, we only want headers/libs
  # from cross-build and &quot;never&quot; want binaries. We do, however, want
  # `*-config` scripts but there's no way to instruct cmake to do that.
  #
  # The best solution may be to whitelist utilities
  #   https://github.com/mxe/mxe/issues/1667
  # and symlink them to an additional root path, changing PROGRAM to ONLY
  
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
  
  # Allow user to specify list of locations to search
  set(CMAKE_FIND_ROOT_PATH /home/tp/ext-git/mxe/usr/i686-w64-mingw32.static CACHE PATH &quot;List of root paths to search on the filesystem&quot;)
  set(CMAKE_PREFIX_PATH /home/tp/ext-git/mxe/usr/i686-w64-mingw32.static CACHE PATH &quot;List of directories specifying installation prefixes to be searched&quot;)
  set(CMAKE_INSTALL_PREFIX /home/tp/ext-git/mxe/usr/i686-w64-mingw32.static CACHE PATH &quot;Installation Prefix&quot;)
  # For custom mxe FindPackage scripts
  set(CMAKE_MODULE_PATH &quot;/home/tp/ext-git/mxe/usr/share/cmake/modules&quot; ${CMAKE_MODULE_PATH})
  
  # projects (mis)use `-isystem` to silence warnings from 3rd-party
  # source (among other things). gcc6 introduces changes to search
  # order which breaks this usage.
  #   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
  #   https://gitlab.kitware.com/cmake/cmake/issues/16291
  #   https://gitlab.kitware.com/cmake/cmake/issues/16919
  set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES /home/tp/ext-git/mxe/usr/i686-w64-mingw32.static/include)
  set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /home/tp/ext-git/mxe/usr/i686-w64-mingw32.static/include)
  
  
  ## Programs
  set(CMAKE_C_COMPILER /home/tp/ext-git/mxe/usr/bin/i686-w64-mingw32.static-gcc)
  set(CMAKE_CXX_COMPILER /home/tp/ext-git/mxe/usr/bin/i686-w64-mingw32.static-g++)
  set(CMAKE_Fortran_COMPILER /home/tp/ext-git/mxe/usr/bin/i686-w64-mingw32.static-gfortran)
  set(CMAKE_RC_COMPILER /home/tp/ext-git/mxe/usr/bin/i686-w64-mingw32.static-windres)
  # CMAKE_RC_COMPILE_OBJECT is defined in:
  #     &lt;cmake root&gt;/share/cmake-X.Y/Modules/Platform/Windows-windres.cmake
  set(CPACK_NSIS_EXECUTABLE i686-w64-mingw32.static-makensis)
  
  ## Individual package configuration
  file(GLOB mxe_cmake_files
      &quot;/home/tp/ext-git/mxe/usr/i686-w64-mingw32.static/share/cmake/mxe-conf.d/*.cmake&quot;
  )
  foreach(mxe_cmake_file ${mxe_cmake_files})
      include(${mxe_cmake_file})
  endforeach()
  </code></pre>
  <p>and the section of makefile</p>
  <pre><code># External object files for target untitled
  untitled_EXTERNAL_OBJECTS =
  
  untitled.exe: CMakeFiles/untitled.dir/main.obj
  untitled.exe: CMakeFiles/untitled.dir/build.make
  untitled.exe: SDL2::SDL2-NOTFOUND
  untitled.exe: CMakeFiles/untitled.dir/linklibs.rsp
  untitled.exe: CMakeFiles/untitled.dir/objects1.rsp
  untitled.exe: CMakeFiles/untitled.dir/link.txt
  </code></pre>
  <p>The line with <code>SDL2</code> is the line with the target pattern error.</p>