Skip to content

Conversation

@MBkkt
Copy link
Contributor

@MBkkt MBkkt commented May 24, 2025

I'm not CMake expert, but with current code and WITH_PYTHON not touched I have following error:

CMake Error at third_party/s2geometry/CMakeLists.txt:658 (if):
  if given arguments:

    "AND" "TRUE"

  Unknown arguments specified

I'm not CMake expert, but with current code and WITH_PYTHON not touched  I have following error:
```
CMake Error at third_party/s2geometry/CMakeLists.txt:658 (if):
  if given arguments:

    "AND" "TRUE"

  Unknown arguments specified
```
endif()

if (${SWIG_FOUND} AND ${Python3_FOUND})
if (SWIG_FOUND AND Python3_FOUND)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd since this hasn't changed in 5 years.

https://github.com/google/s2geometry/blame/473a989af642959b1a52bdb675445ff1a9dd9c09/CMakeLists.txt#L658

What's the exact command that fails for you and what cmake version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake version 3.28.3

I use s2 as submodule with quite complicated setup, so I probably cannot provide exact command.

It uses add_subdirectory(s2geometry)

  • Python3_FOUND defined because other components use find_package(Python3...) before add_subdirectory(s2geometry)
  • WITH_PYTHON isn't defined so SWIG_FOUND also not defined

In general this condition looks quite unusual because

find_package(Some)
if (Some_FOUND)

quite popular cmake construction but not

find_package(Some)
if (${Some_FOUND})

because it will be syntax error if Some_FOUND not defined?

But as I said, I'm not cmake expert so feel free to close if you're thinking it's irrelevant/not necessary/etc
It wasn't issue for me before, because these lines was comment out in my fork

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can became an issue since this efb124d

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can try following patch in github CI?
master...MBkkt:s2geometry:patch-11

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The easiest way to test it is to make a PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok: #434

Copy link
Member

@jmr jmr May 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between X and ${X} is in cmake?

Maybe the most obvious fix is to add WITH_PYTHON && or wrap in if (WITH_PYTHON).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between X and ${X} is in swig?

In cmake you mean?
If I understand right ${X} converts argument to string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I find main difference in if (condition) https://cmake.org/cmake/help/latest/command/if.html#variable-expansion but still don't understand why if (${undefined_var} AND ${defined_as_true_var}) doesn't work

@jmr jmr merged commit 2b542ac into google:master May 24, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants