Skip to content

Fix propagation of generator expressions from parent directory#883

Merged
NWilson merged 2 commits intomainfrom
user/niwilson/mkostemp-defs
Feb 22, 2026
Merged

Fix propagation of generator expressions from parent directory#883
NWilson merged 2 commits intomainfrom
user/niwilson/mkostemp-defs

Conversation

@NWilson
Copy link
Copy Markdown
Member

@NWilson NWilson commented Feb 21, 2026

The CMake build would fail if invoked from a parent directory with a generator expression set on COMPILE_DEFINITIONS:

cmake_minimum_required(VERSION 3.15 FATAL_ERROR)

project(issue-813)

add_compile_definitions($<$<CONFIG:Debug>:DEBUG>)
add_subdirectory(pcre2)

This is a regression.

My code was overly broad; I propagated much more than I intended.

CMakeLists.txt Outdated
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D${_def}")
if(_def STREQUAL "_GNU_SOURCE")
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D${_def}")
endif()
Copy link
Copy Markdown

@sergio-nsk sergio-nsk Feb 22, 2026

Choose a reason for hiding this comment

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

I would replace the foreach with list(FIND _pcre2_compile_definitions "_GNU_SOURCE" _idx).

@NWilson NWilson force-pushed the user/niwilson/mkostemp-defs branch from 72370d0 to 7cb7bc3 Compare February 22, 2026 14:04
@NWilson NWilson force-pushed the user/niwilson/mkostemp-defs branch from 7cb7bc3 to 3dc2bd5 Compare February 22, 2026 14:45
@NWilson
Copy link
Copy Markdown
Member Author

NWilson commented Feb 22, 2026

Thank you for reviewing. I have also added a CI test so we do not regress again on this particular behaviour.

@NWilson NWilson merged commit dbcf67b into main Feb 22, 2026
44 checks passed
@NWilson NWilson deleted the user/niwilson/mkostemp-defs branch February 22, 2026 15:23
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