Skip to content

Commit 49cd94f

Browse files
committed
Propagate project version variables to parent scope
Adds backward compatibility by setting PROJECT_VERSION and its components (MAJOR, MINOR, PATCH) in the parent scope within cpp_library_setup.
1 parent 3c81a15 commit 49cd94f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cpp-library.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ function(cpp_library_setup)
242242
set(ARG_VERSION_MINOR ${PROJECT_VERSION_MINOR})
243243
set(ARG_VERSION_PATCH ${PROJECT_VERSION_PATCH})
244244

245+
# Propagate project version to caller's scope (backward compatibility)
246+
set(PROJECT_VERSION ${ARG_VERSION} PARENT_SCOPE)
247+
set(PROJECT_VERSION_MAJOR ${ARG_VERSION_MAJOR} PARENT_SCOPE)
248+
set(PROJECT_VERSION_MINOR ${ARG_VERSION_MINOR} PARENT_SCOPE)
249+
set(PROJECT_VERSION_PATCH ${ARG_VERSION_PATCH} PARENT_SCOPE)
250+
245251
# Generate full paths for HEADERS and SOURCES based on conventions
246252
set(GENERATED_HEADERS "")
247253
foreach(header IN LISTS ARG_HEADERS)

0 commit comments

Comments
 (0)