diff options
Diffstat (limited to 'Tests/RunCMake')
699 files changed, 5647 insertions, 428 deletions
diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake index dbcf4b8..fe57d56 100644 --- a/Tests/RunCMake/AutoExportDll/AutoExport.cmake +++ b/Tests/RunCMake/AutoExportDll/AutoExport.cmake @@ -7,7 +7,7 @@ set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1) add_library(autoexport SHARED hello.cxx world.cxx foo.c $<TARGET_OBJECTS:objlib>) add_library(autoexport3 SHARED cppCLI.cxx) if(MSVC AND NOT MSVC_VERSION VERSION_LESS 1600 - AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") set_property(TARGET autoexport3 PROPERTY COMMON_LANGUAGE_RUNTIME "") endif() @@ -17,7 +17,7 @@ if(MSVC) add_library(autoexport_for_exec SHARED hello2.c) target_link_libraries(autoexport_for_exec say) if(NOT MSVC_VERSION VERSION_LESS 1600 AND - NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") enable_language(ASM_MASM) target_sources(autoexport PRIVATE nop.asm) set_property(SOURCE nop.asm PROPERTY COMPILE_FLAGS /safeseh) diff --git a/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake b/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake index 61e046f..074db65 100644 --- a/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake @@ -4,3 +4,4 @@ run_cmake_script(Regex-CMP0127-NEW) run_cmake_script(Regex-CMP0127-OLD) run_cmake_script(Parentheses-CMP0127-NEW) run_cmake_script(Parentheses-CMP0127-WARN) +run_cmake_script(UseDotSymbol) diff --git a/Tests/RunCMake/CMakeDependentOption/UseDotSymbol-stdout.txt b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol-stdout.txt new file mode 100644 index 0000000..15b56a1 --- /dev/null +++ b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol-stdout.txt @@ -0,0 +1 @@ +-- USE_FOO='ON' diff --git a/Tests/RunCMake/CMakeDependentOption/UseDotSymbol.cmake b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol.cmake new file mode 100644 index 0000000..8f07c48 --- /dev/null +++ b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol.cmake @@ -0,0 +1,4 @@ +include(CMakeDependentOption) + +cmake_dependent_option(USE_FOO "Use Foo" ON "CMAKE_VERSION VERSION_GREATER_EQUAL 3.08" OFF) +message(STATUS "USE_FOO='${USE_FOO}'") diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bbf8ddc..2f5bc87 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -301,9 +301,13 @@ if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(ExportCompileCommands) endif() add_RunCMake_test(ExcludeFromAll) +add_RunCMake_test(ExportImport) add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) +if(CMAKE_USE_SYSTEM_JSONCPP) + list(APPEND FileAPI_ARGS -DJsonCpp_VERSION_STRING=${JsonCpp_VERSION_STRING}) +endif() add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE} -DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}) add_RunCMake_test(FindBoost) @@ -355,6 +359,7 @@ if(MSVC) add_RunCMake_test(MSVCRuntimeLibrary) add_RunCMake_test(MSVCRuntimeTypeInfo) add_RunCMake_test(MSVCWarningFlags) + add_RunCMake_test(MSVCDebugInformationFormat) endif() if(XCODE_VERSION) set(ObjectLibrary_ARGS -DXCODE_VERSION=${XCODE_VERSION}) @@ -372,7 +377,8 @@ add_RunCMake_test(TargetProperties) add_RunCMake_test(ToolchainFile) add_RunCMake_test(find_dependency) add_RunCMake_test(CompileDefinitions) -add_RunCMake_test(CompileWarningAsError) +add_RunCMake_test(CompileWarningAsError -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) +set_property(TEST RunCMake.CompileWarningAsError APPEND PROPERTY LABELS "CUDA") add_RunCMake_test(CompileFeatures -DCMake_NO_C_STANDARD=${CMake_NO_C_STANDARD} -DCMake_NO_CXX_STANDARD=${CMake_NO_CXX_STANDARD}) add_RunCMake_test(Policy) add_RunCMake_test(PolicyScope) @@ -451,6 +457,7 @@ add_RunCMake_test(find_path) add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(foreach) add_RunCMake_test(function) +add_RunCMake_test(block) add_RunCMake_test(get_filename_component) add_RunCMake_test(get_property) add_RunCMake_test(if) @@ -520,7 +527,9 @@ function(add_RunCMake_test_try_compile) set(CMAKE_CXX_STANDARD_DEFAULT 14) endif() endif() - foreach(var + foreach( + var + IN ITEMS CMAKE_SYSTEM_NAME CMAKE_C_COMPILER_ID CMAKE_C_COMPILER_VERSION @@ -534,7 +543,7 @@ function(add_RunCMake_test_try_compile) CMake_TEST_FILESYSTEM_1S CMAKE_OBJC_STANDARD_DEFAULT CMAKE_OBJCXX_STANDARD_DEFAULT - ) + ) if(DEFINED ${var}) list(APPEND try_compile_ARGS -D${var}=${${var}}) endif() @@ -690,6 +699,8 @@ add_RunCMake_test(target_link_libraries-LINK_LIBRARY -DCMAKE_SYSTEM_NAME=${CMAKE -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION} -DMSVC_VERSION=${MSVC_VERSION} + -DXCODE=${XCODE} + -DXCODE_VERSION=${XCODE_VERSION} -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX} -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX} -DCMAKE_IMPORT_LIBRARY_PREFIX=${CMAKE_IMPORT_LIBRARY_PREFIX} @@ -949,7 +960,7 @@ if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN) if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja|Visual Studio 1[456]") message(FATAL_ERROR "Android tests supported only by Makefile, Ninja, and Visual Studio >= 14 generators") endif() - foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN) + foreach(v IN ITEMS TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN) if(CMake_${v}) string(REPLACE ";" "|" ${v} "${CMake_${v}}") list(APPEND Android_ARGS "-D${v}=${${v}}") @@ -968,7 +979,7 @@ endif() if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|9[0-9])") add_RunCMake_test(CSharpCustomCommand) - if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + if(NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") add_RunCMake_test(CSharpReferenceImport) endif() endif() @@ -993,6 +1004,10 @@ add_RunCMake_test(CMakePresetsTest -DPython_EXECUTABLE=${Python_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA} ) +add_RunCMake_test(CMakePresetsPackage + -DPython_EXECUTABLE=${Python_EXECUTABLE} + -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA} + ) add_RunCMake_test(VerifyHeaderSets) diff --git a/Tests/RunCMake/CMakePresets/Comment-stderr.txt b/Tests/RunCMake/CMakePresets/Comment-stderr.txt index 2f404bc..b3b6b66 100644 --- a/Tests/RunCMake/CMakePresets/Comment-stderr.txt +++ b/Tests/RunCMake/CMakePresets/Comment-stderr.txt @@ -1,2 +1,9 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error$ +]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error +Errors: +[^ +]*Comment\/CMakePresets.json: +\* Line 1, Column 1 + Syntax error: value, object or array expected\. +\* Line 2, Column 1 + Extra non-whitespace after JSON value\.$ diff --git a/Tests/RunCMake/CMakePresets/DocumentationExampleListAllPresets-stdout.txt b/Tests/RunCMake/CMakePresets/DocumentationExampleListAllPresets-stdout.txt new file mode 100644 index 0000000..b1fcc28 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/DocumentationExampleListAllPresets-stdout.txt @@ -0,0 +1,18 @@ +^Not searching for unused variables given on the command line\. +Available configure presets: + + "default" ?- Default Config + "ninja-multi" ?- Ninja Multi-Config( + "windows-only" - Windows-only configuration)? + +Available build presets: + + "default" + +Available test presets: + + "default" + +Available package presets: + + "default"$ diff --git a/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt index 6970674..0d3c500 100644 --- a/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt +++ b/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt @@ -1,2 +1,5 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/EmptyPresetName: Invalid preset$ +]*/Tests/RunCMake/CMakePresets/EmptyPresetName: Invalid preset +Errors: +[^ +]*/EmptyPresetName/CMakePresets.json$ diff --git a/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake b/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake index df58e72..d9e399f 100644 --- a/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake +++ b/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake @@ -1,4 +1,5 @@ include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) get_filename_component(_parent "${CMAKE_SOURCE_DIR}" DIRECTORY) +file(REAL_PATH "${_parent}" _parent) test_variable(CMAKE_BINARY_DIR "" "${_parent}/GoodNoSCachePrep-build") diff --git a/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt b/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt index 7ccabab..85a2d78 100644 --- a/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt +++ b/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt @@ -1,2 +1,5 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/IncludeNotFound: File not found$ +]*/Tests/RunCMake/CMakePresets/IncludeNotFound: File not found +Errors: +[^ +]*/IncludeNotFound/NotFound.json: Failed to read file$ diff --git a/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt b/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt index a43bf77..89eff9f 100644 --- a/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt +++ b/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt @@ -1,2 +1,9 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/JSONParseError: JSON parse error$ +]*/Tests/RunCMake/CMakePresets/JSONParseError: JSON parse error +Errors: +[^ +]*JSONParseError/CMakePresets.json: +\* Line 1, Column 1 + Syntax error: value, object or array expected\. +\* Line 1, Column 1 + A valid JSON document must be either an array or an object value\.$ diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild-stdout.txt b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild-stdout.txt new file mode 100644 index 0000000..38f52aa --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild-stdout.txt @@ -0,0 +1,8 @@ +^Not searching for unused variables given on the command line. +Available configure presets: + + "default" + +Available test presets: + + "default"$ diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild.json.in b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild.json.in new file mode 100644 index 0000000..9259477 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild.json.in @@ -0,0 +1,14 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "default" + } + ], + "testPresets": [ + { + "name": "default", + "configurePreset": "default" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest-stdout.txt b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest-stdout.txt new file mode 100644 index 0000000..8cac0a8 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest-stdout.txt @@ -0,0 +1,8 @@ +^Not searching for unused variables given on the command line. +Available configure presets: + + "default" + +Available build presets: + + "default"$ diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest.json.in b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest.json.in new file mode 100644 index 0000000..33fd036 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest.json.in @@ -0,0 +1,14 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "default" + } + ], + "buildPresets": [ + { + "name": "default", + "configurePreset": "default" + } + ] +} diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt +++ b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt diff --git a/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt new file mode 100644 index 0000000..153abee --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: Invalid value specified for --list-presets\. +Valid values are configure, build, test, package, or all\. When no value is passed the default is configure\. +CMake Error: Run 'cmake --help' for all supported options\.$ diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index d097086..efa838e 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -289,6 +289,7 @@ run_cmake_presets(UserInheritance) # Test listing presets set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListPresets.json.in") run_cmake_presets(ListPresets --list-presets) +run_cmake_presets(ListPresetsInvalidType --list-presets=invalid-type) set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ListPresetsWorkingDir") set(RunCMake_TEST_NO_CLEAN 1) @@ -304,6 +305,12 @@ unset(RunCMake_TEST_BINARY_DIR) run_cmake_presets(ListPresetsNoSuchPreset) run_cmake_presets(ListPresetsHidden) +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListAllPresetsNoBuild.json.in") +run_cmake_presets(ListAllPresetsNoBuild --list-presets=all) + +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListAllPresetsNoTest.json.in") +run_cmake_presets(ListAllPresetsNoTest --list-presets=all) + # Test warning and error flags set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Warnings.json.in") set(CMakePresets_WARN_UNUSED_CLI 1) @@ -401,4 +408,5 @@ set(CMakePresets_EXTRA_FILES "${RunCMake_SOURCE_DIR}/moreThings.json.in" ) run_cmake_presets(DocumentationExample --preset=default) +run_cmake_presets(DocumentationExampleListAllPresets --list-presets=all) unset(CMakePresets_EXTRA_FILES) diff --git a/Tests/RunCMake/CMakePresetsPackage/CMakeLists.txt.in b/Tests/RunCMake/CMakePresetsPackage/CMakeLists.txt.in new file mode 100644 index 0000000..129184a --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/CMakeLists.txt.in @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.19) +project("@CASE_NAME@" NONE) +include("@CASE_SOURCE_DIR@/@CASE_NAME@.cmake") diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-config-file-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-config-file-check.cmake new file mode 100644 index 0000000..40240f9 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-config-file-check.cmake @@ -0,0 +1,6 @@ +include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + +set(filename "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/TGZ/config-file-alt.tar.gz") +if(NOT EXISTS "${filename}") + set(RunCMake_TEST_FAILED "Expected ${filename} to exist but it does not") +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-configurations-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-configurations-check.cmake new file mode 100644 index 0000000..3d684af --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-configurations-check.cmake @@ -0,0 +1,18 @@ +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + set(cpack_dir "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}") + set(contents [[Debug +Release +]]) + + file(GLOB dirs RELATIVE "${cpack_dir}" "${cpack_dir}/*") + foreach(dir IN LISTS dirs) + set(configs_file "${cpack_dir}/${dir}/${CPACK_PACKAGE_FILE_NAME}/configs.txt") + file(READ "${configs_file}" actual_contents) + if(NOT contents STREQUAL actual_contents) + string(REPLACE "\n" "\n " contents_formatted "${contents}") + string(REPLACE "\n" "\n " actual_contents_formatted "${actual_contents}") + string(APPEND RunCMake_TEST_FAILED "Expected contents of ${configs_file}:\n ${contents_formatted}\nActual contents:\n ${actual_contents_formatted}\n") + endif() + endforeach() +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-debug-stdout.txt b/Tests/RunCMake/CMakePresetsPackage/Good-package-debug-stdout.txt new file mode 100644 index 0000000..be885b4 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-debug-stdout.txt @@ -0,0 +1,2 @@ +CPack: [^ +]* Enable Debug diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-generators-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-generators-check.cmake new file mode 100644 index 0000000..aaa75e4 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-generators-check.cmake @@ -0,0 +1 @@ +check_cpack_packages("TBZ2;TXZ" "") diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-no-environment-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-no-environment-check.cmake new file mode 100644 index 0000000..205e7b7 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-no-environment-check.cmake @@ -0,0 +1,7 @@ +check_cpack_packages("TGZ;TXZ" [[TEST_ENV not defined +TEST_ENV_REF=xx +TEST_ENV_OVERRIDE not defined +TEST_ENV_OVERRIDE_REF not defined +]]) + +include("${RunCMake_SOURCE_DIR}/check.cmake") diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-package-directory-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-directory-check.cmake new file mode 100644 index 0000000..8f4b771 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-directory-check.cmake @@ -0,0 +1,6 @@ +include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + +set(filename "${RunCMake_TEST_BINARY_DIR}/default/package-directory/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/TGZ/${CPACK_PACKAGE_FILE_NAME}.tar.gz") +if(NOT EXISTS "${filename}") + set(RunCMake_TEST_FAILED "Expected ${filename} to exist but it does not") +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-package-name-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-name-check.cmake new file mode 100644 index 0000000..fdc4824 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-name-check.cmake @@ -0,0 +1,7 @@ +include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + +file(READ "${RunCMake_TEST_BINARY_DIR}/default/${CPACK_PACKAGE_FILE_NAME}.json" contents) +string(JSON package_name GET "${contents}" packageName) +if(NOT package_name STREQUAL "package-name") + set(RunCMake_TEST_FAILED "Expected package name to be \"package-name\" but it was \"${package_name}\"") +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-package-version-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-version-check.cmake new file mode 100644 index 0000000..dba9110 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-version-check.cmake @@ -0,0 +1,7 @@ +include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + +file(READ "${RunCMake_TEST_BINARY_DIR}/default/${CPACK_PACKAGE_FILE_NAME}.json" contents) +string(JSON package_version GET "${contents}" packageVersion) +if(NOT package_version STREQUAL "1.0") + set(RunCMake_TEST_FAILED "Expected package version to be \"1.0\" but it was \"${package_version}\"") +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-variables-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-variables-check.cmake new file mode 100644 index 0000000..2858170 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-variables-check.cmake @@ -0,0 +1,6 @@ +include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + +set(filename "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/TGZ/variables-package.tar.gz") +if(NOT EXISTS "${filename}") + set(RunCMake_TEST_FAILED "Expected ${filename} to exist but it does not") +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-verbose-stdout.txt b/Tests/RunCMake/CMakePresetsPackage/Good-package-verbose-stdout.txt new file mode 100644 index 0000000..22fd115 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-verbose-stdout.txt @@ -0,0 +1 @@ +CPack: Enable Verbose diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-with-environment-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-with-environment-check.cmake new file mode 100644 index 0000000..a775e4d --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-with-environment-check.cmake @@ -0,0 +1,7 @@ +check_cpack_packages("TGZ;TXZ" [[TEST_ENV=Environment variable +TEST_ENV_REF=xEnvironment variablex +TEST_ENV_OVERRIDE=Override +TEST_ENV_OVERRIDE_REF=xOverridex +]]) + +include("${RunCMake_SOURCE_DIR}/check.cmake") diff --git a/Tests/RunCMake/CMakePresetsPackage/Good.cmake b/Tests/RunCMake/CMakePresetsPackage/Good.cmake new file mode 100644 index 0000000..d019443 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good.cmake @@ -0,0 +1,31 @@ +set(CPACK_PACKAGE_NAME Good) +set(CPACK_GENERATOR "TGZ;TXZ") + +include(CPack) + +install(CODE [[ +function(print_env name) + if(DEFINED ENV{${name}}) + file(APPEND $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/env.txt "${name}=$ENV{${name}}\n") + else() + file(APPEND $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/env.txt "${name} not defined\n") + endif() +endfunction() + +file(REMOVE $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/env.txt) +print_env(TEST_ENV) +print_env(TEST_ENV_REF) +print_env(TEST_ENV_OVERRIDE) +print_env(TEST_ENV_OVERRIDE_REF) + +file(APPEND $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/configs.txt "$<CONFIG>\n") +]]) + +file(WRITE "${CMAKE_BINARY_DIR}/CPackConfigAlt.cmake" [[include(${CMAKE_CURRENT_LIST_DIR}/CPackConfig.cmake) +set(CPACK_PACKAGE_FILE_NAME "config-file-alt") +]]) + +file(WRITE "${CMAKE_BINARY_DIR}/external_package.cmake" [[if(NOT CPACK_PACKAGE_VENDOR STREQUAL "some-vendor") + message(FATAL_ERROR "Expected vendor to be \"some-vendor\" but it was \"${CPACK_PACKAGE_VENDOR}\"") +endif() +]]) diff --git a/Tests/RunCMake/CMakePresetsPackage/Good.json.in b/Tests/RunCMake/CMakePresetsPackage/Good.json.in new file mode 100644 index 0000000..0c0e7d9 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good.json.in @@ -0,0 +1,135 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build/${presetName}", + "environment": { + "TEST_ENV": "Environment variable", + "TEST_ENV_OVERRIDE": "Overridden environment variable" + } + } + ], + "buildPresets": [ + { + "name": "build-default-debug", + "configurePreset": "default", + "configuration": "Debug" + }, + { + "name": "build-default-release", + "inherits": "build-default-debug", + "configuration": "Release" + } + ], + "packagePresets": [ + { + "name": "minimal", + "configurePreset": "default" + }, + { + "name": "defaults", + "hidden": false, + "inherits": [], + "vendor": {}, + "displayName": "", + "description": "", + "environment": {}, + "configurePreset": "default", + "inheritConfigureEnvironment": true + }, + { + "name": "no-environment", + "configurePreset": "default", + "inheritConfigureEnvironment": false, + "environment": { + "TEST_ENV_REF": "x$env{TEST_ENV}x" + } + }, + { + "name": "with-environment", + "inherits": "no-environment", + "inheritConfigureEnvironment": true, + "environment": { + "TEST_ENV_OVERRIDE": "Override", + "TEST_ENV_OVERRIDE_REF": "x$env{TEST_ENV_OVERRIDE}x", + "TEST_ENV_REF": "x$env{TEST_ENV}x" + } + }, + { + "name": "generators", + "inherits": "minimal", + "generators": [ + "TBZ2", + "TXZ" + ] + }, + { + "name": "configurations", + "inherits": "minimal", + "configurations": [ + "Debug", + "Release" + ] + }, + { + "name": "variables", + "inherits": "minimal", + "variables": { + "CPACK_PACKAGE_FILE_NAME": "variables-package" + } + }, + { + "name": "config-file", + "inherits": "minimal", + "configFile": "CPackConfigAlt.cmake" + }, + { + "name": "debug", + "inherits": "minimal", + "output": { + "debug": true + } + }, + { + "name": "verbose", + "inherits": "minimal", + "output": { + "verbose": true + } + }, + { + "name": "package-name", + "inherits": "minimal", + "generators": [ + "External" + ], + "packageName": "package-name" + }, + { + "name": "package-version", + "inherits": "minimal", + "generators": [ + "External" + ], + "packageVersion": "1.0" + }, + { + "name": "package-directory", + "inherits": "minimal", + "packageDirectory": "${sourceDir}/build/default/package-directory" + }, + { + "name": "vendor-name", + "inherits": "minimal", + "generators": [ + "External" + ], + "variables": { + "CPACK_EXTERNAL_PACKAGE_SCRIPT": "${sourceDir}/build/default/external_package.cmake" + }, + "vendorName": "some-vendor" + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsPackage/ListPresets-package-x-stdout.txt b/Tests/RunCMake/CMakePresetsPackage/ListPresets-package-x-stdout.txt new file mode 100644 index 0000000..307ec0a --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/ListPresets-package-x-stdout.txt @@ -0,0 +1,4 @@ +^Available package presets: + + "default" + "with-description" - With Description$ diff --git a/Tests/RunCMake/CMakePresetsPackage/ListPresets.cmake b/Tests/RunCMake/CMakePresetsPackage/ListPresets.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/ListPresets.cmake diff --git a/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in b/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in new file mode 100644 index 0000000..5f3cf48 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in @@ -0,0 +1,20 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default" + } + ], + "packagePresets": [ + { + "name": "default", + "configurePreset": "default" + }, + { + "name": "with-description", + "displayName": "With Description", + "description": "This preset has a description", + "configurePreset": "default" + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsPackage/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsPackage/RunCMakeTest.cmake new file mode 100644 index 0000000..269fb6e --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/RunCMakeTest.cmake @@ -0,0 +1,102 @@ +include(RunCMake) + +# Presets do not support legacy VS generator name architecture suffix. +if(RunCMake_GENERATOR MATCHES "^(Visual Studio [0-9]+ [0-9]+) ") + set(RunCMake_GENERATOR "${CMAKE_MATCH_1}") +endif() + +function(run_cmake_package_presets name CMakePresetsPackage_CONFIGURE_PRESETS CMakePresetsPackage_BUILD_PRESETS CMakePresetsPackage_PACKAGE_PRESETS) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${name}") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_SOURCE_DIR}/build") + set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") + + set(RunCMake_TEST_NO_CLEAN TRUE) + + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + set(CASE_NAME "${name}") + set(CASE_SOURCE_DIR "${RunCMake_SOURCE_DIR}") + configure_file("${RunCMake_SOURCE_DIR}/CMakeLists.txt.in" "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" @ONLY) + + if(NOT CMakePresetsPackage_FILE) + set(CMakePresetsPackage_FILE "${RunCMake_SOURCE_DIR}/${name}.json.in") + endif() + if(EXISTS "${CMakePresetsPackage_FILE}") + configure_file("${CMakePresetsPackage_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakePresets.json" @ONLY) + endif() + + if(NOT CMakeUserPresets_FILE) + set(CMakeUserPresets_FILE "${RunCMake_SOURCE_DIR}/${name}User.json.in") + endif() + if(EXISTS "${CMakeUserPresets_FILE}") + configure_file("${CMakeUserPresets_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakeUserPresets.json" @ONLY) + endif() + + foreach(ASSET ${CMakePresetsPackage_ASSETS}) + configure_file("${RunCMake_SOURCE_DIR}/${ASSET}" "${RunCMake_TEST_SOURCE_DIR}" COPYONLY) + endforeach() + + if (NOT CMakePresetsPackage_NO_CONFIGURE) + foreach(CONFIGURE_PRESET ${CMakePresetsPackage_CONFIGURE_PRESETS}) + run_cmake_command("${name}-configure-${CONFIGURE_PRESET}" + "${CMAKE_COMMAND}" "--preset" "${CONFIGURE_PRESET}") + endforeach() + endif() + + if (NOT CMakePresetsPackage_NO_BUILD) + foreach(BUILD_PRESET ${CMakePresetsPackage_BUILD_PRESETS}) + run_cmake_command("${name}-build-${BUILD_PRESET}" + "${CMAKE_COMMAND}" "--build" "--preset" "${BUILD_PRESET}") + endforeach() + endif() + + set(eq 0) + foreach(PACKAGE_PRESET ${CMakePresetsPackage_PACKAGE_PRESETS}) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages") + + if (EXISTS "${RunCMake_SOURCE_DIR}/${name}-package-${PACKAGE_PRESET}-check.cmake") + set(RunCMake-check-file "${name}-package-${PACKAGE_PRESET}-check.cmake") + else() + set(RunCMake-check-file "check.cmake") + endif() + + if(eq) + run_cmake_command(${name}-package-${PACKAGE_PRESET} + ${CMAKE_CPACK_COMMAND} "--preset=${PACKAGE_PRESET}" ${ARGN}) + set(eq 0) + else() + run_cmake_command(${name}-package-${PACKAGE_PRESET} + ${CMAKE_CPACK_COMMAND} "--preset" "${PACKAGE_PRESET}" ${ARGN}) + set(eq 1) + endif() + endforeach() +endfunction() + +function(check_cpack_packages generators contents) + include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + + set(cpack_dir "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}") + file(GLOB dirs RELATIVE "${cpack_dir}" "${cpack_dir}/*") + if(NOT dirs STREQUAL generators) + string(APPEND RunCMake_TEST_FAILED "Expected CPack generators: ${generators}\nActual CPack generators: ${dirs}\n") + endif() + + if(contents) + foreach(dir IN LISTS dirs) + set(env_file "${cpack_dir}/${dir}/${CPACK_PACKAGE_FILE_NAME}/env.txt") + file(READ "${env_file}" actual_contents) + if(NOT contents STREQUAL actual_contents) + string(REPLACE "\n" "\n " contents_formatted "${contents}") + string(REPLACE "\n" "\n " actual_contents_formatted "${actual_contents}") + string(APPEND RunCMake_TEST_FAILED "Expected contents of ${env_file}:\n ${contents_formatted}\nActual contents:\n ${actual_contents_formatted}\n") + endif() + endforeach() + endif() + + set(RunCMake_TEST_FAILED ${RunCMake_TEST_FAILED} PARENT_SCOPE) +endfunction() + +run_cmake_package_presets(UnsupportedVersion "x" "" "") +run_cmake_package_presets(Good "default" "build-default-debug" "no-environment;with-environment;generators;configurations;variables;config-file;debug;verbose;package-name;package-version;package-directory;vendor-name") +run_cmake_package_presets(ListPresets "default" "" "x" "--list-presets") diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt +++ b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-result.txt diff --git a/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-stderr.txt b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-stderr.txt new file mode 100644 index 0000000..4c461e3 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion: File version must be 6 or higher for package preset support$ diff --git a/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion.json.in b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion.json.in new file mode 100644 index 0000000..e5f7240 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion.json.in @@ -0,0 +1,4 @@ +{ + "version": 5, + "packagePresets": [] +} diff --git a/Tests/RunCMake/CMakePresetsPackage/check.cmake b/Tests/RunCMake/CMakePresetsPackage/check.cmake new file mode 100644 index 0000000..e79c4f1 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/check.cmake @@ -0,0 +1,3 @@ +set(CMakePresets_VALIDATE_SCRIPT_PATH "${RunCMake_SOURCE_DIR}/../CMakePresets/validate_schema.py") +include("${RunCMake_SOURCE_DIR}/../CMakePresets/validate_schema.cmake") +include("${RunCMake_SOURCE_DIR}/../CMakePresets/check.cmake") diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index 9b98ed4..8904c69 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -97,7 +97,7 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR) string(APPEND error_extra "; errors \"${deb_install_files_errors}\"") endif() - if(READELF_EXECUTABLE) + if(CPACK_READELF_EXECUTABLE) string(APPEND error_extra "; readelf \"\n") # Only dynamically linked ELF files are included @@ -106,7 +106,7 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR) if(_FILE MATCHES "ELF.*shared object") string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") - execute_process(COMMAND ${READELF_EXECUTABLE} -d "${CMAKE_MATCH_1}" + execute_process(COMMAND ${CPACK_READELF_EXECUTABLE} -d "${CMAKE_MATCH_1}" WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" RESULT_VARIABLE result OUTPUT_VARIABLE output diff --git a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake index 60d02e7..3b02579 100644 --- a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake +++ b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake @@ -14,9 +14,9 @@ function(get_test_prerequirements found_var config_file) endif() # optional tool for some tests - find_program(READELF_EXECUTABLE NAMES readelf) - if(READELF_EXECUTABLE) + find_program(CPACK_READELF_EXECUTABLE NAMES readelf) + if(CPACK_READELF_EXECUTABLE) file(APPEND "${config_file}" - "\nset(READELF_EXECUTABLE \"${READELF_EXECUTABLE}\")") + "\nset(CPACK_READELF_EXECUTABLE \"${CPACK_READELF_EXECUTABLE}\")") endif() endfunction() diff --git a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake index e95cd15..a4741ba 100644 --- a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake +++ b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake @@ -15,9 +15,9 @@ function(get_test_prerequirements found_var config_file) endif() # optional tool for some tests - find_program(OBJDUMP_EXECUTABLE objdump) - if(OBJDUMP_EXECUTABLE) + find_program(CPACK_OBJDUMP_EXECUTABLE objdump) + if(CPACK_OBJDUMP_EXECUTABLE) file(APPEND "${config_file}" - "\nset(OBJDUMP_EXECUTABLE \"${OBJDUMP_EXECUTABLE}\")") + "\nset(CPACK_OBJDUMP_EXECUTABLE \"${CPACK_OBJDUMP_EXECUTABLE}\")") endif() endfunction() diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake index be44b2e..b0bfc9d 100644 --- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake @@ -1,7 +1,7 @@ function(get_test_prerequirements found_var config_file) include(${config_file}) - if(READELF_EXECUTABLE) + if(CPACK_READELF_EXECUTABLE) set(${found_var} true PARENT_SCOPE) endif() endfunction() diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake index be44b2e..b0bfc9d 100644 --- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake @@ -1,7 +1,7 @@ function(get_test_prerequirements found_var config_file) include(${config_file}) - if(READELF_EXECUTABLE) + if(CPACK_READELF_EXECUTABLE) set(${found_var} true PARENT_SCOPE) endif() endfunction() diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake index 90cfe44..f5df8a2 100644 --- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake @@ -2,7 +2,7 @@ function(get_test_prerequirements found_var config_file) if(SUBTEST_SUFFIX MATCHES ".*single_debug_info") include(${config_file}) - if(OBJDUMP_EXECUTABLE) + if(CPACK_OBJDUMP_EXECUTABLE) set(${found_var} true PARENT_SCOPE) endif() else() diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 8ac1747..df3e82a 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -284,7 +284,7 @@ function(run_TestOutputTruncation mode expected) file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " add_test(Truncation_${mode} \"${CMAKE_COMMAND}\" -E echo 123456789) ") - run_cmake_command(TestOutputTruncation + run_cmake_command(TestOutputTruncation_${mode} ${CMAKE_CTEST_COMMAND} -M Experimental -T Test --no-compress-output --test-output-size-passed 5 @@ -294,6 +294,7 @@ endfunction() run_TestOutputTruncation("head" "\\.\\.\\.6789") run_TestOutputTruncation("middle" "12\\.\\.\\..*\\.\\.\\.89") run_TestOutputTruncation("tail" "12345\\.\\.\\.") +run_TestOutputTruncation("bad" "") # Test --stop-on-failure function(run_stop_on_failure) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-stderr.txt new file mode 100644 index 0000000..6afc02b --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Invalid value for '--test-output-truncation': bad$ diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-stderr.txt index 30b46ce..30b46ce 100644 --- a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-stderr.txt diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt new file mode 100644 index 0000000..30b46ce --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt @@ -0,0 +1 @@ +^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt new file mode 100644 index 0000000..30b46ce --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt @@ -0,0 +1 @@ +^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl diff --git a/Tests/RunCMake/CTestTimeout/TestTimeout.c b/Tests/RunCMake/CTestTimeout/TestTimeout.c index 5a008a7..0d534fc 100644 --- a/Tests/RunCMake/CTestTimeout/TestTimeout.c +++ b/Tests/RunCMake/CTestTimeout/TestTimeout.c @@ -1,6 +1,7 @@ #if defined(_WIN32) # include <windows.h> #else +# include <sched.h> # include <unistd.h> #endif diff --git a/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt b/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt index 7b6eb53..ce40a7a 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt @@ -1,4 +1,4 @@ ^(CMake Warning in [^ -]*/Tests/RunCMake/CUDA_architectures/architectures-suffix-build/CMakeFiles/CMakeTmp/CMakeLists.txt: +]*/Tests/RunCMake/CUDA_architectures/architectures-suffix-build/CMakeFiles/CMakeScratch/TryCompile-[^/]*/CMakeLists.txt: Clang doesn't support disabling CUDA real code generation. *)*$ diff --git a/Tests/RunCMake/CXXModules/CMakeLists.txt b/Tests/RunCMake/CXXModules/CMakeLists.txt index 338a412..708d92c 100644 --- a/Tests/RunCMake/CXXModules/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.23) project(${RunCMake_TEST} NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "17be90bd-a850-44e0-be50-448de847d652") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake new file mode 100644 index 0000000..cb6f6bd --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake @@ -0,0 +1,40 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/export-modules-targets.cmake" export_script) + +if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules\.cmake"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property script inclusion") +endif () + +file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules.cmake" trampoline_script) + +if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property per-config script inclusion(s)") + endif () +else () + if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-[^.]*\.cmake"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property per-config script inclusion(s)") + endif () +endif () + +set(any_exists 0) +foreach (config IN ITEMS noconfig Debug Release RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-${config}.cmake") + continue () + endif () + set(any_exists 1) + + file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-${config}.cmake" config_script) + + if (NOT config_script MATCHES "include\\(\"\\\${CMAKE_CURRENT_LIST_DIR}/target-export-name-${config}\\.cmake\"\\)") + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module per-target property script inclusion") + endif () +endforeach () + +if (NOT any_exists) + list(APPEND RunCMake_TEST_FAILED + "No per-configuration target files exist.") +endif () diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModules-stderr.txt b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-stderr.txt new file mode 100644 index 0000000..c05b0b4 --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at ExportBuildCxxModules.cmake:6 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModules.cmake b/Tests/RunCMake/CXXModules/ExportBuildCxxModules.cmake new file mode 100644 index 0000000..850f8dc --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModules.cmake @@ -0,0 +1,22 @@ +enable_language(CXX) +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "") + +add_library(export-modules) +target_sources(export-modules + PUBLIC + FILE_SET fs TYPE CXX_MODULES FILES + sources/module.cxx) +target_compile_features(export-modules + PRIVATE + cxx_std_20) +set_property(TARGET export-modules + PROPERTY EXPORT_NAME export-name) + +install(TARGETS export-modules + EXPORT exp + FILE_SET fs DESTINATION "include/cxx/export-modules") + +export(EXPORT exp + FILE "${CMAKE_BINARY_DIR}/lib/cmake/export-modules/export-modules-targets.cmake" + CXX_MODULES_DIRECTORY "cxx-modules") diff --git a/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake new file mode 100644 index 0000000..9e83fd8 --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake @@ -0,0 +1,35 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/exp.cmake" export_script) + +if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules\.cmake"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property script inclusion") +endif () + +file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules.cmake" trampoline_script) + +if (NOT trampoline_script MATCHES [[file\(GLOB _cmake_cxx_module_includes "\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-\*\.cmake"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property per-config script inclusion(s)") +endif () + +set(any_exists 0) +foreach (config IN ITEMS noconfig Debug Release RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-${config}.cmake") + continue () + endif () + set(any_exists 1) + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-${config}.cmake" config_script) + + if (NOT config_script MATCHES "include\\(\"\\\${CMAKE_CURRENT_LIST_DIR}/target-export-name-${config}\\.cmake\"\\)") + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module per-target property script inclusion") + endif () +endforeach () + +if (NOT any_exists) + list(APPEND RunCMake_TEST_FAILED + "No per-configuration target files exist.") +endif () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/ExportInstallCxxModules-stderr.txt b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-stderr.txt new file mode 100644 index 0000000..4fe27a9 --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at ExportInstallCxxModules.cmake:6 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/ExportInstallCxxModules.cmake b/Tests/RunCMake/CXXModules/ExportInstallCxxModules.cmake new file mode 100644 index 0000000..234a4b5 --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportInstallCxxModules.cmake @@ -0,0 +1,22 @@ +enable_language(CXX) +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "") + +add_library(export-modules) +target_sources(export-modules + PUBLIC + FILE_SET fs TYPE CXX_MODULES FILES + sources/module.cxx) +target_compile_features(export-modules + PRIVATE + cxx_std_20) +set_property(TARGET export-modules + PROPERTY EXPORT_NAME export-name) + +install(TARGETS export-modules + EXPORT exp + FILE_SET fs DESTINATION "include/cxx/export-modules") + +install(EXPORT exp + DESTINATION "lib/cmake/export-modules" + CXX_MODULES_DIRECTORY "cxx-modules") diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported-stderr.txt new file mode 100644 index 0000000..1b4ba5d --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at FileSetModuleHeaderUnitsInterfaceImported.cmake:2 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake new file mode 100644 index 0000000..9ff5606 --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake @@ -0,0 +1,8 @@ +add_library(module-header SHARED IMPORTED) +target_sources(module-header + INTERFACE + FILE_SET fs TYPE CXX_MODULE_HEADER_UNITS FILES + sources/module-header.h) +target_compile_features(module-header + INTERFACE + cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported-stderr.txt new file mode 100644 index 0000000..4420bbc --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at FileSetModulesInterfaceImported.cmake:2 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake new file mode 100644 index 0000000..6640ae9 --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake @@ -0,0 +1,8 @@ +add_library(module SHARED IMPORTED) +target_sources(module + INTERFACE + FILE_SET fs TYPE CXX_MODULES FILES + sources/module.cxx) +target_compile_features(module + INTERFACE + cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/InstallBMI-check.cmake b/Tests/RunCMake/CXXModules/InstallBMI-check.cmake new file mode 100644 index 0000000..f891c80 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMI-check.cmake @@ -0,0 +1,24 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script) + +if (NOT install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi" OR NOT CMAKE_INSTALL_COMPONENT\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find BMI install script component for `bmi`") +endif () + +if (NOT install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find BMI install script inclusion") +endif () + +if (NOT install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi-optional"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find BMI install script component for `bmi-optional`") +endif () + +if (NOT install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi-only-debug" OR NOT CMAKE_INSTALL_COMPONENT\) + if\(CMAKE_INSTALL_CONFIG_NAME MATCHES "\^\(\[Dd\]\[Ee\]\[Bb\]\[Uu\]\[Gg\]\)\$"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find BMI install script component for `bmi-only-debug`") +endif () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/InstallBMI-stderr.txt b/Tests/RunCMake/CXXModules/InstallBMI-stderr.txt new file mode 100644 index 0000000..fc3c7db --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMI-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at InstallBMI.cmake:8 \(install\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/InstallBMI.cmake b/Tests/RunCMake/CXXModules/InstallBMI.cmake new file mode 100644 index 0000000..f0947b4 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMI.cmake @@ -0,0 +1,23 @@ +enable_language(CXX) + +add_library(install-bmi) +target_sources(install-bmi + PRIVATE + sources/cxx-anchor.cxx) + +install(TARGETS install-bmi + CXX_MODULES_BMI + DESTINATION "lib/bmi" + COMPONENT "bmi") + +install(TARGETS install-bmi + CXX_MODULES_BMI + DESTINATION "lib/bmi" + EXCLUDE_FROM_ALL + COMPONENT "bmi-optional") + +install(TARGETS install-bmi + CXX_MODULES_BMI + DESTINATION "lib/bmi" + CONFIGURATIONS Debug + COMPONENT "bmi-only-debug") diff --git a/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-check.cmake b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-check.cmake new file mode 100644 index 0000000..32a37ad --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-check.cmake @@ -0,0 +1,8 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script) + +if (NOT install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi-generic-args\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find BMI install script inclusion") +endif () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-stderr.txt b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-stderr.txt new file mode 100644 index 0000000..44c961f --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at InstallBMIGenericArgs.cmake:8 \(install\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/InstallBMIGenericArgs.cmake b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs.cmake new file mode 100644 index 0000000..8f17143 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +add_library(install-bmi-generic-args) +target_sources(install-bmi-generic-args + PRIVATE + sources/cxx-anchor.cxx) + +install(TARGETS install-bmi-generic-args + DESTINATION "bin") diff --git a/Tests/RunCMake/CXXModules/InstallBMIIgnore-check.cmake b/Tests/RunCMake/CXXModules/InstallBMIIgnore-check.cmake new file mode 100644 index 0000000..7d13ef0 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIIgnore-check.cmake @@ -0,0 +1,13 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script) + +if (install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi" OR NOT CMAKE_INSTALL_COMPONENT\)]]) + list(APPEND RunCMake_TEST_FAILED + "Found BMI install script component for `bmi`") +endif () + +if (install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi-ignore\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Found BMI install script inclusion") +endif () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/InstallBMIIgnore-stderr.txt b/Tests/RunCMake/CXXModules/InstallBMIIgnore-stderr.txt new file mode 100644 index 0000000..d9d2c2d --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIIgnore-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at InstallBMIIgnore.cmake:5 \(install\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/InstallBMIIgnore.cmake b/Tests/RunCMake/CXXModules/InstallBMIIgnore.cmake new file mode 100644 index 0000000..f339511 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIIgnore.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +add_library(install-bmi-ignore INTERFACE) + +install(TARGETS install-bmi-ignore + CXX_MODULES_BMI + # An empty destination ignores BMI installation. + DESTINATION "" + COMPONENT "bmi") diff --git a/Tests/RunCMake/CXXModules/InstallBMINoGenericArgs-check.cmake b/Tests/RunCMake/CXXModules/InstallBMINoGenericArgs-check.cmake new file mode 100644 index 0000000..412e260 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMINoGenericArgs-check.cmake @@ -0,0 +1,8 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script) + +if (install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi-generic-args\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Found BMI install script inclusion") +endif () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake new file mode 100644 index 0000000..0d08c44 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake @@ -0,0 +1,34 @@ +include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake") + +if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(have_file 0) + foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${config}/CXXDependInfo.json") + continue () + endif () + set(have_file 1) + + set(CMAKE_BUILD_TYPE "${config}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-private.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + endforeach () + + if (NOT have_file) + list(APPEND RunCMake_TEST_FAILED + "No recognized build configurations found.") + endif () +else () + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-private.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") +endif () diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-stderr.txt b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-stderr.txt new file mode 100644 index 0000000..ebf7be5 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at NinjaDependInfoBMIInstall.cmake:14 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall.cmake new file mode 100644 index 0000000..32dc42d --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall.cmake @@ -0,0 +1,76 @@ +# Fake out that we have dyndep; we only need to generate, not actually build +# here. +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "") + +enable_language(CXX) + +if (NOT CMAKE_GENERATOR MATCHES "Ninja") + message(FATAL_ERROR + "This test requires a 'Ninja' generator to be used.") +endif () + +add_library(ninja-bmi-install-public) +target_sources(ninja-bmi-install-public + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-bmi-install-public + PRIVATE + cxx_std_20) +set_property(TARGET ninja-bmi-install-public + PROPERTY EXPORT_NAME "with-public") + +install(TARGETS ninja-bmi-install-public + FILE_SET modules + DESTINATION "lib/cxx" + COMPONENT "modules" + FILE_SET internal_partitions + DESTINATION "lib/cxx/internals" + COMPONENT "modules-internal" + CXX_MODULES_BMI + DESTINATION "lib/cxx/modules/$<CONFIG>" + COMPONENT "bmi") + +add_library(ninja-bmi-install-private) +target_sources(ninja-bmi-install-private + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PRIVATE + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-bmi-install-private + PRIVATE + cxx_std_20) +set_property(TARGET ninja-bmi-install-private + PROPERTY EXPORT_NAME "with-private") + +set(CMAKE_INSTALL_MESSAGE LAZY) +install(TARGETS ninja-bmi-install-private + CXX_MODULES_BMI + DESTINATION "lib/cxx/modules/private/$<CONFIG>" + PERMISSIONS + OWNER_READ OWNER_WRITE + GROUP_READ + WORLD_READ + COMPONENT "bmi") diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake new file mode 100644 index 0000000..7720257 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake @@ -0,0 +1,34 @@ +include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake") + +if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(have_file 0) + foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${config}/CXXDependInfo.json") + continue () + endif () + set(have_file 1) + + set(CMAKE_BUILD_TYPE "${config}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-private.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + endforeach () + + if (NOT have_file) + list(APPEND RunCMake_TEST_FAILED + "No recognized build configurations found.") + endif () +else () + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-private.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") +endif () diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoExport-stderr.txt b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-stderr.txt new file mode 100644 index 0000000..e328223 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at NinjaDependInfoExport.cmake:14 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoExport.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoExport.cmake new file mode 100644 index 0000000..05e7ef7 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoExport.cmake @@ -0,0 +1,85 @@ +# Fake out that we have dyndep; we only need to generate, not actually build +# here. +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "") + +enable_language(CXX) + +if (NOT CMAKE_GENERATOR MATCHES "Ninja") + message(FATAL_ERROR + "This test requires a 'Ninja' generator to be used.") +endif () + +add_library(ninja-exports-public) +target_sources(ninja-exports-public + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-exports-public + PRIVATE + cxx_std_20) +set_property(TARGET ninja-exports-public + PROPERTY EXPORT_NAME "with-public") + +install(TARGETS ninja-exports-public + EXPORT exp + FILE_SET modules + DESTINATION "lib/cxx" + COMPONENT "modules" + FILE_SET internal_partitions + DESTINATION "lib/cxx/internals" + COMPONENT "modules-internal") + +add_library(ninja-exports-private) +target_sources(ninja-exports-private + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PRIVATE + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-exports-private + PRIVATE + cxx_std_20) +set_property(TARGET ninja-exports-private + PROPERTY EXPORT_NAME "with-private") + +install(TARGETS ninja-exports-private + EXPORT exp) + +# Test multiple build exports. +export(EXPORT exp + FILE "${CMAKE_BINARY_DIR}/lib/cmake/export1/export1-targets.cmake" + NAMESPACE export1:: + CXX_MODULES_DIRECTORY "cxx-modules") +export(EXPORT exp + FILE "${CMAKE_BINARY_DIR}/lib/cmake/export2/export2-targets.cmake" + CXX_MODULES_DIRECTORY "cxx-modules") + +# Test multiple install exports. +install(EXPORT exp + DESTINATION "lib/cmake/export1" + NAMESPACE export1:: + CXX_MODULES_DIRECTORY "cxx-modules") +install(EXPORT exp + DESTINATION "lib/cmake/export2" + CXX_MODULES_DIRECTORY "cxx-modules") diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake new file mode 100644 index 0000000..b9a1315 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake @@ -0,0 +1,34 @@ +include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake") + +if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(have_file 0) + foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/${config}/CXXDependInfo.json") + continue () + endif () + set(have_file 1) + + set(CMAKE_BUILD_TYPE "${config}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-private.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + endforeach () + + if (NOT have_file) + list(APPEND RunCMake_TEST_FAILED + "No recognized build configurations found.") + endif () +else () + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-private.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") +endif () diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-stderr.txt b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-stderr.txt new file mode 100644 index 0000000..ca430cc --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at NinjaDependInfoFileSet.cmake:14 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet.cmake new file mode 100644 index 0000000..74e729e --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet.cmake @@ -0,0 +1,59 @@ +# Fake out that we have dyndep; we only need to generate, not actually build +# here. +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "") + +enable_language(CXX) + +if (NOT CMAKE_GENERATOR MATCHES "Ninja") + message(FATAL_ERROR + "This test requires a 'Ninja' generator to be used.") +endif () + +add_library(ninja-file-sets-public) +target_sources(ninja-file-sets-public + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-file-sets-public + PRIVATE + cxx_std_20) + +install(TARGETS ninja-file-sets-public + FILE_SET modules + DESTINATION "lib/cxx" + COMPONENT "modules" + FILE_SET internal_partitions + DESTINATION "lib/cxx/internals" + COMPONENT "modules-internal") + +add_library(ninja-file-sets-private) +target_sources(ninja-file-sets-private + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PRIVATE + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-file-sets-private + PRIVATE + cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/NoCXX20.cmake b/Tests/RunCMake/CXXModules/NoCXX20.cmake index d502f7c..b7372e8 100644 --- a/Tests/RunCMake/CXXModules/NoCXX20.cmake +++ b/Tests/RunCMake/CXXModules/NoCXX20.cmake @@ -5,6 +5,7 @@ target_sources(nocxx20 PUBLIC FILE_SET fs TYPE CXX_MODULES FILES sources/module.cxx) -target_compile_features(nocxx20 - PRIVATE - cxx_std_17) +set_target_properties(nocxx20 + PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON) diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index 68fdcae..3f17c1f 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -60,12 +60,30 @@ foreach (fileset_type IN LISTS fileset_types) foreach (scope IN LISTS scopes) run_cmake("FileSet${fileset_type}${scope}") endforeach () + run_cmake("FileSet${fileset_type}InterfaceImported") # Test the error message when a non-C++ source file is found in the source # list. run_cmake("NotCXXSource${fileset_type}") endforeach () +run_cmake(InstallBMI) +run_cmake(InstallBMIGenericArgs) +run_cmake(InstallBMIIgnore) + +run_cmake(ExportBuildCxxModules) +run_cmake(ExportInstallCxxModules) + +# Generator-specific tests. +if (RunCMake_GENERATOR MATCHES "Ninja") + run_cmake(NinjaDependInfoFileSet) + run_cmake(NinjaDependInfoExport) + run_cmake(NinjaDependInfoBMIInstall) +else () + message(FATAL_ERROR + "Please add 'DependInfo' tests for the '${RunCMake_GENERATOR}' generator.") +endif () + # Actual compilation tests. if (NOT CMake_TEST_MODULE_COMPILATION) return () @@ -86,13 +104,23 @@ function (run_cxx_module_test directory) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif () - set(RunCMake_TEST_OPTIONS + if (RunCMake_CXXModules_INSTALL) + set(prefix "${RunCMake_BINARY_DIR}/examples/${test_name}-install") + file(REMOVE_RECURSE "${prefix}") + list(APPEND RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${prefix}") + endif () + + list(APPEND RunCMake_TEST_OPTIONS "-DCMake_TEST_MODULE_COMPILATION_RULES=${CMake_TEST_MODULE_COMPILATION_RULES}" ${ARGN}) run_cmake("examples/${test_name}") set(RunCMake_TEST_NO_CLEAN 1) - run_cmake_command("${test_name}-build" "${CMAKE_COMMAND}" --build . --config Debug) - run_cmake_command("${test_name}-test" "${CMAKE_CTEST_COMMAND}" -C Debug) + run_cmake_command("examples/${test_name}-build" "${CMAKE_COMMAND}" --build . --config Debug) + if (RunCMake_CXXModules_INSTALL) + run_cmake_command("examples/${test_name}-install" "${CMAKE_COMMAND}" --build . --target install --config Debug) + endif () + run_cmake_command("examples/${test_name}-test" "${CMAKE_CTEST_COMMAND}" -C Debug --output-on-failure) endfunction () string(REPLACE "," ";" CMake_TEST_MODULE_COMPILATION "${CMake_TEST_MODULE_COMPILATION}") @@ -102,6 +130,8 @@ if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(simple) run_cxx_module_test(library library-static -DBUILD_SHARED_LIBS=OFF) run_cxx_module_test(generated) + run_cxx_module_test(public-req-private) + run_cxx_module_test(deep-chain) endif () # Tests which use named modules in shared libraries. @@ -118,3 +148,23 @@ endif () if ("internal_partitions" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(internal-partitions) endif () + +# Tests which install BMIs +if ("export_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) + run_cxx_module_test(export-interface-build) + run_cxx_module_test(export-bmi-and-interface-build) +endif () + +# All of the following tests perform installation. +set(RunCMake_CXXModules_INSTALL 1) + +# Tests which install BMIs +if ("install_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) + run_cxx_module_test(install-bmi) + run_cxx_module_test(install-bmi-and-interfaces) + + if ("export_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) + run_cxx_module_test(export-interface-install) + run_cxx_module_test(export-bmi-and-interface-install) + endif () +endif () diff --git a/Tests/RunCMake/CXXModules/check-json.cmake b/Tests/RunCMake/CXXModules/check-json.cmake new file mode 100644 index 0000000..19d0c8a --- /dev/null +++ b/Tests/RunCMake/CXXModules/check-json.cmake @@ -0,0 +1,160 @@ +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) + +function (json_placeholders in out) + string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" in "${in}") + if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + string(REPLACE "<CONFIG_DIR>" "${CMAKE_BUILD_TYPE}/" in "${in}") + else () + string(REPLACE "<CONFIG_DIR>" "" in "${in}") + endif () + if (CMAKE_BUILD_TYPE) + string(REPLACE "<CONFIG_FORCE>" "${CMAKE_BUILD_TYPE}" in "${in}") + else () + string(REPLACE "<CONFIG_FORCE>" "noconfig" in "${in}") + endif () + string(REPLACE "<SOURCE_DIR>" "${RunCMake_SOURCE_DIR}" in "${in}") + string(REPLACE "<BINARY_DIR>" "${RunCMake_TEST_BINARY_DIR}" in "${in}") + set("${out}" "${in}" PARENT_SCOPE) +endfunction () + +function (check_json_value path actual_type expect_type actual_value expect_value) + if (NOT actual_type STREQUAL expect_type) + list(APPEND RunCMake_TEST_FAILED + "Type mismatch at ${path}: ${actual_type} vs. ${expect_type}") + return () + endif () + + if (actual_type STREQUAL NULL) + # Nothing to check + elseif (actual_type STREQUAL BOOLEAN) + if (NOT actual_value STREQUAL expect_value) + list(APPEND RunCMake_TEST_FAILED + "Boolean mismatch at ${path}: ${actual_value} vs. ${expect_value}") + endif () + elseif (actual_type STREQUAL NUMBER) + if (NOT actual_value EQUAL expect_value) + list(APPEND RunCMake_TEST_FAILED + "Number mismatch at ${path}: ${actual_value} vs. ${expect_value}") + endif () + elseif (actual_type STREQUAL STRING) + # Allow some values to be ignored. + if (expect_value STREQUAL "<IGNORE>") + return () + endif () + + json_placeholders("${expect_value}" expect_value_expanded) + if (NOT actual_value STREQUAL expect_value_expanded) + list(APPEND RunCMake_TEST_FAILED + "String mismatch at ${path}: ${actual_value} vs. ${expect_value_expanded}") + endif () + elseif (actual_type STREQUAL ARRAY) + check_json_array("${path}" "${actual_value}" "${expect_value}") + elseif (actual_type STREQUAL OBJECT) + check_json_object("${path}" "${actual_value}" "${expect_value}") + endif () +endfunction () + +# Check that two arrays are the same. +function (check_json_array path actual expect) + string(JSON actual_len LENGTH "${actual}") + string(JSON expect_len LENGTH "${expect}") + + set(iter_len "${actual_len}") + if (actual_len LESS expect_len) + list(APPEND RunCMake_TEST_FAILED + "Missing array items at ${path}") + elseif (expect_len LESS actual_len) + list(APPEND RunCMake_TEST_FAILED + "Extra array items at ${path}") + set(iter_len "${expect_len}") + endif () + + foreach (idx RANGE "${iter_len}") + if (idx EQUAL iter_len) + break () + endif () + + set(new_path "${path}[${idx}]") + string(JSON actual_type TYPE "${actual}" "${idx}") + string(JSON expect_type TYPE "${expect}" "${idx}") + string(JSON actual_value GET "${actual}" "${idx}") + string(JSON expect_value GET "${expect}" "${idx}") + check_json_value("${new_path}" "${actual_type}" "${expect_type}" "${actual_value}" "${expect_value}") + endforeach () +endfunction () + +# Check that two inner objects are the same. +function (check_json_object path actual expect) + string(JSON actual_len LENGTH "${actual}") + string(JSON expect_len LENGTH "${expect}") + + set(actual_keys "") + set(expect_keys "") + foreach (idx RANGE "${actual_len}") + if (idx EQUAL actual_len) + break () + endif () + + string(JSON actual_key MEMBER "${actual}" "${idx}") + list(APPEND actual_keys "${actual_key}") + endforeach () + foreach (idx RANGE "${expect_len}") + if (idx EQUAL expect_len) + break () + endif () + + string(JSON expect_key MEMBER "${expect}" "${idx}") + list(APPEND expect_keys "${expect_key}") + endforeach () + + json_placeholders("${expect_keys}" expect_keys_expanded) + + set(actual_keys_missed "${actual_keys}") + set(expect_keys_missed "${expect_keys}") + + set(common_keys "") + set(expect_keys_stack "${expect_keys}") + while (expect_keys_stack) + list(POP_BACK expect_keys_stack expect_key) + json_placeholders("${expect_key}" expect_key_expanded) + + if (expect_key_expanded IN_LIST actual_keys_missed AND + expect_key IN_LIST expect_keys_missed) + list(APPEND common_keys "${expect_key}") + endif () + + list(REMOVE_ITEM actual_keys_missed "${expect_key_expanded}") + list(REMOVE_ITEM expect_keys_missed "${expect_key}") + endwhile () + + if (actual_keys_missed) + string(REPLACE ";" ", " actual_keys_missed_text "${actual_keys_missed}") + list(APPEND RunCMake_TEST_FAILED + "Missing expected members at ${path}: ${actual_keys_missed_text}") + endif () + if (expect_keys_missed) + string(REPLACE ";" ", " expect_keys_missed_text "${expect_keys_missed}") + list(APPEND RunCMake_TEST_FAILED + "Extra unexpected members at ${path}: ${expect_keys_missed_text}") + endif () + + foreach (key IN LISTS common_keys) + json_placeholders("${key}" key_expanded) + set(new_path "${path}.${key_expanded}") + string(JSON actual_type TYPE "${actual}" "${key_expanded}") + string(JSON expect_type TYPE "${expect}" "${key}") + string(JSON actual_value GET "${actual}" "${key_expanded}") + string(JSON expect_value GET "${expect}" "${key}") + check_json_value("${new_path}" "${actual_type}" "${expect_type}" "${actual_value}" "${expect_value}") + endforeach () +endfunction () + +# Check that two JSON objects are the same. +function (check_json actual expect) + check_json_object("" "${actual}" "${expect}") +endfunction () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") + +cmake_policy(POP) diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi-and-interfaces.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi-and-interfaces.cmake new file mode 100644 index 0000000..f99455b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi-and-interfaces.cmake @@ -0,0 +1,22 @@ +function (check_for_bmi prefix destination name) + set(found 0) + foreach (ext IN ITEMS gcm) + if (EXISTS "${prefix}/${destination}/${name}.${ext}") + set(found 1) + break () + endif () + endforeach () + + if (NOT found) + message(SEND_ERROR + "Failed to find the ${name} BMI") + endif () +endfunction () + +function (check_for_interface prefix destination subdir name) + set(found 0) + if (NOT EXISTS "${prefix}/${destination}/${subdir}/${name}") + message(SEND_ERROR + "Failed to find the ${name} module interface") + endif () +endfunction () diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake new file mode 100644 index 0000000..91f3995 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake @@ -0,0 +1,27 @@ +function (check_for_bmi prefix destination name) + set(found 0) + foreach (ext IN ITEMS gcm ifc) + if (EXISTS "${prefix}/${destination}/${name}.${ext}") + set(found 1) + break () + endif () + endforeach () + + if (NOT found) + message(SEND_ERROR + "Failed to find the ${name} BMI") + endif () +endfunction () + +function (check_for_interface prefix destination subdir name) + set(found 0) + if (NOT EXISTS "${prefix}/${destination}/${subdir}/${name}") + message(SEND_ERROR + "Failed to find the ${name} module interface") + endif () +endfunction () + +function (report_dirs prefix destination) + message("prefix: ${prefix}") + message("destination: ${destination}") +endfunction () diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake index 91ad208..381094e 100644 --- a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake +++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake @@ -1,4 +1,4 @@ -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "17be90bd-a850-44e0-be50-448de847d652") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") if (NOT EXISTS "${CMake_TEST_MODULE_COMPILATION_RULES}") message(FATAL_ERROR diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt new file mode 100644 index 0000000..515b240 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_deep_chain CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(a STATIC) +target_sources(a + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + a.cxx) +target_compile_features(a PUBLIC cxx_std_20) + +add_library(b STATIC) +target_sources(b + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + b.cxx) +target_compile_features(b PUBLIC cxx_std_20) +target_link_libraries(b PUBLIC a) + +add_library(c STATIC) +target_sources(c + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + c.cxx) +target_compile_features(c PUBLIC cxx_std_20) +target_link_libraries(c PUBLIC b) + +add_library(d STATIC) +target_sources(d + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + d.cxx) +target_compile_features(d PUBLIC cxx_std_20) +target_link_libraries(d PUBLIC c) + +add_library(e STATIC) +target_sources(e + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + e.cxx) +target_compile_features(e PUBLIC cxx_std_20) +target_link_libraries(e PUBLIC d) + +add_executable(exe) +target_link_libraries(exe PRIVATE e) +target_sources(exe + PRIVATE + main.cxx) + +add_test(NAME exe COMMAND exe) diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/a.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/a.cxx new file mode 100644 index 0000000..9edaec9 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/a.cxx @@ -0,0 +1,6 @@ +export module a; + +export int a() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/b.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/b.cxx new file mode 100644 index 0000000..38ab0c2 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/b.cxx @@ -0,0 +1,7 @@ +export module b; +import a; + +export int b() +{ + return a(); +} diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/c.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/c.cxx new file mode 100644 index 0000000..580a458 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/c.cxx @@ -0,0 +1,7 @@ +export module c; +import b; + +export int c() +{ + return b(); +} diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/d.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/d.cxx new file mode 100644 index 0000000..78bc5ba --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/d.cxx @@ -0,0 +1,7 @@ +export module d; +import c; + +export int d() +{ + return c(); +} diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/e.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/e.cxx new file mode 100644 index 0000000..e019440 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/e.cxx @@ -0,0 +1,7 @@ +export module e; +import d; + +export int e() +{ + return d(); +} diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/main.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/main.cxx new file mode 100644 index 0000000..0b7c15d --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/main.cxx @@ -0,0 +1,6 @@ +import e; + +int main(int argc, char* argv[]) +{ + return e(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt new file mode 100644 index 0000000..a450b7e --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_bmi_and_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_bmi_and_interfaces STATIC) +target_sources(export_bmi_and_interfaces + PRIVATE + forward.cxx + PRIVATE + FILE_SET modules_private TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + private.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(export_bmi_and_interfaces PUBLIC cxx_std_20) + +install(TARGETS export_bmi_and_interfaces + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu" + CXX_MODULES_BMI DESTINATION "lib/cxx/bmi") +export(EXPORT CXXModules + NAMESPACE CXXModules:: + FILE "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-targets.cmake" + CXX_MODULES_DIRECTORY "export_bmi_and_interfaces-cxx-modules") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-config.cmake" + "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_bmi_and_interfaces-targets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) +") + +set(generator + -G "${CMAKE_GENERATOR}") +if (CMAKE_GENERATOR_TOOLSET) + list(APPEND generator + -T "${CMAKE_GENERATOR_TOOLSET}") +endif () +if (CMAKE_GENERATOR_PLATFORM) + list(APPEND generator + -A "${CMAKE_GENERATOR_PLATFORM}") +endif () + +add_test(NAME export_bmi_and_interfaces_build + COMMAND + "${CMAKE_COMMAND}" + "-Dexpected_source_dir=${CMAKE_CURRENT_SOURCE_DIR}" + "-Dexpected_binary_dir=${CMAKE_CURRENT_BINARY_DIR}" + "-Dexport_bmi_and_interfaces_DIR=${CMAKE_CURRENT_BINARY_DIR}" + ${generator} + -S "${CMAKE_CURRENT_SOURCE_DIR}/test" + -B "${CMAKE_CURRENT_BINARY_DIR}/test") diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx new file mode 100644 index 0000000..e0b1872 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx @@ -0,0 +1,8 @@ +export module importable; + +int forwarding(); + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/private.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/private.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int from_private() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt new file mode 100644 index 0000000..b814b3b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_library NONE) + +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") + +find_package(export_bmi_and_interfaces REQUIRED) + +if (NOT TARGET CXXModules::export_bmi_and_interfaces) + message(FATAL_ERROR + "Missing imported target") +endif () + +get_property(file_sets TARGET CXXModules::export_bmi_and_interfaces + PROPERTY INTERFACE_CXX_MODULE_SETS) +if (NOT file_sets STREQUAL "modules") + message(FATAL_ERROR + "Incorrect exported file sets in `CXXModules::export_bmi_and_interfaces`: `${file_sets}`") +endif () + +get_property(file_set_files TARGET CXXModules::export_bmi_and_interfaces + PROPERTY CXX_MODULE_SET_modules) +if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx") + message(FATAL_ERROR + "Incorrect exported file set paths in CXXModules::export_bmi_and_interfaces`: `${file_set_files}`") +endif () + +get_property(imported_modules TARGET CXXModules::export_bmi_and_interfaces + PROPERTY IMPORTED_CXX_MODULES_DEBUG) +if (NOT imported_modules MATCHES "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/CMakeFiles/export_bmi_and_interfaces.dir(/Debug)?/importable.(gcm|pcm|ifc)") + message(FATAL_ERROR + "Incorrect exported modules in CXXModules::export_bmi_and_interfaces`: `${imported_modules}`") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt new file mode 100644 index 0000000..a5574fe --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt @@ -0,0 +1,59 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_bmi_and_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_bmi_and_interfaces STATIC) +target_sources(export_bmi_and_interfaces + PRIVATE + forward.cxx + PRIVATE + FILE_SET modules_private TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + private.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(export_bmi_and_interfaces PUBLIC cxx_std_20) + +install(TARGETS export_bmi_and_interfaces + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu" + CXX_MODULES_BMI DESTINATION "lib/cxx/bmi") +install(EXPORT CXXModules + NAMESPACE CXXModules:: + DESTINATION "lib/cmake/export_bmi_and_interfaces" + FILE "export_bmi_and_interfaces-targets.cmake" + CXX_MODULES_DIRECTORY "export_bmi_and_interfaces-cxx-modules") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-config.cmake" + "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_bmi_and_interfaces-targets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) +") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-config.cmake" + DESTINATION "lib/cmake/export_bmi_and_interfaces") + +set(generator + -G "${CMAKE_GENERATOR}") +if (CMAKE_GENERATOR_TOOLSET) + list(APPEND generator + -T "${CMAKE_GENERATOR_TOOLSET}") +endif () +if (CMAKE_GENERATOR_PLATFORM) + list(APPEND generator + -A "${CMAKE_GENERATOR_PLATFORM}") +endif () + +add_test(NAME export_bmi_and_interfaces_build + COMMAND + "${CMAKE_COMMAND}" + "-Dexpected_source_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu" + "-Dexpected_binary_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/bmi" + "-Dexport_bmi_and_interfaces_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_bmi_and_interfaces" + ${generator} + -S "${CMAKE_CURRENT_SOURCE_DIR}/test" + -B "${CMAKE_CURRENT_BINARY_DIR}/test") diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx new file mode 100644 index 0000000..e0b1872 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx @@ -0,0 +1,8 @@ +export module importable; + +int forwarding(); + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/private.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/private.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int from_private() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt new file mode 100644 index 0000000..db0484d --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_library NONE) + +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") + +find_package(export_bmi_and_interfaces REQUIRED) + +if (NOT TARGET CXXModules::export_bmi_and_interfaces) + message(FATAL_ERROR + "Missing imported target") +endif () + +get_property(file_sets TARGET CXXModules::export_bmi_and_interfaces + PROPERTY INTERFACE_CXX_MODULE_SETS) +if (NOT file_sets STREQUAL "modules") + message(FATAL_ERROR + "Incorrect exported file sets in `CXXModules::export_bmi_and_interfaces`: `${file_sets}`") +endif () + +get_property(file_set_files TARGET CXXModules::export_bmi_and_interfaces + PROPERTY CXX_MODULE_SET_modules) +if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx") + message(FATAL_ERROR + "Incorrect exported file set paths in CXXModules::export_bmi_and_interfaces`: `${file_set_files}`") +endif () + +get_property(imported_modules TARGET CXXModules::export_bmi_and_interfaces + PROPERTY IMPORTED_CXX_MODULES_DEBUG) +if (NOT imported_modules MATCHES "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/importable.(gcm|pcm|ifc)") + message(FATAL_ERROR + "Incorrect exported modules in CXXModules::export_bmi_and_interfaces`: `${imported_modules}`") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt new file mode 100644 index 0000000..80ddaf8 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_interfaces STATIC) +target_sources(export_interfaces + PRIVATE + forward.cxx + PRIVATE + FILE_SET modules_private TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + private.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(export_interfaces PUBLIC cxx_std_20) + +install(TARGETS export_interfaces + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu") +export(EXPORT CXXModules + NAMESPACE CXXModules:: + FILE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-targets.cmake") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-config.cmake" + "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_interfaces-targets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) +") + +set(generator + -G "${CMAKE_GENERATOR}") +if (CMAKE_GENERATOR_TOOLSET) + list(APPEND generator + -T "${CMAKE_GENERATOR_TOOLSET}") +endif () +if (CMAKE_GENERATOR_PLATFORM) + list(APPEND generator + -A "${CMAKE_GENERATOR_PLATFORM}") +endif () + +add_test(NAME export_interfaces_build + COMMAND + "${CMAKE_COMMAND}" + "-Dexpected_dir=${CMAKE_CURRENT_SOURCE_DIR}" + "-Dexport_interfaces_DIR=${CMAKE_CURRENT_BINARY_DIR}" + ${generator} + -S "${CMAKE_CURRENT_SOURCE_DIR}/test" + -B "${CMAKE_CURRENT_BINARY_DIR}/test") diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx new file mode 100644 index 0000000..e0b1872 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx @@ -0,0 +1,8 @@ +export module importable; + +int forwarding(); + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/private.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/private.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int from_private() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt new file mode 100644 index 0000000..6145210 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_library NONE) + +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") + +find_package(export_interfaces REQUIRED) + +if (NOT TARGET CXXModules::export_interfaces) + message(FATAL_ERROR + "Missing imported target") +endif () + +get_property(file_sets TARGET CXXModules::export_interfaces + PROPERTY INTERFACE_CXX_MODULE_SETS) +if (NOT file_sets STREQUAL "modules") + message(FATAL_ERROR + "Incorrect exported file sets in `CXXModules::export_interfaces`: `${file_sets}`") +endif () + +get_property(file_set_files TARGET CXXModules::export_interfaces + PROPERTY CXX_MODULE_SET_modules) +if (NOT file_set_files STREQUAL "${expected_dir}/importable.cxx") + message(FATAL_ERROR + "Incorrect exported file set paths in CXXModules::export_interfaces`: `${file_set_files}`") +endif () + +get_property(imported_modules_set TARGET CXXModules::export_interfaces + PROPERTY IMPORTED_CXX_MODULES_DEBUG SET) +if (imported_modules_set) + message(FATAL_ERROR + "Unexpected C++ modules specified.") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt new file mode 100644 index 0000000..1dfb6da --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_interfaces STATIC) +target_sources(export_interfaces + PRIVATE + forward.cxx + PRIVATE + FILE_SET modules_private TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + private.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(export_interfaces PUBLIC cxx_std_20) + +install(TARGETS export_interfaces + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu") +install(EXPORT CXXModules + NAMESPACE CXXModules:: + DESTINATION "lib/cmake/export_interfaces" + FILE "export_interfaces-targets.cmake") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-config.cmake" + "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_interfaces-targets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) +") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-config.cmake" + DESTINATION "lib/cmake/export_interfaces") + +set(generator + -G "${CMAKE_GENERATOR}") +if (CMAKE_GENERATOR_TOOLSET) + list(APPEND generator + -T "${CMAKE_GENERATOR_TOOLSET}") +endif () +if (CMAKE_GENERATOR_PLATFORM) + list(APPEND generator + -A "${CMAKE_GENERATOR_PLATFORM}") +endif () + +add_test(NAME export_interfaces_build + COMMAND + "${CMAKE_COMMAND}" + "-Dexpected_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu" + "-Dexport_interfaces_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_interfaces" + ${generator} + -S "${CMAKE_CURRENT_SOURCE_DIR}/test" + -B "${CMAKE_CURRENT_BINARY_DIR}/test") diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx new file mode 100644 index 0000000..e0b1872 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx @@ -0,0 +1,8 @@ +export module importable; + +int forwarding(); + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/private.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/private.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int from_private() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt new file mode 100644 index 0000000..6145210 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_library NONE) + +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") + +find_package(export_interfaces REQUIRED) + +if (NOT TARGET CXXModules::export_interfaces) + message(FATAL_ERROR + "Missing imported target") +endif () + +get_property(file_sets TARGET CXXModules::export_interfaces + PROPERTY INTERFACE_CXX_MODULE_SETS) +if (NOT file_sets STREQUAL "modules") + message(FATAL_ERROR + "Incorrect exported file sets in `CXXModules::export_interfaces`: `${file_sets}`") +endif () + +get_property(file_set_files TARGET CXXModules::export_interfaces + PROPERTY CXX_MODULE_SET_modules) +if (NOT file_set_files STREQUAL "${expected_dir}/importable.cxx") + message(FATAL_ERROR + "Incorrect exported file set paths in CXXModules::export_interfaces`: `${file_set_files}`") +endif () + +get_property(imported_modules_set TARGET CXXModules::export_interfaces + PROPERTY IMPORTED_CXX_MODULES_DEBUG SET) +if (imported_modules_set) + message(FATAL_ERROR + "Unexpected C++ modules specified.") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces-stderr.txt b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/CMakeLists.txt new file mode 100644 index 0000000..efaca0e --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_install_bmi_and_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(install_bmi_and_interfaces STATIC) +target_sources(install_bmi_and_interfaces + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(install_bmi_and_interfaces PUBLIC cxx_std_20) + +install(TARGETS install_bmi_and_interfaces + ARCHIVE DESTINATION "lib" + CXX_MODULES_BMI DESTINATION "lib/cxx/bmi" + FILE_SET CXX_MODULES DESTINATION "lib/cxx/miu") + +add_test(NAME check-for-bmi + COMMAND + "${CMAKE_COMMAND}" + "-Dprefix=${CMAKE_INSTALL_PREFIX}" + "-Dbmi_destination=lib/cxx/bmi" + "-Dfs_destination=lib/cxx/miu" + -P "${CMAKE_CURRENT_SOURCE_DIR}/check-for-bmi.cmake") diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/check-for-bmi.cmake b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/check-for-bmi.cmake new file mode 100644 index 0000000..a8ff1ad --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/check-for-bmi.cmake @@ -0,0 +1,7 @@ +include("${CMAKE_CURRENT_LIST_DIR}/../cxx-modules-find-bmi.cmake") + +report_dirs("${prefix}" "${bmi_destination}") +check_for_bmi("${prefix}" "${bmi_destination}" importable) + +report_dirs("${prefix}" "${fs_destination}") +check_for_interface("${prefix}" "${fs_destination}" "" importable.cxx) diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/importable.cxx b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/importable.cxx new file mode 100644 index 0000000..607680a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/importable.cxx @@ -0,0 +1,6 @@ +export module importable; + +export int from_import() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-stderr.txt b/Tests/RunCMake/CXXModules/examples/install-bmi-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/install-bmi/CMakeLists.txt new file mode 100644 index 0000000..4e039f9 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_install_bmi CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(install_bmi STATIC) +target_sources(install_bmi + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(install_bmi PUBLIC cxx_std_20) + +install(TARGETS install_bmi + ARCHIVE DESTINATION "lib" + CXX_MODULES_BMI DESTINATION "lib/cxx/bmi") + +add_test(NAME check-for-bmi + COMMAND + "${CMAKE_COMMAND}" + "-Dprefix=${CMAKE_INSTALL_PREFIX}" + "-Ddestination=lib/cxx/bmi" + -P "${CMAKE_CURRENT_SOURCE_DIR}/check-for-bmi.cmake") diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi/check-for-bmi.cmake b/Tests/RunCMake/CXXModules/examples/install-bmi/check-for-bmi.cmake new file mode 100644 index 0000000..ff84ed6 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi/check-for-bmi.cmake @@ -0,0 +1,4 @@ +include("${CMAKE_CURRENT_LIST_DIR}/../cxx-modules-find-bmi.cmake") + +report_dirs("${prefix}" "${destination}") +check_for_bmi("${prefix}" "${destination}" importable) diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi/importable.cxx b/Tests/RunCMake/CXXModules/examples/install-bmi/importable.cxx new file mode 100644 index 0000000..607680a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi/importable.cxx @@ -0,0 +1,6 @@ +export module importable; + +export int from_import() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx b/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx index 8be521b..b872ae9 100644 --- a/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx +++ b/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx @@ -1,5 +1,5 @@ export module importable; -import importable : internal_partition; +import : internal_partition; #include "internal-partitions_export.h" diff --git a/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx b/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx index 1e81aaf..d0ac2f4 100644 --- a/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx +++ b/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx @@ -1,5 +1,5 @@ export module importable; -export import importable : partition; +export import : partition; #include "partitions_export.h" diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt b/Tests/RunCMake/CXXModules/examples/public-req-private-build-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt +++ b/Tests/RunCMake/CXXModules/examples/public-req-private-build-result.txt diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private-build-stdout.txt b/Tests/RunCMake/CXXModules/examples/public-req-private-build-stdout.txt new file mode 100644 index 0000000..b5f1c55 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/public-req-private-build-stdout.txt @@ -0,0 +1 @@ +CMake Error: Public C\+\+ module source `.*/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx` requires the `priv` C\+\+ module which is provided by a private source diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private-stderr.txt b/Tests/RunCMake/CXXModules/examples/public-req-private-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/public-req-private-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/public-req-private/CMakeLists.txt new file mode 100644 index 0000000..600fec4 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/public-req-private/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_public_req_private CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(public_req_private) +target_sources(public_req_private + PRIVATE + FILE_SET private TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + priv.cxx + PUBLIC + FILE_SET public TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + pub.cxx) +target_compile_features(public_req_private PUBLIC cxx_std_20) + +add_test(NAME cmake-version COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private/priv.cxx b/Tests/RunCMake/CXXModules/examples/public-req-private/priv.cxx new file mode 100644 index 0000000..7c000b7 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/public-req-private/priv.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int g() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx b/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx new file mode 100644 index 0000000..6ff2d23 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx @@ -0,0 +1,8 @@ +export module pub; + +import priv; + +export int f() +{ + return g(); +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json new file mode 100644 index 0000000..65f0759 --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json @@ -0,0 +1,45 @@ +{ + "bmi-installation": { + "destination": "lib/cxx/modules/private/<CONFIG>", + "message-level": "MESSAGE_LAZY", + "permissions": " OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ", + "script-location": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-private.dir/install-cxx-module-bmi-<CONFIG_FORCE>.cmake" + }, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-bmi-install-private.dir/sources/module-internal-part.cxx.o": { + "destination": null, + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-bmi-install-private.dir/sources/module-part.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-bmi-install-private.dir/sources/module.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-private.dir" +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json new file mode 100644 index 0000000..9c8a895 --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json @@ -0,0 +1,45 @@ +{ + "bmi-installation": { + "destination": "lib/cxx/modules/<CONFIG>", + "message-level": "", + "permissions": "", + "script-location": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir/install-cxx-module-bmi-noconfig.cmake" + }, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-bmi-install-public.dir/sources/module-internal-part.cxx.o": { + "destination": "lib/cxx/internals", + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-bmi-install-public.dir/sources/module-part.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-bmi-install-public.dir/sources/module.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir" +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json new file mode 100644 index 0000000..0545981 --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json @@ -0,0 +1,73 @@ +{ + "bmi-installation": null, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-exports-private.dir/sources/module-internal-part.cxx.o": { + "destination": null, + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-exports-private.dir/sources/module-part.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-exports-private.dir/sources/module.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [ + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "lib/cmake/export1", + "export-name" : "with-private", + "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/d2e2673818fd2bd8c45c0e3ed0e38fcd", + "install" : true, + "namespace" : "export1::" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "lib/cmake/export2", + "export-name" : "with-private", + "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/28cd47cb4c96ad5cadaa3fb1b0201ae8", + "install" : true, + "namespace" : "" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "<BINARY_DIR>/lib/cmake/export1", + "export-name" : "with-private", + "export-prefix" : "<BINARY_DIR>/lib/cmake/export1", + "install" : false, + "namespace" : "export1::" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "<BINARY_DIR>/lib/cmake/export2", + "export-name" : "with-private", + "export-prefix" : "<BINARY_DIR>/lib/cmake/export2", + "install" : false, + "namespace" : "" + } + ], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-private.dir" +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json new file mode 100644 index 0000000..adc3ae3 --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json @@ -0,0 +1,73 @@ +{ + "bmi-installation": null, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-exports-public.dir/sources/module-internal-part.cxx.o": { + "destination": "lib/cxx/internals", + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-exports-public.dir/sources/module-part.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-exports-public.dir/sources/module.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [ + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "lib/cmake/export1", + "export-name" : "with-public", + "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/d2e2673818fd2bd8c45c0e3ed0e38fcd", + "install" : true, + "namespace" : "export1::" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "lib/cmake/export2", + "export-name" : "with-public", + "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/28cd47cb4c96ad5cadaa3fb1b0201ae8", + "install" : true, + "namespace" : "" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "<BINARY_DIR>/lib/cmake/export1", + "export-name" : "with-public", + "export-prefix" : "<BINARY_DIR>/lib/cmake/export1", + "install" : false, + "namespace" : "export1::" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "<BINARY_DIR>/lib/cmake/export2", + "export-name" : "with-public", + "export-prefix" : "<BINARY_DIR>/lib/cmake/export2", + "install" : false, + "namespace" : "" + } + ], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-public.dir" +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json new file mode 100644 index 0000000..9ba6568 --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json @@ -0,0 +1,40 @@ +{ + "bmi-installation": null, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-file-sets-private.dir/sources/module-internal-part.cxx.o": { + "destination": null, + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-file-sets-private.dir/sources/module-part.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-file-sets-private.dir/sources/module.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-private.dir" +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json new file mode 100644 index 0000000..46e2cbf --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json @@ -0,0 +1,40 @@ +{ + "bmi-installation": null, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module-internal-part.cxx.o": { + "destination": "lib/cxx/internals", + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module-part.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-public.dir" +} diff --git a/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt b/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt index dc2c3ad..9a1ba04 100644 --- a/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt +++ b/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt @@ -1,6 +1,6 @@ ^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): - IPO is not supported \(no C/CXX/Fortran languages found in ENABLED_LANGUAGES - global property\)\. + IPO is not supported \(no C/CXX/CUDA/Fortran languages found in + ENABLED_LANGUAGES global property\)\. Call Stack \(most recent call first\): .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) default-lang-none\.cmake:[0-9]+ \(check_ipo_supported\) diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index 6a932f1..1452c9b 100644 --- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -1 +1 @@ -^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":4}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"version":{.*}}$ +^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":4}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"tls":(true|false),"version":{.*}}$ diff --git a/Tests/RunCMake/CommandLine/E_env-equal.cmake b/Tests/RunCMake/CommandLine/E_env-equal.cmake new file mode 100644 index 0000000..3f18bb6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-equal.cmake @@ -0,0 +1,15 @@ +if (NOT DEFINED ENV{TEST_ENV_EXPECTED}) + if (NOT DEFINED ENV{TEST_ENV}) + message(STATUS "TEST_ENV is correctly not set in environment") + else () + message(FATAL_ERROR "TEST_ENV is incorrectly set in environment") + endif () +else () + if (NOT DEFINED ENV{TEST_ENV}) + message(FATAL_ERROR "TEST_ENV is incorrectly not set in environment") + elseif ("$ENV{TEST_ENV}" STREQUAL "$ENV{TEST_ENV_EXPECTED}") + message(STATUS "TEST_ENV is correctly set in environment: $ENV{TEST_ENV}") + else () + message(FATAL_ERROR "TEST_ENV is incorrectly set in environment!\n\tactual: $ENV{TEST_ENV}\n\texpected: $ENV{TEST_ENV_EXPECTED}") + endif () +endif () diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt +++ b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-result.txt diff --git a/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-stderr.txt b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-stderr.txt new file mode 100644 index 0000000..ccfdeab --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: Error: Unrecognized environment manipulation argument: unknown + +cmake -E env: invalid parameter to --modify: TEST_ENV=unknown:$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-cmake_list-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-cmake_list-stdout.txt new file mode 100644 index 0000000..ad42f56 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-cmake_list-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: exp;ect;ed$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-path_list-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-path_list-stdout.txt new file mode 100644 index 0000000..49572a3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-path_list-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: exp[;:]ect[;:]ed$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-reset-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-reset-stdout.txt new file mode 100644 index 0000000..a60f1bf --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-reset-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: expected$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-reset-to-unset-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-reset-to-unset-stdout.txt new file mode 100644 index 0000000..a1d5c01 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-reset-to-unset-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly not set in environment$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-set-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-set-stdout.txt new file mode 100644 index 0000000..feff117 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-set-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: 1$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-string-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-string-stdout.txt new file mode 100644 index 0000000..a60f1bf --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-string-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: expected$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-unset-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-unset-stdout.txt new file mode 100644 index 0000000..a1d5c01 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-unset-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly not set in environment$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-with-double-dash-result.txt b/Tests/RunCMake/CommandLine/E_env_modify-with-double-dash-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-with-double-dash-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt +++ b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-result.txt diff --git a/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-stderr.txt b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt b/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt index c94c19d..cde76f7 100644 --- a/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt +++ b/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt @@ -1,4 +1,4 @@ -^-- CMAKE_ARGC='8' +^-- CMAKE_ARGC='9' -- CMAKE_ARGV1='-P' -- CMAKE_ARGV2='[^']*/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake' -- CMAKE_ARGV3='--' @@ -6,4 +6,5 @@ -- CMAKE_ARGV5='-S' -- CMAKE_ARGV6='-B' -- CMAKE_ARGV7='--fresh' --- CMAKE_ARGV8=''$ +-- CMAKE_ARGV8='--version' +-- CMAKE_ARGV9=''$ diff --git a/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake index 8dca990..7d79af5 100644 --- a/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake +++ b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake @@ -7,3 +7,4 @@ message(STATUS "CMAKE_ARGV5='${CMAKE_ARGV5}'") message(STATUS "CMAKE_ARGV6='${CMAKE_ARGV6}'") message(STATUS "CMAKE_ARGV7='${CMAKE_ARGV7}'") message(STATUS "CMAKE_ARGV8='${CMAKE_ARGV8}'") +message(STATUS "CMAKE_ARGV9='${CMAKE_ARGV9}'") diff --git a/Tests/RunCMake/CommandLine/P_args-stdout.txt b/Tests/RunCMake/CommandLine/P_args-stdout.txt new file mode 100644 index 0000000..f9d039f --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_args-stdout.txt @@ -0,0 +1,6 @@ +^-- CMAKE_ARGC='5' +-- CMAKE_ARGV1='-P' +-- CMAKE_ARGV2='[^']*/Tests/RunCMake/CommandLine/P_args.cmake' +-- CMAKE_ARGV3='relative/path' +-- CMAKE_ARGV4='[^']*/Tests/RunCMake/CommandLine' +-- CMAKE_ARGV5=''$ diff --git a/Tests/RunCMake/CommandLine/P_args.cmake b/Tests/RunCMake/CommandLine/P_args.cmake new file mode 100644 index 0000000..6c4fa4c --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_args.cmake @@ -0,0 +1,6 @@ +message(STATUS "CMAKE_ARGC='${CMAKE_ARGC}'") +message(STATUS "CMAKE_ARGV1='${CMAKE_ARGV1}'") +message(STATUS "CMAKE_ARGV2='${CMAKE_ARGV2}'") +message(STATUS "CMAKE_ARGV3='${CMAKE_ARGV3}'") +message(STATUS "CMAKE_ARGV4='${CMAKE_ARGV4}'") +message(STATUS "CMAKE_ARGV5='${CMAKE_ARGV5}'") diff --git a/Tests/RunCMake/CommandLine/P_working-dir.cmake b/Tests/RunCMake/CommandLine/P_working-dir.cmake index 4ea0293..e2c0378 100644 --- a/Tests/RunCMake/CommandLine/P_working-dir.cmake +++ b/Tests/RunCMake/CommandLine/P_working-dir.cmake @@ -9,6 +9,11 @@ foreach(d CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRE if(EXPECTED_WORKING_DIR STREQUAL "${${d}}") message(STATUS "${d} is the expected working directory (${EXPECTED_WORKING_DIR})") else() - message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})") + get_filename_component(resolved "${EXPECTED_WORKING_DIR}" REALPATH) + if(resolved STREQUAL "${${d}}") + message(STATUS "${d} is the expected working directory (${resolved}) after symlink resolution") + else() + message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})") + endif() endif() endforeach() diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index c8234ec..1b5a1d6 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -52,7 +52,8 @@ run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G) run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) -run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO -S -B --fresh) +run_cmake_command(P_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_args.cmake" relative/path "${RunCMake_SOURCE_DIR}") +run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO -S -B --fresh --version) run_cmake_command(P_fresh ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_fresh.cmake" --fresh) run_cmake_command(build-no-dir @@ -743,6 +744,10 @@ run_cmake_command(E_cat-without-double-dash ${CMAKE_COMMAND} -E cat "-file-start unset(RunCMake_TEST_COMMAND_WORKING_DIRECTORY) unset(out) +# Unset environment variables that are used for testing cmake -E +unset(ENV{TEST_ENV}) +unset(ENV{TEST_ENV_EXPECTED}) + run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) @@ -757,6 +762,56 @@ file(COPY_FILE "${EXIT_CODE_EXE}" "${RunCMake_BINARY_DIR}/env=${exit_code}") run_cmake_command(E_env-with-double-dash ${CMAKE_COMMAND} -E env TEST_ENV=1 -- "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit) run_cmake_command(E_env-without-double-dash ${CMAKE_COMMAND} -E env TEST_ENV=1 "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit) +## Tests of env --modify +# Repeat the same tests as above +run_cmake_command(E_env_modify-set ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake) +run_cmake_command(E_env_modify-unset ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 ${CMAKE_COMMAND} -E env --modify TEST_ENV=unset: ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake) +run_cmake_command(E_env_modify-with-double-dash ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 -- "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit) +run_cmake_command(E_env_modify-without-double-dash ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit) + +# Test environment modification commands +run_cmake_command(E_env_modify-reset + ${CMAKE_COMMAND} -E env TEST_ENV=expected + ${CMAKE_COMMAND} -E env TEST_ENV_EXPECTED=expected TEST_ENV=bad_value --modify TEST_ENV=reset: + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake) + +run_cmake_command(E_env_modify-reset-to-unset + ${CMAKE_COMMAND} -E env --unset=TEST_ENV --unset=TEST_ENV_EXPECTED + ${CMAKE_COMMAND} -E env TEST_ENV=bad_value --modify TEST_ENV=reset: + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake) + +run_cmake_command(E_env_modify-string + ${CMAKE_COMMAND} -E env TEST_ENV_EXPECTED=expected + --modify TEST_ENV=unset: + --modify TEST_ENV=string_append:ect + --modify TEST_ENV=string_prepend:exp + --modify TEST_ENV=string_append:ed + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake) + +if (WIN32) + set(SEP "\\;") +else () + set(SEP ":") +endif () + +run_cmake_command(E_env_modify-path_list + ${CMAKE_COMMAND} -E env "TEST_ENV_EXPECTED=exp${SEP}ect${SEP}ed" + --modify TEST_ENV=unset: + --modify TEST_ENV=path_list_append:ect + --modify TEST_ENV=path_list_prepend:exp + --modify TEST_ENV=path_list_append:ed + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake) + +run_cmake_command(E_env_modify-cmake_list + ${CMAKE_COMMAND} -E env "TEST_ENV_EXPECTED=exp\\;ect\\;ed" + --modify TEST_ENV=unset: + --modify TEST_ENV=cmake_list_append:ect + --modify TEST_ENV=cmake_list_prepend:exp + --modify TEST_ENV=cmake_list_append:ed + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake) + +run_cmake_command(E_env_modify-bad-operation ${CMAKE_COMMAND} -E env --modify TEST_ENV=unknown:) + run_cmake_command(E_md5sum-dir ${CMAKE_COMMAND} -E md5sum .) run_cmake_command(E_sha1sum-dir ${CMAKE_COMMAND} -E sha1sum .) run_cmake_command(E_sha224sum-dir ${CMAKE_COMMAND} -E sha224sum .) @@ -923,6 +978,8 @@ set(RunCMake_TEST_OPTIONS --debug-trycompile) run_cmake(debug-trycompile) unset(RunCMake_TEST_OPTIONS) +run_cmake(trycompile-clean) + function(run_cmake_depends) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_SOURCE_DIR}/cmake_depends") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/cmake_depends-build") @@ -940,8 +997,8 @@ set(CMAKE_DEPENDS_CHECK_C set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"${RunCMake_TEST_SOURCE_DIR}\") set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\") ") - run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E cmake_depends - "Unix Makefiles" + run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E env VERBOSE=1 + ${CMAKE_COMMAND} -E cmake_depends "Unix Makefiles" ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake diff --git a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt index 8fe092b..cf972a8 100644 --- a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt +++ b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt @@ -1 +1 @@ -^Scanning dependencies of target DepTarget$ +Scanning dependencies of target DepTarget$ diff --git a/Tests/RunCMake/CommandLine/debug-trycompile.cmake b/Tests/RunCMake/CommandLine/debug-trycompile.cmake index a3835a7..9619ba8 100644 --- a/Tests/RunCMake/CommandLine/debug-trycompile.cmake +++ b/Tests/RunCMake/CommandLine/debug-trycompile.cmake @@ -1,5 +1,8 @@ enable_language(C) + # Look for a source tree left by enable_language internal checks. -if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeLists.txt) +set(scratch ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeScratch) +file(GLOB_RECURSE remnants ${scratch}/TryCompile-*/CMakeLists.txt) +if(NOT remnants) message(FATAL_ERROR "--debug-trycompile should leave the source behind") endif() diff --git a/Tests/RunCMake/CommandLine/trycompile-clean.cmake b/Tests/RunCMake/CommandLine/trycompile-clean.cmake new file mode 100644 index 0000000..11ec2b9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trycompile-clean.cmake @@ -0,0 +1,8 @@ +enable_language(C) + +# Look for a source tree left by enable_language internal checks. +set(scratch ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeScratch) +file(GLOB_RECURSE remnants ${scratch}/TryCompile-*/*) +if(remnants) + message(FATAL_ERROR "try_compile should not leave artifacts behind") +endif() diff --git a/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake b/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake index a532f72..392c921 100644 --- a/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake @@ -1,13 +1,22 @@ include(RunCMake) -function(run_compile_warn test) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) +function(run_compile_warn test lang extension) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}_${lang}-build) set(RunCMake_TEST_OUTPUT_MERGE 1) - run_cmake_with_options(${test} ${ARGN}) + run_cmake_with_options(${test}_${lang} "-DLANGUAGE=${lang}" "-DEXTENSION=${extension}" ${ARGN}) set(RunCMake_TEST_NO_CLEAN 1) - run_cmake_command(${test}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) + run_cmake_command(${test}_${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) endfunction() -run_compile_warn(WerrorOn) -run_compile_warn(WerrorOff) -run_compile_warn(WerrorOnIgnore "--compile-no-warning-as-error") +set(langs C CXX) +set(exts c cxx) +if(CMake_TEST_CUDA) + list(APPEND langs CUDA) + list(APPEND exts cu) +endif() + +foreach(lang ext IN ZIP_LISTS langs exts) + run_compile_warn(WerrorOn ${lang} ${ext}) + run_compile_warn(WerrorOff ${lang} ${ext}) + run_compile_warn(WerrorOnIgnore ${lang} ${ext} "--compile-no-warning-as-error") +endforeach() diff --git a/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake b/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake index ccc6cc5..d8770e1 100644 --- a/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake +++ b/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake @@ -1,18 +1,29 @@ # add compile options to warning_options to ensure unused-function throws a warning # if warning_options is NOT DEFINED, assume compiler doesn't support warning as error -macro(get_warning_options warning_options) - if (CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|XLClang|IBMClang|LCC|NVCC|IntelLLVM)$") +macro(get_warning_options warning_options lang) + if (CMAKE_${lang}_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|XLClang|IBMClang|LCC|IntelLLVM|NVHPC)$") set(${warning_options} "-Wall") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" - OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC")) + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "MSVC" + OR (CMAKE_${lang}_COMPILER_ID STREQUAL "Intel" AND CMAKE_${lang}_SIMULATE_ID MATCHES "MSVC")) set(${warning_options} "-W4") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "NVIDIA" + AND CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89) + if(CMAKE_${lang}_SIMULATE_ID MATCHES "MSVC") + set(${warning_options} "-Xcompiler=-W4") + else() + set(${warning_options} "-Xcompiler=-Wall") + endif() + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "Intel") set(${warning_options} "-w3") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "XL") + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "XL") set(${warning_options} "-qinfo=all") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") - set(${warning_options} "+w;+w2") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Fujitsu") + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "SunPro") + if(lang STREQUAL CXX) + set(${warning_options} "+w;+w2") + else() + set(${warning_options} "") + endif() + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "Fujitsu") set(${warning_options} "SHELL:-w 8") endif() endmacro() diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOff.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOff.cmake index b05d65e..0af60f0 100644 --- a/Tests/RunCMake/CompileWarningAsError/WerrorOff.cmake +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOff.cmake @@ -1,8 +1,8 @@ -enable_language(CXX) +enable_language(${LANGUAGE}) include(WarningAsErrorOptions.cmake) -get_warning_options(warning_options) +get_warning_options(warning_options ${LANGUAGE}) -add_executable(WerrorOff warn.cxx) +add_executable(WerrorOff warn.${EXTENSION}) target_compile_options(WerrorOff PUBLIC "${warning_options}") set_target_properties(WerrorOff PROPERTIES COMPILE_WARNING_AS_ERROR OFF) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOff_C.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOff_C.cmake new file mode 100644 index 0000000..35c02aa --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOff_C.cmake @@ -0,0 +1 @@ +include(WerrorOff.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOff_CUDA.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOff_CUDA.cmake new file mode 100644 index 0000000..35c02aa --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOff_CUDA.cmake @@ -0,0 +1 @@ +include(WerrorOff.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOff_CXX.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOff_CXX.cmake new file mode 100644 index 0000000..35c02aa --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOff_CXX.cmake @@ -0,0 +1 @@ +include(WerrorOff.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOn.cmake index 4310333..c3f6526 100644 --- a/Tests/RunCMake/CompileWarningAsError/WerrorOn.cmake +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn.cmake @@ -1,13 +1,13 @@ -enable_language(CXX) +enable_language(${LANGUAGE}) include(WarningAsErrorOptions.cmake) -get_warning_options(warning_options) +get_warning_options(warning_options ${LANGUAGE}) if (DEFINED warning_options) - add_executable(WerrorOn warn.cxx) + add_executable(WerrorOn warn.${EXTENSION}) target_compile_options(WerrorOn PUBLIC "${warning_options}") set_target_properties(WerrorOn PROPERTIES COMPILE_WARNING_AS_ERROR ON) else() - # if no werror option is set for the environment, use err.cxx so that build fails as expected - add_executable(WerrorOn err.cxx) + # if no werror option is set for the environment, use err so that build fails as expected + add_executable(WerrorOn err.${EXTENSION}) endif() diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore.cmake index 1f7ccdb..847bd78 100644 --- a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore.cmake +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore.cmake @@ -1,8 +1,8 @@ -enable_language(CXX) +enable_language(${LANGUAGE}) include(WarningAsErrorOptions.cmake) -get_warning_options(warning_options) +get_warning_options(warning_options ${LANGUAGE}) -add_executable(WerrorOn warn.cxx) +add_executable(WerrorOn warn.${EXTENSION}) target_compile_options(WerrorOn PUBLIC "${warning_options}") set_target_properties(WerrorOn PROPERTIES COMPILE_WARNING_AS_ERROR ON) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_C.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_C.cmake new file mode 100644 index 0000000..ebb9e0e --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_C.cmake @@ -0,0 +1 @@ +include(WerrorOnIgnore.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CUDA.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CUDA.cmake new file mode 100644 index 0000000..ebb9e0e --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CUDA.cmake @@ -0,0 +1 @@ +include(WerrorOnIgnore.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CXX.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CXX.cmake new file mode 100644 index 0000000..ebb9e0e --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CXX.cmake @@ -0,0 +1 @@ +include(WerrorOnIgnore.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn-Build-result.txt b/Tests/RunCMake/CompileWarningAsError/WerrorOn_C-Build-result.txt index d197c91..d197c91 100644 --- a/Tests/RunCMake/CompileWarningAsError/WerrorOn-Build-result.txt +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_C-Build-result.txt diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_C.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOn_C.cmake new file mode 100644 index 0000000..a00edb8 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_C.cmake @@ -0,0 +1 @@ +include(WerrorOn.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA-Build-result.txt b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA.cmake new file mode 100644 index 0000000..a00edb8 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA.cmake @@ -0,0 +1 @@ +include(WerrorOn.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX-Build-result.txt b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX.cmake new file mode 100644 index 0000000..a00edb8 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX.cmake @@ -0,0 +1 @@ +include(WerrorOn.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/err.c b/Tests/RunCMake/CompileWarningAsError/err.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/err.c diff --git a/Tests/RunCMake/CompileWarningAsError/err.cu b/Tests/RunCMake/CompileWarningAsError/err.cu new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/err.cu diff --git a/Tests/RunCMake/CompileWarningAsError/warn.c b/Tests/RunCMake/CompileWarningAsError/warn.c new file mode 100644 index 0000000..cd0c2ba --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/warn.c @@ -0,0 +1,25 @@ +static void unused_function(); + +#ifdef __SUNPRO_C +KandR(x) int x; +{ + return x; +} +#endif + +#ifdef __SUNPRO_CC +struct A +{ + virtual ~A() throw(); +}; +struct B : public A +{ + virtual ~B() throw(int); +}; +#endif + +int main(int argc, char* argv[]) +{ + unsigned int unused_sign_conversion = -1; + return 1; +} diff --git a/Tests/RunCMake/CompileWarningAsError/warn.cu b/Tests/RunCMake/CompileWarningAsError/warn.cu new file mode 100644 index 0000000..22b8db8 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/warn.cu @@ -0,0 +1 @@ +#include "warn.c" diff --git a/Tests/RunCMake/CompileWarningAsError/warn.cxx b/Tests/RunCMake/CompileWarningAsError/warn.cxx index 64a245a..22b8db8 100644 --- a/Tests/RunCMake/CompileWarningAsError/warn.cxx +++ b/Tests/RunCMake/CompileWarningAsError/warn.cxx @@ -1,17 +1 @@ -static void unused_function(); - -#ifdef __SUNPRO_CC -struct A -{ - virtual ~A() throw(); -}; -struct B : public A -{ - virtual ~B() throw(int); -}; -#endif - -int main(int unused_argument, char* []) -{ - return 1; -} +#include "warn.c" diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake index 84d0479..e6a2605 100644 --- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -17,7 +17,8 @@ endfunction() function(run_compiler_launcher_env lang) string(REGEX REPLACE "-.*" "" core_lang "${lang}") - set(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER} "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") + # Use the noop genexp $<PATH:...> genexp to validate genexp support. + set(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER} "$<PATH:CMAKE_PATH,${CMAKE_COMMAND}>;-E;env;USED_LAUNCHER=1") run_compiler_launcher(${lang}) unset(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER}) endfunction() diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-override.cmake b/Tests/RunCMake/Configure/CopyFileABI-override.cmake index c633555..67f6ed5 100644 --- a/Tests/RunCMake/Configure/FailCopyFileABI-override.cmake +++ b/Tests/RunCMake/Configure/CopyFileABI-override.cmake @@ -1,5 +1,6 @@ # Change the executable suffix that try_compile will use for -# COPY_FILE but not inside the test project. This forces failure. +# COPY_FILE but not inside the test project, to verify +# we can handle envs that try and break everything get_property(in_try_compile GLOBAL PROPERTY IN_TRY_COMPILE) if(NOT in_try_compile) set(CMAKE_EXECUTABLE_SUFFIX .missing) diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt index 92fe233..6a856a4 100644 --- a/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt +++ b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt @@ -1,4 +1,4 @@ -- Detecting C compiler ABI info --- Detecting C compiler ABI info - failed.* +-- Detecting C compiler ABI info - done.* -- Configuring done -- Generating done diff --git a/Tests/RunCMake/Configure/FailCopyFileABI.cmake b/Tests/RunCMake/Configure/CopyFileABI.cmake index 74efd97..4eee100 100644 --- a/Tests/RunCMake/Configure/FailCopyFileABI.cmake +++ b/Tests/RunCMake/Configure/CopyFileABI.cmake @@ -1,2 +1,2 @@ -set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/FailCopyFileABI-override.cmake) +set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/CopyFileABI-override.cmake) enable_language(C) diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake b/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake deleted file mode 100644 index db0cb0a..0000000 --- a/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake +++ /dev/null @@ -1,14 +0,0 @@ -set(log "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/CMakeError.log") -if(EXISTS "${log}") - file(READ "${log}" error_log) -else() - set(error_log "") -endif() -string(REPLACE "\r\n" "\n" regex "Cannot copy output executable.* -to destination specified by COPY_FILE:.* -Unable to find the executable at any of: - .*\\.missing") -if(NOT error_log MATCHES "${regex}") - string(REGEX REPLACE "\n" "\n " error_log " ${error_log}") - set(RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected COPY_FILE failure message:\n${error_log}") -endif() diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake index 9fd4499..750fa3c 100644 --- a/Tests/RunCMake/Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake @@ -1,9 +1,9 @@ include(RunCMake) run_cmake(ContinueAfterError) +run_cmake(CopyFileABI) run_cmake(CustomTargetAfterError) run_cmake(ErrorLogs) -run_cmake(FailCopyFileABI) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RerunCMake-build) diff --git a/Tests/RunCMake/ExportImport/CMakeLists.txt b/Tests/RunCMake/ExportImport/CMakeLists.txt new file mode 100644 index 0000000..5ff8d3e --- /dev/null +++ b/Tests/RunCMake/ExportImport/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.23) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExportImport/RunCMakeTest.cmake b/Tests/RunCMake/ExportImport/RunCMakeTest.cmake new file mode 100644 index 0000000..d07fca2 --- /dev/null +++ b/Tests/RunCMake/ExportImport/RunCMakeTest.cmake @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.23) +include(RunCMake) + +function(run_ExportImport_test case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-export-build) + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + run_cmake(${case}-export) + unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${case}-export-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${case}-export-install ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -P cmake_install.cmake) + unset(RunCMake_TEST_NO_CLEAN) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-import-build) + run_cmake_with_options(${case}-import + -Dfoo_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/foo + -Dbar_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/bar + ) +endfunction() + +run_ExportImport_test(SharedDep) diff --git a/Tests/RunCMake/ExportImport/SharedDep-export.cmake b/Tests/RunCMake/ExportImport/SharedDep-export.cmake new file mode 100644 index 0000000..2da3e47 --- /dev/null +++ b/Tests/RunCMake/ExportImport/SharedDep-export.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +install(TARGETS foo EXPORT foo) +install(EXPORT foo DESTINATION lib/cmake/foo) +install(FILES foo-config.cmake.in RENAME foo-config.cmake DESTINATION lib/cmake/foo) + +add_library(bar SHARED bar.c) +target_link_libraries(bar PRIVATE foo) +# 'foo' only appears in IMPORTED_LINK_DEPENDENT_LIBRARIES, and so is not enforced on import. +install(TARGETS bar EXPORT bar) +install(EXPORT bar DESTINATION lib/cmake/bar) +install(FILES bar-config.cmake.in RENAME bar-config.cmake DESTINATION lib/cmake/bar) diff --git a/Tests/RunCMake/ExportImport/SharedDep-import.cmake b/Tests/RunCMake/ExportImport/SharedDep-import.cmake new file mode 100644 index 0000000..2e2c2f6 --- /dev/null +++ b/Tests/RunCMake/ExportImport/SharedDep-import.cmake @@ -0,0 +1 @@ +find_package(bar REQUIRED CONFIG NO_DEFAULT_PATH) diff --git a/Tests/RunCMake/ExportImport/bar-config.cmake.in b/Tests/RunCMake/ExportImport/bar-config.cmake.in new file mode 100644 index 0000000..9148046 --- /dev/null +++ b/Tests/RunCMake/ExportImport/bar-config.cmake.in @@ -0,0 +1,2 @@ +# find_dependency(foo) intentionally left out for this test case +include(${CMAKE_CURRENT_LIST_DIR}/bar.cmake) diff --git a/Tests/RunCMake/ExportImport/bar.c b/Tests/RunCMake/ExportImport/bar.c new file mode 100644 index 0000000..19adca9 --- /dev/null +++ b/Tests/RunCMake/ExportImport/bar.c @@ -0,0 +1,12 @@ +#if defined(_WIN32) +__declspec(dllimport) +#endif + int foo(void); + +#ifdef _WIN32 +__declspec(dllexport) +#endif + int bar(void) +{ + return foo(); +} diff --git a/Tests/RunCMake/ExportImport/foo-config.cmake.in b/Tests/RunCMake/ExportImport/foo-config.cmake.in new file mode 100644 index 0000000..b038138 --- /dev/null +++ b/Tests/RunCMake/ExportImport/foo-config.cmake.in @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/foo.cmake) diff --git a/Tests/RunCMake/ExportImport/foo.c b/Tests/RunCMake/ExportImport/foo.c new file mode 100644 index 0000000..8794965 --- /dev/null +++ b/Tests/RunCMake/ExportImport/foo.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int foo(void) +{ + return 0; +} diff --git a/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build1-stdout.txt b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build1-stdout.txt new file mode 100644 index 0000000..2c223f7 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build1-stdout.txt @@ -0,0 +1,6 @@ +.*-- once: configure +.*-- once: build +.*-- once: install +.*-- always: configure +.*-- always: build +.*-- always: install diff --git a/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build2-stdout.txt b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build2-stdout.txt new file mode 100644 index 0000000..d697490 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build2-stdout.txt @@ -0,0 +1,2 @@ +.*-- always: build +.*-- always: install diff --git a/Tests/RunCMake/ExternalProject/BUILD_ALWAYS.cmake b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS.cmake new file mode 100644 index 0000000..2e5fc6f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS.cmake @@ -0,0 +1,20 @@ +include(ExternalProject) + +ExternalProject_Add(once + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/once-configure.cmake + BUILD_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/once-build.cmake + INSTALL_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/once-install.cmake + ) + +ExternalProject_Add(always + DEPENDS once + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/always-configure.cmake + BUILD_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/always-build.cmake + COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${CMAKE_CURRENT_LIST_FILE} + "${CMAKE_CURRENT_BINARY_DIR}/byproduct.txt" + BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/byproduct.txt" + BUILD_ALWAYS 1 + INSTALL_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/always-install.cmake + ) diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 2588d6c..f152f5b 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -177,6 +177,28 @@ if(doSubstitutionTest) __ep_test_with_build(Substitutions) endif() +function(__ep_test_BUILD_ALWAYS) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BUILD_ALWAYS-build) + run_cmake(BUILD_ALWAYS) + set(RunCMake_TEST_NO_CLEAN 1) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-configure.cmake" [[message(STATUS "once: configure")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-build.cmake" [[message(STATUS "once: build")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-install.cmake" [[message(STATUS "once: install")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-configure.cmake" [[message(STATUS "always: configure")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-build.cmake" [[message(STATUS "always: build")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-install.cmake" [[message(STATUS "always: install")]]) + run_cmake_command(BUILD_ALWAYS-build1 ${CMAKE_COMMAND} --build . --target always) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-configure.cmake" [[message(FATAL_ERROR "once: configure should not run again")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-build.cmake" [[message(FATAL_ERROR "once: build should not run again")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-install.cmake" [[message(FATAL_ERROR "once: install should not run again")]]) + if(NOT RunCMake_GENERATOR MATCHES "^(Xcode|Visual Studio 9 )") + # The Xcode and VS 9 build systems decide to run this every time. + file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-configure.cmake" [[message(FATAL_ERROR "always: configure should not run again")]]) + endif() + run_cmake_command(BUILD_ALWAYS-build2 ${CMAKE_COMMAND} --build . --target always) +endfunction() +__ep_test_BUILD_ALWAYS() + function(__ep_test_CONFIGURE_HANDLED_BY_BUILD) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CONFIGURE_HANDLED_BY_BUILD-build) run_cmake(CONFIGURE_HANDLED_BY_BUILD) diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake index 28b8570..3b095a6 100644 --- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake +++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake @@ -38,9 +38,15 @@ run_cmake(exact_1.2.3.5) unset(RunCMake_DEFAULT_stderr) # check if searching for a version 0 works -list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0") +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0") run_cmake(exact_0_matching) +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=") +run_cmake(empty_version) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}") +run_cmake(exact_1_no_version_var) + # check custom error message set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DCustomMessage_VERSION=1.2.3.4") run_cmake(custom_message_1) diff --git a/Tests/RunCMake/FPHSA/empty_version-result.txt b/Tests/RunCMake/FPHSA/empty_version-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/empty_version-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/empty_version-stderr.txt b/Tests/RunCMake/FPHSA/empty_version-stderr.txt new file mode 100644 index 0000000..3b60c7a --- /dev/null +++ b/Tests/RunCMake/FPHSA/empty_version-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at [^ +]*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\): + Could NOT find Pseudo: \(Required is at least version "1"\) \(found TRUE\) +Call Stack \(most recent call first\): + [^ +]*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(_FPHSA_FAILURE_MESSAGE\) + FindPseudo.cmake:[0-9]+ \(find_package_handle_standard_args\) + empty_version.cmake:[0-9]+ \(find_package\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/FPHSA/empty_version.cmake b/Tests/RunCMake/FPHSA/empty_version.cmake new file mode 100644 index 0000000..7b7ff34 --- /dev/null +++ b/Tests/RunCMake/FPHSA/empty_version.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1 REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt b/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt new file mode 100644 index 0000000..7cbdf6e --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt @@ -0,0 +1 @@ +-- Found Pseudo: TRUE \(Required is at least version "1"\) diff --git a/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake b/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake new file mode 100644 index 0000000..7b7ff34 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1 REQUIRED) diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index 3b91e24..bb27491 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -16,6 +16,7 @@ run_cmake(UsesTerminalOverride) run_cmake(MakeAvailable) run_cmake(MakeAvailableTwice) run_cmake(MakeAvailableUndeclared) +run_cmake(VerifyHeaderSet) run_cmake_with_options(ManualSourceDirectory -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT=${CMAKE_CURRENT_LIST_DIR}/WithProject" diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet-stdout.txt b/Tests/RunCMake/FetchContent/VerifyHeaderSet-stdout.txt new file mode 100644 index 0000000..354529d --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet-stdout.txt @@ -0,0 +1,4 @@ +-- Before subproject, var = 'TRUE' +-- Inside subproject, var = 'FALSE' +-- After subproject, var = 'TRUE' +-- Subproject target property VERIFY_INTERFACE_HEADER_SETS='FALSE' diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet.cmake b/Tests/RunCMake/FetchContent/VerifyHeaderSet.cmake new file mode 100644 index 0000000..8adfcea --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet.cmake @@ -0,0 +1,16 @@ +enable_language(C) + +set(CMAKE_VERIFY_INTERFACE_HEADER_SETS TRUE) + +include(FetchContent) +FetchContent_Declare(verify_subproj + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/VerifyHeaderSet +) +message(STATUS "Before subproject, var = '${CMAKE_VERIFY_INTERFACE_HEADER_SETS}'") +FetchContent_MakeAvailable(verify_subproj) + +# Provide a way to verify the variable was reset back to its original value +message(STATUS "After subproject, var = '${CMAKE_VERIFY_INTERFACE_HEADER_SETS}'") + +get_property(verify TARGET Blah PROPERTY VERIFY_INTERFACE_HEADER_SETS) +message(STATUS "Subproject target property VERIFY_INTERFACE_HEADER_SETS='${verify}'") diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet/CMakeLists.txt b/Tests/RunCMake/FetchContent/VerifyHeaderSet/CMakeLists.txt new file mode 100644 index 0000000..c6ba37e --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.24) +project(VerifyHeaderSet LANGUAGES C) + +message(STATUS "Inside subproject, var = '${CMAKE_VERIFY_INTERFACE_HEADER_SETS}'") + +add_library(Blah INTERFACE) +target_sources(Blah + INTERFACE FILE_SET HEADERS FILES blah.h +) diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet/blah.h b/Tests/RunCMake/FetchContent/VerifyHeaderSet/blah.h new file mode 100644 index 0000000..5b47e14 --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet/blah.h @@ -0,0 +1 @@ +#error Header was used diff --git a/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake b/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake index c1030fb..4943f9e 100644 --- a/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake +++ b/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake @@ -18,3 +18,7 @@ message(STATUS "Lowercase extra file was read") # This is expected to be re-routed to a FetchContent_MakeAvailable() call find_package(AddedProject REQUIRED) + +# Verify that find_package() version constraints are fully ignored by the +# default-generated config version file +find_package(AddedProject 1.2.3 EXACT REQUIRED) diff --git a/Tests/RunCMake/FileAPI/CMakeLists.txt b/Tests/RunCMake/FileAPI/CMakeLists.txt index 44025d3..9a66cde 100644 --- a/Tests/RunCMake/FileAPI/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.13) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FileAPI/ClientStateful-check.py b/Tests/RunCMake/FileAPI/ClientStateful-check.py index f3d20d1..28679bb 100644 --- a/Tests/RunCMake/FileAPI/ClientStateful-check.py +++ b/Tests/RunCMake/FileAPI/ClientStateful-check.py @@ -108,7 +108,11 @@ def check_query_json_empty(q): check_error_re(q, "value, object or array expected") def check_query_json_extra(q): - check_error_re(q, "Extra non-whitespace after JSON value") + if bool(os.environ.get("CMake_JSONCPP_PRE_1_7_5", "")) and is_dict(q) and sorted(q.keys()) == ["responses"]: + # jsoncpp < 1.7.5 did not diagnose extra non-whitespace characters + check_error(q["responses"], "'requests' member missing") + else: + check_error_re(q, "Extra non-whitespace after JSON value") def check_query_not_file(q): check_error_re(q, "failed to read from file") diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake index 61dce17..961b73a 100644 --- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake +++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake @@ -39,6 +39,10 @@ if(RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo") endif() +if(JsonCpp_VERSION_STRING AND JsonCpp_VERSION_STRING VERSION_LESS 1.7.5) + set(ENV{CMake_JSONCPP_PRE_1_7_5} 1) +endif() + run_cmake(Nothing) run_cmake(Empty) run_cmake(EmptyClient) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index d5f596e..b7623de 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -213,6 +213,16 @@ def check_directory(c): assert is_int(at["index"]) assert c["targets"][at["index"]]["name"] == et["index"] + if e.get("cxxModuleBmiTarget", None) is not None: + expected_keys.append("cxxModuleBmiTarget") + et = e["cxxModuleBmiTarget"] + at = a["cxxModuleBmiTarget"] + assert is_dict(at) + assert sorted(at.keys()) == ["id", "index"] + assert matches(at["id"], et["id"]) + assert is_int(at["index"]) + assert c["targets"][at["index"]]["name"] == et["index"] + if e["backtrace"] is not None: expected_keys.append("backtrace") check_backtrace(d, a["backtrace"], e["backtrace"]) @@ -654,6 +664,7 @@ def gen_check_directories(c, g): read_codemodel_json_data("directories/dir_dir.json"), read_codemodel_json_data("directories/external.json"), read_codemodel_json_data("directories/fileset.json"), + read_codemodel_json_data("directories/subdir.json"), ] if matches(g["name"], "^Visual Studio "): @@ -712,6 +723,7 @@ def gen_check_targets(c, g, inSource): read_codemodel_json_data("targets/c_shared_exe.json"), read_codemodel_json_data("targets/c_static_lib.json"), read_codemodel_json_data("targets/c_static_exe.json"), + read_codemodel_json_data("targets/c_subdir.json"), read_codemodel_json_data("targets/all_build_cxx.json"), read_codemodel_json_data("targets/zero_check_cxx.json"), diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json index 6514910..de8b177 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json @@ -10,7 +10,7 @@ "^cxx_alias_exe::@53632cba2752272bb008$" ], "projectName": "Alias", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": null, "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json index c89e4f9..e57191c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json @@ -10,7 +10,7 @@ "^custom_tgt::@c11385ffed57b860da63$" ], "projectName": "Custom", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": null, "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json index 8052c1a..28f2b99 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json @@ -16,7 +16,7 @@ "^cxx_static_lib::@a56b12a3f5c0529fb296$" ], "projectName": "Cxx", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": true, "installers": [ { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json index 8509f08..2a3756e 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json @@ -7,7 +7,7 @@ ], "targetIds": null, "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": null, "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json index 27184cd..12677f2 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json @@ -5,7 +5,7 @@ "childSources": null, "targetIds": null, "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": null, "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json index 6d2952d..f1199c3 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json @@ -9,7 +9,7 @@ "^generated_exe::@[0-9a-f]+$" ], "projectName": "External", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": true, "installers": [ { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json index 4774a13..c4df2ec 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json @@ -8,7 +8,7 @@ "^c_headers_2::@6b8db101d64c125f29fe$" ], "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": true, "installers": [ { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json index 92b9526..8210d7f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json @@ -13,7 +13,7 @@ "^link_imported_static_exe::@ba7eb709d0b48779c6c8$" ], "projectName": "Imported", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": true, "installers": [ { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json index 90664dc..08edd64 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json @@ -9,7 +9,7 @@ "^iface_srcs::@25b7fa8ea00134654b85$" ], "projectName": "Interface", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": null, "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json new file mode 100644 index 0000000..996da47 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json @@ -0,0 +1,11 @@ +{ + "source": "^subdir$", + "build": "^subdir$", + "parentSource": "^\\.$", + "childSources": null, + "targetIds": null, + "projectName": "codemodel-v2", + "minimumCMakeVersion": "3.13", + "hasInstallRule": null, + "installers": [] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json index e7b146f..aed07e2 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json @@ -11,7 +11,8 @@ "^object$", "^.*/Tests/RunCMake/FileAPIExternalSource$", "^dir$", - "^fileset$" + "^fileset$", + "^subdir$" ], "targetIds": [ "^ALL_BUILD::@6890427a1f51a3e7e1df$", @@ -22,10 +23,11 @@ "^c_shared_lib::@6890427a1f51a3e7e1df$", "^c_static_exe::@6890427a1f51a3e7e1df$", "^c_static_lib::@6890427a1f51a3e7e1df$", + "^c_subdir::@6890427a1f51a3e7e1df$", "^interface_exe::@6890427a1f51a3e7e1df$" ], "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": true, "installers": [ { @@ -48,7 +50,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 39, + "line": 42, "command": "install", "hasParent": true }, @@ -93,7 +95,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -141,7 +143,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -186,7 +188,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -230,7 +232,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -274,7 +276,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 47, + "line": 50, "command": "install", "hasParent": true }, @@ -321,7 +323,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 49, + "line": 52, "command": "install", "hasParent": true }, @@ -366,7 +368,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 50, + "line": 53, "command": "install", "hasParent": true }, @@ -415,7 +417,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 51, + "line": 54, "command": "install", "hasParent": true }, @@ -467,7 +469,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 52, + "line": 55, "command": "install", "hasParent": true }, @@ -516,7 +518,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 56, "command": "install", "hasParent": true }, @@ -558,7 +560,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 54, + "line": 57, "command": "install", "hasParent": true }, @@ -600,7 +602,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 55, + "line": 58, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json index 0d6c4a1..151c0a8 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json @@ -14,7 +14,8 @@ "^\\.$", "^dir$", "^dir/dir$", - "^fileset$" + "^fileset$", + "^subdir$" ], "targetIds": [ "^ALL_BUILD::@6890427a1f51a3e7e1df$", @@ -26,6 +27,7 @@ "^c_shared_exe::@6890427a1f51a3e7e1df$", "^c_static_lib::@6890427a1f51a3e7e1df$", "^c_static_exe::@6890427a1f51a3e7e1df$", + "^c_subdir::@6890427a1f51a3e7e1df$", "^c_headers_1::@6b8db101d64c125f29fe$", "^c_headers_2::@6b8db101d64c125f29fe$" ] diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json index 4e772a7..0d45d07 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json @@ -96,6 +96,10 @@ "backtrace": null }, { + "id": "^c_subdir::@6890427a1f51a3e7e1df$", + "backtrace": null + }, + { "id": "^c_static_exe::@6890427a1f51a3e7e1df$", "backtrace": null }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json index b4318dd..9a210ff 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json @@ -115,7 +115,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -145,7 +145,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -175,7 +175,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 47, + "line": 50, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json new file mode 100644 index 0000000..12ec917 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json @@ -0,0 +1,150 @@ +{ + "name": "c_subdir", + "id": "^c_subdir::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "STATIC_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^subdir/empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^subdir/CMakeLists\\.txt$", + "line": 4, + "command": "target_sources", + "hasParent": true + }, + { + "file": "^subdir/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^subdir/empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^subdir/empty\\.c$" + ], + "includes": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/subdir$", + "isSystem": null, + "backtrace": [ + { + "file": "^subdir/CMakeLists\\.txt$", + "line": 2, + "command": "target_include_directories", + "hasParent": true + }, + { + "file": "^subdir/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "defines": [ + { + "define": "SUBDIR", + "backtrace": [ + { + "file": "^subdir/CMakeLists\\.txt$", + "line": 1, + "command": "target_compile_definitions", + "hasParent": true + }, + { + "file": "^subdir/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 17, + "command": "add_library", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib)?c_subdir\\.(a|lib)$", + "artifacts": [ + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_subdir\\.(a|lib)$", + "_dllExtra": false + } + ], + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": null, + "archive": { + "lto": null + }, + "dependencies": [ + { + "id": "^c_lib::@6890427a1f51a3e7e1df$", + "backtrace": [ + { + "file": "^subdir/CMakeLists\\.txt$", + "line": 3, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^subdir/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json index 5769f0c..16d074a 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json @@ -136,7 +136,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 39, + "line": 42, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json index 1fe4d67..03f4cb9 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json @@ -91,7 +91,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -121,7 +121,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -151,7 +151,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 47, + "line": 50, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake index 019eb87..09db216 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake +++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake @@ -14,6 +14,9 @@ add_library(c_static_lib STATIC empty.c) add_executable(c_static_exe empty.c) target_link_libraries(c_static_exe PRIVATE c_static_lib) +add_library(c_subdir STATIC) +add_subdirectory(subdir) + add_subdirectory(cxx) add_subdirectory(alias) add_subdirectory(object) diff --git a/Tests/RunCMake/FileAPI/subdir/CMakeLists.txt b/Tests/RunCMake/FileAPI/subdir/CMakeLists.txt new file mode 100644 index 0000000..b8f4550 --- /dev/null +++ b/Tests/RunCMake/FileAPI/subdir/CMakeLists.txt @@ -0,0 +1,4 @@ +target_compile_definitions(c_subdir PRIVATE SUBDIR) +target_include_directories(c_subdir PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(c_subdir PRIVATE c_lib) +target_sources(c_subdir PRIVATE empty.c) diff --git a/Tests/RunCMake/FileAPI/subdir/empty.c b/Tests/RunCMake/FileAPI/subdir/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FileAPI/subdir/empty.c diff --git a/Tests/RunCMake/File_Archive/RunCMakeTest.cmake b/Tests/RunCMake/File_Archive/RunCMakeTest.cmake index 3908f42..dad0dd3 100644 --- a/Tests/RunCMake/File_Archive/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Archive/RunCMakeTest.cmake @@ -13,6 +13,9 @@ run_cmake(zip) # Extracting only selected files or directories run_cmake(zip-filtered) +run_cmake(create-missing-args) +run_cmake(extract-missing-args) + run_cmake(unsupported-format) run_cmake(zip-with-bad-compression) run_cmake(7zip-with-bad-compression) diff --git a/Tests/RunCMake/File_Archive/create-missing-args-result.txt b/Tests/RunCMake/File_Archive/create-missing-args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Archive/create-missing-args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Archive/create-missing-args-stderr.txt b/Tests/RunCMake/File_Archive/create-missing-args-stderr.txt new file mode 100644 index 0000000..fd026f9 --- /dev/null +++ b/Tests/RunCMake/File_Archive/create-missing-args-stderr.txt @@ -0,0 +1,19 @@ +^CMake Error at create-missing-args.cmake:[0-9]+ \(file\): + Error after keyword "COMPRESSION": + + missing required value + + Error after keyword "COMPRESSION_LEVEL": + + missing required value + + Error after keyword "FORMAT": + + missing required value + + Error after keyword "OUTPUT": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/File_Archive/create-missing-args.cmake b/Tests/RunCMake/File_Archive/create-missing-args.cmake new file mode 100644 index 0000000..a0c84d2 --- /dev/null +++ b/Tests/RunCMake/File_Archive/create-missing-args.cmake @@ -0,0 +1,8 @@ +file(ARCHIVE_CREATE + OUTPUT # missing output path + FORMAT # missing output format + COMPRESSION # missing compression type + COMPRESSION_LEVEL # missing compression level + MTIME # missing modification time + PATHS # no paths + ) diff --git a/Tests/RunCMake/File_Archive/extract-missing-args-result.txt b/Tests/RunCMake/File_Archive/extract-missing-args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Archive/extract-missing-args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Archive/extract-missing-args-stderr.txt b/Tests/RunCMake/File_Archive/extract-missing-args-stderr.txt new file mode 100644 index 0000000..0c93ece --- /dev/null +++ b/Tests/RunCMake/File_Archive/extract-missing-args-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at extract-missing-args.cmake:[0-9]+ \(file\): + Error after keyword "DESTINATION": + + missing required value + + Error after keyword "INPUT": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/File_Archive/extract-missing-args.cmake b/Tests/RunCMake/File_Archive/extract-missing-args.cmake new file mode 100644 index 0000000..21c5d99 --- /dev/null +++ b/Tests/RunCMake/File_Archive/extract-missing-args.cmake @@ -0,0 +1,5 @@ +file(ARCHIVE_EXTRACT + INPUT # missing input + DESTINATION # missing destination + PATTERNS # no patterns + ) diff --git a/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt b/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt index a6ea314..72292f9 100644 --- a/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt +++ b/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt @@ -1,4 +1,7 @@ CMake Error at BadArgContent.cmake:[0-9]+ \(file\): - file CONFIGURE CONTENT option needs a value. + Error after keyword "CONTENT": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt b/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt index b5a924c..d793f48 100644 --- a/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt +++ b/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt @@ -1,4 +1,7 @@ CMake Error at BadArgOutput.cmake:[0-9]+ \(file\): - file CONFIGURE OUTPUT option needs a value. + Error after keyword "OUTPUT": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Configure/NoArgContent-result.txt b/Tests/RunCMake/File_Configure/NoArgContent-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgContent-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Configure/NoArgContent-stderr.txt b/Tests/RunCMake/File_Configure/NoArgContent-stderr.txt new file mode 100644 index 0000000..2e8dd9a --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgContent-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoArgContent.cmake:[0-9]+ \(file\): + file CONFIGURE CONTENT option is mandatory. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/File_Configure/NoArgContent.cmake b/Tests/RunCMake/File_Configure/NoArgContent.cmake new file mode 100644 index 0000000..cf52c46 --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgContent.cmake @@ -0,0 +1 @@ +file(CONFIGURE OUTPUT "") diff --git a/Tests/RunCMake/File_Configure/NoArgOutput-result.txt b/Tests/RunCMake/File_Configure/NoArgOutput-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgOutput-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Configure/NoArgOutput-stderr.txt b/Tests/RunCMake/File_Configure/NoArgOutput-stderr.txt new file mode 100644 index 0000000..53de48b --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgOutput-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoArgOutput.cmake:[0-9]+ \(file\): + file CONFIGURE OUTPUT option is mandatory. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/File_Configure/NoArgOutput.cmake b/Tests/RunCMake/File_Configure/NoArgOutput.cmake new file mode 100644 index 0000000..77e9cdc --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgOutput.cmake @@ -0,0 +1 @@ +file(CONFIGURE CONTENT "") diff --git a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake index 5022985..008ce67 100644 --- a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake @@ -9,6 +9,8 @@ run_cmake(DirOutput) run_cmake(NewLineStyle-NoArg) run_cmake(NewLineStyle-ValidArg) run_cmake(NewLineStyle-WrongArg) +run_cmake(NoArgOutput) +run_cmake(NoArgContent) run_cmake(SubDir) run_cmake(AtOnly) run_cmake(EscapeQuotes) diff --git a/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt b/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt index e823b25..708e6be 100644 --- a/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt +++ b/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt @@ -1,4 +1,7 @@ CMake Error at EmptyCondition1.cmake:2 \(file\): - file Incorrect arguments to GENERATE subcommand. + Error after keyword "CONDITION": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/File_Generate/InputAndContent-check.cmake b/Tests/RunCMake/File_Generate/InputAndContent-check.cmake new file mode 100644 index 0000000..5c9b803 --- /dev/null +++ b/Tests/RunCMake/File_Generate/InputAndContent-check.cmake @@ -0,0 +1,8 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/output-INPUT.txt" input) +if(NOT input MATCHES "INPUT file") + string(APPEND RunCMake_TEST_FAILED "INPUT incorrectly overridden by CONTENT") +endif() +file(READ "${RunCMake_TEST_BINARY_DIR}/output-CONTENT.txt" content) +if(NOT content MATCHES "CONTENT argument") + string(APPEND RunCMake_TEST_FAILED "CONTENT incorrectly overridden by INPUT") +endif() diff --git a/Tests/RunCMake/File_Generate/InputAndContent-input.txt b/Tests/RunCMake/File_Generate/InputAndContent-input.txt new file mode 100644 index 0000000..73f162b --- /dev/null +++ b/Tests/RunCMake/File_Generate/InputAndContent-input.txt @@ -0,0 +1 @@ +INPUT file diff --git a/Tests/RunCMake/File_Generate/InputAndContent.cmake b/Tests/RunCMake/File_Generate/InputAndContent.cmake new file mode 100644 index 0000000..9c3977a --- /dev/null +++ b/Tests/RunCMake/File_Generate/InputAndContent.cmake @@ -0,0 +1,10 @@ +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output-INPUT.txt" + INPUT "${CMAKE_CURRENT_SOURCE_DIR}/InputAndContent-input.txt" + CONTENT "CONTENT argument" +) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output-CONTENT.txt" + CONTENT "CONTENT argument" + INPUT "${CMAKE_CURRENT_SOURCE_DIR}/InputAndContent-input.txt" +) diff --git a/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt b/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt index bc71f2f..b1b7f80 100644 --- a/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt +++ b/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt @@ -1,4 +1,7 @@ CMake Error at NewLineStyle-NoArg.cmake:[0-9]+ \(file\): - file Incorrect arguments to GENERATE subcommand. + Error after keyword "NEWLINE_STYLE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index be3bf04..5a670ae 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -17,6 +17,7 @@ run_cmake(EmptyCondition2) run_cmake(BadCondition) run_cmake(DebugEvaluate) run_cmake(GenerateSource) +run_cmake(InputAndContent) run_cmake(OutputNameMatchesSources) run_cmake(OutputNameMatchesObjects) run_cmake(OutputNameMatchesOtherSources) diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index f479dcf..661ae3f 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -24,6 +24,27 @@ endif() # We need a real pkg-config to run the test for get_variable. find_package(PkgConfig) if (PKG_CONFIG_FOUND) + string(FIND "${CMAKE_CURRENT_BINARY_DIR}" " " IS_SPACES_IN_PATH) + if(IS_SPACES_IN_PATH GREATER -1) + string(REPLACE " " "\\ " ESCAPED_ROOT "${CMAKE_CURRENT_BINARY_DIR}") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_spaces.pc" " +libdir=${ESCAPED_ROOT} +Name: test_spaces.pc +Version: 0.0 +Description: test spaces +Libs: -L\${libdir} +") + set(PKG_CONFIG_PATH_SAVED "$ENV{PKG_CONFIG_PATH}") + set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_BINARY_DIR}") + execute_process(COMMAND "${PKG_CONFIG_EXECUTABLE}" --libs test_spaces + ERROR_QUIET COMMAND_ERROR_IS_FATAL ANY + OUTPUT_VARIABLE test_spaces_LIBS) + set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH_SAVED}") + string(STRIP "${test_spaces_LIBS}" test_spaces_LIBS_STRIPPED) + if(NOT "${test_spaces_LIBS_STRIPPED}" STREQUAL "-L${ESCAPED_ROOT}") + set(PKG_CONFIG_DONT_SUPPORT_SPACES_IN_PATH TRUE) + endif() + endif() run_cmake(FindPkgConfig_GET_VARIABLE) run_cmake(FindPkgConfig_GET_VARIABLE_PREFIX_PATH) run_cmake(FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH) @@ -32,5 +53,7 @@ if (PKG_CONFIG_FOUND) run_cmake(FindPkgConfig_VERSION_OPERATORS) run_cmake(FindPkgConfig_GET_MATCHING_MODULE_NAME) run_cmake(FindPkgConfig_empty_target) - run_cmake(FindPkgConfig_LIBRARY_PATH) + if(NOT PKG_CONFIG_DONT_SUPPORT_SPACES_IN_PATH) + run_cmake(FindPkgConfig_LIBRARY_PATH) + endif() endif () diff --git a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake index 51e627d..3afda4d 100644 --- a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake +++ b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake @@ -23,3 +23,8 @@ string(APPEND content "set(target_file_name ${target_name})\n") file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkMultiConfigPostfixInfo.cmake CONTENT "${content}") + + +# Try to link this framework to ensure postfix is correctly handled +add_library(otherlib SHARED foo.c) +target_link_libraries(otherlib PRIVATE ${target_name}) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake index f20d225..f1023d1 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(add_link_options) run_cmake(link_directories) run_cmake(target_link_options) run_cmake(target_link_directories) +run_cmake(invalid-property) run_cmake(no-arguments) run_cmake(empty-arguments) run_cmake(forbidden-arguments) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt index a80a11b..c3eb103 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_command.cmake:[0-9]+ \(add_custom_command\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt index deb246a..8bd07fe 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_target.cmake:[0-9]+ \(add_custom_target\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt index 17c348c..8314461 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_link_options.cmake:[0-9]+ \(add_link_options\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt index bae6505..b29303b 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt @@ -1,6 +1,6 @@ -CMake Error at forbidden-arguments.cmake:[0-9]+ \(link_libraries\): - Property LINK_LIBRARIES contains the invalid item "<LINK_GROUP:feat>". The - LINK_LIBRARIES property may contain the generator-expression +CMake Error at forbidden-arguments.cmake:[0-9]+ \(add_library\): + Property LINK_LIBRARIES contains the invalid item "</LINK_GROUP:feat>". + The LINK_LIBRARIES property may contain the generator-expression "\$<LINK_GROUP:...>" which may be used to specify how the libraries are linked. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-result.txt b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-stderr.txt new file mode 100644 index 0000000..f39d275 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at invalid-property.cmake:[0-9]+ \(set_property\): + Error evaluating generator expression: + + \$<LINK_GROUP:feat,dep> + + \$<LINK_GROUP:...> may only be used with binary targets to specify group of + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property.cmake b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property.cmake new file mode 100644 index 0000000..549f4c1 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +set (CMAKE_LINK_GROUP_USING_feat "--prefix" "--suffix") +set (CMAKE_LINK_GROUP_USING_feat_SUPPORTED TRUE) + +add_library(dep SHARED empty.c) +set_property(TARGET dep PROPERTY INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE "$<LINK_GROUP:feat,dep>") + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE dep) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt index 51194a4..1ee01f3 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at link_directories.cmake:[0-9]+ \(link_directories\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt index 042dd0b..58a8fc4 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_directories.cmake:[0-9]+ \(target_link_directories\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt index 7030b9c..910106c 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_options.cmake:[0-9]+ \(target_link_options\): \$<LINK_GROUP:FEAT> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake index 3fb68d6..7df0e80 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(add_link_options) run_cmake(link_directories) run_cmake(target_link_options) run_cmake(target_link_directories) +run_cmake(invalid-property) run_cmake(no-arguments) run_cmake(empty-arguments) run_cmake(forbidden-arguments) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt index d8ff0eb..a9c3842 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_command.cmake:[0-9]+ \(add_custom_command\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt index 8ca384d..95104a5 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_target.cmake:[0-9]+ \(add_custom_target\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt index 399a413..f8669ad 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_link_options.cmake:[0-9]+ \(add_link_options\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt index 5245dd8..fc8e383 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt @@ -1,5 +1,5 @@ -CMake Error at forbidden-arguments.cmake:[0-9]+ \(link_libraries\): - Property LINK_LIBRARIES contains the invalid item "<LINK_LIBRARY:feat>". +CMake Error at forbidden-arguments.cmake:[0-9]+ \(add_library\): + Property LINK_LIBRARIES contains the invalid item "</LINK_LIBRARY:feat>". The LINK_LIBRARIES property may contain the generator-expression "\$<LINK_LIBRARY:...>" which may be used to specify how the libraries are linked. diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-stderr.txt new file mode 100644 index 0000000..7410e48 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at invalid-property.cmake:[0-9]+ \(set_property\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:feat,dep> + + \$<LINK_LIBRARY:...> may only be used with binary targets to specify link + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property.cmake new file mode 100644 index 0000000..a8e3a57 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +set (CMAKE_LINK_LIBRARY_USING_feat "<LIBRARY>") +set (CMAKE_LINK_LIBRARY_USING_feat_SUPPORTED TRUE) + +add_library(dep SHARED empty.c) +set_property(TARGET dep PROPERTY INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE "$<LINK_LIBRARY:feat,dep>") + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE dep) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt index aeb32f2..e47bf04 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at link_directories.cmake:[0-9]+ \(link_directories\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt index e0c60c4..7c467fd 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_directories.cmake:[0-9]+ \(target_link_directories\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt index 6c9aab1..02805b7 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_options.cmake:[0-9]+ \(target_link_options\): \$<LINK_LIBRARY:FEAT> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake index 148baac..a79fcaf 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake @@ -2,6 +2,9 @@ include(RunCMake) run_cmake(TARGET_FILE-recursion) run_cmake(OUTPUT_NAME-recursion) +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + run_cmake(TARGET_BUNDLE_DIR_NAME) +endif() run_cmake(TARGET_FILE_DIR-dependency) run_cmake(TARGET_FILE_DIR-no-dependency) run_cmake(TARGET_FILE_PREFIX-imported-target) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME-check.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME-check.cmake new file mode 100644 index 0000000..6e62ce3 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME-check.cmake @@ -0,0 +1 @@ +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_BUNDLE_DIR_NAME-generated.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME.cmake new file mode 100644 index 0000000..23db8fd --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME.cmake @@ -0,0 +1,33 @@ +enable_language(C) + +set(GENERATE_CONTENT [[ +macro (check_value test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_library(test-lib MODULE empty.c) +set_target_properties(test-lib PROPERTIES BUNDLE TRUE) + +add_library(test-fw empty.c) +set_target_properties(test-fw PROPERTIES FRAMEWORK TRUE) + +add_executable(test-app MACOSX_BUNDLE empty.c) + +add_executable(test-app-custom MACOSX_BUNDLE empty.c) +set_target_properties(test-app-custom PROPERTIES BUNDLE_EXTENSION custom) + +string(APPEND GENERATE_CONTENT [[ +check_value("TARGET_BUNDLE_DIR_NAME library" "$<TARGET_BUNDLE_DIR_NAME:test-lib>" "test-lib.bundle") +check_value("TARGET_BUNDLE_DIR_NAME framework" "$<TARGET_BUNDLE_DIR_NAME:test-fw>" "test-fw.framework") +check_value("TARGET_BUNDLE_DIR_NAME app" "$<TARGET_BUNDLE_DIR_NAME:test-app>" "test-app.app") +check_value("TARGET_BUNDLE_DIR_NAME custom" "$<TARGET_BUNDLE_DIR_NAME:test-app-custom>" "test-app-custom.custom") +]]) + +file( + GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_BUNDLE_DIR_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" +) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt new file mode 100644 index 0000000..fb61d4b --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error in CMakeLists.txt: + MSVC_DEBUG_INFORMATION_FORMAT value 'BogusValue' not known for this (C|CXX) + compiler. ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake new file mode 100644 index 0000000..165ea38 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0141 NEW) +include(CMP0141-common.cmake) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake new file mode 100644 index 0000000..82754a9 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake @@ -0,0 +1,4 @@ +include(CMP0141-common.cmake) + +# Setting this policy after enable_language command has no effect. +cmake_policy(SET CMP0141 NEW) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake new file mode 100644 index 0000000..7bbe586 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0141 OLD) +include(CMP0141-common.cmake) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake new file mode 100644 index 0000000..912112a --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0141-common.cmake) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake new file mode 100644 index 0000000..8e43a25 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake @@ -0,0 +1,31 @@ +enable_language(CXX) + +cmake_policy(GET CMP0141 cmp0141) +if(cmp0141 STREQUAL "NEW") + if(NOT CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT) + message(SEND_ERROR "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT not set under NEW behavior") + endif() +else() + if(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT) + message(SEND_ERROR "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT is set under OLD behavior") + endif() +endif() + +if(cmp0141 STREQUAL "NEW") + if(CMAKE_CXX_FLAGS_DEBUG MATCHES "[/-]Zi( |$)") + message(SEND_ERROR "CMAKE_CXX_FLAGS_DEBUG has -Zi flags under NEW behavior.") + endif() + if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "[/-]Zi( |$)") + message(SEND_ERROR "CMAKE_CXX_FLAGS_RELWITHDEBINFO has -Zi flags under NEW behavior.") + endif() +else() + if(NOT (CMAKE_CXX_FLAGS_DEBUG MATCHES "[/-]Zi( |$)")) + message(SEND_ERROR "CMAKE_CXX_FLAGS_DEBUG does not have -Zi flags under OLD behavior.") + endif() + if(NOT (CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "[/-]Zi( |$)")) + message(SEND_ERROR "CMAKE_CXX_FLAGS_RELWITHDEBINFO does not have -Zi flags under OLD behavior.") + endif() +endif() + +set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT BogusValue) +add_library(foo empty.cxx) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt new file mode 100644 index 0000000..aba1016 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.24) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake new file mode 100644 index 0000000..f678acf --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(CMP0141-WARN) +run_cmake(CMP0141-OLD) +run_cmake(CMP0141-NEW) +run_cmake(CMP0141-NoEffect) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx b/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx diff --git a/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake new file mode 100644 index 0000000..a1ae6ac --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake @@ -0,0 +1,28 @@ +set(expected_compile_commands +[==[^\[ +{ + "directory": "[^ +]*(/Tests/RunCMake/NinjaMultiConfig/CompileCommands-build|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\CompileCommands-build)", + "command": "[^ +]*Debug[^ +]*", + "file": "[^ +]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)" +}, +{ + "directory": "[^ +]*(/Tests/RunCMake/NinjaMultiConfig/CompileCommands-build|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\CompileCommands-build)", + "command": "[^ +]*Release[^ +]*", + "file": "[^ +]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)" +} +]$]==]) + +file(READ "${RunCMake_TEST_BINARY_DIR}/compile_commands.json" actual_compile_commands) +if(NOT actual_compile_commands MATCHES "${expected_compile_commands}") + string(REPLACE "\n" "\n " expected_compile_commands_formatted "${expected_compile_commands}") + string(REPLACE "\n" "\n " actual_compile_commands_formatted "${actual_compile_commands}") + string(APPEND RunCMake_TEST_FAILED "Expected compile_commands.json to match:\n ${expected_compile_commands_formatted}\nActual compile_commands.json:\n ${actual_compile_commands_formatted}\n") +endif() diff --git a/Tests/RunCMake/NinjaMultiConfig/CompileCommands.cmake b/Tests/RunCMake/NinjaMultiConfig/CompileCommands.cmake new file mode 100644 index 0000000..fc44d5a --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CompileCommands.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_executable(exe main.c) diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 738bc6c..c040e8f 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -453,6 +453,11 @@ run_cmake_command(NoUnusedVariables ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR} "-DCMAKE_DEFAULT_BUILD_TYPE=Debug" "-DCMAKE_DEFAULT_CONFIGS=all" ) +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_CROSS_CONFIGS=all;-DCMAKE_EXPORT_COMPILE_COMMANDS=ON") +run_cmake(CompileCommands) +unset(RunCMake_TEST_OPTIONS) # CudaSimple uses separable compilation, which is currently only supported on NVCC. if(CMake_TEST_CUDA) diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake index 51c8832..691c495 100644 --- a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake +++ b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake @@ -154,6 +154,7 @@ foreach(t ${targets}) cmake_parse_implicit_link_info("${input}" implicit_libs idirs implicit_fwks log "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}" + LANGUAGE ${lang} COMPUTE_IMPLICIT_OBJECTS implicit_objs) set(library_arch) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 1c92ca0..c329b46 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -1,8 +1,10 @@ -foreach(arg +foreach( + arg + IN ITEMS RunCMake_GENERATOR RunCMake_SOURCE_DIR RunCMake_BINARY_DIR - ) + ) if(NOT DEFINED ${arg}) message(FATAL_ERROR "${arg} not given!") endif() @@ -31,7 +33,7 @@ function(run_cmake test) set(platform_name msys) endif() - foreach(o out err) + foreach(o IN ITEMS out err) if(RunCMake-std${o}-file AND EXISTS ${top_src}/${RunCMake-std${o}-file}) file(READ ${top_src}/${RunCMake-std${o}-file} expect_std${o}) string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") @@ -176,7 +178,7 @@ function(run_cmake test) "|[^\n]*Bullseye Testing Technology" ")[^\n]*\n)+" ) - foreach(o out err) + foreach(o IN ITEMS out err) string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}") string(REGEX REPLACE "${ignore_line_regex}" "\\1" actual_std${o} "${actual_std${o}}") string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") diff --git a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake index e5bfac4..58a111a 100644 --- a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake +++ b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake @@ -1,5 +1,8 @@ include(RunCMake) +# Do not let ccache modify paths checked by the test cases. +unset(ENV{CCACHE_BASEDIR}) + function(run_symlink_test_case) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt" diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 97c3394..0d8e4c9 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -36,6 +36,7 @@ \* CMP0113 \* CMP0119 \* CMP0131 + \* CMP0142 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake b/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake new file mode 100644 index 0000000..46af974 --- /dev/null +++ b/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake @@ -0,0 +1,46 @@ +macro(DebugInformationFormat_check tgt Debug_expect Release_expect MinSizeRel_expect RelWithDebInfo_expect) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.") + return() + endif() + + set(Debug_actual "") + set(Release_actual "") + set(MinSizeRel_actual "") + set(RelWithDebInfo_actual "") + + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<ItemDefinitionGroup Condition=\"'\\$\\(Configuration\\)\\|\\$\\(Platform\\)'=='([^<>]+)\\|[A-Za-z0-9_]+'\">") + set(Configuration "${CMAKE_MATCH_1}") + endif() + if(line MATCHES "^ *<DebugInformationFormat>([^<>]+)</DebugInformationFormat>") + set(${Configuration}_actual "${CMAKE_MATCH_1}") + endif() + endforeach() + + if (NOT "${Debug_actual}" STREQUAL "${Debug_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Debug Configuration has DebugInformationFormat '${Debug_actual}', not '${Debug_expect}'.") + endif() + if (NOT "${Release_actual}" STREQUAL "${Release_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Release Configuration has DebugInformationFormat '${Release_actual}', not '${Release_expect}'.") + endif() + if (NOT "${MinSizeRel_actual}" STREQUAL "${MinSizeRel_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj MinSizeRel Configuration has DebugInformationFormat '${MinSizeRel_actual}', not '${MinSizeRel_expect}'.") + endif() + if (NOT "${RelWithDebInfo_actual}" STREQUAL "${RelWithDebInfo_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj RelWithDebInfo Configuration has DebugInformationFormat '${RelWithDebInfo_actual}', not '${RelWithDebInfo_expect}'.") + endif() +endmacro() + +DebugInformationFormat_check(default-C ProgramDatabase "" "" ProgramDatabase) +DebugInformationFormat_check(default-CXX ProgramDatabase "" "" ProgramDatabase) +DebugInformationFormat_check(empty-C "" "" "" "") +DebugInformationFormat_check(empty-CXX "" "" "" "") +DebugInformationFormat_check(Embedded-C OldStyle OldStyle OldStyle OldStyle) +DebugInformationFormat_check(Embedded-CXX OldStyle OldStyle OldStyle OldStyle) +DebugInformationFormat_check(ProgramDatabase-C ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase) +DebugInformationFormat_check(ProgramDatabase-CXX ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase) +DebugInformationFormat_check(EditAndContinue-C EditAndContinue EditAndContinue EditAndContinue EditAndContinue) +DebugInformationFormat_check(EditAndContinue-CXX EditAndContinue EditAndContinue EditAndContinue EditAndContinue) diff --git a/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake b/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake new file mode 100644 index 0000000..f670166 --- /dev/null +++ b/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake @@ -0,0 +1,24 @@ +set(CMAKE_CONFIGURATION_TYPES Debug Release MinSizeRel RelWithDebInfo) +cmake_policy(SET CMP0141 NEW) +enable_language(C) +enable_language(CXX) + +add_library(default-C empty.c) +add_library(default-CXX empty.cxx) + +set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "") +add_library(empty-C empty.c) +add_library(empty-CXX empty.cxx) + +set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "Embedded") +add_library(Embedded-C empty.c) +add_library(Embedded-CXX empty.cxx) + +set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase") +add_library(ProgramDatabase-C empty.c) +add_library(ProgramDatabase-CXX empty.cxx) + +add_library(EditAndContinue-C empty.c) +set_property(TARGET EditAndContinue-C PROPERTY MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue") +add_library(EditAndContinue-CXX empty.cxx) +set_property(TARGET EditAndContinue-CXX PROPERTY MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue") diff --git a/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake index bcdc101..1701a36 100644 --- a/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake +++ b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake @@ -5,6 +5,7 @@ if(NOT EXISTS "${vcProjectFile}") endif() set(found_iface_h 0) +set(found_int_dir 0) file(STRINGS "${vcProjectFile}" lines) foreach(line IN LISTS lines) if(line MATCHES "<([A-Za-z0-9_]+) +Include=.*iface\\.h") @@ -19,7 +20,15 @@ foreach(line IN LISTS lines) endif() set(found_iface_h 1) endif() + if(line MATCHES "^ *<IntDir [^<>]+>[^<>]+</IntDir>") + set(found_int_dir 1) + endif() endforeach() if(NOT found_iface_h) set(RunCMake_TEST_FAILED "iface.h not referenced in\n ${vcProjectFile}") + return() +endif() +if(NOT found_int_dir) + set(RunCMake_TEST_FAILED "No references to IntDir in\n ${vcProjectFile}") + return() endif() diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index ee8821a..f027e94 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -16,6 +16,7 @@ run_cmake(NoImpLib) run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) run_cmake(SourceGroupTreeCMakeLists) +run_cmake(SourceGroupFileSet) run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) @@ -87,3 +88,4 @@ run_cmake(VsDotnetStartupObject) run_cmake(VsDotnetTargetFramework) run_cmake(VsDotnetTargetFrameworkVersion) run_cmake(VsNoCompileBatching) +run_cmake(DebugInformationFormat) diff --git a/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake new file mode 100644 index 0000000..fb2eecc --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0011 NEW) + +set(vcFiltersFile "${RunCMake_TEST_BINARY_DIR}/SourceGroupFileSet.vcxproj.filters") +if(NOT EXISTS "${vcFiltersFile}") + set(RunCMake_TEST_FAILED "Filters file ${vcFiltersFile} does not exist.") + return() +endif() + +file(STRINGS "${vcFiltersFile}" lines) + +include(${RunCMake_TEST_SOURCE_DIR}/SourceGroupHelpers.cmake) + +find_source_group("${lines}" "Header Files\\SourceGroupFileSet") diff --git a/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake b/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake new file mode 100644 index 0000000..9541687 --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake @@ -0,0 +1,3 @@ +add_library(SourceGroupFileSet INTERFACE) +target_sources(SourceGroupFileSet PUBLIC FILE_SET HEADERS FILES iface.h) +source_group("Header Files/SourceGroupFileSet" FILES iface.h) diff --git a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake index c82a66e..3a5d2e7 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake @@ -1,8 +1,9 @@ function(find_source_group LINES NAME) set(foundFileFilter 0) set(foundFilter 0) + string(REPLACE "\\" "\\\\" regexName "${NAME}") foreach(line IN LISTS LINES) - if(line MATCHES "<Filter>${NAME}</Filter>") + if(line MATCHES "<Filter>${regexName}</Filter>") if(foundFileFilter) set(RunCMake_TEST_FAILED "Multiple files listed with filter for ${NAME}." PARENT_SCOPE) set(FILTER_FOUND 0 PARENT_SCOPE) @@ -10,7 +11,7 @@ function(find_source_group LINES NAME) endif() set(foundFileFilter 1) endif() - if(line MATCHES "<Filter.*Include=\"${NAME}\"") + if(line MATCHES "<Filter.*Include=\"${regexName}\"") if(foundFilter) set(RunCMake_TEST_FAILED "Multiple copies of ${NAME} filter listed." PARENT_SCOPE) set(FILTER_FOUND 0 PARENT_SCOPE) diff --git a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake index ee0c412..28d0d29 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake @@ -18,9 +18,9 @@ set(SOURCE_GROUPS_TO_FIND "SourcesPrefix\\PrefixedNested" ) -foreach(GROUP_NAME IN LISTS ${SOURCE_GROUPS_TO_FIND}) +foreach(GROUP_NAME IN LISTS SOURCE_GROUPS_TO_FIND) find_source_group("${lines}" ${GROUP_NAME}) - if(NOT ${FILTER_FOUND}) + if(NOT FILTER_FOUND) return() endif() endforeach() diff --git a/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets-all_verify_interface_header_sets-Debug-build-check.cmake b/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets-all_verify_interface_header_sets-Debug-build-check.cmake new file mode 100644 index 0000000..d5a513a --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets-all_verify_interface_header_sets-Debug-build-check.cmake @@ -0,0 +1,10 @@ +# A custom command is used to copy the header file from the source directory to +# the binary directory. If the verification target was built, the custom +# command should have been executed, and the file should be present in the +# binary directory. +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/dir1/lib1.h") + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/dir1/lib1.h should exist but it does not\n") +endif() +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/dir2/lib2.h") + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/dir2/lib2.h should exist but it does not\n") +endif() diff --git a/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets.cmake b/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets.cmake new file mode 100644 index 0000000..8948bac --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_subdirectory(dir1) +add_subdirectory(dir2) diff --git a/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake b/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake index f022a43..b4fe720 100644 --- a/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake +++ b/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake @@ -40,8 +40,15 @@ endif() run_cmake_build(VerifyHeaderSets lang_test_c_verify_interface_header_sets) run_cmake_build(VerifyHeaderSets lang_test_cxx_verify_interface_header_sets) +run_cmake_build(VerifyHeaderSets interface_lang_test_cxx_verify_interface_header_sets) run_cmake_build(VerifyHeaderSets list_verify_interface_header_sets) set(RunCMake_TEST_OPTIONS -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON) +run_cmake(AllVerifyInterfaceHeaderSets) +unset(RunCMake_TEST_OPTIONS) + +run_cmake_build(AllVerifyInterfaceHeaderSets all_verify_interface_header_sets) + +set(RunCMake_TEST_OPTIONS -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON) run_cmake(VerifyHeaderSetsNonexistent) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake index 82ed935..f260609 100644 --- a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake +++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake @@ -1,5 +1,7 @@ enable_language(C CXX) +add_compile_definitions(TEST_ADD_COMPILE_DEFINITIONS) + set_property(SOURCE a.h PROPERTY LANGUAGE C) set_property(SOURCE dir/c.h PROPERTY LANGUAGE C) set_property(SOURCE dir/cxx.h PROPERTY LANGUAGE CXX) @@ -59,6 +61,10 @@ add_library(lang_test_cxx STATIC lib.c lib.cxx) target_compile_definitions(lang_test_cxx INTERFACE EXPECT_CXX) target_sources(lang_test_cxx INTERFACE FILE_SET HEADERS FILES lang_test.h) +add_library(interface_lang_test_cxx INTERFACE) +target_compile_definitions(interface_lang_test_cxx INTERFACE EXPECT_CXX) +target_sources(interface_lang_test_cxx INTERFACE FILE_SET HEADERS FILES lang_test.h) + set_property(SOURCE error.h PROPERTY LANGUAGE C) add_library(list STATIC lib.c) diff --git a/Tests/RunCMake/VerifyHeaderSets/a.h b/Tests/RunCMake/VerifyHeaderSets/a.h index 8b17182..898da49 100644 --- a/Tests/RunCMake/VerifyHeaderSets/a.h +++ b/Tests/RunCMake/VerifyHeaderSets/a.h @@ -2,4 +2,8 @@ # error "TEST_A_H defined" #endif +#ifndef TEST_ADD_COMPILE_DEFINITIONS +# error "TEST_ADD_COMPILE_DEFINITIONS not defined" +#endif + extern void a_h(void); diff --git a/Tests/RunCMake/VerifyHeaderSets/dir1/CMakeLists.txt b/Tests/RunCMake/VerifyHeaderSets/dir1/CMakeLists.txt new file mode 100644 index 0000000..d26e933 --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/dir1/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(lib1 STATIC ../lib.c) +add_custom_command(OUTPUT lib1.h COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/lib1.h lib1.h) +target_sources(lib1 PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR} FILES ${CMAKE_CURRENT_BINARY_DIR}/lib1.h) diff --git a/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h b/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h new file mode 100644 index 0000000..69c37ed --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + extern void lib1(void); diff --git a/Tests/RunCMake/VerifyHeaderSets/dir2/CMakeLists.txt b/Tests/RunCMake/VerifyHeaderSets/dir2/CMakeLists.txt new file mode 100644 index 0000000..8c3658c --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/dir2/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(lib2 STATIC ../lib.c) +add_custom_command(OUTPUT lib2.h COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/lib2.h lib2.h) +target_sources(lib2 PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR} FILES ${CMAKE_CURRENT_BINARY_DIR}/lib2.h) diff --git a/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h b/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h new file mode 100644 index 0000000..fa24a9a --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + extern void lib2(void); diff --git a/Tests/RunCMake/XcodeProject/BundleLinkBundle.cmake b/Tests/RunCMake/XcodeProject/BundleLinkBundle.cmake new file mode 100644 index 0000000..1f3c19d --- /dev/null +++ b/Tests/RunCMake/XcodeProject/BundleLinkBundle.cmake @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.23) + +project(BundleLinkBundle CXX) + +add_subdirectory(lib_bundle) + +add_executable(MainBundle MACOSX_BUNDLE main_bundle.cpp) + +target_link_libraries(MainBundle PRIVATE LibBundle) + +set_target_properties(MainBundle PROPERTIES + MACOSX_BUNDLE "YES" + XCODE_LINK_BUILD_PHASE_MODE BUILT_ONLY +) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 80c6b73..d20f5a6 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -151,6 +151,16 @@ endfunction() XcodeXCConfig() +function(BundleLinkBundle) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BundleLinkBundle-build) + run_cmake(BundleLinkBundle) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(BundleLinkBundle-build ${CMAKE_COMMAND} --build .) +endfunction() + +BundleLinkBundle() + + # Isolate device tests from host architecture selection. unset(ENV{CMAKE_OSX_ARCHITECTURES}) diff --git a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake index 71b7d8f..bec8790 100644 --- a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake +++ b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake @@ -12,6 +12,8 @@ set(found_target_library_FRAMEWORK_SEARCH_PATHS 0) set(found_inherited_FRAMEWORK_SEARCH_PATHS 0) set(found_project_LIBRARY_SEARCH_PATHS 0) set(found_target_library_LIBRARY_SEARCH_PATHS 0) +set(found_target_cmp0142old_LIBRARY_SEARCH_PATHS 0) +set(found_target_cmp0142new_LIBRARY_SEARCH_PATHS 0) set(found_inherited_LIBRARY_SEARCH_PATHS 0) file(STRINGS "${xcProjectFile}" lines) foreach(line IN LISTS lines) @@ -42,6 +44,12 @@ foreach(line IN LISTS lines) if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib/\$\(CONFIGURATION\)\$\(EFFECTIVE_PLATFORM_NAME\)(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib(\\")?","\$\(inherited\)"\);]]) set(found_target_library_LIBRARY_SEARCH_PATHS 1) endif() + if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142OLD/\$\(CONFIGURATION\)\$\(EFFECTIVE_PLATFORM_NAME\)(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142OLD(\\")?","\$\(inherited\)"\);]]) + set(found_target_cmp0142old_LIBRARY_SEARCH_PATHS 1) + endif() + if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142NEW(\\")?","\$\(inherited\)"\);]]) + set(found_target_cmp0142new_LIBRARY_SEARCH_PATHS 1) + endif() if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("\$\(inherited\)"\);]]) set(found_inherited_LIBRARY_SEARCH_PATHS 1) endif() @@ -68,6 +76,12 @@ endif() if(NOT found_target_library_LIBRARY_SEARCH_PATHS) string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'library' in\n ${xcProjectFile}\n") endif() +if(NOT found_target_cmp0142old_LIBRARY_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'cmp0142old' in\n ${xcProjectFile}\n") +endif() +if(NOT found_target_cmp0142new_LIBRARY_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'cmp0142new' in\n ${xcProjectFile}\n") +endif() if(found_inherited_LIBRARY_SEARCH_PATHS) string(APPEND RunCMake_TEST_FAILED "Found unexpected LIBRARY_SEARCH_PATHS inherited-only value in\n ${xcProjectFile}\n") endif() diff --git a/Tests/RunCMake/XcodeProject/SearchPaths.cmake b/Tests/RunCMake/XcodeProject/SearchPaths.cmake index ef97709..b469772 100644 --- a/Tests/RunCMake/XcodeProject/SearchPaths.cmake +++ b/Tests/RunCMake/XcodeProject/SearchPaths.cmake @@ -3,6 +3,8 @@ enable_language(C) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathInc/TargetInc.framework") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib/TargetLib.framework") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142OLD") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142NEW") set(CMAKE_XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath") set(CMAKE_XCODE_ATTRIBUTE_LIBRARY_SEARCH_PATHS "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath") @@ -19,3 +21,11 @@ target_include_directories(include PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSe add_executable(library main.c) target_link_libraries(library PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib/TargetLib.framework") target_link_directories(library PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib") + +cmake_policy(SET CMP0142 OLD) +add_executable(cmp0142old main.c) +target_link_directories(cmp0142old PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142OLD") + +cmake_policy(SET CMP0142 NEW) +add_executable(cmp0142new main.c) +target_link_directories(cmp0142new PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142NEW") diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake index efd70cf..6bad527 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake @@ -29,6 +29,8 @@ check_property("UNDEFINED_BEHAVIOUR_SANITIZER" "enableUBSanitizer") check_property("UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "stopOnEveryUBSanitizerIssue") check_property("DISABLE_MAIN_THREAD_CHECKER" "disableMainThreadChecker") check_property("MAIN_THREAD_CHECKER_STOP" "stopOnEveryMainThreadCheckerIssue") +check_property("DISABLE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION" "enableGPUValidationMode") +check_property("ENABLE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION" "enableGPUShaderValidationMode") check_property("MALLOC_SCRIBBLE" "MallocScribble") check_property("MALLOC_GUARD_EDGES" "MallocGuardEdges") diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake index 5edbc89..267e379 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake @@ -32,6 +32,8 @@ function(create_scheme_for_property scheme property value) set_target_properties(${scheme} PROPERTIES XCODE_SCHEME_${property} "${value}") endfunction() +create_scheme_for_property(DISABLE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION ENABLE_GPU_API_VALIDATION OFF) +create_scheme_for_property(ENABLE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION ENABLE_GPU_SHADER_VALIDATION ON) create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_1 ENABLE_GPU_FRAME_CAPTURE_MODE 1) create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_3 ENABLE_GPU_FRAME_CAPTURE_MODE 3) create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED ENABLE_GPU_FRAME_CAPTURE_MODE Disabled) diff --git a/Tests/RunCMake/XcodeProject/lib_bundle/CMakeLIsts.txt b/Tests/RunCMake/XcodeProject/lib_bundle/CMakeLIsts.txt new file mode 100644 index 0000000..7a50ce8 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/lib_bundle/CMakeLIsts.txt @@ -0,0 +1,5 @@ + +add_library(LibBundle lib_bundle.cpp) + +set_target_properties(LibBundle PROPERTIES + MACOSX_BUNDLE YES) diff --git a/Tests/RunCMake/XcodeProject/lib_bundle/lib_bundle.cpp b/Tests/RunCMake/XcodeProject/lib_bundle/lib_bundle.cpp new file mode 100644 index 0000000..9f74584 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/lib_bundle/lib_bundle.cpp @@ -0,0 +1,6 @@ +#include <iostream> + +void foo() +{ + std::cout << "foobar" << std::endl; +} diff --git a/Tests/RunCMake/XcodeProject/main_bundle.cpp b/Tests/RunCMake/XcodeProject/main_bundle.cpp new file mode 100644 index 0000000..11834ac --- /dev/null +++ b/Tests/RunCMake/XcodeProject/main_bundle.cpp @@ -0,0 +1,9 @@ + +extern void foo(); + +int main() +{ + + foo(); + return 0; +} diff --git a/Tests/RunCMake/block/CMakeLists.txt b/Tests/RunCMake/block/CMakeLists.txt new file mode 100644 index 0000000..45cd10e --- /dev/null +++ b/Tests/RunCMake/block/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3...3.25) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/block/EndAlone-result.txt b/Tests/RunCMake/block/EndAlone-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/EndAlone-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/EndAlone-stderr.txt b/Tests/RunCMake/block/EndAlone-stderr.txt new file mode 100644 index 0000000..a588dd7 --- /dev/null +++ b/Tests/RunCMake/block/EndAlone-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at EndAlone.cmake:[0-9]+ \(endblock\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/EndAlone.cmake b/Tests/RunCMake/block/EndAlone.cmake new file mode 100644 index 0000000..0c428a9 --- /dev/null +++ b/Tests/RunCMake/block/EndAlone.cmake @@ -0,0 +1 @@ +endblock() diff --git a/Tests/RunCMake/block/EndAloneWithArgument-result.txt b/Tests/RunCMake/block/EndAloneWithArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/EndAloneWithArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/EndAloneWithArgument-stderr.txt b/Tests/RunCMake/block/EndAloneWithArgument-stderr.txt new file mode 100644 index 0000000..c3d25a3 --- /dev/null +++ b/Tests/RunCMake/block/EndAloneWithArgument-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at EndAloneWithArgument.cmake:[0-9]+ \(endblock\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/EndAloneWithArgument.cmake b/Tests/RunCMake/block/EndAloneWithArgument.cmake new file mode 100644 index 0000000..05df5b0 --- /dev/null +++ b/Tests/RunCMake/block/EndAloneWithArgument.cmake @@ -0,0 +1 @@ +endblock(WRONG_ARG) diff --git a/Tests/RunCMake/block/EndMissing-result.txt b/Tests/RunCMake/block/EndMissing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/EndMissing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/EndMissing-stderr.txt b/Tests/RunCMake/block/EndMissing-stderr.txt new file mode 100644 index 0000000..b9739a5 --- /dev/null +++ b/Tests/RunCMake/block/EndMissing-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at EndMissing.cmake:[0-9]+ \(block\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/EndMissing.cmake b/Tests/RunCMake/block/EndMissing.cmake new file mode 100644 index 0000000..335b64e --- /dev/null +++ b/Tests/RunCMake/block/EndMissing.cmake @@ -0,0 +1 @@ +block() diff --git a/Tests/RunCMake/block/EndWithArgument-stderr.txt b/Tests/RunCMake/block/EndWithArgument-stderr.txt new file mode 100644 index 0000000..7586453 --- /dev/null +++ b/Tests/RunCMake/block/EndWithArgument-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) in EndWithArgument.cmake: + A logical block closing on the line + + .+/Tests/RunCMake/block/EndWithArgument.cmake:[0-9]+ \(endblock\) + + has unexpected arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/block/EndWithArgument.cmake b/Tests/RunCMake/block/EndWithArgument.cmake new file mode 100644 index 0000000..0641c9a --- /dev/null +++ b/Tests/RunCMake/block/EndWithArgument.cmake @@ -0,0 +1,2 @@ +block() +endblock(END_ARG) diff --git a/Tests/RunCMake/block/InvalidArgument-result.txt b/Tests/RunCMake/block/InvalidArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidArgument-stderr.txt b/Tests/RunCMake/block/InvalidArgument-stderr.txt new file mode 100644 index 0000000..bee604b --- /dev/null +++ b/Tests/RunCMake/block/InvalidArgument-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidArgument.cmake:[0-9]+ \(block\): + block PROPAGATE cannot be specified without a new scope for VARIABLES +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidArgument.cmake b/Tests/RunCMake/block/InvalidArgument.cmake new file mode 100644 index 0000000..5269cd0 --- /dev/null +++ b/Tests/RunCMake/block/InvalidArgument.cmake @@ -0,0 +1,2 @@ +block(SCOPE_FOR POLICIES PROPAGATE VAR1) +endblock() diff --git a/Tests/RunCMake/block/InvalidNesting1-result.txt b/Tests/RunCMake/block/InvalidNesting1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting1-stderr.txt b/Tests/RunCMake/block/InvalidNesting1-stderr.txt new file mode 100644 index 0000000..6dfe0e1 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting1-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting1.cmake:[0-9]+ \(else\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting1.cmake b/Tests/RunCMake/block/InvalidNesting1.cmake new file mode 100644 index 0000000..27b7944 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting1.cmake @@ -0,0 +1,6 @@ + +if (TRUE) + block() +else() + endblock() +endif() diff --git a/Tests/RunCMake/block/InvalidNesting2-result.txt b/Tests/RunCMake/block/InvalidNesting2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting2-stderr.txt b/Tests/RunCMake/block/InvalidNesting2-stderr.txt new file mode 100644 index 0000000..71325b6 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting2-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting2.cmake:[0-9]+ \(endblock\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting2.cmake b/Tests/RunCMake/block/InvalidNesting2.cmake new file mode 100644 index 0000000..ae94cdc --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting2.cmake @@ -0,0 +1,6 @@ + +block() +if (TRUE) +elseif(FALSE) +endblock() +endif() diff --git a/Tests/RunCMake/block/InvalidNesting3-result.txt b/Tests/RunCMake/block/InvalidNesting3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting3-stderr.txt b/Tests/RunCMake/block/InvalidNesting3-stderr.txt new file mode 100644 index 0000000..344a931 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting3-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting3.cmake:[0-9]+ \(endwhile\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting3.cmake b/Tests/RunCMake/block/InvalidNesting3.cmake new file mode 100644 index 0000000..f692d24 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting3.cmake @@ -0,0 +1,5 @@ + +while(TRUE) +block() +endwhile() +endblock() diff --git a/Tests/RunCMake/block/InvalidNesting4-result.txt b/Tests/RunCMake/block/InvalidNesting4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting4-stderr.txt b/Tests/RunCMake/block/InvalidNesting4-stderr.txt new file mode 100644 index 0000000..44d6364 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting4-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting4.cmake:[0-9]+ \(endblock\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting4.cmake b/Tests/RunCMake/block/InvalidNesting4.cmake new file mode 100644 index 0000000..6e8e0ae --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting4.cmake @@ -0,0 +1,5 @@ + +block() +foreach(item IN ITEMS A B) +endblock() +endforeach() diff --git a/Tests/RunCMake/block/InvalidNesting5-result.txt b/Tests/RunCMake/block/InvalidNesting5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting5-stderr.txt b/Tests/RunCMake/block/InvalidNesting5-stderr.txt new file mode 100644 index 0000000..976d2e1 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting5-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting5.cmake:[0-9]+ \(endfunction\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting5.cmake b/Tests/RunCMake/block/InvalidNesting5.cmake new file mode 100644 index 0000000..0479e8d --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting5.cmake @@ -0,0 +1,5 @@ + +function(FUNC) + block() +endfunction() +endblock() diff --git a/Tests/RunCMake/block/InvalidNesting6-result.txt b/Tests/RunCMake/block/InvalidNesting6-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting6-stderr.txt b/Tests/RunCMake/block/InvalidNesting6-stderr.txt new file mode 100644 index 0000000..2d67b16 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting6-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting6.cmake:[0-9]+ \(endblock\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting6.cmake b/Tests/RunCMake/block/InvalidNesting6.cmake new file mode 100644 index 0000000..a1cb359 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting6.cmake @@ -0,0 +1,5 @@ + + block() +macro(FUNC) +endblock() +endmacro() diff --git a/Tests/RunCMake/block/MissingArgument-result.txt b/Tests/RunCMake/block/MissingArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/MissingArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/MissingArgument-stderr.txt b/Tests/RunCMake/block/MissingArgument-stderr.txt new file mode 100644 index 0000000..d3e63ca --- /dev/null +++ b/Tests/RunCMake/block/MissingArgument-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at MissingArgument.cmake:[0-9]+ \(block\): + Error after keyword "SCOPE_FOR": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/MissingArgument.cmake b/Tests/RunCMake/block/MissingArgument.cmake new file mode 100644 index 0000000..6018887 --- /dev/null +++ b/Tests/RunCMake/block/MissingArgument.cmake @@ -0,0 +1,2 @@ +block(SCOPE_FOR) +endblock() diff --git a/Tests/RunCMake/block/RunCMakeTest.cmake b/Tests/RunCMake/block/RunCMakeTest.cmake new file mode 100644 index 0000000..4260e76 --- /dev/null +++ b/Tests/RunCMake/block/RunCMakeTest.cmake @@ -0,0 +1,22 @@ +include(RunCMake) + +run_cmake(WrongArgument) +run_cmake(InvalidArgument) +run_cmake(MissingArgument) +run_cmake(WrongScope) +run_cmake(EndMissing) +run_cmake(EndWithArgument) +run_cmake(EndAlone) +run_cmake(EndAloneWithArgument) + +run_cmake(InvalidNesting1) +run_cmake(InvalidNesting2) +run_cmake(InvalidNesting3) +run_cmake(InvalidNesting4) +run_cmake(InvalidNesting5) +run_cmake(InvalidNesting6) + +run_cmake(Scope) +run_cmake(Scope-VARIABLES) +run_cmake(Scope-POLICIES) +run_cmake(Workflows) diff --git a/Tests/RunCMake/block/Scope-POLICIES.cmake b/Tests/RunCMake/block/Scope-POLICIES.cmake new file mode 100644 index 0000000..789b3d9 --- /dev/null +++ b/Tests/RunCMake/block/Scope-POLICIES.cmake @@ -0,0 +1,30 @@ + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") + +cmake_policy(SET CMP0139 NEW) + +# create a block with a new scope for policies +block(SCOPE_FOR POLICIES) + set(VAR1 "INNER1") + unset(VAR2) + set(VAR3 "INNER3") + + cmake_policy(SET CMP0139 OLD) +endblock() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "INNER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(DEFINED VAR2) + message(SEND_ERROR "block/endblock: VAR2 is unexpectedly defined: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() + +cmake_policy(GET CMP0139 CMP0139_STATUS) +if(NOT CMP0139_STATUS STREQUAL "NEW") + message(SEND_ERROR "block/endblock: CMP0139 has unexpected value: ${CMP0139_STATUS}") +endif() diff --git a/Tests/RunCMake/block/Scope-VARIABLES.cmake b/Tests/RunCMake/block/Scope-VARIABLES.cmake new file mode 100644 index 0000000..140e638 --- /dev/null +++ b/Tests/RunCMake/block/Scope-VARIABLES.cmake @@ -0,0 +1,52 @@ + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") +set(VAR3 "OUTER3") +set(VAR4 "OUTER4") +set(VAR5 "OUTER5") + +set(VAR6 "CACHE6" CACHE STRING "") +set(VAR6 "OUTER6") + +cmake_policy(SET CMP0139 NEW) + +# create a block with a new scope for variables +block(SCOPE_FOR VARIABLES PROPAGATE VAR3 VAR4 VAR5 VAR6 VAR7) + set(VAR1 "INNER1") + set(VAR2 "INNER2" PARENT_SCOPE) + set(VAR3 "INNER3") + unset(VAR4) + unset(VAR6) + set(VAR7 "INNER7") + + cmake_policy(SET CMP0139 OLD) +endblock() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2") + message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() +if(DEFINED VAR4) + message(SEND_ERROR "block/endblock: VAR4 is unexpectedly defined: ${VAR4}") +endif() +if(NOT DEFINED VAR5 OR NOT VAR5 STREQUAL "OUTER5") + message(SEND_ERROR "block/endblock: VAR5 has unexpected value: ${VAR5}") +endif() +unset(VAR6 CACHE) +if (DEFINED VAR6) + message(SEND_ERROR "block/endblock: VAR6 is unexpectedly defined: ${VAR6}") +endif() +if(NOT DEFINED VAR7 OR NOT VAR7 STREQUAL "INNER7") + message(SEND_ERROR "block/endblock: VAR7 has unexpected value: ${VAR7}") +endif() + +cmake_policy(GET CMP0139 CMP0139_STATUS) +if(NOT CMP0139_STATUS STREQUAL "OLD") + message(SEND_ERROR "block/endblock: CMP0139 has unexpected value: ${CMP0139_STATUS}") +endif() diff --git a/Tests/RunCMake/block/Scope.cmake b/Tests/RunCMake/block/Scope.cmake new file mode 100644 index 0000000..e1af50a --- /dev/null +++ b/Tests/RunCMake/block/Scope.cmake @@ -0,0 +1,52 @@ + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") +set(VAR3 "OUTER3") +set(VAR4 "OUTER4") +set(VAR5 "OUTER5") + +set(VAR6 "CACHE6" CACHE STRING "") +set(VAR6 "OUTER6") + +cmake_policy(SET CMP0139 NEW) + +# create a block with a new scope for variables and policies +block(PROPAGATE VAR3 VAR4 VAR5 VAR6 VAR7) + set(VAR1 "INNER1") + set(VAR2 "INNER2" PARENT_SCOPE) + set(VAR3 "INNER3") + unset(VAR4) + unset(VAR6) + set(VAR7 "INNER7") + + cmake_policy(SET CMP0139 OLD) +endblock() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2") + message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() +if(DEFINED VAR4) + message(SEND_ERROR "block/endblock: VAR4 is unexpectedly defined: ${VAR4}") +endif() +if(NOT DEFINED VAR5 OR NOT VAR5 STREQUAL "OUTER5") + message(SEND_ERROR "block/endblock: VAR5 has unexpected value: ${VAR5}") +endif() +unset(VAR6 CACHE) +if (DEFINED VAR6) + message(SEND_ERROR "block/endblock: VAR6 is unexpectedly defined: ${VAR6}") +endif() +if(NOT DEFINED VAR7 OR NOT VAR7 STREQUAL "INNER7") + message(SEND_ERROR "block/endblock: VAR6 has unexpected value: ${VAR7}") +endif() + +cmake_policy(GET CMP0139 CMP0139_STATUS) +if(NOT CMP0139_STATUS STREQUAL "NEW") + message(SEND_ERROR "block/endblock: CMP0139 has unexpected value: ${CMP0139_STATUS}") +endif() diff --git a/Tests/RunCMake/block/Workflows.cmake b/Tests/RunCMake/block/Workflows.cmake new file mode 100644 index 0000000..cbf032e --- /dev/null +++ b/Tests/RunCMake/block/Workflows.cmake @@ -0,0 +1,78 @@ + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") +set(VAR3 "OUTER3") + +while (TRUE) + # create a block with a new scope for variables + block(SCOPE_FOR VARIABLES PROPAGATE VAR3) + set(VAR2 "INNER2" PARENT_SCOPE) + set(VAR3 "INNER3") + break() + endblock() +endwhile() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2") + message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() + + + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") +set(VAR3 "OUTER3") + +function (OUTER) + # create a block with a new scope for variables + block(SCOPE_FOR VARIABLES PROPAGATE VAR3) + set(VAR2 "INNER2" PARENT_SCOPE) + set(VAR3 "INNER3") + return() + endblock() + set(VAR1 "INNER1" PARENT_SCOPE) +endfunction() +outer() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "OUTER2") + message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "OUTER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() + + + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") +set(VAR3 "OUTER3") + +foreach (id IN ITEMS 1 2 3) + # create a block with a new scope for variables + block(SCOPE_FOR VARIABLES PROPAGATE VAR${id}) + set(VAR${id} "INNER${id}") + continue() + set(VAR${id} "BAD${id}") + endblock() +endforeach() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "INNER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2") + message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() diff --git a/Tests/RunCMake/block/WrongArgument-result.txt b/Tests/RunCMake/block/WrongArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/WrongArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/WrongArgument-stderr.txt b/Tests/RunCMake/block/WrongArgument-stderr.txt new file mode 100644 index 0000000..56faea7 --- /dev/null +++ b/Tests/RunCMake/block/WrongArgument-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at WrongArgument.cmake:[0-9]+ \(block\): + block called with unsupported argument "WRONG_ARG" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/WrongArgument.cmake b/Tests/RunCMake/block/WrongArgument.cmake new file mode 100644 index 0000000..e460866 --- /dev/null +++ b/Tests/RunCMake/block/WrongArgument.cmake @@ -0,0 +1,2 @@ +block(WRONG_ARG) +endblock() diff --git a/Tests/RunCMake/block/WrongScope-result.txt b/Tests/RunCMake/block/WrongScope-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/WrongScope-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/WrongScope-stderr.txt b/Tests/RunCMake/block/WrongScope-stderr.txt new file mode 100644 index 0000000..dd2a1ef --- /dev/null +++ b/Tests/RunCMake/block/WrongScope-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at WrongScope.cmake:[0-9]+ \(block\): + block SCOPE_FOR unsupported scope "WRONG_SCOPE" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/WrongScope.cmake b/Tests/RunCMake/block/WrongScope.cmake new file mode 100644 index 0000000..97a6783 --- /dev/null +++ b/Tests/RunCMake/block/WrongScope.cmake @@ -0,0 +1,2 @@ +block(SCOPE_FOR WRONG_SCOPE) +endblock() diff --git a/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt b/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt index 6a430f1..ea1566d 100644 --- a/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt +++ b/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt @@ -1,5 +1,7 @@ CMake Error at Registry_BadQuery2.cmake:[0-9]+ \(cmake_host_system_information\): - cmake_host_system_information missing expected value for argument\(s\) - "VALUE". + Error after keyword "VALUE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt b/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt index 5eda4ff..f8c96d8 100644 --- a/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt +++ b/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt @@ -1,5 +1,7 @@ CMake Error at Registry_BadView1.cmake:[0-9]+ \(cmake_host_system_information\): - cmake_host_system_information missing expected value for argument\(s\) - "VIEW". + Error after keyword "VIEW": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake index 6480b2e..38ce10b 100644 --- a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake @@ -8,6 +8,7 @@ foreach(command IN ITEMS "if" "elseif" "else" "endif" "while" "endwhile" "foreach" "endforeach" + "block" "endblock" ) message(STATUS "Running call_invalid_command for ${command}...") run_cmake_with_options(call_invalid_command -Dcommand=${command}) @@ -42,6 +43,7 @@ foreach(command IN ITEMS "if" "elseif" "else" "endif" "while" "endwhile" "foreach" "endforeach" + "block" "endblock" "return" ) message(STATUS "Running defer_call_invalid_command for ${command}...") @@ -82,3 +84,61 @@ run_cmake(defer_get_call_id_var) run_cmake(defer_missing_arg) run_cmake(defer_missing_call) run_cmake(defer_unknown_option) + +# Default log level +run_cmake_command( + get_message_log_level_none + ${CMAKE_COMMAND} + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from cache +run_cmake_command( + get_message_log_level_cache + ${CMAKE_COMMAND} + -DCMAKE_MESSAGE_LOG_LEVEL=TRACE + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from regular variable +run_cmake_command( + get_message_log_level_var + ${CMAKE_COMMAND} + -DNEW_LOG_LEVEL=TRACE + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from command line +run_cmake_command( + get_message_log_level_cli + ${CMAKE_COMMAND} + --log-level=DEBUG + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from command line, it has higher priority over a cache variable +run_cmake_command( + get_message_log_level_cli_and_cache + ${CMAKE_COMMAND} + --log-level=DEBUG + -DCMAKE_MESSAGE_LOG_LEVEL=TRACE + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from command line, it has higher priority over a regular variable +run_cmake_command( + get_message_log_level_cli_and_var + ${CMAKE_COMMAND} + --log-level=DEBUG + -DNEW_LOG_LEVEL=TRACE + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from variable, it has higher priority over a cache variable +run_cmake_command( + get_message_log_level_var_and_cache + ${CMAKE_COMMAND} + -DNEW_LOG_LEVEL=DEBUG + -DCMAKE_MESSAGE_LOG_LEVEL=TRACE + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) diff --git a/Tests/RunCMake/cmake_language/get_message_log_level.cmake b/Tests/RunCMake/cmake_language/get_message_log_level.cmake new file mode 100644 index 0000000..1740c1f --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level.cmake @@ -0,0 +1,5 @@ +if(NEW_LOG_LEVEL) + set(CMAKE_MESSAGE_LOG_LEVEL "${NEW_LOG_LEVEL}") +endif() +cmake_language(GET_MESSAGE_LOG_LEVEL log_level) +message(STATUS "log level is: ${log_level}") diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cache-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cache-stdout.txt new file mode 100644 index 0000000..cf1cd7b --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_cache-stdout.txt @@ -0,0 +1 @@ +log level is: TRACE diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cli-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cli-stdout.txt new file mode 100644 index 0000000..4d6e1eb --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_cli-stdout.txt @@ -0,0 +1 @@ +log level is: DEBUG diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_cache-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_cache-stdout.txt new file mode 100644 index 0000000..4d6e1eb --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_cache-stdout.txt @@ -0,0 +1 @@ +log level is: DEBUG diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_var-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_var-stdout.txt new file mode 100644 index 0000000..4d6e1eb --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_var-stdout.txt @@ -0,0 +1 @@ +log level is: DEBUG diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_none-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_none-stdout.txt new file mode 100644 index 0000000..92ffd34 --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_none-stdout.txt @@ -0,0 +1 @@ +log level is: STATUS diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_var-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_var-stdout.txt new file mode 100644 index 0000000..cf1cd7b --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_var-stdout.txt @@ -0,0 +1 @@ +log level is: TRACE diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_var_and_cache-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_var_and_cache-stdout.txt new file mode 100644 index 0000000..4d6e1eb --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_var_and_cache-stdout.txt @@ -0,0 +1 @@ +log level is: DEBUG diff --git a/Tests/RunCMake/cmake_path/BASE_DIRECTORY-no-arg-stderr.txt b/Tests/RunCMake/cmake_path/BASE_DIRECTORY-no-arg-stderr.txt new file mode 100644 index 0000000..ad7d134 --- /dev/null +++ b/Tests/RunCMake/cmake_path/BASE_DIRECTORY-no-arg-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + Error after keyword "BASE_DIRECTORY": + + missing required value diff --git a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-empty-stderr.txt b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-empty-stderr.txt new file mode 100644 index 0000000..f1b52cc --- /dev/null +++ b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-empty-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at .+/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + Error after keyword "OUTPUT_VARIABLE": + + empty string not allowed diff --git a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt index e1d6592..63289ef 100644 --- a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt +++ b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt @@ -1,2 +1,4 @@ CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): - cmake_path OUTPUT_VARIABLE requires an argument. + Error after keyword "OUTPUT_VARIABLE": + + missing required value diff --git a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake index 991f46b..1742b06 100644 --- a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake @@ -74,6 +74,14 @@ foreach (command IN ITEMS APPEND APPEND_STRING REMOVE_FILENAME REPLACE_FILENAME endforeach() +## BASE_DIRECTORY without argument +set (RunCMake-stderr-file "BASE_DIRECTORY-no-arg-stderr.txt") + +foreach (command IN ITEMS RELATIVE_PATH ABSOLUTE_PATH) + run_cmake_command (${command}-OUTPUT_VARIABLE-no-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path BASE_DIRECTORY" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + + ## Invalid output variable set (RunCMake-stderr-file "invalid-output-var-stderr.txt") @@ -106,6 +114,9 @@ foreach (command IN ITEMS NATIVE_PATH run_cmake_command (${command}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") endforeach() +# OUTPUT_VARIABLE empty name +set (RunCMake-stderr-file "OUTPUT_VARIABLE-empty-stderr.txt") + foreach (command IN ITEMS APPEND APPEND_STRING REMOVE_FILENAME REPLACE_FILENAME REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH RELATIVE_PATH ABSOLUTE_PATH) diff --git a/Tests/RunCMake/ctest_build/CMakeLists.txt.in b/Tests/RunCMake/ctest_build/CMakeLists.txt.in index 133ae36..4a067fa 100644 --- a/Tests/RunCMake/ctest_build/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_build/CMakeLists.txt.in @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1) @CASE_CMAKELISTS_PREFIX_CODE@ -project(CTestBuild@CASE_NAME@ NONE) +project(CTestBuild@CASE_NAME@ @LANG@) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) @CASE_CMAKELISTS_SUFFIX_CODE@ diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake new file mode 100644 index 0000000..7089d70 --- /dev/null +++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake @@ -0,0 +1,23 @@ +file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml") +if(build_xml_file) + file(READ "${build_xml_file}" build_xml LIMIT 8192) + string(FIND "${build_xml}" [[This should not be compiled]] expected_failure_pos) + if(expected_failure_pos EQUAL "-1") + string(REPLACE "\n" "\n " build_xml " ${build_xml}") + set(RunCMake_TEST_FAILED + "Build.xml does not have expected error message:\n${build_xml}" + ) + else() + string(SUBSTRING "${build_xml}" "${expected_failure_pos}" -1 remaining_xml) + string(FIND "${remaining_xml}" [[<Failure type="Error">]] unexpected_failure_pos) + if(NOT unexpected_failure_pos EQUAL "-1") + string(SUBSTRING "${remaining_xml}" "${unexpected_failure_pos}" -1 error_msg_xml) + string(REPLACE "\n" "\n " error_msg_xml " ${error_msg_xml}") + set(RunCMake_TEST_FAILED + "Build.xml contains unexpected extra <Failure> elements:\n${error_msg_xml}" + ) + endif() + endif() +else() + set(RunCMake_TEST_FAILED "Build.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt new file mode 100644 index 0000000..bbe9410 --- /dev/null +++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt @@ -0,0 +1 @@ +^Error\(s\) when building project diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index e94a55d..6f1b4b6 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCTest) +set(LANG NONE) set(CASE_CTEST_BUILD_ARGS "") set(RunCMake_USE_LAUNCHERS TRUE) set(RunCMake_USE_CUSTOM_BUILD_COMMAND FALSE) @@ -70,3 +71,18 @@ set(RunCMake_USE_LAUNCHERS FALSE) set(RunCMake_BUILD_COMMAND "${COLOR_WARNING}") run_ctest(IgnoreColor) unset(RunCMake_BUILD_COMMAND) + +set(RunCMake_USE_CUSTOM_BUILD_COMMAND FALSE) +if(RunCMake_GENERATOR MATCHES "Ninja") + function(run_NinjaLauncherSingleBuildFailure) + set(LANG C) + set(RunCMake_USE_LAUNCHERS TRUE) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/NinjaLauncherSingleBuildFailure") + configure_file("${RunCMake_SOURCE_DIR}/error.c" "${RunCMake_TEST_SOURCE_DIR}/error.c" COPYONLY) + set(CASE_CMAKELISTS_SUFFIX_CODE [=[ + add_executable(error error.c) + ]=]) + run_ctest(NinjaLauncherSingleBuildFailure) + endfunction() + run_NinjaLauncherSingleBuildFailure() +endif() diff --git a/Tests/RunCMake/ctest_build/error.c b/Tests/RunCMake/ctest_build/error.c new file mode 100644 index 0000000..f10e687 --- /dev/null +++ b/Tests/RunCMake/ctest_build/error.c @@ -0,0 +1 @@ +#error "This should not be compiled" diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-result.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-stdout.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-stdout.txt new file mode 100644 index 0000000..a7eae05 --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-stdout.txt @@ -0,0 +1 @@ +CTEST_TEST_VAR=set-via-ENVIRONMENT-property diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop.cmake b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop.cmake new file mode 100644 index 0000000..51e7f2a --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop.cmake @@ -0,0 +1,9 @@ +include(CTest) + +add_test(NAME cmake_environment COMMAND "${CMAKE_COMMAND}" -E environment) +set_tests_properties( + cmake_environment + PROPERTIES + ENVIRONMENT "CTEST_TEST_VAR=set-via-ENVIRONMENT-property" + ENVIRONMENT_MODIFICATION "CTEST_TEST_VAR=set:set-via-ENVIRONMENT_MODIFICATION;CTEST_TEST_VAR=reset:" +) diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-result.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-stdout.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-stdout.txt new file mode 100644 index 0000000..beaf133 --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-stdout.txt @@ -0,0 +1 @@ +CTEST_TEST_VAR=set-via-system-environment diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system.cmake b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system.cmake new file mode 100644 index 0000000..23268aa --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system.cmake @@ -0,0 +1,9 @@ +include(CTest) + +add_test(NAME cmake_environment COMMAND "${CMAKE_COMMAND}" -E environment) +set_tests_properties( + cmake_environment + PROPERTIES + # ENVIRONMENT "CTEST_TEST_VAR=set-via-ENVIRONMENT-property" + ENVIRONMENT_MODIFICATION "CTEST_TEST_VAR=set:set-via-ENVIRONMENT_MODIFICATION;CTEST_TEST_VAR=reset:" +) diff --git a/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake b/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake index 3447779..365c9e8 100644 --- a/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake @@ -10,3 +10,7 @@ set(RunCTest_VERBOSE_FLAG "-VV") run_ctest(ENVIRONMENT_MODIFICATION-invalid-op) run_ctest(ENVIRONMENT_MODIFICATION-no-colon) run_ctest(ENVIRONMENT_MODIFICATION-no-equals) + +set(ENV{CTEST_TEST_VAR} set-via-system-environment) +run_ctest(ENVIRONMENT_MODIFICATION-reset-to-prop) +run_ctest(ENVIRONMENT_MODIFICATION-reset-to-system) diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index b41c271..74ae99c 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -84,18 +84,18 @@ run_TestOutputSize() function(run_TestOutputTruncation mode expected) set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion) set(TRUNCATED_OUTPUT ${expected}) # used in TestOutputTruncation-check.cmake - set(CASE_TEST_PREFIX_CODE [[ -set( CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION${mode}) - ]]) - set(CASE_CMAKELISTS_SUFFIX_CODE [[ -add_test(NAME Truncation_${mode} COMMAND ${CMAKE_COMMAND} -E echo 123456789) - ]]) + string(CONCAT CASE_TEST_PREFIX_CODE " +set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 5) +set(CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION ${mode})" ) + set(CASE_CMAKELISTS_SUFFIX_CODE " +add_test(NAME Truncation_${mode} COMMAND \${CMAKE_COMMAND} -E echo 123456789)") - run_ctest(TestOutputTruncation) + run_ctest(TestOutputTruncation_${mode}) endfunction() -run_TestOutputTruncation("head" "...6789") -run_TestOutputTruncation("middle" "12....*...89") -run_TestOutputTruncation("tail" "12345...") +run_TestOutputTruncation("head" "\\.\\.\\.6789") +run_TestOutputTruncation("middle" "12\\.\\.\\..*\\.\\.\\.89") +run_TestOutputTruncation("tail" "12345\\.\\.\\.") +run_TestOutputTruncation("bad" "") run_ctest_test(TestRepeatBad1 REPEAT UNKNOWN:3) run_ctest_test(TestRepeatBad2 REPEAT UNTIL_FAIL:-1) diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-check.cmake new file mode 100644 index 0000000..4315074f --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-check.cmake @@ -0,0 +1,4 @@ +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + set(RunCMake_TEST_FAILED "Test.xml should not exist:\n ${test_xml_file}") +endif() diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-result.txt b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-stderr.txt b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-stderr.txt new file mode 100644 index 0000000..ef4d11b --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-stderr.txt @@ -0,0 +1 @@ +^Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: bad$ diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_head-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_head-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_head-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_middle-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_middle-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_middle-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_tail-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_tail-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_tail-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt b/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt index e27f1e6..62cad52 100644 --- a/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt +++ b/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt @@ -1,2 +1,4 @@ CMake Error at .*EchoCommand.cmake:.*\(execute_process\): - execute_process called with no value for COMMAND_ECHO. + Error after keyword "COMMAND_ECHO": + + missing required value diff --git a/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt b/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt index 1a69579..7f85654 100644 --- a/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt +++ b/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt @@ -1,4 +1,7 @@ ^CMake Error at EncodingMissing.cmake:[0-9]+ \(execute_process\): - execute_process called with no value for ENCODING. + Error after keyword "ENCODING": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 0e6020f..ee00b27 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -18,3 +18,4 @@ run_cmake(DependOnDoubleExport) run_cmake(UnknownExport) run_cmake(NamelinkOnlyExport) run_cmake(SeparateNamelinkExport) +run_cmake(TryCompileExport) diff --git a/Tests/RunCMake/export/TryCompileExport.cmake b/Tests/RunCMake/export/TryCompileExport.cmake new file mode 100644 index 0000000..5ad7c6e --- /dev/null +++ b/Tests/RunCMake/export/TryCompileExport.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +add_library(interface INTERFACE) +install(TARGETS interface EXPORT export) +export(EXPORT export) + +add_library(imported IMPORTED INTERFACE) + +try_compile(tc "${CMAKE_CURRENT_BINARY_DIR}/tc" "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" LINK_LIBRARIES imported) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt deleted file mode 100644 index b22387b..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at CHMOD-all-perms\.cmake:[0-9]+ \(file\): - file Remove either PERMISSIONS or FILE_PERMISSIONS or DIRECTORY_PERMISSIONS - from the invocation -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake deleted file mode 100644 index b49583d..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake +++ /dev/null @@ -1,6 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ - FILE_PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt deleted file mode 100644 index 8d09e35..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at CHMOD-invalid-path\.cmake:[0-9]+ \(file\): - file does not exist: - - .*/chmod-tests/I_dont_exist -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake deleted file mode 100644 index 36915c1..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake +++ /dev/null @@ -1,4 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/I_dont_exist PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt deleted file mode 100644 index 84ba2a2..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at CHMOD-invalid-perms\.cmake:[0-9]+ \(file\): - file INVALID_PERMISSION is an invalid permission specifier -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake deleted file mode 100644 index 22cab0b..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS INVALID_PERMISSION) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt deleted file mode 100644 index 2c248f8..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at CHMOD-no-keyword\.cmake:[0-9]+ \(file\): - file No permissions given -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake deleted file mode 100644 index 8b62106..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt deleted file mode 100644 index a18609f..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at CHMOD-no-perms\.cmake:[0-9]+ \(file\): - file No permissions given -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake deleted file mode 100644 index 9fbd359..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake deleted file mode 100644 index 87e3e57..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake deleted file mode 100644 index d9226b8..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake +++ /dev/null @@ -1,6 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ - FILE_PERMISSIONS OWNER_READ OWNER_WRITE) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt deleted file mode 100644 index 1c87a59..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at CHMOD-write-only\.cmake:[0-9]+ \(file\): - file failed to open for reading \(Permission denied\): - - .*/chmod-tests/a -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake deleted file mode 100644 index 1289efc..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake +++ /dev/null @@ -1,6 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a "CONTENT") -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_WRITE) -file(READ ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a content) diff --git a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake index 18deb89..e6b1169 100644 --- a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake @@ -1,12 +1,14 @@ include(RunCMake) -run_cmake(CHMOD-no-perms) -run_cmake(CHMOD-no-keyword) -run_cmake(CHMOD-all-perms) -run_cmake(CHMOD-invalid-perms) -run_cmake(CHMOD-invalid-path) -run_cmake(CHMOD-ok) -run_cmake(CHMOD-override) +run_cmake_script(no-perms) +run_cmake_script(missing-perms) +run_cmake_script(missing-file-perms) +run_cmake_script(missing-dir-perms) +run_cmake_script(all-perms) +run_cmake_script(invalid-perms) +run_cmake_script(invalid-path) +run_cmake_script(ok) +run_cmake_script(override) if(UNIX) execute_process(COMMAND id -u $ENV{USER} @@ -15,5 +17,5 @@ if(UNIX) endif() if(NOT WIN32 AND NOT MSYS AND NOT "${uid}" STREQUAL "0") - run_cmake(CHMOD-write-only) + run_cmake_script(write-only) endif() diff --git a/Tests/RunCMake/file-CHMOD/all-perms-result.txt b/Tests/RunCMake/file-CHMOD/all-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/all-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/all-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/all-perms-stderr.txt new file mode 100644 index 0000000..6932a1f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/all-perms-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at [^ +]*/all-perms\.cmake:[0-9]+ \(file\): + file Remove either PERMISSIONS or FILE_PERMISSIONS or DIRECTORY_PERMISSIONS + from the invocation$ diff --git a/Tests/RunCMake/file-CHMOD/all-perms.cmake b/Tests/RunCMake/file-CHMOD/all-perms.cmake new file mode 100644 index 0000000..5ff81b8 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/all-perms.cmake @@ -0,0 +1,3 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ + FILE_PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/invalid-path-result.txt b/Tests/RunCMake/file-CHMOD/invalid-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/invalid-path-stderr.txt b/Tests/RunCMake/file-CHMOD/invalid-path-stderr.txt new file mode 100644 index 0000000..eb5fb31 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-path-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/invalid-path\.cmake:[0-9]+ \(file\): + file does not exist: + + [^ +]*/Tests/RunCMake/file-CHMOD/invalid-path-build/I_dont_exist$ diff --git a/Tests/RunCMake/file-CHMOD/invalid-path.cmake b/Tests/RunCMake/file-CHMOD/invalid-path.cmake new file mode 100644 index 0000000..e8b0313 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-path.cmake @@ -0,0 +1 @@ +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/I_dont_exist PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/invalid-perms-result.txt b/Tests/RunCMake/file-CHMOD/invalid-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/invalid-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/invalid-perms-stderr.txt new file mode 100644 index 0000000..daab22e --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-perms-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at [^ +]*/invalid-perms\.cmake:[0-9]+ \(file\): + file INVALID_PERMISSION is an invalid permission specifier$ diff --git a/Tests/RunCMake/file-CHMOD/invalid-perms.cmake b/Tests/RunCMake/file-CHMOD/invalid-perms.cmake new file mode 100644 index 0000000..42129b9 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-perms.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS INVALID_PERMISSION) diff --git a/Tests/RunCMake/file-CHMOD/missing-dir-perms-result.txt b/Tests/RunCMake/file-CHMOD/missing-dir-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-dir-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/missing-dir-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/missing-dir-perms-stderr.txt new file mode 100644 index 0000000..c05bb2d --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-dir-perms-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at [^ +]*/missing-dir-perms.cmake:[0-9]+ \(file\): + Error after keyword "DIRECTORY_PERMISSIONS": + + missing required value$ diff --git a/Tests/RunCMake/file-CHMOD/missing-dir-perms.cmake b/Tests/RunCMake/file-CHMOD/missing-dir-perms.cmake new file mode 100644 index 0000000..9d0fdad --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-dir-perms.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS) diff --git a/Tests/RunCMake/file-CHMOD/missing-file-perms-result.txt b/Tests/RunCMake/file-CHMOD/missing-file-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-file-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/missing-file-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/missing-file-perms-stderr.txt new file mode 100644 index 0000000..c3f4f0f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-file-perms-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at [^ +]*/missing-file-perms.cmake:[0-9]+ \(file\): + Error after keyword "FILE_PERMISSIONS": + + missing required value$ diff --git a/Tests/RunCMake/file-CHMOD/missing-file-perms.cmake b/Tests/RunCMake/file-CHMOD/missing-file-perms.cmake new file mode 100644 index 0000000..bcf35aa --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-file-perms.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ FILE_PERMISSIONS) diff --git a/Tests/RunCMake/file-CHMOD/missing-perms-result.txt b/Tests/RunCMake/file-CHMOD/missing-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/missing-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/missing-perms-stderr.txt new file mode 100644 index 0000000..1508b13 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-perms-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at [^ +]*/missing-perms.cmake:[0-9]+ \(file\): + Error after keyword "PERMISSIONS": + + missing required value$ diff --git a/Tests/RunCMake/file-CHMOD/missing-perms.cmake b/Tests/RunCMake/file-CHMOD/missing-perms.cmake new file mode 100644 index 0000000..da9f182 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-perms.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a FILE_PERMISSIONS OWNER_READ PERMISSIONS) diff --git a/Tests/RunCMake/file-CHMOD/no-perms-result.txt b/Tests/RunCMake/file-CHMOD/no-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/no-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/no-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/no-perms-stderr.txt new file mode 100644 index 0000000..4c5a139 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/no-perms-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at [^ +]*/no-perms\.cmake:[0-9]+ \(file\): + file No permissions given$ diff --git a/Tests/RunCMake/file-CHMOD/no-perms.cmake b/Tests/RunCMake/file-CHMOD/no-perms.cmake new file mode 100644 index 0000000..602cfc2 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/no-perms.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a) diff --git a/Tests/RunCMake/file-CHMOD/ok.cmake b/Tests/RunCMake/file-CHMOD/ok.cmake new file mode 100644 index 0000000..7c74d27 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/ok.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/override.cmake b/Tests/RunCMake/file-CHMOD/override.cmake new file mode 100644 index 0000000..67e5a23 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/override.cmake @@ -0,0 +1,3 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ + FILE_PERMISSIONS OWNER_READ OWNER_WRITE) diff --git a/Tests/RunCMake/file-CHMOD/write-only-result.txt b/Tests/RunCMake/file-CHMOD/write-only-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/write-only-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/write-only-stderr.txt b/Tests/RunCMake/file-CHMOD/write-only-stderr.txt new file mode 100644 index 0000000..169a092 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/write-only-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/write-only\.cmake:[0-9]+ \(file\): + file failed to open for reading \(Permission denied\): + + [^ +]*/Tests/RunCMake/file-CHMOD/write-only-build/a$ diff --git a/Tests/RunCMake/file-CHMOD/write-only.cmake b/Tests/RunCMake/file-CHMOD/write-only.cmake new file mode 100644 index 0000000..aa9d803 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/write-only.cmake @@ -0,0 +1,3 @@ +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/a "CONTENT") +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_WRITE) +file(READ ${CMAKE_CURRENT_BINARY_DIR}/a content) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt index c6ad3d0..39f307d 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt @@ -13,11 +13,21 @@ Call Stack \(most recent call first\): This warning is for project developers\. Use -Wno-dev to suppress it\. CMake Error at badargs2\.cmake:[0-9]+ \(file\): - file Keywords missing values: + Error after keyword "BUNDLE_EXECUTABLE": + + missing required value + + Error after keyword "CONFLICTING_DEPENDENCIES_PREFIX": + + missing required value + + Error after keyword "RESOLVED_DEPENDENCIES_VAR": + + missing required value + + Error after keyword "UNRESOLVED_DEPENDENCIES_VAR": + + missing required value - RESOLVED_DEPENDENCIES_VAR - UNRESOLVED_DEPENDENCIES_VAR - CONFLICTING_DEPENDENCIES_PREFIX - BUNDLE_EXECUTABLE Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt index 7c58aeb..54a3e5a 100644 --- a/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt +++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt @@ -1,2 +1,7 @@ -CMake Error at REAL_PATH-no-base-dir.cmake:[0-9]+ \(file\): - file BASE_DIRECTORY requires a value +^CMake Error at REAL_PATH-no-base-dir.cmake:[0-9]+ \(file\): + Error after keyword "BASE_DIRECTORY": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index aff4735..db88956 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -47,6 +47,7 @@ run_cmake(GLOB_RECURSE) run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS) run_cmake(SIZE) run_cmake(SIZE-error-does-not-exist) +run_cmake(TIMESTAMP) run_cmake(REMOVE-empty) diff --git a/Tests/RunCMake/file/TIMESTAMP-stdout.txt b/Tests/RunCMake/file/TIMESTAMP-stdout.txt new file mode 100644 index 0000000..42be6ba --- /dev/null +++ b/Tests/RunCMake/file/TIMESTAMP-stdout.txt @@ -0,0 +1 @@ +-- '[0-9]*-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-6][0-9]Z' diff --git a/Tests/RunCMake/file/TIMESTAMP.cmake b/Tests/RunCMake/file/TIMESTAMP.cmake new file mode 100644 index 0000000..2bd2577 --- /dev/null +++ b/Tests/RunCMake/file/TIMESTAMP.cmake @@ -0,0 +1,2 @@ +file(TIMESTAMP "TIMESTAMP.cmake" output UTC) +message(STATUS "'${output}'") diff --git a/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stderr.txt b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stderr.txt new file mode 100644 index 0000000..48d2fad --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stderr.txt @@ -0,0 +1,43 @@ + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 0 + + find_library considered the following locations:.* + The item was not found.* + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 1 + + find_library considered the following locations:.* + The item was found at.* + .*IgnoreStagingAndInstallPrefix-build/lib.* + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 0 + + find_library considered the following locations:.* + The item was not found.* diff --git a/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stdout.txt b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stdout.txt new file mode 100644 index 0000000..ea6614e --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stdout.txt @@ -0,0 +1,3 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix.cmake b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix.cmake new file mode 100644 index 0000000..9b5700a --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix.cmake @@ -0,0 +1 @@ +include(IgnoreInstallPrefix.cmake) diff --git a/Tests/RunCMake/find_library/IgnoreStagingPrefix-stderr.txt b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stderr.txt new file mode 100644 index 0000000..784c5fd --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stderr.txt @@ -0,0 +1,43 @@ + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 0 + + find_library considered the following locations:.* + The item was not found.* + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 1 + + find_library considered the following locations:.* + The item was found at.* + .*IgnoreStagingPrefix-build/lib.* + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 0 + + find_library considered the following locations:.* + The item was not found.* diff --git a/Tests/RunCMake/find_library/IgnoreStagingPrefix-stdout.txt b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stdout.txt new file mode 100644 index 0000000..fd414fb --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stdout.txt @@ -0,0 +1,3 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/IgnoreStagingPrefix-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/IgnoreStagingPrefix.cmake b/Tests/RunCMake/find_library/IgnoreStagingPrefix.cmake new file mode 100644 index 0000000..9b5700a --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingPrefix.cmake @@ -0,0 +1 @@ +include(IgnoreInstallPrefix.cmake) diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index cc005d0..8b223b4 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -4,6 +4,8 @@ run_cmake(Created) run_cmake(FromPrefixPath) run_cmake(FromPATHEnv) run_cmake_with_options(IgnoreInstallPrefix "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/IgnoreInstallPrefix-build/") +run_cmake_with_options(IgnoreStagingPrefix "-DCMAKE_STAGING_PREFIX=${RunCMake_BINARY_DIR}/IgnoreStagingPrefix-build/") +run_cmake_with_options(IgnoreStagingAndInstallPrefix "-DCMAKE_STAGING_PREFIX=${RunCMake_BINARY_DIR}/IgnoreStagingAndInstallPrefix-build/" "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/IgnoreStagingAndInstallPrefix-build/") if(UNIX AND NOT CYGWIN) run_cmake(LibArchLink) run_cmake(LibSymLink) diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index 32e54d5..fa41fc1 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -55,6 +55,22 @@ run_cmake(REGISTRY_VIEW-no-view) run_cmake(REGISTRY_VIEW-wrong-view) run_cmake(REGISTRY_VIEW-propagated) +file( + GLOB SearchPaths_TEST_CASE_LIST + LIST_DIRECTORIES TRUE + "${RunCMake_SOURCE_DIR}/SearchPaths/*" + ) +foreach(TestCasePrefix IN LISTS SearchPaths_TEST_CASE_LIST) + if(IS_DIRECTORY "${TestCasePrefix}") + cmake_path(GET TestCasePrefix FILENAME TestSuffix) + run_cmake_with_options( + SearchPaths_${TestSuffix} + "-DSearchPaths_ROOT=${TestCasePrefix}" + "--debug-find-pkg=SearchPaths" + ) + endif() +endforeach() + if(UNIX AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS ) diff --git a/Tests/RunCMake/find_package/SearchPaths.cmake b/Tests/RunCMake/find_package/SearchPaths.cmake new file mode 100644 index 0000000..a5a10fc --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0074 NEW) +find_package(SearchPaths REQUIRED CONFIG) diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1.2.3/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1.2.3/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1.2.3/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1.2.3/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1.2.3/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1.2.3/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1.2.3/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1.2.3/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1.2.3/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1.2.3/share/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1.2.3/share/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1.2.3/share/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1.2.3/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1.2.3/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1.2.3/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix-stderr.txt new file mode 100644 index 0000000..fae13ef --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix-stderr.txt @@ -0,0 +1,10 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-stderr.txt new file mode 100644 index 0000000..eba88c9 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-stderr.txt new file mode 100644 index 0000000..cebc169 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-stderr.txt new file mode 100644 index 0000000..4e5d3f6 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-stderr.txt new file mode 100644 index 0000000..f290545 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-stderr.txt new file mode 100644 index 0000000..32b9fcb --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-stderr.txt new file mode 100644 index 0000000..7bf5cf8 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-stderr.txt new file mode 100644 index 0000000..812c607 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-stderr.txt new file mode 100644 index 0000000..3592f72 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-stderr.txt new file mode 100644 index 0000000..b196b7a --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-stderr.txt new file mode 100644 index 0000000..17e0399 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-stderr.txt new file mode 100644 index 0000000..ee01a50 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-stderr.txt new file mode 100644 index 0000000..d6abd2f --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-stderr.txt new file mode 100644 index 0000000..b578b2b --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-stderr.txt new file mode 100644 index 0000000..2f3f18a --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-stderr.txt new file mode 100644 index 0000000..3eef002 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-stderr.txt new file mode 100644 index 0000000..c962f8b --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/include_external_msproject/Program.cs b/Tests/RunCMake/include_external_msproject/Program.cs new file mode 100644 index 0000000..5ed58c8 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/Program.cs @@ -0,0 +1,9 @@ +namespace ConsoleApp +{ + internal class Program + { + static void Main(string[] args) + { + } + } +} diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake index cb0eb18..4fbf147 100644 --- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake @@ -10,3 +10,14 @@ if(RunCMake_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])") run_cmake(SkipGetTargetFrameworkProperties) run_cmake(VSCSharpReference) endif() + +if(RunCMake_GENERATOR MATCHES "^Visual Studio (1[6-9]|[2-9][0-9])") + function(run_VSCSharpOnlyProject) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VSCSharpOnlyProject-build) + run_cmake(VSCSharpOnlyProject) + set(RunCMake_TEST_NO_CLEAN 1) + set(build_flags /restore) + run_cmake_command(VSCSharpOnlyProject-build ${CMAKE_COMMAND} --build . -- ${build_flags}) + endfunction() + run_VSCSharpOnlyProject() +endif() diff --git a/Tests/RunCMake/include_external_msproject/VSCSharpOnlyProject.cmake b/Tests/RunCMake/include_external_msproject/VSCSharpOnlyProject.cmake new file mode 100644 index 0000000..e7e0b99 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/VSCSharpOnlyProject.cmake @@ -0,0 +1,9 @@ +project(VSCSharpOnlyProject) + +file(COPY + ${CMAKE_CURRENT_SOURCE_DIR}/Program.cs + ${CMAKE_CURRENT_SOURCE_DIR}/consoleapp.csproj + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +include_external_msproject( + test "${CMAKE_CURRENT_BINARY_DIR}/consoleapp.csproj") diff --git a/Tests/RunCMake/include_external_msproject/consoleapp.csproj b/Tests/RunCMake/include_external_msproject/consoleapp.csproj new file mode 100644 index 0000000..2894848 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/consoleapp.csproj @@ -0,0 +1,14 @@ +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net472</TargetFramework> + <RootNamespace>ConsoleApp</RootNamespace> + <AssemblyName>ConsoleApp</AssemblyName> + <PlatformTarget>x64</PlatformTarget> + <EnableDefaultItems>false</EnableDefaultItems> + </PropertyGroup> + + <ItemGroup> + <Compile Include="Program.cs" /> + </ItemGroup> +</Project> diff --git a/Tests/RunCMake/project/LanguagesDuplicate-check.cmake b/Tests/RunCMake/project/LanguagesDuplicate-check.cmake new file mode 100644 index 0000000..31c7da3 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesDuplicate-check.cmake @@ -0,0 +1,10 @@ +if(NOT actual_stderr MATCHES "The following language has been specified multiple times: C\n") + set(RunCMake_TEST_FAILED "'LANGUAGES C C C' should report only 'C' and only once.") +endif() + +if(NOT actual_stderr MATCHES "The following languages have been specified multiple times: C, CXX\n") + if(RunCMake_TEST_FAILED) + string(APPEND RunCMake_TEST_FAILED "\n") + endif() + string(APPEND RunCMake_TEST_FAILED "'LANGUAGES C C CXX CXX' should report 'C' and 'CXX'.") +endif() diff --git a/Tests/RunCMake/project/LanguagesDuplicate.cmake b/Tests/RunCMake/project/LanguagesDuplicate.cmake new file mode 100644 index 0000000..97a79d0 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesDuplicate.cmake @@ -0,0 +1,11 @@ +cmake_policy(SET CMP0057 NEW) + +project(ProjectA C C C) +project(ProjectB C C CXX CXX) + +get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(lang C CXX) + if(NOT lang IN_LIST langs) + message(FATAL_ERROR "Expected language '${lang}' to be enabled.") + endif() +endforeach() diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 945d9ed..6d9f52f 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -12,6 +12,11 @@ run_cmake_with_options(CodeInjection if(CMake_TEST_RESOURCES) run_cmake(ExplicitRC) endif() + +set(RunCMake_DEFAULT_stderr .) +run_cmake(LanguagesDuplicate) +unset(RunCMake_DEFAULT_stderr) + run_cmake(LanguagesImplicit) run_cmake(LanguagesEmpty) run_cmake(LanguagesNONE) diff --git a/Tests/RunCMake/return/CMP0140-NEW.cmake b/Tests/RunCMake/return/CMP0140-NEW.cmake new file mode 100644 index 0000000..eb6b85c --- /dev/null +++ b/Tests/RunCMake/return/CMP0140-NEW.cmake @@ -0,0 +1,13 @@ + +cmake_policy(SET CMP0140 NEW) + +function(FUNC) + set(VAR "set") + return(PROPAGATE VAR) +endfunction() + +set(VAR "initial") +func() +if (NOT DEFINED VAR OR NOT VAR STREQUAL "set") + message(FATAL_ERROR "return(PROPAGATE) not handled correctly.") +endif() diff --git a/Tests/RunCMake/return/CMP0140-OLD.cmake b/Tests/RunCMake/return/CMP0140-OLD.cmake new file mode 100644 index 0000000..8113a43 --- /dev/null +++ b/Tests/RunCMake/return/CMP0140-OLD.cmake @@ -0,0 +1,8 @@ + +cmake_policy(SET CMP0140 OLD) + +function(FUNC) + return(PROPAGATE VAR) +endfunction() + +func() diff --git a/Tests/RunCMake/return/CMP0140-WARN-result.txt b/Tests/RunCMake/return/CMP0140-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/return/CMP0140-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/return/CMP0140-WARN-stderr.txt b/Tests/RunCMake/return/CMP0140-WARN-stderr.txt new file mode 100644 index 0000000..ed4beb6 --- /dev/null +++ b/Tests/RunCMake/return/CMP0140-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0140-WARN.cmake:[0-9]+ \(return\): + Policy CMP0140 is not set: The return\(\) command checks its arguments. Run + "cmake --help-policy CMP0140" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + return\(\) checks its arguments when the policy is set to NEW. Since the + policy is not set the OLD behavior will be used so the arguments will be + ignored. +Call Stack \(most recent call first\): + CMP0140-WARN.cmake:[0-9]+ \(func\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/return/CMP0140-WARN.cmake b/Tests/RunCMake/return/CMP0140-WARN.cmake new file mode 100644 index 0000000..df2fc88 --- /dev/null +++ b/Tests/RunCMake/return/CMP0140-WARN.cmake @@ -0,0 +1,8 @@ + +cmake_policy(VERSION 3.1) + +function(FUNC) + return(PROPAGATE VAR) +endfunction() + +func() diff --git a/Tests/RunCMake/return/CMakeLists.txt b/Tests/RunCMake/return/CMakeLists.txt index ef2163c..6cc903f 100644 --- a/Tests/RunCMake/return/CMakeLists.txt +++ b/Tests/RunCMake/return/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.25) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/return/PropagateFromDirectory.cmake b/Tests/RunCMake/return/PropagateFromDirectory.cmake new file mode 100644 index 0000000..9c820bb --- /dev/null +++ b/Tests/RunCMake/return/PropagateFromDirectory.cmake @@ -0,0 +1,10 @@ + +set(VAR1 "initial") +set(VAR2 "initial") + +add_subdirectory(subdir) + +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC1") +endif() diff --git a/Tests/RunCMake/return/PropagateFromFunction.cmake b/Tests/RunCMake/return/PropagateFromFunction.cmake new file mode 100644 index 0000000..1c12bc1 --- /dev/null +++ b/Tests/RunCMake/return/PropagateFromFunction.cmake @@ -0,0 +1,142 @@ + +function(FUNC1) + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func1() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC1") +endif() + + +function(FUNC2) + block() + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endblock() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func2() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC2") +endif() + + +function(FUNC3) + block(SCOPE_FOR POLICIES) + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endblock() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func3() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC3") +endif() + + +function(FUNC4) + while(TRUE) + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endwhile() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func4() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC4") +endif() + + +function(FUNC5) + foreach(item IN ITEMS A B) + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endforeach() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func5() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC5") +endif() + + +function(FUNC6) + if(TRUE) + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endif() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func6() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC6") +endif() + + +function(FUNC7) + if(FALSE) + else() + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endif() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func7() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC7") +endif() + + +set(VAR1 "initial") +set(VAR2 "initial") +cmake_language(CALL func7) +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for cmake_language(CALL FUNC7)") +endif() + + +set(VAR1 "initial") +set(VAR2 "initial") +cmake_language(EVAL CODE " + function(FUNC8) + set(VAR1 \"set\") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endfunction() + + func8()") +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for cmake_language(EVAL CODE)") +endif() diff --git a/Tests/RunCMake/return/PropagateNothing.cmake b/Tests/RunCMake/return/PropagateNothing.cmake new file mode 100644 index 0000000..0ace58e --- /dev/null +++ b/Tests/RunCMake/return/PropagateNothing.cmake @@ -0,0 +1,2 @@ + +return(PROPAGATE) diff --git a/Tests/RunCMake/return/RunCMakeTest.cmake b/Tests/RunCMake/return/RunCMakeTest.cmake index 2cc6c9d..f9e06a5 100644 --- a/Tests/RunCMake/return/RunCMakeTest.cmake +++ b/Tests/RunCMake/return/RunCMakeTest.cmake @@ -1,3 +1,12 @@ include(RunCMake) run_cmake(ReturnFromForeach) + +run_cmake(WrongArgument) +run_cmake(PropagateNothing) +run_cmake(PropagateFromFunction) +run_cmake(PropagateFromDirectory) + +run_cmake(CMP0140-NEW) +run_cmake(CMP0140-OLD) +run_cmake(CMP0140-WARN) diff --git a/Tests/RunCMake/return/WrongArgument-result.txt b/Tests/RunCMake/return/WrongArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/return/WrongArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/return/WrongArgument-stderr.txt b/Tests/RunCMake/return/WrongArgument-stderr.txt new file mode 100644 index 0000000..4d1c5ad --- /dev/null +++ b/Tests/RunCMake/return/WrongArgument-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at WrongArgument.cmake:[0-9]+ \(return\): + return called with unsupported argument "WRONG_ARG" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/return/WrongArgument.cmake b/Tests/RunCMake/return/WrongArgument.cmake new file mode 100644 index 0000000..d03b19f --- /dev/null +++ b/Tests/RunCMake/return/WrongArgument.cmake @@ -0,0 +1,2 @@ + +return(WRONG_ARG) diff --git a/Tests/RunCMake/return/subdir/CMakeLists.txt b/Tests/RunCMake/return/subdir/CMakeLists.txt new file mode 100644 index 0000000..e575d47 --- /dev/null +++ b/Tests/RunCMake/return/subdir/CMakeLists.txt @@ -0,0 +1,5 @@ + +set(VAR1 "set") +unset(VAR2) + +return(PROPAGATE VAR1 VAR2) diff --git a/Tests/RunCMake/string/JSON.cmake b/Tests/RunCMake/string/JSON.cmake index ab4194d..255c16a 100644 --- a/Tests/RunCMake/string/JSON.cmake +++ b/Tests/RunCMake/string/JSON.cmake @@ -129,7 +129,7 @@ assert_strequal("${error}" "member '0' not found") string(JSON result ERROR_VARIABLE error GET "${json1}" array 10) assert_strequal("${result}" "array-10-NOTFOUND") -assert_strequal("${error}" "expected an index less then 4 got '10'") +assert_strequal("${error}" "expected an index less than 4 got '10'") string(JSON result ERROR_VARIABLE error GET "${json1}" array 2 some notThere) assert_strequal("${result}" "array-2-some-notThere-NOTFOUND") @@ -240,7 +240,7 @@ endif() string(JSON result ERROR_VARIABLE error MEMBER "${json1}" values 100) assert_strequal("${result}" "values-100-NOTFOUND") -assert_strequal("${error}" "expected an index less then 5 got '100'") +assert_strequal("${error}" "expected an index less than 5 got '100'") # Test length loops string(JSON arrayLength ERROR_VARIABLE error LENGTH "${json1}" types array) @@ -301,7 +301,7 @@ assert_json_equal("${error}" "${result}" string(JSON result ERROR_VARIABLE error REMOVE ${json2} array 100) assert_strequal("${result}" "array-100-NOTFOUND") -assert_strequal("${error}" "expected an index less then 4 got '100'") +assert_strequal("${error}" "expected an index less than 4 got '100'") # Test SET string(JSON result ERROR_VARIABLE error SET ${json2} new 5) diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-check.cmake new file mode 100644 index 0000000..b6cabf5 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "(/|-)-START_GROUP\"? +\"?(/|-)-PREFIX_LIBRARY\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base2${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIX_LIBRARY\"? +\"?(/|-)-END_GROUP") + set (RunCMake_TEST_FAILED "Not found expected '--START_GROUP --PREFIX_LIBRARY --LIBFLAG<base1> --LIBFLAG<base2> --END_GROUP'.") +endif() diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake index 31eb7e2..fea2f91 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake @@ -20,6 +20,9 @@ set(CMAKE_C_LINK_GROUP_USING_feat1_SUPPORTED TRUE) set(CMAKE_C_LINK_LIBRARY_USING_feat1 "--LIBFLAG<LIBRARY>") set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat2 "--PREFIX_LIBRARY" "--LIBFLAG<LIBRARY>" "--SUFFIX_LIBRARY") +set(CMAKE_C_LINK_LIBRARY_USING_feat2_SUPPORTED TRUE) + set(CMAKE_C_LINK_GROUP_USING_feat2 "--START_GROUP" "--END_GROUP") set(CMAKE_LINK_GROUP_USING_feat2 "--START_GROUP" "--END_GROUP") set(CMAKE_LINK_GROUP_USING_feat2_SUPPORTED TRUE) @@ -53,6 +56,9 @@ target_link_libraries(LinkGroup_group-and-single PRIVATE "$<LINK_GROUP:feat1,bas add_library(LinkGroup_with-LINK_LIBRARY SHARED lib.c) target_link_libraries(LinkGroup_with-LINK_LIBRARY PRIVATE "$<LINK_GROUP:feat1,$<LINK_LIBRARY:feat1,base1>,base2>") +add_library(LinkGroup_with-LINK_LIBRARY2 SHARED lib.c) +target_link_libraries(LinkGroup_with-LINK_LIBRARY2 PRIVATE "$<LINK_GROUP:feat1,$<LINK_LIBRARY:feat2,base1,base2>>") + add_library(LinkGroup_with-LINK_LIBRARY_OVERRIDE SHARED lib.c) target_link_libraries(LinkGroup_with-LINK_LIBRARY_OVERRIDE PRIVATE "$<LINK_GROUP:feat1,$<LINK_LIBRARY:feat1,base1,base3>,base2>") diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake index c1d74d0..3ebe269 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake @@ -46,6 +46,7 @@ if ((RunCMake_GENERATOR MATCHES "Makefiles|Ninja|Xcode" run_cmake_target(LINK_GROUP multiple-groups LinkGroup_multiple-groups) run_cmake_target(LINK_GROUP group-and-single LinkGroup_group-and-single) run_cmake_target(LINK_GROUP with-LINK_LIBRARY LinkGroup_with-LINK_LIBRARY) + run_cmake_target(LINK_GROUP with-LINK_LIBRARY2 LinkGroup_with-LINK_LIBRARY2) run_cmake_target(LINK_GROUP with-LINK_LIBRARY_OVERRIDE LinkGroup_with-LINK_LIBRARY_OVERRIDE) run_cmake(imported-target) diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake index 021de41..9b6581c 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake @@ -90,12 +90,22 @@ if(APPLE AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES run_cmake_target(apple_framework target-framework main-target-framework) run_cmake_target(apple_framework target-reexport_framework main-target-reexport_framework) run_cmake_target(apple_framework target-weak_framework main-target-weak_framework) + + if(RunCMake_GENERATOR_IS_MULTI_CONFIG AND (NOT XCODE OR XCODE_VERSION GREATER_EQUAL 13)) + run_cmake_target(apple_framework target-framework-postfix main-target-framework-postfix) + run_cmake_target(apple_framework target-reexport_framework-postfix main-target-reexport_framework-postfix) + run_cmake_target(apple_framework target-weak_framework-postfix main-target-weak_framework-postfix) + endif() endif() if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION GREATER_EQUAL "12") run_cmake_target(apple_framework needed_framework main-needed_framework) run_cmake_target(apple_framework target-needed_framework main-target-needed_framework) + + if(RunCMake_GENERATOR_IS_MULTI_CONFIG AND (NOT XCODE OR XCODE_VERSION GREATER_EQUAL 13)) + run_cmake_target(apple_framework target-needed_framework-postfix main-target-needed_framework-postfix) + endif() endif() # Apple library features diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake index e9a93e9..ca0e72d 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake @@ -59,3 +59,33 @@ target_link_libraries(main-target-reexport_framework PRIVATE "$<LINK_LIBRARY:FRA # feature WEAK_FRAMEWORK add_executable(main-target-weak_framework main.mm) target_link_libraries(main-target-weak_framework PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:REEXPORT_FRAMEWORK,target-framework>") + + + +get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTI_CONFIG) + add_library(target-framework-postfix SHARED foo.mm) + set_target_properties(target-framework-postfix PROPERTIES FRAMEWORK TRUE + FRAMEWORK_MULTI_CONFIG_POSTFIX_RELEASE "_release") + target_link_libraries(target-framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>") + + + # feature FRAMEWORK + add_executable(main-target-framework-postfix main.mm) + target_link_libraries(main-target-framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:FRAMEWORK,target-framework-postfix>") + + + # feature NEEDED_FRAMEWORK + add_executable(main-target-needed_framework-postfix main.mm) + target_link_libraries(main-target-needed_framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:NEEDED_FRAMEWORK,target-framework-postfix>") + + + # feature REEXPORT_FRAMEWORK + add_executable(main-target-reexport_framework-postfix main.mm) + target_link_libraries(main-target-reexport_framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:REEXPORT_FRAMEWORK,target-framework-postfix>") + + + # feature WEAK_FRAMEWORK + add_executable(main-target-weak_framework-postfix main.mm) + target_link_libraries(main-target-weak_framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:REEXPORT_FRAMEWORK,target-framework-postfix>") +endif() diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake index 2dbcee7..5ade637 100644 --- a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "17be90bd-a850-44e0-be50-448de847d652") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET UNKNOWN) diff --git a/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-result.txt b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-stderr.txt b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-stderr.txt new file mode 100644 index 0000000..b8d35af --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error in CMakeLists\.txt: + File set "a" is listed in interface file sets of lib1 but has not been + exported + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport.cmake b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport.cmake new file mode 100644 index 0000000..72fab47 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +install(TARGETS lib1 EXPORT a) +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +export(EXPORT a) diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-result.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-stderr.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-stderr.txt new file mode 100644 index 0000000..b8d35af --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error in CMakeLists\.txt: + File set "a" is listed in interface file sets of lib1 but has not been + exported + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall.cmake b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall.cmake new file mode 100644 index 0000000..4e1edff --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +install(TARGETS lib1 EXPORT a) +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +install(EXPORT a DESTINATION lib/cmake/test) diff --git a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake index 024c2cb..332441c 100644 --- a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake +++ b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "17be90bd-a850-44e0-be50-448de847d652") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET a TYPE UNKNOWN) diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index 135777b..7c67c3f 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -35,6 +35,8 @@ run_cmake(FileSetWrongBaseDirsRelative) run_cmake(FileSetOverlappingBaseDirs) run_cmake(FileSetInstallMissingSetsPrivate) run_cmake(FileSetInstallMissingSetsInterface) +run_cmake(FileSetInstallMissingSetsInterfacePostInstall) +run_cmake(FileSetExportMissingSetsInterfacePostExport) run_cmake(FileSetReadOnlyPrivate) run_cmake(FileSetReadOnlyInterface) run_cmake(FileSetNoExistInstall) diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt index 652bcfc..4e41a19 100644 --- a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt +++ b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadLinkLibraries.cmake:2 \(try_compile\): +CMake Error at BadLinkLibraries.cmake:[0-9]+ \(try_compile\): Only libraries may be used as try_compile or try_run IMPORTED LINK_LIBRARIES. Got not_a_library of type UTILITY. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries.cmake b/Tests/RunCMake/try_compile/BadLinkLibraries.cmake index e8b5add..b758e23 100644 --- a/Tests/RunCMake/try_compile/BadLinkLibraries.cmake +++ b/Tests/RunCMake/try_compile/BadLinkLibraries.cmake @@ -1,3 +1,7 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + add_custom_target(not_a_library) -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c LINK_LIBRARIES not_a_library) diff --git a/Tests/RunCMake/try_compile/BadSources1-stderr.txt b/Tests/RunCMake/try_compile/BadSources1-stderr.txt index 864a294..ddcba4f 100644 --- a/Tests/RunCMake/try_compile/BadSources1-stderr.txt +++ b/Tests/RunCMake/try_compile/BadSources1-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadSources1.cmake:1 \(try_compile\): +CMake Error at BadSources1.cmake:[0-9]+ \(try_compile\): Unknown extension ".c" for file .*/Tests/RunCMake/try_compile/src.c diff --git a/Tests/RunCMake/try_compile/BadSources1.cmake b/Tests/RunCMake/try_compile/BadSources1.cmake index aa4dc5e..c95935d 100644 --- a/Tests/RunCMake/try_compile/BadSources1.cmake +++ b/Tests/RunCMake/try_compile/BadSources1.cmake @@ -1 +1,3 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c) +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_compile/BadSources2-stderr.txt b/Tests/RunCMake/try_compile/BadSources2-stderr.txt index 3313f99..953dd9c 100644 --- a/Tests/RunCMake/try_compile/BadSources2-stderr.txt +++ b/Tests/RunCMake/try_compile/BadSources2-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadSources2.cmake:2 \(try_compile\): +CMake Error at BadSources2.cmake:[0-9]+ \(try_compile\): Unknown extension ".cxx" for file .*/Tests/RunCMake/try_compile/src.cxx diff --git a/Tests/RunCMake/try_compile/BadSources2.cmake b/Tests/RunCMake/try_compile/BadSources2.cmake index ed2b036..3f22bb6 100644 --- a/Tests/RunCMake/try_compile/BadSources2.cmake +++ b/Tests/RunCMake/try_compile/BadSources2.cmake @@ -1,5 +1,6 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) enable_language(C) -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c - ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx ) diff --git a/Tests/RunCMake/try_compile/BinDirEmpty-result.txt b/Tests/RunCMake/try_compile/BinDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/BinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/BinDirEmpty-stderr.txt new file mode 100644 index 0000000..b1f5ae3 --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at BinDirEmpty.cmake:[0-9]+ \(try_compile\): + No <bindir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/BinDirEmpty.cmake b/Tests/RunCMake/try_compile/BinDirEmpty.cmake new file mode 100644 index 0000000..7bea43d --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirEmpty.cmake @@ -0,0 +1 @@ +try_compile(resultVar "" ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_compile/BinDirRelative-result.txt b/Tests/RunCMake/try_compile/BinDirRelative-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirRelative-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/BinDirRelative-stderr.txt b/Tests/RunCMake/try_compile/BinDirRelative-stderr.txt new file mode 100644 index 0000000..a7b6302 --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirRelative-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at BinDirRelative.cmake:[0-9]+ \(try_compile\): + <bindir> is not an absolute path: + + 'bin_dir_relative' +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/BinDirRelative.cmake b/Tests/RunCMake/try_compile/BinDirRelative.cmake new file mode 100644 index 0000000..8deda11 --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirRelative.cmake @@ -0,0 +1 @@ +try_compile(resultVar bin_dir_relative ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_compile/BuildType.cmake b/Tests/RunCMake/try_compile/BuildType.cmake new file mode 100644 index 0000000..8d7e3be --- /dev/null +++ b/Tests/RunCMake/try_compile/BuildType.cmake @@ -0,0 +1,8 @@ +enable_language(C) +set(CMAKE_BUILD_TYPE RelWithDebInfo) + +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT + ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + ) diff --git a/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake b/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake new file mode 100644 index 0000000..a822156 --- /dev/null +++ b/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake @@ -0,0 +1,9 @@ +enable_language(C) +set(CMAKE_BUILD_TYPE RelWithDebInfo) + +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT + ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + CMAKE_FLAGS "-DCMAKE_BUILD_TYPE=Release" + ) diff --git a/Tests/RunCMake/try_compile/CStandard-stderr.txt b/Tests/RunCMake/try_compile/CStandard-stderr.txt index 209afcc..c3c48a1 100644 --- a/Tests/RunCMake/try_compile/CStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/CStandard-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at .*/Tests/RunCMake/try_compile/CStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): +^CMake Error at .*/Tests/RunCMake/try_compile/CStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\): C_STANDARD is set to invalid value '3' + CMake Error at CStandard.cmake:[0-9]+ \(try_compile\): diff --git a/Tests/RunCMake/try_compile/CStandard.cmake b/Tests/RunCMake/try_compile/CStandard.cmake index 2849ed4..6ac04db 100644 --- a/Tests/RunCMake/try_compile/CStandard.cmake +++ b/Tests/RunCMake/try_compile/CStandard.cmake @@ -1,7 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c C_STANDARD 3 OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/CStandardGNU.cmake b/Tests/RunCMake/try_compile/CStandardGNU.cmake index 79ae874..10a4384 100644 --- a/Tests/RunCMake/try_compile/CStandardGNU.cmake +++ b/Tests/RunCMake/try_compile/CStandardGNU.cmake @@ -1,23 +1,30 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c C_STANDARD 99 C_STANDARD_REQUIRED 1 C_EXTENSIONS 0 OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() cmake_policy(SET CMP0067 NEW) + set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED 1) set(CMAKE_C_EXTENSIONS 0) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() diff --git a/Tests/RunCMake/try_compile/CStandardNoDefault.cmake b/Tests/RunCMake/try_compile/CStandardNoDefault.cmake index 97e72ea..f4dd5ae 100644 --- a/Tests/RunCMake/try_compile/CStandardNoDefault.cmake +++ b/Tests/RunCMake/try_compile/CStandardNoDefault.cmake @@ -1,9 +1,13 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c C_STANDARD 3 # bogus, but not used OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt index 5d09c0c..8c49302 100644 --- a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt +++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at CopyFileErrorNoCopyFile.cmake:1 \(try_compile\): +CMake Error at CopyFileErrorNoCopyFile.cmake:[0-9]+ \(try_compile\): COPY_FILE_ERROR may be used only with COPY_FILE Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake index 8d7cb0e..8d15b3d 100644 --- a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake +++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c COPY_FILE_ERROR _copied) diff --git a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt index bcf95d5..52dff8f 100644 --- a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at .*/Tests/RunCMake/try_compile/CudaStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): +^CMake Error at .*/Tests/RunCMake/try_compile/CudaStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\): CUDA_STANDARD is set to invalid value '4' + CMake Error at CudaStandard.cmake:[0-9]+ \(try_compile\): diff --git a/Tests/RunCMake/try_compile/CudaStandard.cmake b/Tests/RunCMake/try_compile/CudaStandard.cmake index a230424..0be89be 100644 --- a/Tests/RunCMake/try_compile/CudaStandard.cmake +++ b/Tests/RunCMake/try_compile/CudaStandard.cmake @@ -1,7 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(CUDA) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cu + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cu CUDA_STANDARD 4 OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/CxxStandard-stderr.txt b/Tests/RunCMake/try_compile/CxxStandard-stderr.txt index cee1b44..55a06e2 100644 --- a/Tests/RunCMake/try_compile/CxxStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/CxxStandard-stderr.txt @@ -1,13 +1,13 @@ -^(CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt: +^(CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt: The CXX_STANDARD property on target "cmTC_[0-9a-f]*" contained an invalid value: "3". -)?CMake Error at .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): +)?CMake Error at .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\): CXX_STANDARD is set to invalid value '3' ( -CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt: +CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt: The CXX_STANDARD property on target "cmTC_[0-9a-f]*" contained an invalid value: "3". diff --git a/Tests/RunCMake/try_compile/CxxStandard.cmake b/Tests/RunCMake/try_compile/CxxStandard.cmake index bcb49b9..e5b4e78 100644 --- a/Tests/RunCMake/try_compile/CxxStandard.cmake +++ b/Tests/RunCMake/try_compile/CxxStandard.cmake @@ -1,7 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(CXX) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx CXX_STANDARD 3 OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/CxxStandardGNU.cmake b/Tests/RunCMake/try_compile/CxxStandardGNU.cmake index e714fe4..552d99d 100644 --- a/Tests/RunCMake/try_compile/CxxStandardGNU.cmake +++ b/Tests/RunCMake/try_compile/CxxStandardGNU.cmake @@ -1,23 +1,30 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(CXX) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx CXX_STANDARD 11 CXX_STANDARD_REQUIRED 1 CXX_EXTENSIONS 0 OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() cmake_policy(SET CMP0067 NEW) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED 1) set(CMAKE_CXX_EXTENSIONS 0) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() diff --git a/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake b/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake index 35caa9d..e0ebfee 100644 --- a/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake +++ b/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake @@ -1,9 +1,13 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(CXX) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx CXX_STANDARD 3 # bogus, but not used OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() diff --git a/Tests/RunCMake/try_compile/EmptyListArgs.cmake b/Tests/RunCMake/try_compile/EmptyListArgs.cmake new file mode 100644 index 0000000..5cd7465 --- /dev/null +++ b/Tests/RunCMake/try_compile/EmptyListArgs.cmake @@ -0,0 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +enable_language(C) + +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + CMAKE_FLAGS # no values + COMPILE_DEFINITIONS # no values + LINK_LIBRARIES # no values + LINK_OPTIONS # no values + ) diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs-result.txt b/Tests/RunCMake/try_compile/EmptyValueArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/EmptyValueArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt new file mode 100644 index 0000000..b1344bd --- /dev/null +++ b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\): + COPY_FILE must be followed by a file path +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\): + COPY_FILE_ERROR must be followed by a variable name +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake new file mode 100644 index 0000000..fda4f10 --- /dev/null +++ b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake @@ -0,0 +1,7 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "") +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "x" COPY_FILE_ERROR "") diff --git a/Tests/RunCMake/try_compile/EnvConfig.cmake b/Tests/RunCMake/try_compile/EnvConfig.cmake index 4040c59..6e66825 100644 --- a/Tests/RunCMake/try_compile/EnvConfig.cmake +++ b/Tests/RunCMake/try_compile/EnvConfig.cmake @@ -1,3 +1,5 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) set(ENV{CMAKE_BUILD_TYPE} "Bad") @@ -6,8 +8,8 @@ set(ENV{CMAKE_CONFIGURATION_TYPES} "Bad;Debug") add_library(tc_defs INTERFACE IMPORTED) target_compile_definitions(tc_defs INTERFACE "TC_CONFIG_$<UPPER_CASE:$<CONFIG>>") -try_compile(ENV_CONFIG_RESULT "${CMAKE_BINARY_DIR}" - SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/EnvConfig.c" +try_compile(ENV_CONFIG_RESULT "${try_compile_bindir_or_SOURCES}" + ${try_compile_redundant_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/EnvConfig.c" COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/EnvConfig.bin" OUTPUT_VARIABLE tc_output LINK_LIBRARIES tc_defs diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake index 6d29069..1ead4c2 100644 --- a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake @@ -1,8 +1,12 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(ISPC) -set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 - avx512skx-i32x16) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + +set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 avx512skx-i32x16) + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake index 7f59c14..e08e25f 100644 --- a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake @@ -1,11 +1,16 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(ISPC) -set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 - avx512skx-i32x16) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + +set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 avx512skx-i32x16) + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") + if(NOT result) message(FATAL_ERROR "making Ninja and Ninja Multi-Config behave the same") endif() diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake index c1ab6f2..2276bd3 100644 --- a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake +++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake @@ -1,7 +1,12 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(ISPC) + set(CMAKE_ISPC_INSTRUCTION_SETS "avxknl-i32x16") -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ISPCTargets.cmake b/Tests/RunCMake/try_compile/ISPCTargets.cmake index 0d3bd43..bd45569 100644 --- a/Tests/RunCMake/try_compile/ISPCTargets.cmake +++ b/Tests/RunCMake/try_compile/ISPCTargets.cmake @@ -1,7 +1,12 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(ISPC) + set(CMAKE_ISPC_INSTRUCTION_SETS avx512knl-i32x16 avx512skx-i32x16) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/NoArgs-stderr.txt b/Tests/RunCMake/try_compile/NoArgs-stderr.txt index 8808fd1..4228580 100644 --- a/Tests/RunCMake/try_compile/NoArgs-stderr.txt +++ b/Tests/RunCMake/try_compile/NoArgs-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NoArgs.cmake:1 \(try_compile\): - try_compile unknown error. +CMake Error at NoArgs.cmake:[0-9]+ \(try_compile\): + The try_compile\(\) command requires at least 3 arguments. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCStandard-result.txt b/Tests/RunCMake/try_compile/NoCStandard-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/NoCStandard-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/NoCStandard-stderr.txt b/Tests/RunCMake/try_compile/NoCStandard-stderr.txt new file mode 100644 index 0000000..e0bb9ed --- /dev/null +++ b/Tests/RunCMake/try_compile/NoCStandard-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at NoCStandard.cmake:[0-9]+ \(try_compile\): + Error after keyword "C_STANDARD": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCStandard.cmake b/Tests/RunCMake/try_compile/NoCStandard.cmake new file mode 100644 index 0000000..e0d0478 --- /dev/null +++ b/Tests/RunCMake/try_compile/NoCStandard.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(result ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + C_STANDARD) diff --git a/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt index d65d9488..55ba687 100644 --- a/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt +++ b/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoCopyFile.cmake:1 \(try_compile\): - COPY_FILE must be followed by a file path +CMake Error at NoCopyFile.cmake:[0-9]+ \(try_compile\): + Error after keyword "COPY_FILE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCopyFile.cmake b/Tests/RunCMake/try_compile/NoCopyFile.cmake index 8c648ff..270dff9 100644 --- a/Tests/RunCMake/try_compile/NoCopyFile.cmake +++ b/Tests/RunCMake/try_compile/NoCopyFile.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c COPY_FILE) diff --git a/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt index e889524..008d4e9 100644 --- a/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt +++ b/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoCopyFile2.cmake:1 \(try_compile\): - COPY_FILE must be followed by a file path +CMake Error at NoCopyFile2.cmake:[0-9]+ \(try_compile\): + Error after keyword "COPY_FILE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCopyFile2.cmake b/Tests/RunCMake/try_compile/NoCopyFile2.cmake index 04b7f68..2ea8182 100644 --- a/Tests/RunCMake/try_compile/NoCopyFile2.cmake +++ b/Tests/RunCMake/try_compile/NoCopyFile2.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c COPY_FILE CMAKE_FLAGS -DA=B) diff --git a/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt index ed552fd..7ca185d 100644 --- a/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt +++ b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoCopyFileError.cmake:1 \(try_compile\): - COPY_FILE_ERROR must be followed by a variable name +CMake Error at NoCopyFileError.cmake:[0-9]+ \(try_compile\): + Error after keyword "COPY_FILE_ERROR": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCopyFileError.cmake b/Tests/RunCMake/try_compile/NoCopyFileError.cmake index d4d69ee..1a56e86 100644 --- a/Tests/RunCMake/try_compile/NoCopyFileError.cmake +++ b/Tests/RunCMake/try_compile/NoCopyFileError.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copied.bin COPY_FILE_ERROR) diff --git a/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt b/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt index 18ad751..ec29f0b 100644 --- a/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt +++ b/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoOutputVariable.cmake:1 \(try_compile\): - OUTPUT_VARIABLE must be followed by a variable name +CMake Error at NoOutputVariable.cmake:[0-9]+ \(try_compile\): + Error after keyword "OUTPUT_VARIABLE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoOutputVariable.cmake b/Tests/RunCMake/try_compile/NoOutputVariable.cmake index 3b9cb34..13dc4b4 100644 --- a/Tests/RunCMake/try_compile/NoOutputVariable.cmake +++ b/Tests/RunCMake/try_compile/NoOutputVariable.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c OUTPUT_VARIABLE) diff --git a/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt b/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt index 8b2cc25..dd34559 100644 --- a/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt +++ b/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoOutputVariable2.cmake:1 \(try_compile\): - OUTPUT_VARIABLE must be followed by a variable name +CMake Error at NoOutputVariable2.cmake:[0-9]+ \(try_compile\): + Error after keyword "OUTPUT_VARIABLE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoOutputVariable2.cmake b/Tests/RunCMake/try_compile/NoOutputVariable2.cmake index ad9ac9a..4d5dda3 100644 --- a/Tests/RunCMake/try_compile/NoOutputVariable2.cmake +++ b/Tests/RunCMake/try_compile/NoOutputVariable2.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c OUTPUT_VARIABLE CMAKE_FLAGS -DA=B) diff --git a/Tests/RunCMake/try_compile/NoSources-stderr.txt b/Tests/RunCMake/try_compile/NoSources-stderr.txt index 023032b..55603dc 100644 --- a/Tests/RunCMake/try_compile/NoSources-stderr.txt +++ b/Tests/RunCMake/try_compile/NoSources-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoSources.cmake:1 \(try_compile\): - SOURCES must be followed by at least one source file +CMake Error at NoSources.cmake:[0-9]+ \(try_compile\): + Error after keyword "SOURCES": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt index 025e658..dcd5c7a 100644 --- a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt +++ b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NonSourceCompileDefinitions.cmake:1 \(try_compile\): - COMPILE_DEFINITIONS specified on a srcdir type TRY_COMPILE +CMake Error at NonSourceCompileDefinitions.cmake:[0-9]+ \(try_compile\): + COMPILE_DEFINITIONS allowed only in source file signature Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt b/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt index f5893e1..1b7dfeb 100644 --- a/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt +++ b/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NonSourceCopyFile.cmake:1 \(try_compile\): - COPY_FILE specified on a srcdir type TRY_COMPILE +CMake Error at NonSourceCopyFile.cmake:[0-9]+ \(try_compile\): + COPY_FILE allowed only in source file signature Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt index f1b4df9..59f1d73 100644 --- a/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at .*/Tests/RunCMake/try_compile/ObjCStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): +^CMake Error at .*/Tests/RunCMake/try_compile/ObjCStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\): OBJC_STANDARD is set to invalid value '3' + CMake Error at ObjCStandard.cmake:[0-9]+ \(try_compile\): diff --git a/Tests/RunCMake/try_compile/ObjCStandard.cmake b/Tests/RunCMake/try_compile/ObjCStandard.cmake index b2066f9..a691ddd 100644 --- a/Tests/RunCMake/try_compile/ObjCStandard.cmake +++ b/Tests/RunCMake/try_compile/ObjCStandard.cmake @@ -1,7 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(OBJC) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.m + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.m OBJC_STANDARD 3 OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt index a2f91b4..21fa20f 100644 --- a/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at .*/Tests/RunCMake/try_compile/ObjCxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): +^CMake Error at .*/Tests/RunCMake/try_compile/ObjCxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\): OBJCXX_STANDARD is set to invalid value '3' + CMake Error at ObjCxxStandard.cmake:[0-9]+ \(try_compile\): diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard.cmake b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake index 1221805..b03f560 100644 --- a/Tests/RunCMake/try_compile/ObjCxxStandard.cmake +++ b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake @@ -1,7 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(OBJCXX) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.mm + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.mm OBJCXX_STANDARD 3 OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt new file mode 100644 index 0000000..e9ec450 --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at OldProjectBinDirEmpty.cmake:[0-9]+ \(try_compile\): + No <bindir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake new file mode 100644 index 0000000..fa922d9 --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake @@ -0,0 +1 @@ +try_compile(RESULT "" ${CMAKE_CURRENT_SOURCE_DIR}/proj Foo) diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt new file mode 100644 index 0000000..47dd60f --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at OldProjectSrcDirEmpty.cmake:[0-9]+ \(try_compile\): + No <srcdir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake new file mode 100644 index 0000000..dfbfba6 --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake @@ -0,0 +1 @@ +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} "" Foo) diff --git a/Tests/RunCMake/try_compile/OneArg-stderr.txt b/Tests/RunCMake/try_compile/OneArg-stderr.txt index 12835be..a2e983e 100644 --- a/Tests/RunCMake/try_compile/OneArg-stderr.txt +++ b/Tests/RunCMake/try_compile/OneArg-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at OneArg.cmake:1 \(try_compile\): - try_compile unknown error. +CMake Error at OneArg.cmake:[0-9]+ \(try_compile\): + The try_compile\(\) command requires at least 3 arguments. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake b/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake new file mode 100644 index 0000000..1214bbb --- /dev/null +++ b/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake @@ -0,0 +1,9 @@ +enable_language(C) +set(CMAKE_BUILD_TYPE RelWithDebInfo) + +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT + ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + CMAKE_FLAGS "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=bin" + ) diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt new file mode 100644 index 0000000..57a2bd0 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at ProjectBinDirEmpty.cmake:[0-9]+ \(try_compile\): + No <bindir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake b/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake new file mode 100644 index 0000000..e867cc6 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake @@ -0,0 +1,4 @@ +try_compile(RESULT PROJECT Foo + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/proj + BINARY_DIR "" + ) diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt b/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt b/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt new file mode 100644 index 0000000..45241c9 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at ProjectCopyFile.cmake:[0-9]+ \(try_compile\): + Unknown arguments: + + "COPY_FILE" + "result" +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile.cmake b/Tests/RunCMake/try_compile/ProjectCopyFile.cmake new file mode 100644 index 0000000..6bfec99 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectCopyFile.cmake @@ -0,0 +1,4 @@ +try_compile(RESULT + PROJECT TestProject + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/proj + COPY_FILE result) diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt new file mode 100644 index 0000000..dc6f354 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at ProjectSrcDirEmpty.cmake:[0-9]+ \(try_compile\): + No <srcdir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake new file mode 100644 index 0000000..ac33ed0 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake @@ -0,0 +1 @@ +try_compile(RESULT PROJECT Foo SOURCE_DIR "") diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt new file mode 100644 index 0000000..af6edd5 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at ProjectSrcDirMissing.cmake:[0-9]+ \(try_compile\): + No <srcdir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake b/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake new file mode 100644 index 0000000..e32cdf4 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake @@ -0,0 +1 @@ +try_compile(RESULT PROJECT Foo) diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index eca7bf4..d63624c 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -1,32 +1,39 @@ include(RunCMake) -run_cmake(CopyFileErrorNoCopyFile) run_cmake(NoArgs) run_cmake(OneArg) run_cmake(TwoArgs) -run_cmake(NoCopyFile) -run_cmake(NoCopyFile2) -run_cmake(NoCopyFileError) -run_cmake(NoOutputVariable) -run_cmake(NoOutputVariable2) run_cmake(NoSources) -run_cmake(BadLinkLibraries) -run_cmake(BadSources1) -run_cmake(BadSources2) +run_cmake(BinDirEmpty) +run_cmake(BinDirRelative) +run_cmake(ProjectSrcDirMissing) +run_cmake(ProjectSrcDirEmpty) +run_cmake(ProjectBinDirEmpty) +run_cmake(OldProjectSrcDirEmpty) +run_cmake(OldProjectBinDirEmpty) + +set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=old_signature.cmake) +include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=new_signature.cmake) +include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake) +unset(RunCMake_TEST_OPTIONS) + +run_cmake(SourceFromOneArg) +run_cmake(SourceFromThreeArgs) +run_cmake(SourceFromBadName) +run_cmake(SourceFromBadFile) + +run_cmake(ProjectCopyFile) run_cmake(NonSourceCopyFile) run_cmake(NonSourceCompileDefinitions) -run_cmake(EnvConfig) - set(RunCMake_TEST_OPTIONS --debug-trycompile) run_cmake(PlatformVariables) run_cmake(WarnDeprecated) unset(RunCMake_TEST_OPTIONS) -run_cmake(TargetTypeExe) -run_cmake(TargetTypeInvalid) -run_cmake(TargetTypeStatic) - if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$") set (RunCMake_TEST_OPTIONS -DRunCMake_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) @@ -34,41 +41,6 @@ if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND unset (RunCMake_TEST_OPTIONS) endif() -if(CMAKE_C_STANDARD_DEFAULT) - run_cmake(CStandard) -elseif(DEFINED CMAKE_C_STANDARD_DEFAULT) - run_cmake(CStandardNoDefault) -endif() -if(CMAKE_OBJC_STANDARD_DEFAULT) - run_cmake(ObjCStandard) -endif() -if(CMAKE_CXX_STANDARD_DEFAULT) - run_cmake(CxxStandard) -elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT) - run_cmake(CxxStandardNoDefault) -endif() -if(CMAKE_OBJCXX_STANDARD_DEFAULT) - run_cmake(ObjCxxStandard) -endif() -if(CMake_TEST_CUDA) - run_cmake(CudaStandard) -endif() -if(CMake_TEST_ISPC) - run_cmake(ISPCTargets) - run_cmake(ISPCInvalidTarget) - set(ninja "") - if(RunCMake_GENERATOR MATCHES "Ninja") - set(ninja "Ninja") - endif() - run_cmake(ISPCDuplicateTarget${ninja}) -endif() -if((CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC") - run_cmake(CStandardGNU) -endif() -if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC") - run_cmake(CxxStandardGNU) -endif() - run_cmake(CMP0056) run_cmake(CMP0066) run_cmake(CMP0067) diff --git a/Tests/RunCMake/try_compile/SourceFromBadFile-result.txt b/Tests/RunCMake/try_compile/SourceFromBadFile-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadFile-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/SourceFromBadFile-stderr.txt b/Tests/RunCMake/try_compile/SourceFromBadFile-stderr.txt new file mode 100644 index 0000000..53a6d8d --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadFile-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceFromBadFile.cmake:[0-9]+ \(try_compile\): + SOURCE_FROM_FILE failed to copy "bad#source.c": No such file or directory +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromBadFile.cmake b/Tests/RunCMake/try_compile/SourceFromBadFile.cmake new file mode 100644 index 0000000..0a37f11 --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadFile.cmake @@ -0,0 +1 @@ +try_compile(RESULT SOURCE_FROM_FILE bad.c "bad#source.c") diff --git a/Tests/RunCMake/try_compile/SourceFromBadName-result.txt b/Tests/RunCMake/try_compile/SourceFromBadName-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt b/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt new file mode 100644 index 0000000..ef6847c --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceFromBadName.cmake:[0-9]+ \(try_compile\): + SOURCES_FROM_ARG given invalid filename "bad/name.c" +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromBadName.cmake b/Tests/RunCMake/try_compile/SourceFromBadName.cmake new file mode 100644 index 0000000..e53a73f --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadName.cmake @@ -0,0 +1 @@ +try_compile(RESULT SOURCE_FROM_ARG bad/name.c "int main();") diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg-result.txt b/Tests/RunCMake/try_compile/SourceFromOneArg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromOneArg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt b/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt new file mode 100644 index 0000000..bebe8bb --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceFromOneArg.cmake:[0-9]+ \(try_compile\): + SOURCE_FROM_ARG requires exactly two arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg.cmake b/Tests/RunCMake/try_compile/SourceFromOneArg.cmake new file mode 100644 index 0000000..39ca11e --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromOneArg.cmake @@ -0,0 +1 @@ +try_compile(RESULT SOURCE_FROM_ARG test.c) diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs-result.txt b/Tests/RunCMake/try_compile/SourceFromThreeArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt b/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt new file mode 100644 index 0000000..2cf201d --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceFromThreeArgs.cmake:[0-9]+ \(try_compile\): + SOURCE_FROM_ARG requires exactly two arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake b/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake new file mode 100644 index 0000000..af6340d --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake @@ -0,0 +1 @@ +try_compile(RESULT SOURCE_FROM_ARG test.c "int" "main();") diff --git a/Tests/RunCMake/try_compile/TargetTypeExe.cmake b/Tests/RunCMake/try_compile/TargetTypeExe.cmake index 9b6e727..330f5f5 100644 --- a/Tests/RunCMake/try_compile/TargetTypeExe.cmake +++ b/Tests/RunCMake/try_compile/TargetTypeExe.cmake @@ -1,14 +1,20 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) + set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c OUTPUT_VARIABLE out COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy COPY_FILE_ERROR copy_err ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() + if(copy_err) message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}") endif() diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt index 08b281a..e9123e3 100644 --- a/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt +++ b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at TargetTypeInvalid.cmake:2 \(try_compile\): +^CMake Error at TargetTypeInvalid.cmake:[0-9]+ \(try_compile\): Invalid value 'INVALID' for CMAKE_TRY_COMPILE_TARGET_TYPE. Only 'EXECUTABLE' and 'STATIC_LIBRARY' are allowed. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake index 0bbc4ac..15a20bb 100644 --- a/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake +++ b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake @@ -1,2 +1,6 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + set(CMAKE_TRY_COMPILE_TARGET_TYPE INVALID) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c) + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_compile/TargetTypeStatic.cmake b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake index 006b8b8..98dea41 100644 --- a/Tests/RunCMake/try_compile/TargetTypeStatic.cmake +++ b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake @@ -1,14 +1,20 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/other.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/other.c OUTPUT_VARIABLE out COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy COPY_FILE_ERROR copy_err ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() + if(copy_err) message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}") endif() diff --git a/Tests/RunCMake/try_compile/TryRunArgs-stderr.txt b/Tests/RunCMake/try_compile/TryRunArgs-stderr.txt new file mode 100644 index 0000000..2a58e71 --- /dev/null +++ b/Tests/RunCMake/try_compile/TryRunArgs-stderr.txt @@ -0,0 +1,18 @@ +^CMake Warning \(dev\) at TryRunArgs.cmake:[0-9]+ \(try_compile\): + Unknown arguments: + + "COMPILE_OUTPUT_VARIABLE" + "compOutputVar" + "RUN_OUTPUT_VARIABLE" + "runOutputVar" + "RUN_OUTPUT_STDOUT_VARIABLE" + "runOutputStdOutVar" + "RUN_OUTPUT_STDERR_VARIABLE" + "runOutputStdErrVar" + "WORKING_DIRECTORY" + "runWorkDir" + "ARGS" + "runArgs" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/try_compile/TryRunArgs.cmake b/Tests/RunCMake/try_compile/TryRunArgs.cmake new file mode 100644 index 0000000..e4cb1fe --- /dev/null +++ b/Tests/RunCMake/try_compile/TryRunArgs.cmake @@ -0,0 +1,14 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +enable_language(C) + +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + COMPILE_OUTPUT_VARIABLE compOutputVar + RUN_OUTPUT_VARIABLE runOutputVar + RUN_OUTPUT_STDOUT_VARIABLE runOutputStdOutVar + RUN_OUTPUT_STDERR_VARIABLE runOutputStdErrVar + WORKING_DIRECTORY runWorkDir + ARGS runArgs + ) diff --git a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt index b9c08fc..b68e78e 100644 --- a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt +++ b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at TwoArgs.cmake:1 \(try_compile\): - try_compile unknown error. +CMake Error at TwoArgs.cmake:[0-9]+ \(try_compile\): + The try_compile\(\) command requires at least 3 arguments. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/new_signature.cmake b/Tests/RunCMake/try_compile/new_signature.cmake new file mode 100644 index 0000000..cbcb261 --- /dev/null +++ b/Tests/RunCMake/try_compile/new_signature.cmake @@ -0,0 +1,2 @@ +set(try_compile_bindir_or_SOURCES SOURCES) +set(try_compile_redundant_SOURCES "") diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake new file mode 100644 index 0000000..ac07ad3 --- /dev/null +++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake @@ -0,0 +1,66 @@ +# These tests are performed using both the historic and the newer SOURCES +# signatures of try_compile. It is critical that they behave the same and +# produce comparable output for both signatures. Tests that cannot do this +# belong in RunCMakeTests.txt, not here. +# +# Tests here MUST include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) and +# use the variables defined therein appropriately. Refer to existing tests for +# examples. + +run_cmake(CopyFileErrorNoCopyFile) +run_cmake(NoCopyFile) +run_cmake(NoCopyFile2) +run_cmake(NoCopyFileError) +run_cmake(NoCStandard) +run_cmake(NoOutputVariable) +run_cmake(NoOutputVariable2) +run_cmake(BadLinkLibraries) +run_cmake(BadSources1) +run_cmake(BadSources2) +run_cmake(EmptyValueArgs) +run_cmake(EmptyListArgs) +run_cmake(TryRunArgs) +run_cmake(BuildType) +run_cmake(BuildTypeAsFlag) +run_cmake(OutputDirAsFlag) + +run_cmake(EnvConfig) + +run_cmake(TargetTypeExe) +run_cmake(TargetTypeInvalid) +run_cmake(TargetTypeStatic) + +if(CMAKE_C_STANDARD_DEFAULT) + run_cmake(CStandard) +elseif(DEFINED CMAKE_C_STANDARD_DEFAULT) + run_cmake(CStandardNoDefault) +endif() +if(CMAKE_OBJC_STANDARD_DEFAULT) + run_cmake(ObjCStandard) +endif() +if(CMAKE_CXX_STANDARD_DEFAULT) + run_cmake(CxxStandard) +elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT) + run_cmake(CxxStandardNoDefault) +endif() +if(CMAKE_OBJCXX_STANDARD_DEFAULT) + run_cmake(ObjCxxStandard) +endif() +if(CMake_TEST_CUDA) + run_cmake(CudaStandard) +endif() +if(CMake_TEST_ISPC) + run_cmake(ISPCTargets) + run_cmake(ISPCInvalidTarget) + set(ninja "") + if(RunCMake_GENERATOR MATCHES "Ninja") + set(ninja "Ninja") + endif() + run_cmake(ISPCDuplicateTarget${ninja}) +endif() +if((CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC") + run_cmake(CStandardGNU) +endif() +if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC") + run_cmake(CxxStandardGNU) +endif() diff --git a/Tests/RunCMake/try_compile/old_signature.cmake b/Tests/RunCMake/try_compile/old_signature.cmake new file mode 100644 index 0000000..94b12de --- /dev/null +++ b/Tests/RunCMake/try_compile/old_signature.cmake @@ -0,0 +1,2 @@ +set(try_compile_bindir_or_SOURCES ${CMAKE_CURRENT_BINARY_DIR}) +set(try_compile_redundant_SOURCES SOURCES) diff --git a/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt index dcd1bfc..f9cc50e 100644 --- a/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt +++ b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadLinkLibraries.cmake:2 \(try_run\): +CMake Error at BadLinkLibraries.cmake:[0-9+] \(try_run\): Only libraries may be used as try_compile or try_run IMPORTED LINK_LIBRARIES. Got not_a_library of type UTILITY. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/try_run/BadLinkLibraries.cmake b/Tests/RunCMake/try_run/BadLinkLibraries.cmake index a124bf6..950a942 100644 --- a/Tests/RunCMake/try_run/BadLinkLibraries.cmake +++ b/Tests/RunCMake/try_run/BadLinkLibraries.cmake @@ -1,4 +1,7 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + add_custom_target(not_a_library) -try_run(RUN_RESULT COMPILE_RESULT - ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c LINK_LIBRARIES not_a_library) diff --git a/Tests/RunCMake/try_run/BinDirEmpty-result.txt b/Tests/RunCMake/try_run/BinDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt b/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt new file mode 100644 index 0000000..def1c22 --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at BinDirEmpty.cmake:[0-9]+ \(try_run\): + No <bindir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/BinDirEmpty.cmake b/Tests/RunCMake/try_run/BinDirEmpty.cmake new file mode 100644 index 0000000..d4b7ee3 --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirEmpty.cmake @@ -0,0 +1 @@ +try_run(runResultVar compileResultVar "" ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_run/BinDirRelative-result.txt b/Tests/RunCMake/try_run/BinDirRelative-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirRelative-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/BinDirRelative-stderr.txt b/Tests/RunCMake/try_run/BinDirRelative-stderr.txt new file mode 100644 index 0000000..54d4e86 --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirRelative-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at BinDirRelative.cmake:[0-9]+ \(try_run\): + <bindir> is not an absolute path: + + 'bin_dir_relative' +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/BinDirRelative.cmake b/Tests/RunCMake/try_run/BinDirRelative.cmake new file mode 100644 index 0000000..a277403 --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirRelative.cmake @@ -0,0 +1 @@ +try_run(runResultVar compileResultVar bin_dir_relative ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_run/NoCompileOutputVariable-result.txt b/Tests/RunCMake/try_run/NoCompileOutputVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoCompileOutputVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoCompileOutputVariable-stderr.txt b/Tests/RunCMake/try_run/NoCompileOutputVariable-stderr.txt new file mode 100644 index 0000000..e8baffb --- /dev/null +++ b/Tests/RunCMake/try_run/NoCompileOutputVariable-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoCompileOutputVariable.cmake:[0-9]+ \(try_run\): + Error after keyword "COMPILE_OUTPUT_VARIABLE": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/NoCompileOutputVariable.cmake b/Tests/RunCMake/try_run/NoCompileOutputVariable.cmake new file mode 100644 index 0000000..9eb7c5e --- /dev/null +++ b/Tests/RunCMake/try_run/NoCompileOutputVariable.cmake @@ -0,0 +1,6 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COMPILE_OUTPUT_VARIABLE + ) diff --git a/Tests/RunCMake/try_run/NoOutputCompileVariable-result.txt b/Tests/RunCMake/try_run/NoOutputCompileVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoOutputCompileVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoOutputVariable-result.txt b/Tests/RunCMake/try_run/NoOutputVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoOutputVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoOutputVariable-stderr.txt b/Tests/RunCMake/try_run/NoOutputVariable-stderr.txt new file mode 100644 index 0000000..46cfca0 --- /dev/null +++ b/Tests/RunCMake/try_run/NoOutputVariable-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoOutputVariable.cmake:[0-9]+ \(try_run\): + Error after keyword "OUTPUT_VARIABLE": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/NoOutputVariable.cmake b/Tests/RunCMake/try_run/NoOutputVariable.cmake new file mode 100644 index 0000000..1901b30 --- /dev/null +++ b/Tests/RunCMake/try_run/NoOutputVariable.cmake @@ -0,0 +1,4 @@ +try_run(RUN_RESULT COMPILE_RESULT + ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE + ) diff --git a/Tests/RunCMake/try_run/NoRunOutputVariable-result.txt b/Tests/RunCMake/try_run/NoRunOutputVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunOutputVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoRunOutputVariable-stderr.txt b/Tests/RunCMake/try_run/NoRunOutputVariable-stderr.txt new file mode 100644 index 0000000..8ccbdab --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunOutputVariable-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoRunOutputVariable.cmake:[0-9]+ \(try_run\): + Error after keyword "RUN_OUTPUT_VARIABLE": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/NoRunOutputVariable.cmake b/Tests/RunCMake/try_run/NoRunOutputVariable.cmake new file mode 100644 index 0000000..f9e5e0b --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunOutputVariable.cmake @@ -0,0 +1,6 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + RUN_OUTPUT_VARIABLE + ) diff --git a/Tests/RunCMake/try_run/NoRunStdErrVariable-result.txt b/Tests/RunCMake/try_run/NoRunStdErrVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdErrVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoRunStdErrVariable-stderr.txt b/Tests/RunCMake/try_run/NoRunStdErrVariable-stderr.txt new file mode 100644 index 0000000..1443ab2 --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdErrVariable-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoRunStdErrVariable.cmake:[0-9]+ \(try_run\): + Error after keyword "RUN_OUTPUT_STDERR_VARIABLE": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/try_run/NoRunStdErrVariable.cmake b/Tests/RunCMake/try_run/NoRunStdErrVariable.cmake new file mode 100644 index 0000000..888bc25 --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdErrVariable.cmake @@ -0,0 +1,7 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/workdir + RUN_OUTPUT_STDERR_VARIABLE + ) diff --git a/Tests/RunCMake/try_run/NoRunStdOutVariable-result.txt b/Tests/RunCMake/try_run/NoRunStdOutVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdOutVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoRunStdOutVariable-stderr.txt b/Tests/RunCMake/try_run/NoRunStdOutVariable-stderr.txt new file mode 100644 index 0000000..8b90e94 --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdOutVariable-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoRunStdOutVariable.cmake:[0-9]+ \(try_run\): + Error after keyword "RUN_OUTPUT_STDOUT_VARIABLE": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/try_run/NoRunStdOutVariable.cmake b/Tests/RunCMake/try_run/NoRunStdOutVariable.cmake new file mode 100644 index 0000000..ed6ab88 --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdOutVariable.cmake @@ -0,0 +1,7 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/workdir + RUN_OUTPUT_STDOUT_VARIABLE + ) diff --git a/Tests/RunCMake/try_run/NoWorkingDirectory-result.txt b/Tests/RunCMake/try_run/NoWorkingDirectory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoWorkingDirectory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoWorkingDirectory-stderr.txt b/Tests/RunCMake/try_run/NoWorkingDirectory-stderr.txt new file mode 100644 index 0000000..b6e258f --- /dev/null +++ b/Tests/RunCMake/try_run/NoWorkingDirectory-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoWorkingDirectory.cmake:[0-9]+ \(try_run\): + Error after keyword "WORKING_DIRECTORY": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/NoWorkingDirectory.cmake b/Tests/RunCMake/try_run/NoWorkingDirectory.cmake new file mode 100644 index 0000000..0d68182 --- /dev/null +++ b/Tests/RunCMake/try_run/NoWorkingDirectory.cmake @@ -0,0 +1,6 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + WORKING_DIRECTORY + ) diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake index d74add0..dbea089 100644 --- a/Tests/RunCMake/try_run/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake @@ -1,6 +1,16 @@ include(RunCMake) -run_cmake(BadLinkLibraries) +run_cmake(BinDirEmpty) +run_cmake(BinDirRelative) +run_cmake(NoOutputVariable) + +set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=old_signature.cmake) +include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=new_signature.cmake) +include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake) +unset(RunCMake_TEST_OPTIONS) if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$") @@ -8,5 +18,3 @@ if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND run_cmake(LinkOptions) unset (RunCMake_TEST_OPTIONS) endif() - -run_cmake(WorkingDirArg) diff --git a/Tests/RunCMake/try_run/WorkingDirArg.cmake b/Tests/RunCMake/try_run/WorkingDirArg.cmake index b583823..375a703 100644 --- a/Tests/RunCMake/try_run/WorkingDirArg.cmake +++ b/Tests/RunCMake/try_run/WorkingDirArg.cmake @@ -1,6 +1,8 @@ -try_run(RUN_RESULT COMPILE_RESULT - ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c - RUN_OUTPUT_VARIABLE OUTPUT_VARIABLE +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + RUN_OUTPUT_VARIABLE RUN_OUTPUT WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/workdir ) diff --git a/Tests/RunCMake/try_run/new_signature.cmake b/Tests/RunCMake/try_run/new_signature.cmake new file mode 100644 index 0000000..cbcb261 --- /dev/null +++ b/Tests/RunCMake/try_run/new_signature.cmake @@ -0,0 +1,2 @@ +set(try_compile_bindir_or_SOURCES SOURCES) +set(try_compile_redundant_SOURCES "") diff --git a/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake new file mode 100644 index 0000000..e1c1784 --- /dev/null +++ b/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake @@ -0,0 +1,20 @@ +# These tests are performed using both the historic and the newer SOURCES +# signatures of try_run. It is critical that they behave the same and produce +# comparable output for both signatures. Tests that cannot do this belong in +# RunCMakeTests.txt, not here. +# +# Tests here MUST include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) and +# use the variables defined therein appropriately. Refer to existing tests for +# examples. + +run_cmake(BadLinkLibraries) +run_cmake(BinDirEmpty) +run_cmake(BinDirRelative) + +run_cmake(WorkingDirArg) + +run_cmake(NoCompileOutputVariable) +run_cmake(NoRunOutputVariable) +run_cmake(NoRunStdOutVariable) +run_cmake(NoRunStdErrVariable) +run_cmake(NoWorkingDirectory) diff --git a/Tests/RunCMake/try_run/old_signature.cmake b/Tests/RunCMake/try_run/old_signature.cmake new file mode 100644 index 0000000..94b12de --- /dev/null +++ b/Tests/RunCMake/try_run/old_signature.cmake @@ -0,0 +1,2 @@ +set(try_compile_bindir_or_SOURCES ${CMAKE_CURRENT_BINARY_DIR}) +set(try_compile_redundant_SOURCES SOURCES) |