-
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 version support expanded to handle more use-cases
The rapids_export command now supports the following features: Explicit version argument option. This allows projects to specify a version when calling `rapids_export` instead of having it inferred from the `project()` call. Disabling of version exporting by passing `VERSION OFF`. This removes the generation of any version related information to allow for projects that don't have API/ABI version matching requirements Projects that only have a MAJOR version number now don't try to match on the exact Major.Minor value but instead on Major only
- Loading branch information
1 parent
e76246d
commit 457cd90
Showing
9 changed files
with
393 additions
and
42 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,13 +47,15 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | |
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | ||
endif() | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | ||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | ||
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | ||
endif() | ||
|
||
# Set our version variables | ||
set(@project_name_uppercase@_VERSION_MAJOR @PROJECT_VERSION_MAJOR@) | ||
set(@project_name_uppercase@_VERSION_MINOR @PROJECT_VERSION_MINOR@) | ||
set(@project_name_uppercase@_VERSION_PATCH @PROJECT_VERSION_PATCH@) | ||
set(@project_name_uppercase@_VERSION @PROJECT_VERSION@) | ||
set(@project_name_uppercase@_VERSION_MAJOR @rapdis_orig_major_version@) | ||
set(@project_name_uppercase@_VERSION_MINOR @rapdis_orig_minor_version@) | ||
set(@project_name_uppercase@_VERSION_PATCH @rapdis_orig_patch_version@) | ||
set(@project_name_uppercase@_VERSION @RAPIDS_VERSION@) | ||
|
||
|
||
set(rapids_global_targets @RAPIDS_GLOBAL_TARGETS@) | ||
|
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
58 changes: 58 additions & 0 deletions
58
testing/export/export-verify-explicit-disabled-version.cmake
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#============================================================================= | ||
# Copyright (c) 2018-2021, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
include(${rapids-cmake-dir}/export/cpm.cmake) | ||
include(${rapids-cmake-dir}/export/export.cmake) | ||
|
||
project(test LANGUAGES CXX VERSION 1.2) | ||
|
||
add_library(fakeLib INTERFACE) | ||
install(TARGETS fakeLib EXPORT fake_set) | ||
|
||
rapids_export(BUILD test | ||
VERSION OFF | ||
EXPORT_SET fake_set | ||
LANGUAGES CXX | ||
) | ||
|
||
# Verify that build files have correct names | ||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/test-config.cmake") | ||
message(FATAL_ERROR "rapids_export failed to generate correct config file name") | ||
endif() | ||
|
||
# Verify that the version.cmake file doesn't exist as we don't have a | ||
# version value | ||
if(EXISTS "${CMAKE_BINARY_DIR}/test-config-version.cmake") | ||
message(FATAL_ERROR "rapids_export incorrectly generated a version file") | ||
endif() | ||
|
||
set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) | ||
find_package(test REQUIRED) | ||
|
||
if(DEFINED TEST_VERSION) | ||
message(FATAL_ERROR "rapids_export incorrectly generated a version variable") | ||
endif() | ||
|
||
if(DEFINED TEST_VERSION_MAJOR) | ||
message(FATAL_ERROR "rapids_export incorrectly generated a major version value") | ||
endif() | ||
|
||
if(DEFINED TEST_VERSION_MINOR) | ||
message(FATAL_ERROR "rapids_export incorrectly generated a minor version value") | ||
endif() | ||
|
||
if(DEFINED TEST_VERSION_PATCH) | ||
message(FATAL_ERROR "rapids_export incorrectly generated a patch version value") | ||
endif() |
57 changes: 57 additions & 0 deletions
57
testing/export/export-verify-explicit-major-version-only-matching.cmake
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#============================================================================= | ||
# Copyright (c) 2018-2021, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
include(${rapids-cmake-dir}/export/cpm.cmake) | ||
include(${rapids-cmake-dir}/export/export.cmake) | ||
|
||
project(test LANGUAGES CXX VERSION 4.2.1) | ||
|
||
add_library(fakeLib INTERFACE) | ||
install(TARGETS fakeLib EXPORT fake_set) | ||
|
||
rapids_export(BUILD test | ||
VERSION 4 | ||
EXPORT_SET fake_set | ||
LANGUAGES CXX | ||
) | ||
|
||
# Verify that build files have correct names | ||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/test-config.cmake") | ||
message(FATAL_ERROR "rapids_export failed to generate correct config file name") | ||
endif() | ||
|
||
# Verify that the version.cmake file exists with an explicit version arg | ||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/test-config-version.cmake") | ||
message(FATAL_ERROR "rapids_export failed to generate a version file") | ||
endif() | ||
|
||
set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) | ||
find_package(test 4.0 REQUIRED) | ||
|
||
if(NOT TEST_VERSION STREQUAL "4") | ||
message(FATAL_ERROR "rapids_export failed to export version information") | ||
endif() | ||
|
||
if(NOT TEST_VERSION_MAJOR STREQUAL "4") | ||
message(FATAL_ERROR "rapids_export failed to export major version value") | ||
endif() | ||
|
||
if(DEFINED TEST_VERSION_MINOR) | ||
message(FATAL_ERROR "rapids_export incorrectly generated a minor version value") | ||
endif() | ||
|
||
if(DEFINED TEST_VERSION_PATCH) | ||
message(FATAL_ERROR "rapids_export incorrectly generated a patch version value") | ||
endif() |
Oops, something went wrong.