From 10860164778327c0009f6efc8e020308cadb13a2 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 13 May 2023 12:12:29 +0200 Subject: build: cmake cleanup - Simplify error checking when using execute_process. - Set BUILD_SHARED_LIBS to OFF when building dependencies. This is normally not needed, but msgpack interprets an unset BUILD_SHARED_LIBS to build a shared library, which is the opposite of the cmake behavior. - Move function check_lua_module to Util.cmake. - Remove unnecessary code. - Make variable naming more consistent --- cmake/Util.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cmake/Util.cmake') diff --git a/cmake/Util.cmake b/cmake/Util.cmake index e15b44d29a..b70f33a302 100644 --- a/cmake/Util.cmake +++ b/cmake/Util.cmake @@ -193,3 +193,14 @@ function(set_default_buildtype) endif() endif() endfunction() + +# Check if a module is available in Lua +function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR) + execute_process(COMMAND ${LUA_PRG_PATH} -l "${MODULE}" -e "" + RESULT_VARIABLE module_missing) + if(module_missing) + set(${RESULT_VAR} FALSE PARENT_SCOPE) + else() + set(${RESULT_VAR} TRUE PARENT_SCOPE) + endif() +endfunction() -- cgit From 46e95909bf898bd295f8009b15a88719733de906 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 24 Jun 2023 00:29:53 +0200 Subject: ci: introduce CI_LINT option This will abort if lint programs are not found, and is meant primarily for the lint job in CI. Supersedes the REQUIRED argument in add_glob_target as it's a superior replacement by being a built-in solution. --- cmake/Util.cmake | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'cmake/Util.cmake') diff --git a/cmake/Util.cmake b/cmake/Util.cmake index b70f33a302..0d6fa2a4ce 100644 --- a/cmake/Util.cmake +++ b/cmake/Util.cmake @@ -4,7 +4,6 @@ # depends on the value of TOUCH_STRATEGY. # # Options: -# REQUIRED - Abort if COMMAND doesn't exist. # # Single value arguments: # TARGET - Name of the target @@ -53,7 +52,7 @@ # files. function(add_glob_target) cmake_parse_arguments(ARG - "REQUIRED" + "" "TARGET;COMMAND;GLOB_PAT;TOUCH_STRATEGY" "FLAGS;FILES;GLOB_DIRS;EXCLUDE" ${ARGN} @@ -61,14 +60,8 @@ function(add_glob_target) if(NOT ARG_COMMAND) add_custom_target(${ARG_TARGET}) - if(ARG_REQUIRED) - add_custom_command(TARGET ${ARG_TARGET} - COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET}: ${ARG_COMMAND} not found" - COMMAND false) - else() - add_custom_command(TARGET ${ARG_TARGET} - COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found") - endif() + add_custom_command(TARGET ${ARG_TARGET} + COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found") return() endif() -- cgit From 2c16c6a6c42f46e290df5441c37572f296aeb09f Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Mon, 27 Nov 2023 10:43:13 +0100 Subject: docs: small fixes (#26154) --- cmake/Util.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmake/Util.cmake') diff --git a/cmake/Util.cmake b/cmake/Util.cmake index 0d6fa2a4ce..01d34d6752 100644 --- a/cmake/Util.cmake +++ b/cmake/Util.cmake @@ -162,8 +162,8 @@ endfunction() # cmake -B build # cmake --build build --config Release # -# Passing CMAKE_BUILD_TYPE for multi-config generators will now not only -# not be used, but also generate a warning for the user. +# Passing CMAKE_BUILD_TYPE for multi-config generators will not only not be +# used, but also generate a warning for the user. function(set_default_buildtype) set(allowableBuildTypes Debug Release MinSizeRel RelWithDebInfo) -- cgit