From 2c84476c77ca7f93e815d96d133deeb818b36141 Mon Sep 17 00:00:00 2001 From: evo <149657734+evo-i@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:28:41 +0300 Subject: [PATCH 1/4] [CMP0153](https://cmake.org/cmake/help/latest/policy/CMP0153.html) --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ce1da9..8876500 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,9 +177,13 @@ endif() # uClibc *intentionally* crashes in duplocale(), at least as of: # https://github.com/ffainelli/uClibc/blob/266bdc1/libc/misc/locale/locale.c#L1322 -# So, if it looks like we're compiling for a system like that just disable +# So, if it looks like we're compiling for a system like that just disable # locale handling entirely. -exec_program(${CMAKE_C_COMPILER} ARGS -dumpmachine OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) +if (CMAKE_VERSION GREATER_EQUAL "3.28") + execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_QUIET ERROR_QUIET OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) +else () + exec_program(${CMAKE_C_COMPILER} ARGS -dumpmachine OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) +endif () if (CMAKE_GNU_C_MACHINE MATCHES "uclibc") message(STATUS "Detected uClibc compiler, disabling locale handling") set(HAVE_SETLOCALE 0) @@ -569,4 +573,3 @@ if (NOT MSVC) # cmd line apps don't built on Windows currently. add_subdirectory(apps) endif() endif() - From e85c8ada5433148a745c98c84d6d201437242091 Mon Sep 17 00:00:00 2001 From: evo <149657734+evo-i@users.noreply.github.com> Date: Sun, 17 Dec 2023 00:23:51 +0300 Subject: [PATCH 2/4] Fix ECHO_OUTPUT_VARIABLE --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8876500..f2ab0d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,7 +180,7 @@ endif() # So, if it looks like we're compiling for a system like that just disable # locale handling entirely. if (CMAKE_VERSION GREATER_EQUAL "3.28") - execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_QUIET ERROR_QUIET OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) + execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_QUIET ERROR_QUIET ECHO_OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) else () exec_program(${CMAKE_C_COMPILER} ARGS -dumpmachine OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) endif () From c0cf4bc23bafd26beec6926faf14b6bfb28a678d Mon Sep 17 00:00:00 2001 From: evo <149657734+evo-i@users.noreply.github.com> Date: Sun, 17 Dec 2023 00:32:21 +0300 Subject: [PATCH 3/4] Update CMakeLists.txt Now saved to variable. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2ab0d8..e9e9dc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,7 +180,7 @@ endif() # So, if it looks like we're compiling for a system like that just disable # locale handling entirely. if (CMAKE_VERSION GREATER_EQUAL "3.28") - execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_QUIET ERROR_QUIET ECHO_OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) + execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpmachine ERROR_QUIET OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) else () exec_program(${CMAKE_C_COMPILER} ARGS -dumpmachine OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) endif () From eef983b1df7c1d88dfe6b3c64bec49dcc6897e90 Mon Sep 17 00:00:00 2001 From: evo <149657734+evo-i@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:19:20 +0300 Subject: [PATCH 4/4] Update CMakeLists.txt Replace with `execute_process` available on v3.0+ --- CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9e9dc9..413ea21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,11 +179,8 @@ endif() # https://github.com/ffainelli/uClibc/blob/266bdc1/libc/misc/locale/locale.c#L1322 # So, if it looks like we're compiling for a system like that just disable # locale handling entirely. -if (CMAKE_VERSION GREATER_EQUAL "3.28") - execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpmachine ERROR_QUIET OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) -else () - exec_program(${CMAKE_C_COMPILER} ARGS -dumpmachine OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) -endif () +execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpmachine ERROR_QUIET OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) + if (CMAKE_GNU_C_MACHINE MATCHES "uclibc") message(STATUS "Detected uClibc compiler, disabling locale handling") set(HAVE_SETLOCALE 0)