On 2026/07/22 10:44, Jun Omae wrote:
> On Wed, Jul 22, 2026 at 3:32 AM Timofei Zhakov <[email protected]> wrote:
>>
>> I think here you've changed the behaviour by using the configure time 
>> environment instead of the one when tests are run (which I assume 
>> ENVIRONMENT_MODIFICATION does). This is not mentioned in the log message.
>>
>> Btw, did you consider simply requiring more modern cmake when swig bindings 
>> are enabled? I remember before we bumped to 3.14 from 3.12 there was logic 
>> to still force cmake 3.14/3.13 (I don't remember the exact version) for the 
>> bindings. The default config should not be affected by this but the bindings 
>> (I assume a lot of consumers don't compile them) - in this case they will 
>> have to get a newer cmake.
>>
>> --
>> Timofei Zhakov
> 
> That might be r1932396 ?

Building Python bindings requires Python3::Module component, which is added in 
cmake 3.15. Other targets can be built with cmake 3.14. 


> After r1934847, the CheckCompilerFlag is used but the module is
> introduced in 3.19.
> See also https://cmake.org/cmake/help/latest/module/CheckCompilerFlag.html
> 
> [[[
> CMake Error at CMakeLists.txt:339 (include):
>   include could not find load file:
> 
>     CheckCompilerFlag
> 
> 
> CMake Error at CMakeLists.txt:343 (check_compiler_flag):
>   Unknown CMake command "check_compiler_flag".
> Call Stack (most recent call first):
>   CMakeLists.txt:366 (SVN_CFLAGS_ADD_IFELSE)
> ]]]

The check_compiler_flag() is used to verify whether the -W options are 
available. If the module is unavailable, adding the options can be skipped. 
Alternatively, wouldn't it be possible to check the options using 
try_compile()? After resolving the issue, it is able to build with cmake 3.14 
(or 3.15).

[[[
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a7e49225..d219fb0f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -352,15 +352,22 @@ else()
   # Assume that all compilers except MSVC are GCC-compatible and support
   # the -W syntax

-  include(CheckCompilerFlag)
-  # Adds flags if one is supported by the compiler
-  function(SVN_CFLAGS_ADD_IFELSE flag)
-    set(variable "HAVE_FLAG_${flag}")
-    check_compiler_flag(C ${flag} ${variable})
-    if (${${variable}})
-      add_compile_options("${flag}")
-    endif()
-  endfunction()
+  include(CheckCompilerFlag OPTIONAL)
+  if(COMMAND check_compiler_flag)
+    # Adds flags if one is supported by the compiler
+    function(SVN_CFLAGS_ADD_IFELSE flag)
+      set(variable "HAVE_FLAG_${flag}")
+      check_compiler_flag(C ${flag} ${variable})
+      if (${${variable}})
+        add_compile_options("${flag}")
+      endif()
+    endfunction()
+  else()
+    message(NOTICE "CheckCompilerFlag module unavailable")
+    function(SVN_CFLAGS_ADD_IFELSE flag)
+      message(NOTICE "Skipped Test HAVE_FLAG_${flag}")
+    endfunction()
+  endif()

   # Add flags that all versions of GCC (should) support
   add_compile_options(-Wpointer-arith)
]]]


> After the changes for CheckCompilerFlag are commented temporarily, the
> following error is occurred.
> The Intl::Intl is added in 3.20.
> See https://cmake.org/cmake/help/latest/module/FindIntl.html
> 
> [[[
> -- Found Intl: /usr/include
> CMake Error at CMakeLists.txt:453 (add_library):
>   add_library cannot create ALIAS target "external-intl" because target
>   "Intl::Intl" is imported but not globally visible.
> ]]]
> 

Fixed in r1936526.

-- 
Jun Omae <[email protected]> (大前 潤)

Reply via email to