-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rapids_export_write_language no longer generates cmake dev warnings (#…
…712) The `rapids_export_write_language` function would generate CMake code that would try and do `set(var PARENT_SCOPE)` in the root directory. This would cause CMake developer warnings to appear. This resolves the issues by adding root level guards around the `set` commands, and setting up each rapids-cmake test to have developer warnings as errors. Due to #680 we mark some tests with `NO_DEV_ERRORS` so that they continue to pass while we wait to 2025 to bump the minimum required CMake version. Authors: - Robert Maynard (https://github.com/robertmaynard) Approvers: - Bradley Dice (https://github.com/bdice) URL: #712
- Loading branch information
1 parent
2f81c15
commit e867d76
Showing
4 changed files
with
24 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,31 +73,33 @@ endif() | |
# | ||
# So what we need to do is the following: | ||
# | ||
# 1. Transform each `set` in CMake@lang@Compiler to be a `PARENT_SCOPE` | ||
# This allows us to propagate up immediate information that is | ||
# used by commands such target_compile_features. | ||
# For non-root directories: | ||
# 1. Transform each `set` in CMake@lang@Compiler to be a `PARENT_SCOPE` | ||
# This allows us to propagate up immediate information that is | ||
# used by commands such target_compile_features. | ||
# | ||
# 2. Make sure that every directory including root also re-executes | ||
# `CMake@lang@Information` This can't be deferred as the contents | ||
# are required if any target is constructed | ||
# 2. Include `CMake@lang@Information` this can't be deferred as the contents | ||
# are required if any target is constructed | ||
# | ||
# For root directories we only need to include `CMake@lang@Information` | ||
# | ||
|
||
# Expose the language at the current scope | ||
enable_language(@lang@) | ||
|
||
|
||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/cmake/PropagateCMake@[email protected]") | ||
# 1. | ||
# Take everything that `enable_language` generated and transform all sets to PARENT_SCOPE () | ||
# This will allow our parent directory to be able to call CMake@lang@Information | ||
file(STRINGS "${CMAKE_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION}/CMake@[email protected]" rapids_code_to_transform) | ||
set(rapids_code_to_execute ) | ||
set(rapids_code_to_execute "if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)\n") | ||
foreach( line IN LISTS rapids_code_to_transform) | ||
if(line MATCHES "[ ]*set") | ||
string(REPLACE ")" " PARENT_SCOPE)" line "${line}") | ||
endif() | ||
string(APPEND rapids_code_to_execute "${line}\n") | ||
endforeach() | ||
string(APPEND rapids_code_to_execute "endif()\n") | ||
|
||
# 2. | ||
# Make sure we call "CMake@lang@Information" for the current directory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters