diff --git a/CMakeLists.txt b/CMakeLists.txt index 87c556e40..fb562b8ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,8 +49,20 @@ endif() if(NOT CMAKE_VERSION VERSION_LESS 3.4.0 AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android") set(LANG CXX) endif() + + +option(HUNTER_ENABLED "Get third parties (Corrade, glfw, SDL2) via hunter " OFF) +if (HUNTER_ENABLED) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/package/hunter") + include(HunterInit) +endif() + project(Magnum ${LANG}) +if(HUNTER_ENABLED) + include(HunterFetchDeps) +endif() + # Use folders for nice tree in Visual Studio and XCode set_property(GLOBAL PROPERTY USE_FOLDERS ON) diff --git a/package/hunter/.gitignore b/package/hunter/.gitignore new file mode 100644 index 000000000..599bf8e81 --- /dev/null +++ b/package/hunter/.gitignore @@ -0,0 +1 @@ +HunterGate.cmake diff --git a/package/hunter/HunterFetchDeps.cmake b/package/hunter/HunterFetchDeps.cmake new file mode 100644 index 000000000..02975ebf1 --- /dev/null +++ b/package/hunter/HunterFetchDeps.cmake @@ -0,0 +1,7 @@ +hunter_add_package(corrade) +if(WITH_GLFWAPPLICATION) + hunter_add_package(glfw) +endif() +if(WITH_SDL2APPLICATION) + hunter_add_package(SDL2) +endif() diff --git a/package/hunter/HunterInit.cmake b/package/hunter/HunterInit.cmake new file mode 100644 index 000000000..08253db9a --- /dev/null +++ b/package/hunter/HunterInit.cmake @@ -0,0 +1,11 @@ +file( + DOWNLOAD + https://raw.githubusercontent.com/hunter-packages/gate/master/cmake/HunterGate.cmake + ${CMAKE_CURRENT_LIST_DIR}//HunterGate.cmake +) + +include("${CMAKE_CURRENT_LIST_DIR}/HunterGate.cmake") +HunterGate( + URL "https://github.com/pthom/hunter/archive/test-corrade-v2018.10.tar.gz" + SHA1 "3415f425f0ff1aa1754b8a2b57c77ba20f5b7bbc" +)