Skip to content

[CMake] Fix to handle empty CMAKE_SYSTEM_ARCHITECTURE - #1040

Closed
JoeLoser wants to merge 1 commit into
meta:masterfrom
JoeLoser:cmake_empty_var
Closed

JoeLoser wants to merge 1 commit into
meta:masterfrom
JoeLoser:cmake_empty_var

Conversation

@JoeLoser

@JoeLoser JoeLoser commented Mar 2, 2019 •

Copy link
Copy Markdown
Contributor

Summary:

  • On some platforms, CMAKE_SYSTEM_ARCHITECTURE may resolve to an empty
    string.
  • When this value is used without quotes to the string command, it is
    ill-formed with error:
  CMake Error at CMakeLists.txt:174 (string):
  string sub-command FIND requires 3 or 4 parameters.
  • Explicitly wrap the value to the string operation in quotes to treat
    CMAKE_SYSTEM_ARCHITECTURE as a string, which is allowed to be empty.
    The result is that the string operation will not result in a hard
    error.

Summary:
- On some platforms, `CMAKE_SYSTEM_ARCHITECTURE` may resolve to an empty
  string.
- When this value is used without quotes to the `string` command, it is
  ill-formed with error:

```
  CMake Error at CMakeLists.txt:174 (string):
  string sub-command FIND requires 3 or 4 parameters.
```

- Explicitly wrap the value to the `string` operation in quotes to treat
  `CMAKE_SYSTEM_ARCHITECTURE` as a string, which is allowed to be empty.
  The result is that the `string` operation will not result in a hard
  error.

@facebook-github-bot facebook-github-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@yfeldblum has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

sandraiser pushed a commit to sandraiser/folly that referenced this pull request Mar 4, 2019
Summary:
- On some platforms, `CMAKE_SYSTEM_ARCHITECTURE` may resolve to an empty
  string.
- When this value is used without quotes to the `string` command, it is
  ill-formed with error:

```
  CMake Error at CMakeLists.txt:174 (string):
  string sub-command FIND requires 3 or 4 parameters.
```

- Explicitly wrap the value to the `string` operation in quotes to treat
  `CMAKE_SYSTEM_ARCHITECTURE` as a string, which is allowed to be empty.
  The result is that the `string` operation will not result in a hard
  error.
Pull Request resolved: meta#1040

Reviewed By: calebmarchent

Differential Revision: D14293784

Pulled By: yfeldblum

fbshipit-source-id: cd5924fa62277aa07e930c7b088197ef596be977
@JoeLoser
JoeLoser deleted the cmake_empty_var branch April 2, 2019 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants