repo_id
stringlengths
21
96
file_path
stringlengths
31
155
content
stringlengths
1
92.9M
__index_level_0__
int64
0
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_rmm-simple.cmake
#============================================================================= # Copyright (c) 2021-2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/rmm.cmake) rapids_cpm_init() if(TARGET rmm::rmm) message(FATAL_ERROR "Expected rmm::rmm not to exist") endif() rapids_cpm_rmm() if(NOT TARGET rmm::rmm) message(FATAL_ERROR "Expected rmm::rmm target to exist") endif() rapids_cpm_rmm()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_libcudacxx-export.cmake
#============================================================================= # Copyright (c) 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/libcudacxx.cmake) rapids_cpm_init() rapids_cpm_libcudacxx(BUILD_EXPORT_SET frank INSTALL_EXPORT_SET test) rapids_cpm_libcudacxx(INSTALL_EXPORT_SET test2) add_library(example INTERFACE ) target_link_libraries(example INTERFACE libcudacxx::libcudacxx) install(TARGETS example EXPORT example-targets) install(EXPORT example-targets FILE ${project_name}-targets.cmake DESTINATION "lib/cmake/") get_target_property(packages rapids_export_install_test PACKAGE_NAMES) if(NOT libcudacxx IN_LIST packages) message(FATAL_ERROR "rapids_cpm_libcudacxx failed to record libcudacxx needs to be exported") endif() get_target_property(packages rapids_export_install_test2 PACKAGE_NAMES) if(NOT libcudacxx IN_LIST packages) message(FATAL_ERROR "rapids_cpm_libcudacxx failed to record libcudacxx needs to be exported") endif() get_target_property(packages rapids_export_build_frank PACKAGE_NAMES) if(NOT libcudacxx IN_LIST packages) message(FATAL_ERROR "rapids_cpm_libcudacxx failed to record libcudacxx needs to be exported") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_cuco-libcudacxx-no-install-export.cmake
#============================================================================= # Copyright (c) 2022, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/cuco.cmake) include(${rapids-cmake-dir}/cpm/libcudacxx.cmake) rapids_cpm_init() rapids_cpm_libcudacxx(BUILD_EXPORT_SET test_export_set) # Verify that cuco doesn't fail to generate when # it encounters a libcudacxx that has has no INSTALL rules rapids_cpm_cuco(BUILD_EXPORT_SET test_export_set) get_target_property(packages rapids_export_build_test_export_set PACKAGE_NAMES) if(NOT libcudacxx IN_LIST packages) message(FATAL_ERROR "rapids_cpm_cuco failed to record cuco needs to be exported") endif() if(NOT cuco IN_LIST packages) message(FATAL_ERROR "rapids_cpm_cuco failed to record cuco needs to be exported") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_fmt-export.cmake
#============================================================================= # Copyright (c) 2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/fmt.cmake) rapids_cpm_init() rapids_cpm_fmt(BUILD_EXPORT_SET frank INSTALL_EXPORT_SET test) rapids_cpm_fmt(INSTALL_EXPORT_SET test2) get_target_property(packages rapids_export_install_test PACKAGE_NAMES) if(NOT fmt IN_LIST packages) message(FATAL_ERROR "rapids_cpm_fmt failed to record fmt needs to be exported") endif() get_target_property(packages rapids_export_install_test2 PACKAGE_NAMES) if(NOT fmt IN_LIST packages) message(FATAL_ERROR "rapids_cpm_fmt failed to record fmt needs to be exported") endif() get_target_property(packages rapids_export_build_frank PACKAGE_NAMES) if(NOT fmt IN_LIST packages) message(FATAL_ERROR "rapids_cpm_fmt failed to record fmt needs to be exported") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_package_override-obey-cpm-source-var.cmake
#============================================================================= # Copyright (c) 2021-2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/package_override.cmake) rapids_cpm_init() # Need to write out an override file file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json [=[ { "packages" : { "rmm" : { "git_url" : "new_rmm_url", "git_shallow" : "OFF", "exclude_from_all" : "ON" }, "not_in_base" : { "git_url" : "new_rmm_url", "git_shallow" : "OFF", "exclude_from_all" : "ON" } } } ]=]) set(CPM_rmm_SOURCE "${CMAKE_CURRENT_BINARY_DIR}") set(CPM_not_in_base_SOURCE "${CMAKE_CURRENT_BINARY_DIR}") rapids_cpm_package_override(${CMAKE_CURRENT_BINARY_DIR}/override.json) # Verify that the override doesn't exist due to `CPM_rmm_SOURCE` include("${rapids-cmake-dir}/cpm/detail/package_details.cmake") rapids_cpm_package_details(rmm version repository tag shallow exclude) if(repository MATCHES "new_rmm_url") message(FATAL_ERROR "custom url field should not be set, due to CPM_rmm_SOURCE") endif() if(shallow MATCHES "OFF") message(FATAL_ERROR "shallow field should not be set, due to CPM_rmm_SOURCE") endif() if(CPM_DOWNLOAD_ALL) message(FATAL_ERROR "CPM_DOWNLOAD_ALL should not be set, due to CPM_rmm_SOURCE") endif() unset(version) unset(repository) unset(tag) rapids_cpm_package_details(not_in_base version repository tag shallow exclude) if(version OR repository OR tag) message(FATAL_ERROR "rapids_cpm_package_details should not return anything for package that doesn't exist") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/make_fake_project_build_dir_with_config.cmake
#============================================================================= # Copyright (c) 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. #============================================================================= function(make_fake_project_build_dir_with_config name version config_file version_file) include(CMakePackageConfigHelpers) # Generate a fake config module for RapidsTestFind set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${name}-build/") file(MAKE_DIRECTORY ${build_dir}) configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/${config_file}" "${build_dir}/${config_file}" INSTALL_DESTINATION "${build_dir}/${config_file}" ) write_basic_package_version_file("${build_dir}/${version_file}" VERSION ${version} COMPATIBILITY SameMajorVersion) endfunction()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_init-override-multiple.cmake
#============================================================================= # Copyright (c) 2021-2023, 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}/cpm/init.cmake) rapids_cpm_init() # Load the default values for nvbench and GTest projects include("${rapids-cmake-dir}/cpm/detail/package_details.cmake") rapids_cpm_package_details(nvbench nvbench_version nvbench_repository nvbench_tag nvbench_shallow nvbench_exclude) rapids_cpm_package_details(GTest GTest_version GTest_repository GTest_tag GTest_shallow GTest_exclude) # Need to write out an override file file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json [=[ { "packages" : { "nvbench" : { "git_tag" : "my_tag", "always_download" : false }, "rmm" : { "git_tag" : "my_tag" }, "GTest" : { "version" : "2.99" } } } ]=]) rapids_cpm_init(OVERRIDE "${CMAKE_CURRENT_BINARY_DIR}/override.json") # Verify that the override works rapids_cpm_package_details(nvbench version repository tag shallow exclude) if(NOT version STREQUAL nvbench_version) message(FATAL_ERROR "default version field was removed.") endif() if(NOT repository STREQUAL nvbench_repository) message(FATAL_ERROR "default repository field was removed.") endif() if(NOT tag STREQUAL "my_tag") message(FATAL_ERROR "custom git_tag field was ignored. ${tag} found instead of my_tag") endif() if(CPM_DOWNLOAD_ALL) message(FATAL_ERROR "CPM_DOWNLOAD_ALL should be false since the nvbench override explicitly sets it to 'false'") endif() unset(CPM_DOWNLOAD_ALL) # Verify that the override works rapids_cpm_package_details(rmm version repository tag shallow exclude) if(NOT tag STREQUAL "my_tag") message(FATAL_ERROR "custom git_tag field was ignored. ${tag} found instead of my_tag") endif() if(NOT CPM_DOWNLOAD_ALL) message(FATAL_ERROR "CPM_DOWNLOAD_ALL should be true since a custom git tag was used for rmm") endif() unset(CPM_DOWNLOAD_ALL) rapids_cpm_package_details(GTest version repository tag shallow exclude) if(NOT version STREQUAL "2.99") message(FATAL_ERROR "custom version field was removed. ${version} was found instead") endif() if(NOT tag MATCHES "2.99") message(FATAL_ERROR "custom version field not used when computing git_tag value. ${tag} was found instead") endif() if(CPM_DOWNLOAD_ALL) message(FATAL_ERROR "CPM_DOWNLOAD_ALL should be false by default when an override exists that doesn't modify url or tag") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_gtest-export.cmake
#============================================================================= # Copyright (c) 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/gtest.cmake) rapids_cpm_init() rapids_cpm_gtest(BUILD_EXPORT_SET test) rapids_cpm_gtest(BUILD_EXPORT_SET test2) get_target_property(packages rapids_export_build_test PACKAGE_NAMES) if(NOT GTest IN_LIST packages) message(FATAL_ERROR "rapids_cpm_gtest failed to record gtest needs to be exported") endif() get_target_property(packages rapids_export_build_test2 PACKAGE_NAMES) if(NOT GTest IN_LIST packages) message(FATAL_ERROR "rapids_cpm_gtest failed to record gtest needs to be exported") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_package_override-empty.cmake
#============================================================================= # Copyright (c) 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/package_override.cmake) rapids_cpm_init() # Need to write out an override file file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json [=[ { "packages" : { } } ]=]) # Verify that the override can be consumed without errors rapids_cpm_package_override(${CMAKE_CURRENT_BINARY_DIR}/override.json)
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_generate_patch_command-current_json_dir.cmake
#============================================================================= # Copyright (c) 2022-2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/package_override.cmake) include(${rapids-cmake-dir}/cpm/detail/generate_patch_command.cmake) rapids_cpm_init() rapids_cpm_generate_patch_command(pkg_with_patch 10.2 patch_command) if(patch_command) message(FATAL_ERROR "pkg_with_patch doesn't have override yet, patch_command should be empty") endif() # Need to write out an override file file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json [=[ { "packages" : { "pkg_with_patch" : { "version" : "10.2", "git_tag" : "a_tag", "git_shallow" : "OFF", "exclude_from_all" : "ON", "patches" : [ { "file" : "${current_json_dir}/example.diff", "issue" : "explain", "fixed_in" : "" }, { "file" : "${current_json_dir}/example2.diff", "issue" : "explain", "fixed_in" : "" } ] } } } ]=]) rapids_cpm_package_override(${CMAKE_CURRENT_BINARY_DIR}/override.json) rapids_cpm_generate_patch_command(pkg_with_patch 10.2 patch_command) if(NOT patch_command) message(FATAL_ERROR "rapids_cpm_package_override specified a patch step for `pkg_with_patch`") endif() set(to_match_string "set(files \"${CMAKE_CURRENT_BINARY_DIR}/example.diff;${CMAKE_CURRENT_BINARY_DIR}/example2.diff\")") list(POP_BACK patch_command script_to_run) file(READ "${script_to_run}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_cpm_generate_patch_command failed to handle the `current_json_dir` placeholder") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_package_override-simple.cmake
#============================================================================= # Copyright (c) 2021-2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/package_override.cmake) rapids_cpm_init() # Need to write out an override file file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json [=[ { "packages" : { "rmm" : { "git_url" : "new_rmm_url", "git_shallow" : "OFF", "exclude_from_all" : "ON" }, "GTest" : { "version" : "3.00.A1" } } } ]=]) rapids_cpm_package_override(${CMAKE_CURRENT_BINARY_DIR}/override.json) # Verify that the override works include("${rapids-cmake-dir}/cpm/detail/package_details.cmake") rapids_cpm_package_details(GTest version repository tag shallow exclude) if(NOT version STREQUAL "3.00.A1") message(FATAL_ERROR "custom version field was removed. ${version} was found instead") endif() if(NOT tag MATCHES "3.00.A1") message(FATAL_ERROR "custom version field not used when computing git_tag value. ${tag} was found instead") endif() if(NOT exclude MATCHES "OFF") message(FATAL_ERROR "default value of exclude not found. ${exclude} was found instead") endif() if(CPM_DOWNLOAD_ALL) message(FATAL_ERROR "CPM_DOWNLOAD_ALL should be false by default when an override exists that doesn't modify url or tag") endif() rapids_cpm_package_details(rmm version repository tag shallow exclude) if(NOT repository MATCHES "new_rmm_url") message(FATAL_ERROR "custom url field was not used. ${repository} was found instead") endif() if(NOT shallow MATCHES "OFF") message(FATAL_ERROR "override should not change git_shallow value. ${shallow} was found instead") endif() if(NOT exclude MATCHES "ON") message(FATAL_ERROR "override should have changed exclude value. ${exclude} was found instead") endif() if(NOT CPM_DOWNLOAD_ALL) message(FATAL_ERROR "CPM_DOWNLOAD_ALL should be set to true when an override exists with a custom repository") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_package_override-multiple.cmake
#============================================================================= # Copyright (c) 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/package_override.cmake) rapids_cpm_init() # Load the default values for nvbench and GTest projects include("${rapids-cmake-dir}/cpm/detail/package_details.cmake") rapids_cpm_package_details(nvbench nvbench_version nvbench_repository nvbench_tag nvbench_shallow nvbench_exclude) rapids_cpm_package_details(GTest GTest_version GTest_repository GTest_tag GTest_shallow GTest_exclude) rapids_cpm_package_details(rmm rmm_version rmm_repository rmm_tag rmm_shallow rmm_exclude) # Need to write out an override file file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override1.json [=[ { "packages" : { "nvbench" : { "git_tag" : "my_tag" }, "GTest" : { "version" : "2.99" } } } ]=]) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override2.json [=[ { "packages" : { "rmm" : { "git_tag" : "new_rmm_tag" }, "GTest" : { "version" : "3.99" } } } ]=]) rapids_cpm_package_override(${CMAKE_CURRENT_BINARY_DIR}/override1.json) rapids_cpm_package_override(${CMAKE_CURRENT_BINARY_DIR}/override2.json) # Verify that the override works rapids_cpm_package_details(nvbench version repository tag shallow exclude) if(NOT version STREQUAL nvbench_version) message(FATAL_ERROR "default version field was removed.") endif() if(NOT repository STREQUAL nvbench_repository) message(FATAL_ERROR "default repository field was removed.") endif() if(NOT tag STREQUAL "my_tag") message(FATAL_ERROR "custom git_tag field was ignored. ${tag} found instead of my_url") endif() rapids_cpm_package_details(GTest version repository tag shallow exclude) if(NOT version STREQUAL "3.99") message(FATAL_ERROR "custom version field was removed. ${version} was found instead") endif() if(NOT tag MATCHES "3.99") message(FATAL_ERROR "custom version field not used when computing git_tag value. ${tag} was found instead") endif() rapids_cpm_package_details(rmm version repository tag shallow exclude) if(NOT tag MATCHES "new_rmm_tag") message(FATAL_ERROR "custom version field not used when computing git_tag value. ${tag} was found instead") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_gbench-simple.cmake
#============================================================================= # Copyright (c) 2022-2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/gbench.cmake) rapids_cpm_init() if(TARGET benchmark::benchmark) message(FATAL_ERROR "Expected benchmark::benchmark not to exist") endif() rapids_cpm_gbench() if(NOT TARGET benchmark::benchmark) message(FATAL_ERROR "Expected benchmark::benchmark target to exist") endif() # Make sure we can be called multiple times rapids_cpm_gbench()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_nvbench-export.cmake
#============================================================================= # Copyright (c) 2021-2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/nvbench.cmake) rapids_cpm_init() set(CMAKE_CUDA_ARCHITECTURES OFF) rapids_cpm_nvbench(BUILD_EXPORT_SET test) rapids_cpm_nvbench(BUILD_EXPORT_SET test2 INSTALL_EXPORT_SET test2) get_target_property(packages rapids_export_build_test PACKAGE_NAMES) if(NOT nvbench IN_LIST packages) message(FATAL_ERROR "rapids_cpm_nvbench failed to record nvbench needs to be exported") endif() get_target_property(packages rapids_export_build_test2 PACKAGE_NAMES) if(NOT nvbench IN_LIST packages) message(FATAL_ERROR "rapids_cpm_nvbench failed to record nvbench needs to be exported") endif() get_target_property(packages rapids_export_install_test2 PACKAGE_NAMES) if(NOT nvbench IN_LIST packages) message(FATAL_ERROR "rapids_cpm_nvbench failed to record nvbench needs to be exported") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_gtest-simple.cmake
#============================================================================= # Copyright (c) 2021-2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/gtest.cmake) rapids_cpm_init() if(TARGET GTest::gtest) message(FATAL_ERROR "Expected GTest::gtest not to exist") endif() rapids_cpm_gtest() set(targets_made GTest::gtest GTest::gmock GTest::gtest_main GTest::gmock_main) foreach(t IN LISTS targets_made) if(NOT TARGET ${t}) message(FATAL_ERROR "Expected ${t} target to exist") endif() endforeach() # Make sure we can be called multiple times rapids_cpm_gtest()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_proprietary-url-no-ctk-parsing.cmake
#============================================================================= # Copyright (c) 2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/package_override.cmake) include(${rapids-cmake-dir}/cpm/detail/get_proprietary_binary_url.cmake) include(${rapids-cmake-dir}/cpm/detail/package_details.cmake) rapids_cpm_init() # Need to write out an override file with a proprietary blob url file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json [=[ { "packages" : { "test_binary" : { "version" : "2.6.1", "proprietary_binary" : { "x86_64-linux" : "https://fake.url.com/x86_${version}.tgz", "aarch64-linux" : "https://fake.url.com/aarch_${version}.tgz", } } } } ]=]) rapids_cpm_package_override(${CMAKE_CURRENT_BINARY_DIR}/override.json) rapids_cpm_package_details(test_binary version repository tag shallow exclude) rapids_cpm_get_proprietary_binary_url(test_binary ${version} nvcomp_url) # Verify that we didn't go searching for the CUDAToolkit if(TARGET CUDA::cudart_static OR TARGET CUDA::cudart) message(FATAL_ERROR "test_binary didn't use the cuda toolkit placeholder, but searching for it still occurred") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_proprietary-url-ctk-version.cmake
#============================================================================= # Copyright (c) 2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/package_override.cmake) include(${rapids-cmake-dir}/cpm/detail/get_proprietary_binary_url.cmake) include(${rapids-cmake-dir}/cpm/detail/package_details.cmake) rapids_cpm_init() # Need to write out an override file with a proprietary blob url file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json [=[ { "packages" : { "test_binary" : { "version" : "2.6.1", "proprietary_binary" : { "x86_64-linux" : "https://fake.url.com/${version}/${cuda-toolkit-version}/x86_64_${cuda-toolkit-version-major}.tgz", "aarch64-linux" : "https://fake.url.com/${version}/${cuda-toolkit-version}/aarch64_${cuda-toolkit-version-major}.tgz", } } } } ]=]) rapids_cpm_package_override(${CMAKE_CURRENT_BINARY_DIR}/override.json) # Verify that the placeholders are evaluated correctly from `find_package(CUDAToolkit)` find_package(CUDAToolkit REQUIRED) rapids_cpm_package_details(test_binary version repository tag shallow exclude) rapids_cpm_get_proprietary_binary_url(test_binary ${version} url) set(CTK_VER ${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR}) set(CTK_VER_M ${CUDAToolkit_VERSION_MAJOR}) set(valid_url "https://fake.url.com/2.6.1/${CTK_VER}/${CMAKE_SYSTEM_PROCESSOR}_${CTK_VER_M}.tgz") if(NOT valid_url STREQUAL url) message(FATAL_ERROR "Expected: ${valid_url} got: ${url}") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_package_override-patches.cmake
#============================================================================= # Copyright (c) 2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/package_override.cmake) rapids_cpm_init() # Need to write out an override file file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json [=[ { "packages" : { "rmm" : { "patches" : [ { "file" : "rmm_patch_install_rules.diff", "issue" : "Fake install rule patch file", "fixed_in" : "39.99.0" } ] } } } ]=]) rapids_cpm_package_override(${CMAKE_CURRENT_BINARY_DIR}/override.json) # Verify that the override works include("${rapids-cmake-dir}/cpm/detail/package_details.cmake") rapids_cpm_package_details(rmm version repository tag shallow exclude) if(NOT CPM_DOWNLOAD_ALL) message(FATAL_ERROR "CPM_DOWNLOAD_ALL should be set to true when an override exists with a patches entry") endif()
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-add-pkg-source/CMakeLists.txt
#============================================================================= # Copyright (c) 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/find.cmake) cmake_minimum_required(VERSION 3.23.1) project(rapids-cpm-find-add-pkg-source LANGUAGES CXX) set(CPM_ZLIB_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/mock_zlib_source_dir") rapids_cpm_init() rapids_cpm_find(ZLIB 1.0) if (NOT TARGET MOCK_ZLIB) message(FATAL_ERROR "rapids_cpm_find failed to add ZLIB source dir ${CPM_ZLIB_SOURCE}") endif()
0
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-add-pkg-source
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-add-pkg-source/mock_zlib_source_dir/CMakeLists.txt
#============================================================================= # Copyright (c) 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. #============================================================================= cmake_minimum_required(VERSION 3.23.1) project(ZLIB LANGUAGES CXX) add_library(MOCK_ZLIB INTERFACE)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_thrust-verify-post-find-code/CMakeLists.txt
#============================================================================= # Copyright (c) 2023, 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. #============================================================================= cmake_minimum_required(VERSION 3.23.1) project(rapids-test-project LANGUAGES CXX) include(${rapids-cmake-dir}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/thrust.cmake) include(${rapids-cmake-dir}/export/export.cmake) set(CMAKE_INSTALL_LIBDIR "lib") rapids_cpm_init() rapids_cpm_thrust(NAMESPACE RapidsTest GLOBAL_TARGETS RapidsTest::Thrust INSTALL_EXPORT_SET example_export_set) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT example_export_set) target_link_libraries(fakeLib INTERFACE RapidsTest::Thrust) rapids_export(INSTALL fake EXPORT_SET example_export_set NAMESPACE test:: ) # Install our project so we can verify `thrust_create_target` is called # automatically in the export-set add_custom_target(install_project ALL COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --prefix install/fake/ ) # Add a custom command that verifies that the expect files have # been installed for each component file(WRITE "${CMAKE_BINARY_DIR}/install/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.20) project(verify_install_targets LANGUAGES CXX) set(computed_path "${CMAKE_CURRENT_SOURCE_DIR}/fake/lib/cmake/fake/") find_package(fake REQUIRED NO_DEFAULT_PATH HINTS ${computed_path}) if(NOT TARGET RapidsTest::Thrust) message(FATAL_ERROR "Failed to construct RapidsTest::Thrust target") endif() ]=]) add_custom_target(verify_install_thrust_works ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/install/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/install" -B="${CMAKE_BINARY_DIR}/install/build" ) add_dependencies(verify_install_thrust_works install_project)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-existing-target/CMakeLists.txt
#============================================================================= # Copyright (c) 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/find.cmake) cmake_minimum_required(VERSION 3.23.1) project(rapids-existing-target LANGUAGES CXX) include("${rapids-cmake-testing-dir}/cpm/make_fake_project_build_dir_with_config.cmake") make_fake_project_build_dir_with_config(RapidsTestFind 2021.01.02 RapidsTestFindConfig.cmake RapidsTestFindConfigVersion.cmake) rapids_cpm_init() set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/RapidsTestFind-build/" ) add_library(RapidsTest::RapidsTest IMPORTED INTERFACE) rapids_cpm_find(RapidsTestFind 2021.01.02 GLOBAL_TARGETS RapidsTest::RapidsTest)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-existing-target/RapidsTestFindConfig.cmake
#============================================================================= # Copyright (c) 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. #============================================================================= @PACKAGE_INIT@ include("${CMAKE_CURRENT_LIST_DIR}/RapidsTestFindConfigVersion.cmake") add_library(RapidsTest::RapidsTest IMPORTED INTERFACE GLOBAL) check_required_components(RapidsTest2)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-options-escaped/CMakeLists.txt
#============================================================================= # Copyright (c) 2021-2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/find.cmake) cmake_minimum_required(VERSION 3.23.1) project(rapids-test-project LANGUAGES CXX) rapids_cpm_init() rapids_cpm_find( RapidsTest 20.09.00 GLOBAL_TARGETS RapidsTest::RapidsTest BUILD_EXPORT_SET example_export_set CPM_ARGS DOWNLOAD_COMMAND "ls" #Fake comment OPTIONS "BUILD_TESTS TRUE" "BUILD_EXAMPLES FALSE" ) add_library(exampleLib INTERFACE) install(TARGETS exampleLib EXPORT example_export_set) include(${rapids-cmake-dir}/export/export.cmake) rapids_export(BUILD rapids-test-project EXPORT_SET example_export_set ) if(NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-test-project-dependencies.cmake") message(FATAL_ERROR "rapids_cpm_find(BUILD) failed to generate a CPM configuration") endif() # We need to validate that we propagate NAME, VERSION, and CPM ARGS properly to # the exported dependency file set(to_match_string [=["NAME;RapidsTest;VERSION;20.09.00;DOWNLOAD_COMMAND;ls;OPTIONS;BUILD_TESTS TRUE;BUILD_EXAMPLES FALSE"]=]) file(READ "${CMAKE_BINARY_DIR}/rapids-test-project-dependencies.cmake" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_cpm_find(BUILD) failed to preserve quotes around CPM arguments") endif()
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-options-escaped/rapidstest-config.cmake
#============================================================================= # Copyright (c) 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. #============================================================================= @PACKAGE_INIT@ cmake_minimum_required(VERSION 3.23.1) include("${CMAKE_CURRENT_LIST_DIR}/rapidstest-config-version.cmake") add_library(RapidsTest::RapidsTest IMPORTED INTERFACE GLOBAL) check_required_components(RapidsTest)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-and-find_package/CMakeLists.txt
#============================================================================= # Copyright (c) 2021-2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/find.cmake) cmake_minimum_required(VERSION 3.23.1) project(rapids-test-project LANGUAGES CXX) set(CPM_cucxx_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/mock_cucxx_source_dir") rapids_cpm_init() rapids_cpm_find(cucxx 1.0) # Should find CPM generated `Findcucxx.cmake` find_package(cucxx REQUIRED) set(expected_find_path "${CPM_MODULE_PATH}/Findcucxx.cmake") if(NOT EXISTS "${expected_find_path}") message(FATAL_ERROR "Findcucxx.cmake was not generated") endif() if(NOT TARGET MOCK_CUCXX) message(FATAL_ERROR "cucxx targets should be generated") endif()
0
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-and-find_package
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-and-find_package/mock_cucxx_source_dir/CMakeLists.txt
#============================================================================= # Copyright (c) 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. #============================================================================= cmake_minimum_required(VERSION 3.23.1) project(mock_cucxx LANGUAGES CXX) add_library(MOCK_CUCXX INTERFACE)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-existing-build-dir/CMakeLists.txt
#============================================================================= # Copyright (c) 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/find.cmake) cmake_minimum_required(VERSION 3.23.1) project(rapids-test-project LANGUAGES CXX) include("${rapids-cmake-testing-dir}/cpm/make_fake_project_build_dir_with_config.cmake") make_fake_project_build_dir_with_config(RapidsTestFind 2021.01.02 RapidsTestFindConfig.cmake RapidsTestFindConfigVersion.cmake) make_fake_project_build_dir_with_config(RapidsTestFind2 0.2 rapidstestfind2-config.cmake rapidstestfind2-config-version.cmake) rapids_cpm_init() set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/RapidsTestFind-build/" "${CMAKE_CURRENT_BINARY_DIR}/RapidsTestFind2-build/" ) rapids_cpm_find(RapidsTestFind 2021.01.02) rapids_cpm_find(RapidsTestFind2 0.2) if(NOT TARGET RapidsTest::RapidsTest) message(FATAL_ERROR "RapidsTest targets should be generated") endif() if(NOT TARGET RapidsTest2::RapidsTest) message(FATAL_ERROR "RapidsTest2 targets should be generated") endif()
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-existing-build-dir/RapidsTestFindConfig.cmake
#============================================================================= # Copyright (c) 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. #============================================================================= @PACKAGE_INIT@ include("${CMAKE_CURRENT_LIST_DIR}/RapidsTestFindConfigVersion.cmake") add_library(RapidsTest::RapidsTest IMPORTED INTERFACE GLOBAL) check_required_components(RapidsTest2)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-existing-build-dir/rapidstestfind2-config.cmake
#============================================================================= # Copyright (c) 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. #============================================================================= @PACKAGE_INIT@ include("${CMAKE_CURRENT_LIST_DIR}/rapidstestfind2-config-version.cmake") add_library(RapidsTest2::RapidsTest IMPORTED INTERFACE GLOBAL) check_required_components(RapidsTest2)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-restore-cpm-vars/CMakeLists.txt
#============================================================================= # Copyright (c) 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/find.cmake) cmake_minimum_required(VERSION 3.23.1) project(rapids-cpm-find-add-pkg-source LANGUAGES CXX) set(CPM_ZLIB_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/mock_zlib_source_dir") rapids_cpm_init() rapids_cpm_find(ZLIB 1.0) if (NOT TARGET MOCK_ZLIB) message(FATAL_ERROR "rapids_cpm_find failed to add ZLIB source dir ${CPM_ZLIB_SOURCE}") endif() if(NOT DEFINED ZLIB_SOURCE_DIR) message(FATAL_ERROR "rapids_cpm_find failed to construct ZLIB_SOURCE_DIR variable") endif() if(NOT DEFINED ZLIB_BINARY_DIR) message(FATAL_ERROR "rapids_cpm_find failed to construct ZLIB_BINARY_DIR variable") endif() if(NOT DEFINED ZLIB_ADDED) message(FATAL_ERROR "rapids_cpm_find failed to construct ZLIB_ADDED variable") endif() if(NOT ZLIB_ADDED) message(FATAL_ERROR "rapids_cpm_find failed to find local mock zlib") endif() set(old_source_dir ${ZLIB_SOURCE_DIR}) set(old_binary_dir ${ZLIB_BINARY_DIR}) unset(ZLIB_SOURCE_DIR) unset(ZLIB_BINARY_DIR) unset(ZLIB_ADDED) rapids_cpm_find(ZLIB 1.0) if(NOT DEFINED ZLIB_SOURCE_DIR) message(FATAL_ERROR "rapids_cpm_find failed to construct ZLIB_SOURCE_DIR variable") endif() if(NOT DEFINED ZLIB_BINARY_DIR) message(FATAL_ERROR "rapids_cpm_find failed to construct ZLIB_BINARY_DIR variable") endif() if(NOT DEFINED ZLIB_ADDED) message(FATAL_ERROR "rapids_cpm_find failed to construct ZLIB_ADDED variable") endif() if(NOT old_source_dir STREQUAL ZLIB_SOURCE_DIR) message(FATAL_ERROR "rapids_cpm_find failed to restore correct ZLIB_SOURCE_DIR path") endif() if(NOT old_binary_dir STREQUAL ZLIB_BINARY_DIR) message(FATAL_ERROR "rapids_cpm_find failed to restore correct ZLIB_BINARY_DIR path") endif() if(ZLIB_ADDED) message(FATAL_ERROR "rapids_cpm_find failed to restore correct ZLIB_ADDED state ( second call should be ZLIB_ADDED=false )") endif()
0
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-restore-cpm-vars
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-restore-cpm-vars/mock_zlib_source_dir/CMakeLists.txt
#============================================================================= # Copyright (c) 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. #============================================================================= cmake_minimum_required(VERSION 3.23.1) project(ZLIB LANGUAGES CXX VERSION 1.0) add_library(MOCK_ZLIB INTERFACE)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-components/CMakeLists.txt
#============================================================================= # Copyright (c) 2022-2023, 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}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/find.cmake) cmake_minimum_required(VERSION 3.23.1) project(rapids-test-project LANGUAGES CXX) set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}") rapids_cpm_init() rapids_cpm_find(FakeDependency 11 REQUIRED COMPONENTS A B C INSTALL_EXPORT_SET test_export_set BUILD_EXPORT_SET test_export_set ) if(NOT (TARGET FakeDependency::A AND TARGET FakeDependency::B AND TARGET FakeDependency::C) ) message(FATAL_ERROR "rapids_cpm_find() failed to propagate COMPONENT A B C") endif() set(to_match_string "COMPONENTS A B C") set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/cpm_FakeDependency.cmake") file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_cpm_find(BUILD) failed to preserve version information in exported file") endif() set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/install/package_FakeDependency.cmake") file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_cpm_find(INSTALL) failed to preserve version information in exported file") endif()
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-components/fakedependency-config.cmake
#============================================================================= # Copyright (c) 2022, 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. #============================================================================= cmake_minimum_required(VERSION 3.21) set(allowed_components A B C) foreach(comp IN LISTS FakeDependency_FIND_COMPONENTS) if(${comp} IN_LIST allowed_components) set(FakeDependency_${comp}_FOUND ON) add_library(FakeDependency::${comp} INTERFACE IMPORTED) else() string(APPEND _FAIL_REASON "component '${comp}' was requested, but not found. ") endif() endforeach() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(FakeDependency REASON_FAILURE_MESSAGE "${_FAIL_REASON}" HANDLE_COMPONENTS)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-components/fakedependency-config-version.cmake
#============================================================================= # Copyright (c) 2022, 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. #============================================================================= set(PACKAGE_VERSION "11") if(PACKAGE_FIND_VERSION_MAJOR STREQUAL PACKAGE_VERSION) set(PACKAGE_VERSION_COMPATIBLE TRUE) else() set(PACKAGE_VERSION_COMPATIBLE FALSE) endif() if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) set(PACKAGE_VERSION_EXACT TRUE) endif()
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_libcudacxx-verify-install-custom-libdir/CMakeLists.txt
#============================================================================= # Copyright (c) 2023, 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. #============================================================================= cmake_minimum_required(VERSION 3.20) include(${rapids-cmake-dir}/cpm/libcudacxx.cmake) include(${rapids-cmake-dir}/cpm/init.cmake) include(${rapids-cmake-dir}/export/export.cmake) project(fake LANGUAGES CXX VERSION 3.1.4) rapids_cpm_init() set(CMAKE_INSTALL_LIBDIR "lib/aarch64") rapids_cpm_libcudacxx(INSTALL_EXPORT_SET fake_set) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) target_link_libraries(fakeLib INTERFACE libcudacxx::libcudacxx) rapids_export(INSTALL fake EXPORT_SET fake_set NAMESPACE test:: ) # Install our project so we can verify `libcudacxx` can be found # from a custom install location add_custom_target(install_project ALL COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --prefix install/fake/ ) # Add a custom command that verifies that the expect files have # been installed for each component file(WRITE "${CMAKE_BINARY_DIR}/install/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.20) project(verify_install_targets LANGUAGES CXX) set(computed_path "${CMAKE_CURRENT_SOURCE_DIR}/fake/lib/aarch64/cmake/fake/") find_package(fake REQUIRED NO_DEFAULT_PATH HINTS ${computed_path}) if(NOT TARGET libcudacxx::libcudacxx) message(FATAL_ERROR "Failed to import libcudacxx dependency") endif() ]=]) add_custom_target(verify_install_libcudacxx_works ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/install/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/install" -B="${CMAKE_BINARY_DIR}/install/build" ) add_dependencies(verify_install_libcudacxx_works install_project)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-existing-target-to-export-sets/CMakeLists.txt
#============================================================================= # Copyright (c) 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. #============================================================================= cmake_minimum_required(VERSION 3.23.1) include(${rapids-cmake-dir}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/find.cmake) include(${rapids-cmake-dir}/export/write_dependencies.cmake) project(rapids-existing-target LANGUAGES CXX) include("${rapids-cmake-testing-dir}/cpm/make_fake_project_build_dir_with_config.cmake") make_fake_project_build_dir_with_config(RapidsTestFind 2021.01.02 RapidsTestFindConfig.cmake RapidsTestFindConfigVersion.cmake) rapids_cpm_init() set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/RapidsTestFind-build/" ) add_library(RapidsTest::RapidsTest IMPORTED INTERFACE) rapids_cpm_find(RapidsTestFind 2021.01.02 GLOBAL_TARGETS RapidsTest::RapidsTest INSTALL_EXPORT_SET setA) rapids_cpm_find(RapidsTestFind 2021.01.02 GLOBAL_TARGETS RapidsTest::RapidsTest INSTALL_EXPORT_SET setB) rapids_cpm_find(RapidsTestFind 2021.01.02 GLOBAL_TARGETS RapidsTest::RapidsTest BUILD_EXPORT_SET setB) function(verify_dependency_file file_name to_match) file(STRINGS "${file_name}" text) set(package_dependency_found FALSE) foreach(line IN LISTS text) if( line MATCHES ${to_match}) set(package_dependency_found TRUE) break() endif() endforeach() if(NOT package_dependency_found) message(FATAL_ERROR "${file_name} failed to export RapidsTestFind properly") endif() endfunction() set(file_path "${CMAKE_CURRENT_BINARY_DIR}/build_export_set.cmake") file(REMOVE "${file_path}") rapids_export_write_dependencies(build setB "${file_path}") verify_dependency_file("${file_path}" "[=[NAME;RapidsTestFind;VERSION;2021.01.02]=]") set(file_path "${CMAKE_CURRENT_BINARY_DIR}/install_export_setA.cmake") file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/install_export_setA.cmake") rapids_export_write_dependencies(build setB "${file_path}") verify_dependency_file("${file_path}" "[=[find_dependency(RapidsTestFind)]=]") set(file_path "${CMAKE_CURRENT_BINARY_DIR}/install_export_setB.cmake") file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/install_export_setB.cmake") rapids_export_write_dependencies(build setB "${file_path}") verify_dependency_file("${file_path}" "[=[find_dependency(RapidsTestFind)]=]")
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-existing-target-to-export-sets/RapidsTestFindConfig.cmake
#============================================================================= # Copyright (c) 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. #============================================================================= @PACKAGE_INIT@ include("${CMAKE_CURRENT_LIST_DIR}/RapidsTestFindConfigVersion.cmake") add_library(RapidsTest::RapidsTest IMPORTED INTERFACE GLOBAL) check_required_components(RapidsTest2)
0
rapidsai_public_repos/rapids-cmake/testing/cpm
rapidsai_public_repos/rapids-cmake/testing/cpm/cpm_find-gtest-no-gmock/CMakeLists.txt
#============================================================================= # Copyright (c) 2022, 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. #============================================================================= cmake_minimum_required(VERSION 3.23) project(rapids-cpm-find-gtest-no-gmock LANGUAGES CXX) include(${rapids-cmake-dir}/cpm/init.cmake) include(${rapids-cmake-dir}/cpm/gtest.cmake) set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/mock_installed_gtest") rapids_cpm_init() rapids_cpm_gtest() if (NOT TARGET GTest::gtest) message(FATAL_ERROR "rapids_cpm_find failed to add mocked gtest version") endif() if (TARGET GTest::gmock) message(FATAL_ERROR "rapids_cpm_find failed to add mocked gtest version") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/write_dependencies-duplicate-packages.cmake
#============================================================================= # Copyright (c) 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/package.cmake) include(${rapids-cmake-dir}/export/write_dependencies.cmake) rapids_export_package(BUILD ExactlyDuplicate test_set GLOBAL_TARGETS EDT::EDT) rapids_export_package(BUILD DifferingPkgNameDuplicateTargets test_set GLOBAL_TARGETS PST::PST) rapids_export_package(BUILD DifferingPkgNameV2DuplicateTargets test_set GLOBAL_TARGETS PST::PST) rapids_export_package(build ExactlyDuplicate test_set GLOBAL_TARGETS EDT::EDT) rapids_export_write_dependencies(build test_set "${CMAKE_CURRENT_BINARY_DIR}/export_set.cmake") # Parse the `export_set.cmake` file for correct number of `find_dependency` calls # and entries in `rapids_global_targets` file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/export_set.cmake" text) foreach(line IN LISTS text) # message(STATUS "1. line: ${line}") if( line MATCHES "find_dependency\\(ExactlyDuplicate\\)" ) if(NOT DEFINED duplicate_package_parsed ) set(duplicate_package_parsed TRUE) else() #We parsed a duplicate package message(FATAL_ERROR "Detected duplicate `find_dependency` calls for the same package") endif() endif() if( line MATCHES "set\\(rapids_global_targets" AND NOT line MATCHES "unset") # execute this line so we can check how many targets # exist cmake_language(EVAL CODE "${line}") if(NOT "PST::PST" IN_LIST rapids_global_targets) message(FATAL_ERROR "Missing item [PST::PST] from list of targets to promote to global") endif() if(NOT "EDT::EDT" IN_LIST rapids_global_targets) message(FATAL_ERROR "Missing item [EDT::EDT] from list of targets to promote to global") endif() list(LENGTH rapids_global_targets orig_len) list(REMOVE_DUPLICATES rapids_global_targets) list(LENGTH rapids_global_targets uniquify_len) if(NOT orig_len EQUAL uniquify_len) message(FATAL_ERROR "Duplicate entries found in targets to promote to global") endif() endif() endforeach()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-install-with-version.cmake
#============================================================================= # 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/package.cmake) rapids_export_package( build FAKE_PACKAGE test_export_set COMPONENTS 14.7.2) # Verify that package configuration files exist set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_FAKE_PACKAGE.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # verify that the expected COMPONENTS exists in FAKE_PACKAGE.cmake set(to_match_string [=[COMPONENTS 14.7.2)]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration with COMPONENTS") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/rapids-export.cmake
#============================================================================= # Copyright (c) 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}/rapids-export.cmake)
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-multiple-export_sets.cmake
#============================================================================= # Copyright (c) 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/package.cmake) rapids_export_package(BUILD DifferingExportSets export1 GLOBAL_TARGETS EDT::EDT) rapids_export_package(BUILD DifferingExportSets export2 GLOBAL_TARGETS EDT::EDT) # Verify that we have the package and targets listed in both export sets get_target_property(packages1 rapids_export_build_export1 PACKAGE_NAMES) get_target_property(packages2 rapids_export_build_export2 PACKAGE_NAMES) get_target_property(global_targets1 rapids_export_build_export1 GLOBAL_TARGETS) get_target_property(global_targets2 rapids_export_build_export2 GLOBAL_TARGETS) if(NOT packages1 STREQUAL packages2) message(FATAL_ERROR "rapids_export_package failed to record same package is in multiple export sets") endif() if(NOT global_targets1 STREQUAL global_targets2) message(FATAL_ERROR "rapids_export_package failed to record same target is in multiple export sets") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-explicit-version-all-zeros.cmake
#============================================================================= # Copyright (c) 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 08.06.04) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD test VERSION 0.00.000 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 0.0 REQUIRED) if(NOT TEST_VERSION STREQUAL "0.00.000") message(FATAL_ERROR "rapids_export failed to export version information") endif() if(NOT TEST_VERSION_MAJOR STREQUAL "0") message(FATAL_ERROR "rapids_export failed to export major version value") endif() if(NOT TEST_VERSION_MINOR STREQUAL "00") message(FATAL_ERROR "rapids_export failed to export minor version value") endif() if(NOT TEST_VERSION_PATCH STREQUAL "000") message(FATAL_ERROR "rapids_export failed to export patch version value") endif() find_package(test 0.0.0 EXACT REQUIRED) if(NOT TEST_VERSION STREQUAL "0.00.000") message(FATAL_ERROR "rapids_export failed to export version information") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/CMakeLists.txt
#============================================================================= # Copyright (c) 2021-2023, 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. #============================================================================= add_cmake_config_test( rapids-export.cmake ) add_cmake_config_test( export_cpm-build-possible-dir.cmake ) add_cmake_config_test( export_cpm-build.cmake ) add_cmake_config_test( export_cpm-install.cmake ) add_cmake_config_test( export_cpm-options-escaped.cmake ) add_cmake_build_test( export-verify-build-components-dependencies ) add_cmake_build_test( export-verify-build-components-targets ) add_cmake_build_test( export-verify-build-multiple-export-sets-to-single-component ) add_cmake_build_test( export-verify-build-namespaces ) add_cmake_build_test( export-verify-code-block ) add_cmake_build_test( export-verify-doc-string ) add_cmake_build_test( export-verify-global-targets ) add_cmake_build_test( export-verify-install-components ) add_cmake_build_test( export-verify-no-namespace ) add_cmake_config_test( export-verify-bad-code-block-var.cmake SHOULD_FAIL "FINAL_CODE_BLOCK variable `var_doesn't_exist` doesn't exist") add_cmake_config_test( export-verify-missing-components.cmake SHOULD_FAIL "is missing COMPONENTS as COMPONENTS_EXPORT_SET was provided") add_cmake_config_test( export-verify-missing-components-export.cmake SHOULD_FAIL "is missing COMPONENTS_EXPOR22T_SET as COMPONENTS was provided") add_cmake_config_test( export-verify-bad-doc-var.cmake SHOULD_FAIL "DOCUMENTATION variable `var_doesn't_exist` doesn't exist") add_cmake_config_test( export-verify-calendar-version-matching.cmake ) add_cmake_config_test( export-verify-explicit-disabled-version.cmake ) add_cmake_config_test( export-verify-explicit-major-version-only-matching.cmake ) add_cmake_config_test( export-verify-explicit-patch-version-value-of-zero.cmake ) add_cmake_config_test( export-verify-explicit-version-all-zeros.cmake ) add_cmake_config_test( export-verify-explicit-version-value.cmake ) add_cmake_config_test( export-verify-file-names.cmake ) add_cmake_config_test( export-verify-implicit-disabled-version.cmake ) add_cmake_config_test( export-verify-implicit-major-version-only-matching.cmake ) add_cmake_config_test( export-verify-version.cmake ) add_cmake_config_test( export_component-build ) add_cmake_config_test( export_package-build-possible-dir.cmake ) add_cmake_config_test( export_package-build-post-find-code.cmake ) add_cmake_config_test( export_package-build-with-components-and-version.cmake ) add_cmake_config_test( export_package-build-with-components.cmake ) add_cmake_config_test( export_package-build-with-empty-components.cmake ) add_cmake_config_test( export_package-build-with-version.cmake ) add_cmake_config_test( export_package-build.cmake ) add_cmake_config_test( export_package-install-possible-dir.cmake ) add_cmake_config_test( export_package-install-post-find-code.cmake ) add_cmake_config_test( export_package-install-with-components-and-version.cmake ) add_cmake_config_test( export_package-install-with-components.cmake ) add_cmake_config_test( export_package-install-with-version.cmake ) add_cmake_config_test( export_package-install.cmake ) add_cmake_config_test( export_package-multiple-export_sets.cmake ) add_cmake_config_test( write_dependencies-cpm-preserve-options.cmake ) add_cmake_config_test( write_dependencies-duplicate-cpm.cmake ) add_cmake_config_test( write_dependencies-duplicate-packages.cmake ) add_cmake_config_test( write_dependencies-duplicate-cpm-and-package.cmake ) add_cmake_config_test( write_dependencies-multiple-directories ) add_cmake_config_test( write_dependencies-root-dirs.cmake ) add_cmake_build_test( write_language-multiple-nested-enables ) add_cmake_build_test( write_language-nested-dirs ) set(deprecated_message [=[rapids-cmake policy [deprecated=23.12 removed=24.02]: Usage of ]=]) add_cmake_config_test( find_package_file-deprecated.cmake SHOULD_FAIL "${deprecated_message}") add_cmake_config_test( find_package_root-deprecated.cmake SHOULD_FAIL "${deprecated_message}")
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_cpm-install.cmake
#============================================================================= # Copyright (c) 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) rapids_export_cpm( INSTALL RaFT fake_set CPM_ARGS FAKE_PACKAGE_ARGS TRUE ) rapids_export_cpm( install RMM fake_set CPM_ARGS VERSION 2.0 FAKE_PACKAGE_ARGS FALSE GLOBAL_TARGETS RMM::RMM_POOL ) if(NOT TARGET rapids_export_install_fake_set) message(FATAL_ERROR "rapids_export_cpm failed to generate target for install") endif() # Verify that we encoded both packages for exporting get_target_property(packages rapids_export_install_fake_set PACKAGE_NAMES) if(NOT RaFT IN_LIST packages) message(FATAL_ERROR "rapids_export_cpm failed to record RaFT needs to be exported") endif() if(NOT RMM IN_LIST packages) message(FATAL_ERROR "rapids_export_cpm failed to record RMM needs to be exported") endif() # Verify that we encoded what `targets` are marked as global export get_target_property( global_targets rapids_export_install_fake_set GLOBAL_TARGETS) if( NOT "RMM::RMM_POOL" IN_LIST global_targets) message(FATAL_ERROR "rapids_export_cpm failed to record RMM::RMM_POOL needs to be global") endif() # Verify that CPM property is set get_target_property( requires_cpm rapids_export_install_fake_set REQUIRES_CPM) if( NOT requires_cpm) message(FATAL_ERROR "rapids_export_cpm failed to record that CPM is required by the export set") endif() # Verify that cpm configuration files exist if(NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/fake_set/install/cpm_RaFT.cmake" OR NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/fake_set/install/cpm_RMM.cmake") message(FATAL_ERROR "rapids_export_cpm failed to generate a CPM configuration") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-implicit-disabled-version.cmake
#============================================================================= # Copyright (c) 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) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD test 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()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/write_dependencies-cpm-preserve-options.cmake
#============================================================================= # Copyright (c) 2021-2023, 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/write_dependencies.cmake) rapids_export_cpm( INSTALL RMM test_set CPM_ARGS NAME RMM VERSION 2.0 OPTIONS "FAKE_PACKAGE_ARGS FALSE" GLOBAL_TARGETS RMM::RMM_POOL ) rapids_export_write_dependencies(install test_set "${CMAKE_CURRENT_BINARY_DIR}/export_set.cmake") # Parse the `export_set.cmake` file for correct escaped args to `CPMFindPackage` calls set(to_match_string [=["NAME;RMM;VERSION;2.0;OPTIONS;FAKE_PACKAGE_ARGS FALSE"]=]) file(READ "${CMAKE_CURRENT_BINARY_DIR}/export_set.cmake" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_write_dependencies(BUILD) failed to preserve quotes around CPM arguments") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-build-possible-dir.cmake
#============================================================================= # 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/package.cmake) # Verify valid dir is picked up set(FAKE_PACKAGE_DIR "/valid/looking/path") rapids_export_package( build FAKE_PACKAGE test_export_set) # Verify that package configuration files exist set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_FAKE_PACKAGE.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # verify that the expected path exists in FAKE_PACKAGE.cmake set(to_match_string [=[set(possible_package_dir "/valid/looking/path")]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # Verify in-valid dir is ignored set(also_fake_package_DIR OFF) rapids_export_package( BUILD also_fake_package test_export_set) set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_also_fake_package.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # verify that the expected path exists in also_fake_package.cmake set(to_match_string [=[set(possible_package_dir "")]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package(BUILD) failed to write out the possible_package_dir") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/write_dependencies-duplicate-cpm-and-package.cmake
#============================================================================= # Copyright (c) 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/package.cmake) include(${rapids-cmake-dir}/export/write_dependencies.cmake) rapids_export_cpm( INSTALL RMM test_set CPM_ARGS RMM VERSION 2.0 FAKE_PACKAGE_ARGS FALSE GLOBAL_TARGETS RMM::RMM_POOL ) rapids_export_package(install RMM test_set) rapids_export_package(install ZLIB test_set) rapids_export_package(install PNG test_set) rapids_export_write_dependencies(install test_set "${CMAKE_CURRENT_BINARY_DIR}/export_set.cmake") # Parse the `export_set.cmake` file for correct number of `CPMFindPackage` calls # and entries in `rapids_global_targets` file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/export_set.cmake" text) set(cpm_command_count 0) set(find_dependency_command_count 0) foreach(line IN LISTS text) # message(STATUS "1. line: ${line}") if( line MATCHES "CPMFindPackage" ) math(EXPR cpm_command_count "${cpm_command_count} + 1") elseif(line MATCHES "find_dependency") math(EXPR find_dependency_command_count "${find_dependency_command_count} + 1") endif() endforeach() if(NOT cpm_command_count EQUAL 1) message(FATAL_ERROR "Incorrect number of CPMFindPackage entries found. Expected 1, counted ${cpm_command_count}") endif() if(NOT find_dependency_command_count EQUAL 2) message(FATAL_ERROR "Incorrect number of find_dependency entries found. Expected 2, counted ${find_dependency_command_count}") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-explicit-disabled-version.cmake
#============================================================================= # Copyright (c) 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()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-calendar-version-matching.cmake
#============================================================================= # Copyright (c) 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 21.09.03) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD test 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() set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) find_package(test 21.09.01 REQUIRED) message(STATUS "TEST_VERSION ${TEST_VERSION}") message(STATUS "TEST_VERSION_VALUES ${TEST_VERSION_MAJOR}.${TEST_VERSION_MINOR}") if(NOT TEST_VERSION VERSION_EQUAL 21.09.03) message(FATAL_ERROR "rapids_export failed to export version information") endif() if(NOT "${TEST_VERSION_MAJOR}.${TEST_VERSION_MINOR}" VERSION_EQUAL 21.09) message(FATAL_ERROR "rapids_export failed to export version major/minor information") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/find_package_root-deprecated.cmake
#============================================================================= # Copyright (c) 2023, 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/find_package_root.cmake) project(rapids-project LANGUAGES CUDA) set(CMAKE_ERROR_DEPRECATED ON) rapids_export_find_package_root(BUILD RMM [=[${CMAKE_CURRENT_LIST_DIR}/fake/build/path]=] test_set)
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/write_dependencies-root-dirs.cmake
#============================================================================= # Copyright (c) 2021-2023, 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/find_package_root.cmake) include(${rapids-cmake-dir}/export/write_dependencies.cmake) rapids_export_find_package_root(BUILD RMM [=[${CMAKE_CURRENT_LIST_DIR}/fake/build/path]=] EXPORT_SET test_set) rapids_export_write_dependencies(build test_set "${CMAKE_CURRENT_BINARY_DIR}/build_export_set.cmake") rapids_export_find_package_root(BUILD RMM "/bad/install/path" EXPORT_SET ${unknown_var}) #ignored rapids_export_find_package_root(BUILD RMM "/bad/install/path2" EXPORT_SET test_set CONDITION unknown_var) #ignored # Parse the `build_export_set.cmake` file for correct escaped args # to `rapids_export_find_package_root` calls set(build_to_match_string [=[set(RMM_ROOT "${CMAKE_CURRENT_LIST_DIR}/fake/build/path"]=]) file(READ "${CMAKE_CURRENT_BINARY_DIR}/build_export_set.cmake" contents) string(FIND "${contents}" "${build_to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_write_dependencies(BUILD) failed to preserve variables in the directory path to rapids_export_find_package_root") endif() rapids_export_find_package_root(install RMM "/first/install/path" EXPORT_SET test_set) rapids_export_find_package_root(INSTALL RMM "/second/install/path" EXPORT_SET test_set) set(to_install FALSE) rapids_export_find_package_root(INSTALL RMM "/bad/install/path" EXPORT_SET test_set CONDITION to_install) #ignored rapids_export_find_package_root(install PKG2 "/pkg2/install/path" EXPORT_SET test_set) rapids_export_write_dependencies(INSTALL test_set "${CMAKE_CURRENT_BINARY_DIR}/install_export_set.cmake") set(install_to_match_string_1 [=[set(RMM_ROOT "/first/install/path;/second/install/path"]=]) set(install_to_match_string_2 [=[set(PKG2_ROOT "/pkg2/install/path"]=]) file(READ "${CMAKE_CURRENT_BINARY_DIR}/install_export_set.cmake" contents) string(FIND "${contents}" "${install_to_match_string_1}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_write_dependencies(INSTALL) failed to record all RMM_ROOT rapids_export_find_package_root commands") endif() string(FIND "${contents}" "${install_to_match_string_2}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_write_dependencies(INSTALL) failed to record all PKG2 rapids_export_find_package_root commands") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-build-with-empty-components.cmake
#============================================================================= # Copyright (c) 2018-2023, 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/package.cmake) rapids_export_package( build FAKE_PACKAGE test_export_set COMPONENTS) # Verify that package configuration files exist set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_FAKE_PACKAGE.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # verify that `COMPONENTS` isn't in FAKE_PACKAGE.cmake set(to_match_string [=[COMPONENTS)]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(NOT is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package generated a find_package configuration with COMPONENTS") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_cpm-options-escaped.cmake
#============================================================================= # Copyright (c) 2021-2023, 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) rapids_export_cpm( build FAKE_CPM_PACKAGE test_export_set CPM_ARGS NAME FAKE_CPM_PACKAGE VERSION 1.0 OPTIONS "FAKE_PACKAGE_OPTION_A TRUE" "FAKE_PACKAGE_OPTION_B FALSE" ) rapids_export_cpm( install FAKE_CPM_PACKAGE test_export_set CPM_ARGS NAME FAKE_CPM_PACKAGE VERSION 1.0 OPTIONS "FAKE_PACKAGE_OPTION_A TRUE" "FAKE_PACKAGE_OPTION_B FALSE" ) if(NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/cpm_FAKE_CPM_PACKAGE.cmake") message(FATAL_ERROR "rapids_export_cpm(BUILD) failed to generate a CPM configuration") endif() if(NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/install/cpm_FAKE_CPM_PACKAGE.cmake") message(FATAL_ERROR "rapids_export_cpm(INSTALL) failed to generate a CPM configuration") endif() # We need to validate both of the files all CPM args in quotes # set(to_match_string [=["NAME;FAKE_CPM_PACKAGE;VERSION;1.0;OPTIONS;FAKE_PACKAGE_OPTION_A TRUE;FAKE_PACKAGE_OPTION_B FALSE"]=]) file(READ "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/cpm_FAKE_CPM_PACKAGE.cmake" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_cpm(BUILD) failed to preserve quotes around CPM arguments") endif() file(READ "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/install/cpm_FAKE_CPM_PACKAGE.cmake" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_cpm(INSTALL) failed to preserve quotes around CPM arguments") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-explicit-version-value.cmake
#============================================================================= # Copyright (c) 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 08.06.04) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD test VERSION 21.09.03 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 21.09.01 REQUIRED) if(NOT TEST_VERSION STREQUAL "21.09.03") message(FATAL_ERROR "rapids_export failed to export version information") endif() if(NOT TEST_VERSION_MAJOR STREQUAL "21") message(FATAL_ERROR "rapids_export failed to export major version value") endif() if(NOT TEST_VERSION_MINOR STREQUAL "09") message(FATAL_ERROR "rapids_export failed to export minor version value") endif() if(NOT TEST_VERSION_PATCH STREQUAL "03") message(FATAL_ERROR "rapids_export failed to export patch version value") endif() if(NOT "${TEST_VERSION_MAJOR}.${TEST_VERSION_MINOR}" VERSION_EQUAL 21.09) message(FATAL_ERROR "rapids_export failed to export version major/minor information") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-build-with-components.cmake
#============================================================================= # Copyright (c) 2018-2023, 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/package.cmake) rapids_export_package( build FAKE_PACKAGE test_export_set COMPONENTS comp1 comp2 comp3) # Verify that package configuration files exist set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_FAKE_PACKAGE.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # verify that the expected components is in FAKE_PACKAGE.cmake set(to_match_string [=[COMPONENTS comp1;comp2;comp3)]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration with COMPONENTS") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-missing-components.cmake
#============================================================================= # Copyright (c) 2023, 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/export.cmake) cmake_minimum_required(VERSION 3.20) project(FakEProJecT LANGUAGES CXX VERSION 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) add_library(fakeLib_c1 INTERFACE) install(TARGETS fakeLib_c1 EXPORT fake_set_c1) rapids_export(BUILD FakEProJecT EXPORT_SET fake_set COMPONENTS_EXPORT_SET fake_set_c1 NAMESPACE test:: )
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-install-post-find-code.cmake
#============================================================================= # Copyright (c) 2023, 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/package.cmake) include(${rapids-cmake-dir}/export/detail/post_find_package_code.cmake) rapids_export_package(INSTALL FAKE_PACKAGE test_export_set VERSION 22.08) rapids_export_post_find_package_code(INSTALL FAKE_PACKAGE "set(a ON)" EXPORT_SET test_export_set) get_target_property(install_code rapids_export_install_test_export_set FAKE_PACKAGE_POST_FIND_CODE) cmake_language(EVAL CODE "${install_code}") if(NOT a) message(FATAL_ERROR "rapids_export_post_find_package_code failed to record first call") endif() include(${rapids-cmake-dir}/export/write_dependencies.cmake) rapids_export_write_dependencies(INSTALL test_export_set "${CMAKE_CURRENT_BINARY_DIR}/install_export_set.cmake") set(to_match [=[if(FAKE_PACKAGE_FOUND)_set(a ON)__endif()]=]) file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/install_export_set.cmake" contents NEWLINE_CONSUME) string(REPLACE "\n" "_" contents "${contents}") string(FIND "${contents}" "${to_match}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_write_dependencies(INSTALL) failed to record rapids_export_post_find_package_code") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-install-with-components.cmake
#============================================================================= # 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/package.cmake) rapids_export_package( build FAKE_PACKAGE test_export_set VERSION 14.7.2) # Verify that package configuration files exist set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_FAKE_PACKAGE.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # verify that the expected version exists in FAKE_PACKAGE.cmake set(to_match_string [=[14.7.2 QUIET)]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration with version") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_cpm-build.cmake
#============================================================================= # Copyright (c) 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) rapids_export_cpm( build FAKE_CPM_PACKAGE test_export_set CPM_ARGS FAKE_PACKAGE_ARGS TRUE ) rapids_export_cpm( BUILD SECOND_FAKE_CPM_PACKAGE test_export_set CPM_ARGS VERSION 2.0 GLOBAL_TARGETS ABC::ABC ABC::CBA ) if(NOT TARGET rapids_export_build_test_export_set) message(FATAL_ERROR "rapids_export_cpm failed to generate target for build") endif() # Verify that we encoded both packages for exporting get_target_property(packages rapids_export_build_test_export_set PACKAGE_NAMES) if(NOT FAKE_CPM_PACKAGE IN_LIST packages) message(FATAL_ERROR "rapids_export_cpm failed to record FAKE_CPM_PACKAGE needs to be exported") endif() if(NOT SECOND_FAKE_CPM_PACKAGE IN_LIST packages) message(FATAL_ERROR "rapids_export_cpm failed to record SECOND_FAKE_CPM_PACKAGE needs to be exported") endif() # Verify that we encoded what `targets` are marked as global export get_target_property( global_targets rapids_export_build_test_export_set GLOBAL_TARGETS) if( NOT "ABC::ABC" IN_LIST global_targets) message(FATAL_ERROR "rapids_export_cpm failed to record ABC::ABC needs to be global") endif() if( NOT "ABC::CBA" IN_LIST global_targets) message(FATAL_ERROR "rapids_export_cpm failed to record ABC::CBA needs to be global") endif() # Verify that CPM property is set get_target_property( requires_cpm rapids_export_build_test_export_set REQUIRES_CPM) if( NOT requires_cpm) message(FATAL_ERROR "rapids_export_cpm failed to record that CPM is required by the export set") endif() # Verify that cpm configuration files exist if(NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/cpm_FAKE_CPM_PACKAGE.cmake" OR NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/cpm_SECOND_FAKE_CPM_PACKAGE.cmake") message(FATAL_ERROR "rapids_export_cpm failed to generate a CPM configuration") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_cpm-build-possible-dir.cmake
#============================================================================= # Copyright (c) 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) # Verify valid dir is picked up set(FAKE_CPM_PACKAGE_DIR "/valid/looking/path") rapids_export_cpm( build FAKE_CPM_PACKAGE test_export_set CPM_ARGS FAKE_PACKAGE_ARGS TRUE ) # Verify that cpm configuration files exist set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/cpm_FAKE_CPM_PACKAGE.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_cpm failed to generate a CPM configuration") endif() # verify that the expected path exists in FAKE_CPM_PACKAGE.cmake set(to_match_string [=[set(possible_package_dir "/valid/looking/path")]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_cpm(BUILD) failed to write out the possible_package_dir") endif() # Verify in-valid dir is ignored set(also_fake_cpm_package_DIR OFF) set(also_fake_cpm_package_BINARY_DIR /binary/dir/path/) rapids_export_cpm( BUILD also_fake_cpm_package test_export_set CPM_ARGS VERSION 2.0 GLOBAL_TARGETS ABC::ABC ABC::CBA ) set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/cpm_also_fake_cpm_package.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_cpm failed to generate a CPM configuration") endif() # verify that the expected path exists in also_fake_cpm_package.cmake set(to_match_string [=[set(possible_package_dir "/binary/dir/path/")]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_cpm(BUILD) failed to write out the possible_package_dir") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-build-with-components-and-version.cmake
#============================================================================= # Copyright (c) 2018-2023, 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/package.cmake) rapids_export_package( build FAKE_PACKAGE test_export_set VERSION 22.08 COMPONENTS comp1) # Verify that package configuration files exist set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_FAKE_PACKAGE.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # verify that the expected version is in FAKE_PACKAGE.cmake set(to_match_string [=[22.08 QUIET]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration with version") endif() # verify that the expected components is in FAKE_PACKAGE.cmake set(to_match_string [=[COMPONENTS comp1)]=]) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration with COMPONENTS") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/find_package_file-deprecated.cmake
#============================================================================= # Copyright (c) 2023, 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/find_package_file.cmake) project(rapids-project LANGUAGES CUDA) set(CMAKE_ERROR_DEPRECATED ON) rapids_export_find_package_file(BUILD [=[${CMAKE_CURRENT_LIST_DIR}/fake/build/path]=] test_set)
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-build-with-version.cmake
#============================================================================= # Copyright (c) 2018-2023, 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/package.cmake) rapids_export_package( build FAKE_PACKAGE test_export_set VERSION 22.08) # Verify that package configuration files exist set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_FAKE_PACKAGE.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # verify that the expected version is in FAKE_PACKAGE.cmake set(to_match_string [=[22.08 QUIET)]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration with version") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-explicit-major-version-only-matching.cmake
#============================================================================= # Copyright (c) 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()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-install.cmake
#============================================================================= # Copyright (c) 2021-2023, 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/package.cmake) rapids_export_package(install ZLIB test_export_set GLOBAL_TARGETS ZLIB::ZLIB ) if(NOT TARGET rapids_export_install_test_export_set) message(FATAL_ERROR "rapids_export_package failed to generate target for install") endif() rapids_export_package(INSTALL PNG test_export_set GLOBAL_TARGETS PNG::PNG_V2 ) # Verify that we encoded both packages for exporting get_target_property(packages rapids_export_install_test_export_set PACKAGE_NAMES) if(NOT ZLIB IN_LIST packages) message(FATAL_ERROR "rapids_export_package failed to record ZLIB needs to be exported") endif() if(NOT PNG IN_LIST packages) message(FATAL_ERROR "rapids_export_package failed to record PNG needs to be exported") endif() # Verify that we encoded what `targets` are marked as global export get_target_property( global_targets rapids_export_install_test_export_set GLOBAL_TARGETS) if( NOT "ZLIB::ZLIB" IN_LIST global_targets) message(FATAL_ERROR "rapids_export_package failed to record ZLIB::ZLIB needs to be global") endif() if( NOT "PNG::PNG_V2" IN_LIST global_targets) message(FATAL_ERROR "rapids_export_package failed to record PNG::PNG_V2 needs to be global") endif() # Verify that temp install package configuration files exist if(NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/install/package_ZLIB.cmake" OR NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/install/package_PNG.cmake") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # Verify that temp build package configuration files don't exist if(EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_ZLIB.cmake" OR EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_PNG.cmake") message(FATAL_ERROR "rapids_export_package(INSTALL) generated temp files in the wrong directory") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-bad-code-block-var.cmake
#============================================================================= # Copyright (c) 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 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD test EXPORT_SET fake_set LANGUAGES CXX FINAL_CODE_BLOCK var_doesn't_exist )
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-explicit-patch-version-value-of-zero.cmake
#============================================================================= # Copyright (c) 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 08.06.04) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD test VERSION 21.09.0 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 21.9 REQUIRED) if(NOT TEST_VERSION STREQUAL "21.09.0") message(FATAL_ERROR "rapids_export failed to export version information") endif() if(NOT TEST_VERSION_MAJOR STREQUAL "21") message(FATAL_ERROR "rapids_export failed to export major version value") endif() if(NOT TEST_VERSION_MINOR STREQUAL "09") message(FATAL_ERROR "rapids_export failed to export minor version value") endif() if(NOT TEST_VERSION_PATCH STREQUAL "0") message(FATAL_ERROR "rapids_export failed to export patch version value") endif() if(NOT "${TEST_VERSION_MAJOR}.${TEST_VERSION_MINOR}" VERSION_EQUAL 21.09) message(FATAL_ERROR "rapids_export failed to export version major/minor information") endif() find_package(test 21.09.0 EXACT REQUIRED) if(NOT TEST_VERSION STREQUAL "21.09.0") message(FATAL_ERROR "rapids_export failed to export version information") endif() if(NOT TEST_VERSION_MAJOR STREQUAL "21") message(FATAL_ERROR "rapids_export failed to export major version value") endif() if(NOT TEST_VERSION_MINOR STREQUAL "09") message(FATAL_ERROR "rapids_export failed to export minor version value") endif() if(NOT TEST_VERSION_PATCH STREQUAL "0") message(FATAL_ERROR "rapids_export failed to export patch version value") endif() if(NOT "${TEST_VERSION_MAJOR}.${TEST_VERSION_MINOR}" VERSION_EQUAL 21.09) message(FATAL_ERROR "rapids_export failed to export version major/minor information") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-build-post-find-code.cmake
#============================================================================= # Copyright (c) 2023, 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/package.cmake) include(${rapids-cmake-dir}/export/detail/post_find_package_code.cmake) rapids_export_package( BUILD FAKE_PACKAGE test_export_set VERSION 22.08) rapids_export_post_find_package_code( BUILD FAKE_PACKAGE "set(a ON)" EXPORT_SET test_export_set) rapids_export_post_find_package_code( bUILd FAKE_PACKAGE [=[ set(b ON) set(c ON)]=] EXPORT_SET test_export_set) rapids_export_post_find_package_code(build FAKE_PACKAGE "set(d ON);set(e ON)" EXPORT_SET test_export_set) include(${rapids-cmake-dir}/export/write_dependencies.cmake) rapids_export_write_dependencies(BUILD test_export_set "${CMAKE_CURRENT_BINARY_DIR}/install_export_set.cmake") set(to_match [=[if(FAKE_PACKAGE_FOUND)_set(a ON)_set(b ON)_set(c ON)_set(d ON)_set(e ON)__endif()]=]) file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/install_export_set.cmake" contents NEWLINE_CONSUME) string(REPLACE "\n" "_" contents "${contents}") string(FIND "${contents}" "${to_match}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_write_dependencies(BUILD) failed to record rapids_export_post_find_package_code") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-bad-doc-var.cmake
#============================================================================= # Copyright (c) 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 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD test EXPORT_SET fake_set LANGUAGES CXX DOCUMENTATION var_doesn't_exist )
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-install-with-components-and-version.cmake
#============================================================================= # 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/package.cmake) rapids_export_package( build FAKE_PACKAGE test_export_set VERSION 14.7.2 COMPONENTS abc def) # Verify that package configuration files exist set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_FAKE_PACKAGE.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # verify that the expected version exists in FAKE_PACKAGE.cmake set(to_match_string [=[14.7.2 QUIET]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration with version") endif() # verify that the expected components is in FAKE_PACKAGE.cmake set(to_match_string [=[COMPONENTS abc;def)]=]) string(FIND "${contents}" "${to_match_string}" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration with COMPONENTS") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-file-names.cmake
#============================================================================= # Copyright (c) 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(FakEProJecT LANGUAGES CXX VERSION 3.1.4) rapids_export_cpm(BUILD RaFT fake_set CPM_ARGS FAKE_PACKAGE_ARGS TRUE ) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD FakEProJecT EXPORT_SET fake_set LANGUAGES CXX ) # Verify that build files have correct names if(NOT EXISTS "${CMAKE_BINARY_DIR}/fakeproject-config.cmake") message(FATAL_ERROR "rapids_export failed to generate correct config file name") endif() if(NOT EXISTS "${CMAKE_BINARY_DIR}/fakeproject-config-version.cmake") message(FATAL_ERROR "rapids_export failed to generate correct config-version file name") endif() if(NOT EXISTS "${CMAKE_BINARY_DIR}/fakeproject-dependencies.cmake") message(FATAL_ERROR "rapids_export failed to generate correct dependencies file name") endif() if(NOT EXISTS "${CMAKE_BINARY_DIR}/fakeproject-CXX-language.cmake") message(FATAL_ERROR "rapids_export failed to generate correct language file name") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-missing-components-export.cmake
#============================================================================= # Copyright (c) 2023, 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/export.cmake) cmake_minimum_required(VERSION 3.20) project(FakEProJecT LANGUAGES CXX VERSION 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) add_library(fakeLib_c1 INTERFACE) install(TARGETS fakeLib_c1 EXPORT fake_set_c1) rapids_export(BUILD FakEProJecT EXPORT_SET fake_set COMPONENTS c1 NAMESPACE test:: )
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-implicit-major-version-only-matching.cmake
#============================================================================= # Copyright (c) 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) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD test 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()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-version.cmake
#============================================================================= # Copyright (c) 2021-2023, 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 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD test 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() unset(TEST_VERSION) unset(TEST_VERSION_MAJOR) unset(TEST_VERSION_MINOR) set(CMAKE_FIND_PACKAGE_NAME test) # Emulate `find_package` include("${CMAKE_BINARY_DIR}/test-config.cmake") if(NOT TEST_VERSION VERSION_EQUAL 3.1.4) message(FATAL_ERROR "rapids_export failed to export version information") endif() if(NOT "${TEST_VERSION_MAJOR}.${TEST_VERSION_MINOR}" VERSION_EQUAL 3.1) message(FATAL_ERROR "rapids_export failed to export version major/minor information") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-build.cmake
#============================================================================= # Copyright (c) 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/package.cmake) rapids_export_package(BUILD ZLIB test_export_set GLOBAL_TARGETS ZLIB::ZLIB) rapids_export_package(build PNG test_export_set ) if(NOT TARGET rapids_export_build_test_export_set) message(FATAL_ERROR "rapids_export_package failed to generate target for build") endif() # Verify that we encoded both packages for exporting get_target_property(packages rapids_export_build_test_export_set PACKAGE_NAMES) if(NOT ZLIB IN_LIST packages) message(FATAL_ERROR "rapids_export_package failed to record ZLIB needs to be exported") endif() if(NOT PNG IN_LIST packages) message(FATAL_ERROR "rapids_export_package failed to record PNG needs to be exported") endif() # Verify that we encoded what `targets` are marked as global export get_target_property( global_targets rapids_export_build_test_export_set GLOBAL_TARGETS) if( NOT "ZLIB::ZLIB" IN_LIST global_targets) message(FATAL_ERROR "rapids_export_package failed to record ZLIB::ZLIB needs to be global") endif() # Verify that temp package configuration files exist if(NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_ZLIB.cmake" OR NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/package_PNG.cmake") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/write_dependencies-duplicate-cpm.cmake
#============================================================================= # Copyright (c) 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/write_dependencies.cmake) rapids_export_cpm( INSTALL RMM test_set CPM_ARGS VERSION 2.0 FAKE_PACKAGE_ARGS FALSE GLOBAL_TARGETS RMM::RMM_POOL ) rapids_export_cpm( INSTALL Thrust test_set CPM_ARGS VERSION 12.0 GLOBAL_TARGETS Thrust::Thrust ) rapids_export_cpm( INSTALL RMM test_set CPM_ARGS VERSION 2.0 FAKE_PACKAGE_ARGS FALSE GLOBAL_TARGETS RMM::RMM ) rapids_export_write_dependencies(install test_set "${CMAKE_CURRENT_BINARY_DIR}/export_set.cmake") # Parse the `export_set.cmake` file for correct number of `CPMFindPackage` calls # and entries in `rapids_global_targets` file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/export_set.cmake" text) set(find_package_count 0) foreach(line IN LISTS text) # message(STATUS "1. line: ${line}") if( line MATCHES "CPMFindPackage" ) math(EXPR find_package_count "${find_package_count} + 1") endif() if( line MATCHES "set\\(rapids_global_targets" AND NOT line MATCHES "unset") # execute this line so we can check how many targets # exist cmake_language(EVAL CODE "${line}") if(NOT "RMM::RMM" IN_LIST rapids_global_targets) message(FATAL_ERROR "Missing item [RMM::RMM] from list of targets to promote to global") endif() if(NOT "RMM::RMM_POOL" IN_LIST rapids_global_targets) message(FATAL_ERROR "Missing item [RMM::RMM_POOL] from list of targets to promote to global") endif() list(LENGTH rapids_global_targets orig_len) list(REMOVE_DUPLICATES rapids_global_targets) list(LENGTH rapids_global_targets uniquify_len) if(NOT orig_len EQUAL uniquify_len) message(FATAL_ERROR "Duplicate entries found in targets to promote to global") endif() endif() endforeach() if(NOT find_package_count EQUAL 2) message(FATAL_ERROR "Too many CPMFindPackage entries found. Expected 2, counted ${find_package_count}") endif()
0
rapidsai_public_repos/rapids-cmake/testing
rapidsai_public_repos/rapids-cmake/testing/export/export_package-install-possible-dir.cmake
#============================================================================= # Copyright (c) 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/package.cmake) # Verify valid dir is picked up set(FAKE_PACKAGE_DIR "/valid/looking/path") rapids_export_package( install FAKE_PACKAGE test_export_set) # Verify that package configuration files exist set(path "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/install/package_FAKE_PACKAGE.cmake") if(NOT EXISTS "${path}") message(FATAL_ERROR "rapids_export_package failed to generate a find_package configuration") endif() # verify that the expected path exists in FAKE_PACKAGE.cmake set(to_match_string [=[set(possible_package_dir "/valid/looking/path")]=]) file(READ "${path}" contents) string(FIND "${contents}" "${to_match_string}" is_found) if(NOT is_found EQUAL -1) message(FATAL_ERROR "rapids_export_package shouldn't have generated a possible_package_dir") endif()
0
rapidsai_public_repos/rapids-cmake/testing/export
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-doc-string/CMakeLists.txt
#============================================================================= # Copyright (c) 2021-2023, 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/export.cmake) cmake_minimum_required(VERSION 3.23.1) project(FakEProJecT LANGUAGES CXX VERSION 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) set(doc_string [=[ Unique String To Verify. ]=]) rapids_export(BUILD FakEProJecT EXPORT_SET fake_set NAMESPACE test:: DOCUMENTATION doc_string ) # Add a custom command that generates a second project # that verifies our target was exported with the correct # namespace file(WRITE "${CMAKE_BINARY_DIR}/verify/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.23.1) project(verify_build_targets LANGUAGES CXX) message(STATUS "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-config.cmake") if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-config.cmake") message(FATAL_ERROR "rapids_export failed to generate correct config file name") endif() file(READ "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-config.cmake" contents) string(FIND "${contents}" "Unique String To Verify" is_found) if(is_found EQUAL -1) message(FATAL_ERROR "rapids_export failed to generate correct doc string") endif() ]=]) add_custom_target(verify_target_file ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/verify/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/verify" -B="${CMAKE_BINARY_DIR}/verify/build" )
0
rapidsai_public_repos/rapids-cmake/testing/export
rapidsai_public_repos/rapids-cmake/testing/export/export_component-build/CMakeLists.txt
#============================================================================= # Copyright (c) 2023, 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/detail/component.cmake) include(${rapids-cmake-dir}/export/package.cmake) cmake_minimum_required(VERSION 3.20) project(FakEProJecT LANGUAGES CXX VERSION 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export_package( build CUDAToolkit fake_set ) rapids_export_component(BUILD fakeproject component1 fake_set fake_set test::c1::) # Add a custom command that generates a second project # that verifies our component targets are exported correctly file(WRITE "${CMAKE_BINARY_DIR}/verify-1/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.20) project(verify_build_targets LANGUAGES CXX) message(STATUS "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-component1-targets.cmake") if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-component1-targets.cmake") message(FATAL_ERROR "rapids_export failed to generate correct component config file") endif() include("${CMAKE_CURRENT_LIST_DIR}/../fakeproject-component1-targets.cmake") if(NOT TARGET test::c1::fakeLib) message(FATAL_ERROR "rapids_export failed to generate correct component target of test::c1::fakeLib") endif() message(STATUS "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-component1-dependencies.cmake") if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-component1-dependencies.cmake") message(FATAL_ERROR "rapids_export failed to generate correct dependencies file") endif() include("${CMAKE_CURRENT_LIST_DIR}/../fakeproject-component1-dependencies.cmake") if(NOT TARGET CUDA::toolkit) message(FATAL_ERROR "rapids_export failed to write a correct `CUDAToolkit` dependency") endif() ]=]) add_custom_target(verify_target_component_files ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/verify-1/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/verify-1" -B="${CMAKE_BINARY_DIR}/verify-1/build" )
0
rapidsai_public_repos/rapids-cmake/testing/export
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-build-namespaces/CMakeLists.txt
#============================================================================= # Copyright (c) 2021-2023, 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/export.cmake) cmake_minimum_required(VERSION 3.23.1) project(FakEProJecT LANGUAGES CXX VERSION 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD FakEProJecT EXPORT_SET fake_set LANGUAGES CXX NAMESPACE test:: ) # Add a custom command that generates a second project # that verifies our target was exported with the correct # namespace file(WRITE "${CMAKE_BINARY_DIR}/verify/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.23.1) project(verify_build_targets LANGUAGES CXX) message(STATUS "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-targets.cmake") if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-targets.cmake") message(FATAL_ERROR "rapids_export failed to generate correct config file name") endif() include("${CMAKE_CURRENT_LIST_DIR}/../fakeproject-targets.cmake") if(NOT TARGET test::fakeLib) message(FATAL_ERROR "rapids_export failed to generate correct namespace targets") endif() ]=]) add_custom_target(verify_target_file ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/verify/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/verify" -B="${CMAKE_BINARY_DIR}/verify/build" )
0
rapidsai_public_repos/rapids-cmake/testing/export
rapidsai_public_repos/rapids-cmake/testing/export/write_dependencies-multiple-directories/CMakeLists.txt
#============================================================================= # Copyright (c) 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. #============================================================================= #Needs to before inclusion of `cpm.cmake` cmake_minimum_required(VERSION 3.23.1) include(${rapids-cmake-dir}/export/cpm.cmake) include(${rapids-cmake-dir}/export/write_dependencies.cmake) project(FakEProJecT LANGUAGES CXX VERSION 3.1.4) add_subdirectory(A) add_subdirectory(B) if(NOT TARGET rapids_export_build_test_export_set) message(FATAL_ERROR "rapids_export_cpm failed to generate target for build") endif() # Verify that we encoded both packages for exporting get_target_property(packages rapids_export_build_test_export_set PACKAGE_NAMES) if(NOT FAKE_CPM_PACKAGE IN_LIST packages) message(FATAL_ERROR "rapids_export_cpm failed to record FAKE_CPM_PACKAGE needs to be exported") endif() if(NOT SECOND_FAKE_CPM_PACKAGE IN_LIST packages) message(FATAL_ERROR "rapids_export_cpm failed to record SECOND_FAKE_CPM_PACKAGE needs to be exported") endif() # Verify that we encoded what `targets` are marked as global export get_target_property( global_targets rapids_export_build_test_export_set GLOBAL_TARGETS) if( NOT "ABC::ABC" IN_LIST global_targets) message(FATAL_ERROR "rapids_export_cpm failed to record ABC::ABC needs to be global") endif() if( NOT "ABC::CBA" IN_LIST global_targets) message(FATAL_ERROR "rapids_export_cpm failed to record ABC::CBA needs to be global") endif() # Verify that we removed CMake internal encoding for which directory a target was # added in message(STATUS "global_targets: ${global_targets}") if( "::@" IN_LIST global_targets) message(FATAL_ERROR "rapids_export_cpm failed to remove special cmake encoding") endif() # Verify that CPM property is set get_target_property( requires_cpm rapids_export_build_test_export_set REQUIRES_CPM) if( NOT requires_cpm) message(FATAL_ERROR "rapids_export_cpm failed to record that CPM is required by the export set") endif() # Verify that cpm configuration files exist if(NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/cpm_FAKE_CPM_PACKAGE.cmake" OR NOT EXISTS "${CMAKE_BINARY_DIR}/rapids-cmake/test_export_set/build/cpm_SECOND_FAKE_CPM_PACKAGE.cmake") message(FATAL_ERROR "rapids_export_cpm failed to generate a CPM configuration") endif()
0
rapidsai_public_repos/rapids-cmake/testing/export/write_dependencies-multiple-directories
rapidsai_public_repos/rapids-cmake/testing/export/write_dependencies-multiple-directories/B/CMakeLists.txt
#============================================================================= # Copyright (c) 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. #============================================================================= rapids_export_cpm( BUILD SECOND_FAKE_CPM_PACKAGE test_export_set CPM_ARGS VERSION 2.0 GLOBAL_TARGETS ABC::ABC ABC::CBA )
0
rapidsai_public_repos/rapids-cmake/testing/export/write_dependencies-multiple-directories
rapidsai_public_repos/rapids-cmake/testing/export/write_dependencies-multiple-directories/A/CMakeLists.txt
#============================================================================= # Copyright (c) 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. #============================================================================= rapids_export_cpm( build FAKE_CPM_PACKAGE test_export_set CPM_ARGS FAKE_PACKAGE_ARGS TRUE GLOBAL_TARGETS ABC::ABC )
0
rapidsai_public_repos/rapids-cmake/testing/export
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-build-multiple-export-sets-to-single-component/CMakeLists.txt
#============================================================================= # Copyright (c) 2023, 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/export.cmake) cmake_minimum_required(VERSION 3.20) project(fake LANGUAGES CXX VERSION 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) add_library(fakeLib_c1 INTERFACE) install(TARGETS fakeLib_c1 EXPORT fake_c1-export) add_library(fakeLib_c1-lib INTERFACE) install(TARGETS fakeLib_c1-lib EXPORT fake-c1-lib-exports) rapids_export(BUILD fake EXPORT_SET fake_set COMPONENTS c1 c1 COMPONENTS_EXPORT_SET fake_c1-export fake-c1-lib-exports NAMESPACE test:: ) # Add a custom command that generates a second project # that verifies our component targets are exported correctly file(WRITE "${CMAKE_BINARY_DIR}/verify-1/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.20) project(verify_build_targets LANGUAGES CXX) set(export_sets c1 c1-lib) foreach(export_set IN LISTS export_sets) include("${CMAKE_CURRENT_LIST_DIR}/../fake-${export_set}-targets.cmake") if(NOT TARGET test::fakeLib_${export_set}) message(FATAL_ERROR "rapids_export failed to generate correct component target of test::fakeLib_${export_set}") endif() endforeach() ]=]) add_custom_target(verify_target_component_files ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/verify-1/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/verify-1" -B="${CMAKE_BINARY_DIR}/verify-1/build" ) # Add a custom command that generates a second project # that verifies our component aren't brought in with `find_package()` file(WRITE "${CMAKE_BINARY_DIR}/verify-2/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.20) project(verify_build_targets LANGUAGES CXX) set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../) find_package(fake REQUIRED) if(TARGET test::fakeLib_c1 OR TARGET test::fakeLib_c1-lib) message(FATAL_ERROR "incorrectly included generated components without COMPONENTS keyword to `find_package`") endif() ]=]) add_custom_target(verify_target_find_package ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/verify-2/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/verify-2" -B="${CMAKE_BINARY_DIR}/verify-2/build" ) # Add a custom command that generates a second project # that verifies our component are brought in with `find_package( COMPONENTS)` file(WRITE "${CMAKE_BINARY_DIR}/verify-3/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.20) project(verify_build_targets LANGUAGES CXX) set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../) find_package(fake COMPONENTS c1 REQUIRED) if(NOT (TARGET test::fakeLib_c1 AND TARGET test::fakeLib_c1-lib)) message(FATAL_ERROR "find_package(COMPONENTS) failed to bring in components") endif() ]=]) add_custom_target(verify_target_find_components ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/verify-3/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/verify-3" -B="${CMAKE_BINARY_DIR}/verify-3/build" )
0
rapidsai_public_repos/rapids-cmake/testing/export
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-global-targets/CMakeLists.txt
#============================================================================= # Copyright (c) 2021-2023, 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/export.cmake) cmake_minimum_required(VERSION 3.23.1) project(FakEProJecT LANGUAGES CXX VERSION 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) rapids_export(BUILD FakEProJecT GLOBAL_TARGETS fakeLib EXPORT_SET fake_set LANGUAGES CXX NAMESPACE test:: ) # Add a custom command that generates a second project # that verifies our target was exported with the correct # namespace file(WRITE "${CMAKE_BINARY_DIR}/verify/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.23.1) project(verify_build_targets LANGUAGES CXX) message(STATUS "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-config.cmake") if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../fakeproject-config.cmake") message(FATAL_ERROR "rapids_export failed to generate correct config file name") endif() set(FakEProJecT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../") find_package(FakEProJecT REQUIRED) if(NOT TARGET test::fakeLib) message(FATAL_ERROR "rapids_export failed to generate correct namespace targets") endif() get_target_property(_is_global test::fakeLib IMPORTED_GLOBAL) if(NOT _is_global) message(FATAL_ERROR "rapids_export failed to mark target as global") endif() ]=]) add_custom_target(verify_target_file ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/verify/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/verify" -B="${CMAKE_BINARY_DIR}/verify/build" )
0
rapidsai_public_repos/rapids-cmake/testing/export
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-build-components-dependencies/CMakeLists.txt
#============================================================================= # Copyright (c) 2023, 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/export.cmake) cmake_minimum_required(VERSION 3.20) project(FakEProJecT LANGUAGES CXX VERSION 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) add_library(fakeLib_c1 INTERFACE) install(TARGETS fakeLib_c1 EXPORT fake_set_c1_export) include(${rapids-cmake-dir}/export/package.cmake) rapids_export_package( build CUDAToolkit fake_set_c1_export) rapids_export(BUILD FakEProJecT EXPORT_SET fake_set COMPONENTS c1 COMPONENTS_EXPORT_SET fake_set_c1_export LANGUAGES CXX NAMESPACE test:: ) # Add a custom command that generates a second project # that verifies our component targets are exported correctly file(WRITE "${CMAKE_BINARY_DIR}/verify-1/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.20) project(verify_build_targets LANGUAGES CXX) set(nice_names c1-fake_set) foreach(nice_name IN ZIP_LISTS components export_sets) include("${CMAKE_CURRENT_LIST_DIR}/../fakeproject-${nice_names}-dependencies.cmake") if(NOT TARGET CUDA::toolkit) message(FATAL_ERROR "rapids_export failed to generate correct dependencies imports[fakeproject-${nice_names}-dependencies.cmake]") endif() endforeach() ]=]) add_custom_target(verify_target_dependencies_files ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/verify-1/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/verify-1" -B="${CMAKE_BINARY_DIR}/verify-1/build" ) # Add a custom command that generates a second project # that verifies our component targets are exported correctly file(WRITE "${CMAKE_BINARY_DIR}/verify-2/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.20) project(verify_build_targets LANGUAGES CXX) set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../) find_package(fakeproject COMPONENTS c1 REQUIRED) if(NOT TARGET CUDA::toolkit) message(FATAL_ERROR "rapids_export failed to generate correct dependencies imports") endif() ]=]) add_custom_target(verify_target_dependencies_find ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/verify-2/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/verify-2" -B="${CMAKE_BINARY_DIR}/verify-2/build" )
0
rapidsai_public_repos/rapids-cmake/testing/export
rapidsai_public_repos/rapids-cmake/testing/export/export-verify-install-components/CMakeLists.txt
#============================================================================= # Copyright (c) 2023, 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/export.cmake) cmake_minimum_required(VERSION 3.20) project(fake LANGUAGES CXX VERSION 3.1.4) add_library(fakeLib INTERFACE) install(TARGETS fakeLib EXPORT fake_set) add_library(fakeLib_c1 INTERFACE) install(TARGETS fakeLib_c1 EXPORT fake_c1_export) include(${rapids-cmake-dir}/export/package.cmake) rapids_export_package(INSTALL CUDAToolkit fake_c1_export) add_library(fakeLib_c2 INTERFACE) install(TARGETS fakeLib_c2 EXPORT fake_c2_exports) add_library(fakeLib_c2_lib INTERFACE) install(TARGETS fakeLib_c2_lib EXPORT fake_c2-lib_exports) set(CMAKE_INSTALL_LIBDIR "lib64") rapids_export(INSTALL fake EXPORT_SET fake_set COMPONENTS c1 c2 c2 COMPONENTS_EXPORT_SET fake_c1_export fake_c2_exports fake_c2-lib_exports NAMESPACE test:: ) # Add a custom command that install each component into # a different temp location add_custom_target(install_each_component_files ALL COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --component fake --prefix install/fake/ COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --component c1 --prefix install/c1/ COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --component c2 --prefix install/c2/ ) # Add a custom command that verifies that the expect files have # been installed for each component file(WRITE "${CMAKE_BINARY_DIR}/install/CMakeLists.txt" [=[ cmake_minimum_required(VERSION 3.20) project(verify_install_targets LANGUAGES CXX) set(fake_files fake/lib64/cmake/fake/fake-config-version.cmake fake/lib64/cmake/fake/fake-config.cmake fake/lib64/cmake/fake/fake-targets.cmake ) set(c1_files c1/lib64/cmake/fake/fake-c1-dependencies.cmake c1/lib64/cmake/fake/fake-c1-targets.cmake ) set(c2_files c2/lib64/cmake/fake/fake-c2-targets.cmake c2/lib64/cmake/fake/fake-c2-lib-targets.cmake ) foreach(file IN LISTS fake_files c1_files c2_files) if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${file}") message(FATAL_ERROR "rapids_export(COMPONENTS) failed to install ${file}") endif() endforeach() ]=]) add_custom_target(verify_install_components ALL COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_BINARY_DIR}/install/build" COMMAND ${CMAKE_COMMAND} -S="${CMAKE_BINARY_DIR}/install" -B="${CMAKE_BINARY_DIR}/install/build" ) add_dependencies(verify_install_components install_each_component_files)
0
rapidsai_public_repos/rapids-cmake/testing/export
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/CMakeLists.txt
#============================================================================= # Copyright (c) 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/write_language.cmake) cmake_minimum_required(VERSION 3.23.1 FATAL_ERROR) project(write_language-multiple-nested-enable LANGUAGES NONE) # verify that enabling langues CXX && CUDA in A/B/D and A/C # only installs one hook in `A` and `CMAKE_SOURCE_DIR` add_subdirectory(A) #Verify number of hooks is equal to 2 cmake_language(DEFER GET_CALL_IDS all_ids) list(LENGTH all_ids list_len) if(NOT list_len EQUAL 2) message(FATAL_ERROR "incorrect number of language hooks detected") endif() add_executable(write_language-multiple-nested-enable main.cpp) target_link_libraries(write_language-multiple-nested-enable PRIVATE A B C D)
0
rapidsai_public_repos/rapids-cmake/testing/export
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/main.cpp
/* * Copyright (c) 2021-2023, 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 <iostream> int static_launch_kernelA(int x, int y); int static_launch_kernelB(int x, int y); int static_launch_kernelD(int x, int y); int cpu_function(int x, int y); int main(int argc, char**) { auto resultA = static_launch_kernelA(3, argc); auto resultB = static_launch_kernelB(3, argc); auto resultC = cpu_function(3, argc); auto resultD = static_launch_kernelD(3, argc); if (resultA != 6) { return 1; } if ((resultA != resultB) || (resultA != resultC) || (resultA != resultD)) { return 1; } return 0; }
0
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A/static.cu
/* * Copyright (c) 2021-2023, 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. */ static __global__ void example_cuda_kernel(int& r, int x, int y) { r = x * y + (x * 4 - (y / 2)); } int static_launch_kernelA(int x, int y) { int r; example_cuda_kernel<<<1, 1>>>(r, x, y); return r; }
0
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A/CMakeLists.txt
#============================================================================= # Copyright (c) 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. #============================================================================= set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) add_subdirectory(B) add_subdirectory(C) #Verify number of hooks is equal to 1 cmake_language(DEFER GET_CALL_IDS all_ids) list(LENGTH all_ids list_len) if(NOT list_len EQUAL 2) message(FATAL_ERROR "incorrect number of language hooks detected") endif() add_library(A STATIC static.cu)
0
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A/B/static.not_cu
/* * Copyright (c) 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. */ static __global__ void example_cuda_kernel(int& r, int x, int y) { r = x * y + ( x * 4 - (y/2) ); } int static_launch_kernelB(int x, int y) { int r; example_cuda_kernel<<<1, 1>>>(r, x, y); return r; }
0
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A/B/CMakeLists.txt
#============================================================================= # Copyright (c) 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. #============================================================================= add_subdirectory(D) add_library(B STATIC static.not_cu) set_source_files_properties(static.not_cu PROPERTIES LANGUAGE CUDA)
0
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A/B
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A/B/D/static.cu
/* * Copyright (c) 2021-2023, 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. */ static __global__ void example_cuda_kernel(int& r, int x, int y) { r = x * y + (x * 4 - (y / 2)); } int static_launch_kernelD(int x, int y) { int r; example_cuda_kernel<<<1, 1>>>(r, x, y); return r; }
0
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A/B
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A/B/D/CMakeLists.txt
#============================================================================= # Copyright (c) 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/write_language.cmake) function(enable_nested_language file_path) #replicates CPM including the file include("${file_path}") endfunction() set(path "${CMAKE_CURRENT_BINARY_DIR}/enable_cuda_language.cmake") rapids_export_write_language(BUILD CUDA "${path}") enable_nested_language("${path}") add_library(D STATIC static.cu)
0
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A/C/CMakeLists.txt
#============================================================================= # Copyright (c) 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/write_language.cmake) function(enable_nested_language file_path) #replicates CPM including the file include("${file_path}") endfunction() set(path "${CMAKE_CURRENT_BINARY_DIR}/enable_cuda_language.cmake") rapids_export_write_language(BUILD CXX "${path}") enable_nested_language("${path}") add_library(C STATIC static.cpp)
0
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A
rapidsai_public_repos/rapids-cmake/testing/export/write_language-multiple-nested-enables/A/C/static.cpp
/* * Copyright (c) 2021-2023, 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. */ int cpu_function(int x, int y) { return x * y + (x * 4 - (y / 2)); }
0