Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix if(DEFINED ENV{var}) for CMAKE_* variables #281

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Takishima
Copy link

MRE:

cmake_minimum_required(VERSION 3.0)
project(test LANGUAGES CXX)

if(DEFINED ENV{CMAKE_CXX_COMPILER_LAUNCHER})
  message(STATUS "Hello World!")
endif()

Expected:

No warnings

Actual:

/tmp/CMakeLists.txt
===================
/tmp/CMakeLists.txt:04,11: [W0106] String looks like a variable reference missing an open tag '{CMAKE_CXX_COMPILER_LAUNCHER'

Summary
=======
files scanned: 1
found lint:
     Warning: 1

This PR addresses this by patching the LintChecker::check_tokens() function to check for cases where the first group of the match happens to be ENV{.

# This file is missing a final newline

Choose a reason for hiding this comment

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

The commit adds newline and thus breaking the expected check.

ndam-hexagon

This comment was marked as off-topic.

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.

None yet

3 participants