dimanche 22 février 2015

How to use CMake's pkg_search_module() when compiling under Windows?


I'm programming a game which uses SDL2 and CMake. In order to link and include SDL2 I use the following CMake code:



include(FindPkgConfig)
pkg_search_module(SDL2 REQUIRED sdl2)
target_link_libraries(MYLIB SDL2)


When compiling under Linux (Fedora) this works perfectly.


But what about Windows? There I don't have standard system locations for DLL/a files and include folders. There isn't even pkg-config.


This is the error I get:



Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
checking for one of the modules 'sdl2'
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.0/Modules/FindPkgConfig.cmake:425 (message):
None of the required 'sdl2' found
Call Stack (most recent call first):
.../CMakeLists.txt:4 (pkg_search_module)


I used the VS 2013 generator.




Aucun commentaire:

Enregistrer un commentaire