AmigaPorts / AmigaCMakeCrossToolchains

Mozilla Public License 2.0
11 stars 3 forks source link

if given arguments: "NOT" "M68K_CRT" "IN_LIST" "M68K_CRT_TYPES" Unknown arguments specified #18

Closed MBeijer closed 1 year ago

MBeijer commented 1 year ago

@simpsond

M68K_CRT not set, defaulting C Runtime to libnix
CMake Warning (dev) at /opt/m68k-amigaos/lib/m68k-amigaos.cmake:42 (if):
  Policy CMP0057 is not set: Support new IN_LIST if() operator.  Run "cmake
  --help-policy CMP0057" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  IN_LIST will be interpreted as an operator when the policy is set to NEW.
  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  /usr/share/cmake-3.25/Modules/CMakeDetermineSystem.cmake:124 (include)
  CMakeLists.txt:4 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /opt/m68k-amigaos/lib/m68k-amigaos.cmake:42 (if):
  if given arguments:

    "NOT" "M68K_CRT" "IN_LIST" "M68K_CRT_TYPES"

  Unknown arguments specified
Call Stack (most recent call first):
  /usr/share/cmake-3.25/Modules/CMakeDetermineSystem.cmake:124 (include)
  CMakeLists.txt:4 (project)
MBeijer commented 1 year ago

In list seems to be in CMake 3.3 which is bleeding edge...

simpsond commented 1 year ago

Okay, I will look into that today!

simpsond commented 1 year ago

I confirmed that IN_LIST was introduced in version 3.3, see CMP0057

CMake 3.3 Release was nearly 8 years ago, but I suppose you could consider that bleeding edge since we work with the Amiga ;)

I'll get a PR to remove the need for this operator.

tehKaiN commented 1 year ago

is it really necessary to support 3.3 when bleeding edge's 3.25, though? What's the version on current LTS/main versions of large *nix systems? On ubuntu it's 3.16 if I look at it correctly (https://packages.ubuntu.com/focal/cmake) and Debian says 3.13 (https://packages.debian.org/buster/cmake).

On a side note, I think we should come up with some kind of policy on which cmake do we support, organization-wise.

simpsond commented 1 year ago

I agree we should identify a target, either fixed (version X until further notice) or moving (X versions back, or tracking a linux distribution, etc.)

MBeijer commented 1 year ago

Sorry, my brain went dumb for a moment and thought 3.3 was more than 3.25 lmao. facepalm The error should probably be avoided somehow though...

MBeijer commented 1 year ago

I read 3.3 as 3.30

tehKaiN commented 1 year ago

now I see that https://github.com/AmigaPorts/ACE targets cmake 3.14 which IIRC I've bumped to arbitrary kinda-modern version when I needed some feature which wasn't supported by some kind of ancient, previously required version. I guess settling at Debian (3.13) for our project is reasonable enough? What are your thoughts, @MBeijer ?

MBeijer commented 1 year ago

@tehKaiN I think lowest common denominator is fine. If both Ubuntu and Debian are on 3.13, that's what we should aim for. I try/tend not to use bleeding edge CMake features, to be sure to support as many as possible.

@simpsond Now back to the matter at hand. Somthing is obviously wrong even in 3.25 with something that has been supported since 3.3. This latest change makes it impossible for me to build new docker images for m68k-amigaos due to the toolchain file.

Debian unstable (which the docker image is based on) is on 3.25.

simpsond commented 1 year ago

I'll test with the docker image, thank you and sorry for the inconvenience.

simpsond commented 1 year ago

Still trying to reproduce. I pulled in the latest toolchain file by wget https://raw.githubusercontent.com/AmigaPorts/AmigaCMakeCrossToolchains/0e93445febdb6abaf06c8ccd391e8e7d99c1776b/m68k-amigaos.cmake

and then tried to build a little hello world project.

root@007e7788999d:/work/cmake-manual# cmake --version
cmake version 3.24.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
root@007e7788999d:/work/cmake-manual# grep IN_LIST /opt/m68k-amigaos/lib/m68k-amigaos.cmake
if(NOT M68K_CRT IN_LIST M68K_CRT_TYPES)
root@007e7788999d:/work/cmake-manual# cd ..
root@007e7788999d:/work# rm -rf cmake-manual/*
root@007e7788999d:/work# ls
AmigaCMakeCrossToolchains  cmake-build-debug-amiga-gcc  cmake-build-release-amiga-gcc  cmake-build-release-amiga-vbcc  CMakeLists.txt  cmake-manual  cmake-vbcc  README.md  Smakefile  src  vbcc-env.sh
root@007e7788999d:/work# cat CMakeLists.txt
cmake_minimum_required(VERSION 3.24)
set(M68K_CRT none)
project(AmiHello C)

set(CMAKE_C_STANDARD 99)

add_executable(AmiHello
        src/hello.c
        )
install(TARGETS AmiHello DESTINATION AmiHello)
root@007e7788999d:/work# cmake -B cmake-manual/
M68K_CRT not set, defaulting C Runtime to libnix
-- The C compiler identification is GNU 6.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/m68k-amigaos/bin/m68k-amigaos-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /work/cmake-manual
root@007e7788999d:/work# cd cmake-manual/
root@007e7788999d:/work/cmake-manual# make
[ 50%] Building C object CMakeFiles/AmiHello.dir/src/hello.c.obj
/work/src/hello.c:5:0: warning: "__saveds" redefined
 #define __saveds

<built-in>: note: this is the location of the previous definition
[100%] Linking C executable AmiHello
[100%] Built target AmiHello

I can clearly just remove IN_LIST and replace it with a substring check, but was hoping to reproduce first.

MBeijer commented 1 year ago

Huh, strange...

MBeijer commented 1 year ago
CMP0057
-------

.. versionadded:: 3.3

Support new ``if()`` IN_LIST operator.

CMake 3.3 adds support for the new IN_LIST operator.

The ``OLD`` behavior for this policy is to ignore the IN_LIST operator.
The ``NEW`` behavior is to interpret the IN_LIST operator.

This policy was introduced in CMake version 3.3.
CMake version 3.25.1 warns when the policy is not set and uses
``OLD`` behavior.  Use the ``cmake_policy()`` command to set
it to ``OLD`` or ``NEW`` explicitly.

.. note::
  The ``OLD`` behavior of a policy is
  ``deprecated by definition``
  and may be removed in a future version of CMake.