From 27d6e51ae9b57657289a4db6092d8a47472b842e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jun 2019 08:50:57 -0400 Subject: Tests: add tests for export set error messages --- Tests/RunCMake/export/DependOnDoubleExport-result.txt | 1 + Tests/RunCMake/export/DependOnDoubleExport-stderr.txt | 13 +++++++++++++ Tests/RunCMake/export/DependOnDoubleExport.cmake | 7 +++++++ Tests/RunCMake/export/DependOnNotExport-result.txt | 1 + Tests/RunCMake/export/DependOnNotExport-stderr.txt | 6 ++++++ Tests/RunCMake/export/DependOnNotExport.cmake | 4 ++++ Tests/RunCMake/export/RunCMakeTest.cmake | 2 ++ 7 files changed, 34 insertions(+) create mode 100644 Tests/RunCMake/export/DependOnDoubleExport-result.txt create mode 100644 Tests/RunCMake/export/DependOnDoubleExport-stderr.txt create mode 100644 Tests/RunCMake/export/DependOnDoubleExport.cmake create mode 100644 Tests/RunCMake/export/DependOnNotExport-result.txt create mode 100644 Tests/RunCMake/export/DependOnNotExport-stderr.txt create mode 100644 Tests/RunCMake/export/DependOnNotExport.cmake diff --git a/Tests/RunCMake/export/DependOnDoubleExport-result.txt b/Tests/RunCMake/export/DependOnDoubleExport-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/DependOnDoubleExport-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt b/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt new file mode 100644 index 0000000..b78c7e4 --- /dev/null +++ b/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt @@ -0,0 +1,13 @@ +CMake Error in CMakeLists.txt: + export called with target "exported" which requires target "doubleexported" + that is not in this export set, but in multiple other export sets: + .*/Tests/RunCMake/export/DependOnDoubleExport-build/exportset.cmake, + .*/Tests/RunCMake/export/DependOnDoubleExport-build/manual.cmake. + + + An exported target cannot depend upon another target which is exported + multiple times. Consider consolidating the exports of the "doubleexported" + target to a single export. + + +CMake Generate step failed. Build files cannot be regenerated correctly. diff --git a/Tests/RunCMake/export/DependOnDoubleExport.cmake b/Tests/RunCMake/export/DependOnDoubleExport.cmake new file mode 100644 index 0000000..8d108d7 --- /dev/null +++ b/Tests/RunCMake/export/DependOnDoubleExport.cmake @@ -0,0 +1,7 @@ +add_library(doubleexported INTERFACE) +install(TARGETS doubleexported EXPORT exportset) +export(TARGETS doubleexported FILE "${CMAKE_CURRENT_BINARY_DIR}/manual.cmake") +export(EXPORT exportset FILE "${CMAKE_CURRENT_BINARY_DIR}/exportset.cmake") +add_library(exported INTERFACE) +target_link_libraries(exported INTERFACE doubleexported) +export(TARGETS exported FILE "${CMAKE_CURRENT_BINARY_DIR}/exports.cmake") diff --git a/Tests/RunCMake/export/DependOnNotExport-result.txt b/Tests/RunCMake/export/DependOnNotExport-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/DependOnNotExport-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/DependOnNotExport-stderr.txt b/Tests/RunCMake/export/DependOnNotExport-stderr.txt new file mode 100644 index 0000000..80f5758 --- /dev/null +++ b/Tests/RunCMake/export/DependOnNotExport-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + export called with target "exported" which requires target "notexported" + that is not in any export set. + + +CMake Generate step failed. Build files cannot be regenerated correctly. diff --git a/Tests/RunCMake/export/DependOnNotExport.cmake b/Tests/RunCMake/export/DependOnNotExport.cmake new file mode 100644 index 0000000..06c1ad9 --- /dev/null +++ b/Tests/RunCMake/export/DependOnNotExport.cmake @@ -0,0 +1,4 @@ +add_library(notexported INTERFACE) +add_library(exported INTERFACE) +target_link_libraries(exported INTERFACE notexported) +export(TARGETS exported FILE "${CMAKE_CURRENT_BINARY_DIR}/exports.cmake") diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 97a0ca6..4d2f217 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -10,3 +10,5 @@ run_cmake(ForbiddenToExportInterfaceProperties) run_cmake(ForbiddenToExportImportedProperties) run_cmake(ForbiddenToExportPropertyWithGenExp) run_cmake(ExportPropertiesUndefined) +run_cmake(DependOnNotExport) +run_cmake(DependOnDoubleExport) -- cgit v0.12