From 3404ba16c1956c4544704a1da90811e2c96d2b56 Mon Sep 17 00:00:00 2001 From: Konstantin Tyurin Date: Wed, 23 Apr 2025 22:31:38 +0200 Subject: [PATCH 1/2] Fix CMake warning cmake_minimum_required() should be called prior to this top-level project() --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca263814..80e1f21b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,10 @@ # Unix: export LUA_DIR=/home/user/pkg # Windows: set LUA_DIR=c:\lua51 -project(lua-cjson C) cmake_minimum_required(VERSION 2.6) +project(lua-cjson C) + option(USE_INTERNAL_FPCONV "Use internal strtod() / g_fmt() code for performance") option(MULTIPLE_THREADS "Support multi-threaded apps with internal fpconv - recommended" ON) From 0fda46521d1622ef5273408f0e717089d7d907ed Mon Sep 17 00:00:00 2001 From: Konstantin Tyurin Date: Tue, 4 Nov 2025 20:56:41 +0100 Subject: [PATCH 2/2] Build static library and for Lua 5.4 --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80e1f21b..6b7be4cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # If Lua is installed in a non-standard location, please set the LUA_DIR # environment variable to point to prefix for the install. Eg: # Unix: export LUA_DIR=/home/user/pkg -# Windows: set LUA_DIR=c:\lua51 +# Windows: set LUA_DIR=c:\lua54 cmake_minimum_required(VERSION 2.6) @@ -16,7 +16,7 @@ if(NOT CMAKE_BUILD_TYPE) FORCE) endif() -find_package(Lua51 REQUIRED) +find_package(Lua 5.4 REQUIRED) include_directories(${LUA_INCLUDE_DIR}) if(NOT USE_INTERNAL_FPCONV) @@ -66,7 +66,7 @@ if(WIN32) # Windows sprintf()/strtod() handle NaN/inf differently. Not supported. add_definitions(-DDISABLE_INVALID_NUMBERS) else() - set(_lua_module_dir "${_lua_lib_dir}/lua/5.1") + set(_lua_module_dir "${_lua_lib_dir}/lua/5.4") endif() if(MSVC) @@ -76,7 +76,7 @@ if(MSVC) add_definitions(-Dstrncasecmp=_strnicmp) endif() -add_library(cjson MODULE lua_cjson.c strbuf.c ${FPCONV_SOURCES}) +add_library(cjson STATIC lua_cjson.c strbuf.c ${FPCONV_SOURCES}) set_target_properties(cjson PROPERTIES PREFIX "") target_link_libraries(cjson ${_MODULE_LINK}) install(TARGETS cjson DESTINATION "${_lua_module_dir}")