Skip to content

[NativeAOT] set StaticICULinking results in a CmakeLists.txt that violates policy CMP0000 of Cmake (affects CMake version >= 3.9.0) #93436

Closed
@Neo-vortex

Description

@Neo-vortex

Intro:

when compiling with NativeAOT and StaticICULinking flags, the resulting CmakeLists.txt does not respect policy CMP0000 of Cmake and produces a warning :

 CMake Warning (dev) in CMakeLists.txt:
    No cmake_minimum_required command is present.  A line of code such as
  
      cmake_minimum_required(VERSION 3.22)
  
    should be added at the top of the file. 

steps to produce

1- create a new dotnet console project
2- add <StaticICULinking>true</StaticICULinking> <PublishAot>true</PublishAot> to .csproj file
3- add Microsoft.Dotnet.ILCompiler 8.0.0-rc.2.23479.6 nuget
4- run dotnet publish -r linux-x64 -c Release --self-contained

Expected Behavior

no warning should be emitted by Cmake

Actual Behavior

Cmake emits warning about policy CMP0000

Other Areas Effected ?

perhaps
System.IO.Compression.Native,
System.Security.Cryptography.Native,
System.Security.Cryptography.Native.Android,
System.Security.Cryptography.Native.Apple
...

Solution

myabe setting the min version of cmake to the version that reflects
https://github.com/dotnet/runtime/blob/main/src/coreclr/CMakeLists.txt
or
https://github.com/dotnet/runtime/blob/main/src/native/libs/CMakeLists.txt

Tested System

1- dotnet 8.0.100-rc.2.23502.2
2- cmake version 3.22.1 , This affects CMake version >= 3.9.0
3- Linux neo-Intel 6.2.0-34-generic #34~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 13:12:03 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
4- Microsoft.Dotnet.ILCompiler 8.0.0-rc.2.23479.6 nuget

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions