From 0b98cf771d092234e1f635d990dd67239a24f932 Mon Sep 17 00:00:00 2001 From: Bluub Date: Tue, 15 Jun 2021 17:47:05 +0200 Subject: [PATCH] try fix cmake --- CMakeLists.txt | 2 +- lib/lua/Findlua.cmake | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bdade0c..327fc8c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 20) find_package(Lua QUIET) -if (NOT Lua_FOUND) +if (NOT LUA_FOUND) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../lib/lua) find_package(Lua REQUIRED) endif() diff --git a/lib/lua/Findlua.cmake b/lib/lua/Findlua.cmake index 2afa3892..d087ccee 100644 --- a/lib/lua/Findlua.cmake +++ b/lib/lua/Findlua.cmake @@ -40,6 +40,18 @@ This is because, the lua location is not standardized and may exist in locations other than lua/ #]=======================================================================] +if (NOT LUA_FOUND) + INCLUDE(FetchContent) + + FetchContent_Declare(lua URL https://www.lua.org/ftp/lua-5.4.3.tar.gz) + FetchContent_GetProperties(lua) + if (NOT lua_POPULATED) + SET(FETCHCONTENT_QUIET NO) + FetchContent_Populate(lua) + ADD_SUBDIRECTORY(${lua_SOURCE_DIR}) + endif() +endif() + cmake_policy(PUSH) # Policies apply to functions at definition-time cmake_policy(SET CMP0012 NEW) # For while(TRUE)