diff options
Diffstat (limited to 'Tests/RunCMake')
540 files changed, 3215 insertions, 27 deletions
diff --git a/Tests/RunCMake/set/PARENT_SCOPE-result.txt b/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt index 573541a..573541a 100644 --- a/Tests/RunCMake/set/PARENT_SCOPE-result.txt +++ b/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt diff --git a/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt b/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt new file mode 100644 index 0000000..87d198d --- /dev/null +++ b/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at ObjlibNotDefined.cmake:[0-9]+ \(get_target_property\): + Policy CMP0026 is not set: Disallow use of the LOCATION target property. + Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The LOCATION property should not be read from target "objlibuser". Use the + target name directly with add_custom_command, or use the generator + expression \$<TARGET_FILE>, as appropriate. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake b/Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake new file mode 100644 index 0000000..194760c --- /dev/null +++ b/Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake @@ -0,0 +1,13 @@ + +enable_language(CXX) + +add_executable(objlibuser + empty.cpp + $<TARGET_OBJECTS:bar> +) + +get_target_property(_location objlibuser LOCATION) + +add_library(bar OBJECT + empty.cpp +) diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake index 1824cc6..7c2582f 100644 --- a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake @@ -9,3 +9,4 @@ run_cmake(CMP0026-CONFIG-LOCATION-WARN) run_cmake(CMP0026-LOCATION-CONFIG-NEW) run_cmake(CMP0026-LOCATION-CONFIG-OLD) run_cmake(CMP0026-LOCATION-CONFIG-WARN) +run_cmake(ObjlibNotDefined) diff --git a/Tests/RunCMake/CMP0051/CMP0051-NEW-result.txt b/Tests/RunCMake/CMP0051/CMP0051-NEW-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-NEW-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0051/CMP0051-NEW-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-NEW-stderr.txt new file mode 100644 index 0000000..e5578ba --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-NEW-stderr.txt @@ -0,0 +1 @@ +^Sources: "empty.cpp;\$<TARGET_OBJECTS:objects>"$ diff --git a/Tests/RunCMake/CMP0051/CMP0051-NEW.cmake b/Tests/RunCMake/CMP0051/CMP0051-NEW.cmake new file mode 100644 index 0000000..f304bf1 --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-NEW.cmake @@ -0,0 +1,10 @@ + +cmake_policy(SET CMP0051 NEW) + +add_library(objects OBJECT empty.cpp) + +add_library(empty empty.cpp $<TARGET_OBJECTS:objects>) + +get_target_property(srcs empty SOURCES) + +message("Sources: \"${srcs}\"") diff --git a/Tests/RunCMake/CMP0051/CMP0051-OLD-result.txt b/Tests/RunCMake/CMP0051/CMP0051-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt new file mode 100644 index 0000000..cc17f33 --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt @@ -0,0 +1 @@ +^Sources: "empty.cpp"$ diff --git a/Tests/RunCMake/CMP0051/CMP0051-OLD.cmake b/Tests/RunCMake/CMP0051/CMP0051-OLD.cmake new file mode 100644 index 0000000..0243e94 --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-OLD.cmake @@ -0,0 +1,10 @@ + +cmake_policy(SET CMP0051 OLD) + +add_library(objects OBJECT empty.cpp) + +add_library(empty empty.cpp $<TARGET_OBJECTS:objects>) + +get_target_property(srcs empty SOURCES) + +message("Sources: \"${srcs}\"") diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt new file mode 100644 index 0000000..77cbad5 --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(empty2 ../empty.cpp $<TARGET_OBJECTS:objects>) diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-result.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt new file mode 100644 index 0000000..ae2e468 --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt @@ -0,0 +1,31 @@ +CMake Warning \(dev\) at CMP0051-WARN.cmake:6 \(get_target_property\): + Policy CMP0051 is not set: List TARGET_OBJECTS in SOURCES target property. + Run "cmake --help-policy CMP0051" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + Target "empty" contains \$<TARGET_OBJECTS> generator expression in its + sources list. This content was not previously part of the SOURCES property + when that property was read at configure time. Code reading that property + needs to be adapted to ignore the generator expression using the + string\(GENEX_STRIP\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +Sources: "empty.cpp" +* +CMake Warning \(dev\) at CMP0051-WARN.cmake:12 \(get_target_property\): + Policy CMP0051 is not set: List TARGET_OBJECTS in SOURCES target property. + Run "cmake --help-policy CMP0051" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + Target "empty2" contains \$<TARGET_OBJECTS> generator expression in its + sources list. This content was not previously part of the SOURCES property + when that property was read at configure time. Code reading that property + needs to be adapted to ignore the generator expression using the + string\(GENEX_STRIP\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +Sources: "../empty.cpp"$ diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake b/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake new file mode 100644 index 0000000..744598f --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake @@ -0,0 +1,14 @@ + +add_library(objects OBJECT empty.cpp) + +add_library(empty empty.cpp $<TARGET_OBJECTS:objects>) + +get_target_property(srcs empty SOURCES) + +message("Sources: \"${srcs}\"") + +add_subdirectory(CMP0051-WARN-Dir) + +get_target_property(srcs empty2 SOURCES) + +message("Sources: \"${srcs}\"") diff --git a/Tests/RunCMake/CMP0051/CMakeLists.txt b/Tests/RunCMake/CMP0051/CMakeLists.txt new file mode 100644 index 0000000..3482e6b --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0051/RunCMakeTest.cmake b/Tests/RunCMake/CMP0051/RunCMakeTest.cmake new file mode 100644 index 0000000..621192d --- /dev/null +++ b/Tests/RunCMake/CMP0051/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0051-OLD) +run_cmake(CMP0051-NEW) +run_cmake(CMP0051-WARN) diff --git a/Tests/RunCMake/CMP0051/empty.cpp b/Tests/RunCMake/CMP0051/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0051/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0053/CMP0053-NEW-stderr.txt b/Tests/RunCMake/CMP0053/CMP0053-NEW-stderr.txt new file mode 100644 index 0000000..836b0ff --- /dev/null +++ b/Tests/RunCMake/CMP0053/CMP0053-NEW-stderr.txt @@ -0,0 +1,2 @@ +^called +--><--$ diff --git a/Tests/RunCMake/CMP0053/CMP0053-NEW.cmake b/Tests/RunCMake/CMP0053/CMP0053-NEW.cmake new file mode 100644 index 0000000..6ffedc6 --- /dev/null +++ b/Tests/RunCMake/CMP0053/CMP0053-NEW.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0053 NEW) + +function (watch_callback) + message("called") +endfunction () + +variable_watch(test watch_callback) +message("-->${test}<--") diff --git a/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt b/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt new file mode 100644 index 0000000..836b0ff --- /dev/null +++ b/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt @@ -0,0 +1,2 @@ +^called +--><--$ diff --git a/Tests/RunCMake/CMP0053/CMP0053-OLD.cmake b/Tests/RunCMake/CMP0053/CMP0053-OLD.cmake new file mode 100644 index 0000000..41f5347 --- /dev/null +++ b/Tests/RunCMake/CMP0053/CMP0053-OLD.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0053 OLD) + +function (watch_callback) + message("called") +endfunction () + +variable_watch(test watch_callback) +message("-->${test}<--") diff --git a/Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt b/Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt new file mode 100644 index 0000000..836b0ff --- /dev/null +++ b/Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt @@ -0,0 +1,2 @@ +^called +--><--$ diff --git a/Tests/RunCMake/CMP0053/CMP0053-WARN.cmake b/Tests/RunCMake/CMP0053/CMP0053-WARN.cmake new file mode 100644 index 0000000..b010d13 --- /dev/null +++ b/Tests/RunCMake/CMP0053/CMP0053-WARN.cmake @@ -0,0 +1,6 @@ +function (watch_callback) + message("called") +endfunction () + +variable_watch(test watch_callback) +message("-->${test}<--") diff --git a/Tests/RunCMake/CMP0053/CMakeLists.txt b/Tests/RunCMake/CMP0053/CMakeLists.txt new file mode 100644 index 0000000..3482e6b --- /dev/null +++ b/Tests/RunCMake/CMP0053/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0053/RunCMakeTest.cmake b/Tests/RunCMake/CMP0053/RunCMakeTest.cmake new file mode 100644 index 0000000..6521ac0 --- /dev/null +++ b/Tests/RunCMake/CMP0053/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0053-OLD) +run_cmake(CMP0053-NEW) +run_cmake(CMP0053-WARN) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 9bb097b..06272ce 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -3,8 +3,8 @@ macro(add_RunCMake_test test) add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} - -DRunCMake_GENERATOR=${CMAKE_TEST_GENERATOR} - -DRunCMake_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET} + -DRunCMake_GENERATOR=${CMAKE_GENERATOR} + -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} ${${test}_ARGS} @@ -16,6 +16,10 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) endif() +if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2) + set(TargetSources_ARGS -DXCODE_BELOW_2=1) +endif() + add_RunCMake_test(CMP0019) add_RunCMake_test(CMP0022) add_RunCMake_test(CMP0026) @@ -34,20 +38,28 @@ add_RunCMake_test(CMP0045) add_RunCMake_test(CMP0046) add_RunCMake_test(CMP0049) add_RunCMake_test(CMP0050) +add_RunCMake_test(CMP0051) +add_RunCMake_test(CMP0053) add_RunCMake_test(CTest) -if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") +if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") add_RunCMake_test(CompilerChange) endif() add_RunCMake_test(CompilerNotFound) add_RunCMake_test(Configure) add_RunCMake_test(DisallowedCommands) add_RunCMake_test(ExternalData) +add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorToolset) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(ObjectLibrary) +add_RunCMake_test(TargetObjects) +add_RunCMake_test(TargetSources) +add_RunCMake_test(find_dependency) +add_RunCMake_test(CompileFeatures) +add_RunCMake_test(WriteCompilerDetectionHeader) if(NOT WIN32) add_RunCMake_test(PositionIndependentCode) set(SKIP_VISIBILITY 0) @@ -77,6 +89,7 @@ add_RunCMake_test(add_dependencies) add_RunCMake_test(build_command) add_RunCMake_test(export) add_RunCMake_test(cmake_minimum_required) +add_RunCMake_test(file) add_RunCMake_test(find_package) add_RunCMake_test(get_filename_component) add_RunCMake_test(if) @@ -94,6 +107,7 @@ add_RunCMake_test(TargetPolicies) add_RunCMake_test(alias_targets) add_RunCMake_test(interface_library) add_RunCMake_test(no_install_prefix) +add_RunCMake_test(configure_file) find_package(Qt4 QUIET) find_package(Qt5Core QUIET) @@ -105,15 +119,27 @@ if (QT4_FOUND) add_RunCMake_test(ObsoleteQtMacros) endif() -if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]") +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + add_RunCMake_test(FindPkgConfig) +endif() + +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio [^6]") add_RunCMake_test(include_external_msproject) add_RunCMake_test(SolutionGlobalSections) endif() +if(XCODE_VERSION AND NOT "${XCODE_VERSION}" VERSION_LESS 3) + add_RunCMake_test(XcodeProject) +endif() + add_RunCMake_test(File_Generate) add_RunCMake_test(ExportWithoutLanguage) add_RunCMake_test(target_link_libraries) + +add_RunCMake_test(target_compile_features) add_RunCMake_test(CheckModules) add_RunCMake_test(CommandLine) add_RunCMake_test(install) +add_RunCMake_test(CPackInstallProperties) diff --git a/Tests/RunCMake/CPackInstallProperties/Append-check.cmake b/Tests/RunCMake/CPackInstallProperties/Append-check.cmake new file mode 100644 index 0000000..017b30d --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Append-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property("append.txt" CPACK_TEST_PROP "value1;value2;value3") diff --git a/Tests/RunCMake/CPackInstallProperties/Append.cmake b/Tests/RunCMake/CPackInstallProperties/Append.cmake new file mode 100644 index 0000000..cecc45f --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Append.cmake @@ -0,0 +1,2 @@ +set_property(INSTALL append.txt PROPERTY CPACK_TEST_PROP value1) +set_property(INSTALL append.txt PROPERTY CPACK_TEST_PROP value2 value3 APPEND) diff --git a/Tests/RunCMake/CPackInstallProperties/CMakeLists.txt b/Tests/RunCMake/CPackInstallProperties/CMakeLists.txt new file mode 100644 index 0000000..89ff7c4 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.0) + +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) + +include(CPack) diff --git a/Tests/RunCMake/CPackInstallProperties/FilenameGenex-check.cmake b/Tests/RunCMake/CPackInstallProperties/FilenameGenex-check.cmake new file mode 100644 index 0000000..8c9e967 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/FilenameGenex-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property(${EXPECTED_MYTEST_NAME} CPACK_TEST_PROP2 PROP_VALUE2) diff --git a/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake b/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake new file mode 100644 index 0000000..1a373b9 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake @@ -0,0 +1,7 @@ +add_executable(mytest test.cpp) + +file(GENERATE OUTPUT runtest_info.cmake CONTENT [[ +set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>") +]]) + +set_property(INSTALL $<TARGET_FILE_NAME:mytest> PROPERTY CPACK_TEST_PROP2 PROP_VALUE2) diff --git a/Tests/RunCMake/CPackInstallProperties/MultipleValues-check.cmake b/Tests/RunCMake/CPackInstallProperties/MultipleValues-check.cmake new file mode 100644 index 0000000..91278ba --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/MultipleValues-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property("multiple_values.txt" CPACK_TEST_PROP "value1;value2;value3") diff --git a/Tests/RunCMake/CPackInstallProperties/MultipleValues.cmake b/Tests/RunCMake/CPackInstallProperties/MultipleValues.cmake new file mode 100644 index 0000000..26db52a --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/MultipleValues.cmake @@ -0,0 +1 @@ +set_property(INSTALL multiple_values.txt PROPERTY CPACK_TEST_PROP value1 value2 value3) diff --git a/Tests/RunCMake/CPackInstallProperties/PerConfigValue-check.cmake b/Tests/RunCMake/CPackInstallProperties/PerConfigValue-check.cmake new file mode 100644 index 0000000..2966d88 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/PerConfigValue-check.cmake @@ -0,0 +1,13 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +file(GLOB INFO_FILES ${RunCMake_TEST_BINARY_DIR}/runtest_info_*.cmake) + +if(NOT INFO_FILES) + message(FATAL_ERROR "missing expected info files") +endif() + +foreach(INFO_FILE IN LISTS INFO_FILES) + include(${INFO_FILE}) + include(${RunCMake_TEST_BINARY_DIR}/CPackProperties.cmake) + test_property("config.cpp" FOO ${EXPECTED_MYTEST_NAME}) +endforeach() diff --git a/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake b/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake new file mode 100644 index 0000000..77fe8ed --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake @@ -0,0 +1,14 @@ +add_executable(mytest test.cpp) + +foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES) + string(TOUPPER ${CONFIG} UPPER_CONFIG) + set_property(TARGET mytest PROPERTY + OUTPUT_NAME_${UPPER_CONFIG} bar_${CONFIG}) +endforeach() + +file(GENERATE OUTPUT runtest_info_$<CONFIG>.cmake CONTENT [[ +set(CPACK_BUILD_CONFIG "$<CONFIG>") +set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>") +]]) + +set_property(INSTALL config.cpp PROPERTY FOO $<TARGET_FILE_NAME:mytest>) diff --git a/Tests/RunCMake/CPackInstallProperties/Replace-check.cmake b/Tests/RunCMake/CPackInstallProperties/Replace-check.cmake new file mode 100644 index 0000000..6e492e7 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Replace-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property("replace.txt" CPACK_TEST_PROP "value2") diff --git a/Tests/RunCMake/CPackInstallProperties/Replace.cmake b/Tests/RunCMake/CPackInstallProperties/Replace.cmake new file mode 100644 index 0000000..104d5a4 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Replace.cmake @@ -0,0 +1,2 @@ +set_property(INSTALL replace.txt PROPERTY CPACK_TEST_PROP value1) +set_property(INSTALL replace.txt PROPERTY CPACK_TEST_PROP value2) diff --git a/Tests/RunCMake/CPackInstallProperties/RunCMakeTest.cmake b/Tests/RunCMake/CPackInstallProperties/RunCMakeTest.cmake new file mode 100644 index 0000000..d244ac5 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +run_cmake(Simple) +run_cmake(FilenameGenex) +run_cmake(ValueGenex) +run_cmake(MultipleValues) +run_cmake(Append) +run_cmake(Replace) +run_cmake(PerConfigValue) diff --git a/Tests/RunCMake/CPackInstallProperties/Simple-check.cmake b/Tests/RunCMake/CPackInstallProperties/Simple-check.cmake new file mode 100644 index 0000000..6a7ee2a --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Simple-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property("foo/test.cpp" CPACK_TEST_PROP PROP_VALUE) diff --git a/Tests/RunCMake/CPackInstallProperties/Simple.cmake b/Tests/RunCMake/CPackInstallProperties/Simple.cmake new file mode 100644 index 0000000..2eb8755 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Simple.cmake @@ -0,0 +1 @@ +set_property(INSTALL foo/test.cpp PROPERTY CPACK_TEST_PROP PROP_VALUE) diff --git a/Tests/RunCMake/CPackInstallProperties/ValueGenex-check.cmake b/Tests/RunCMake/CPackInstallProperties/ValueGenex-check.cmake new file mode 100644 index 0000000..cdfbcda --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/ValueGenex-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property("bar/test.cpp" CPACK_TEST_PROP ${EXPECTED_MYTEST_NAME}) diff --git a/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake b/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake new file mode 100644 index 0000000..2e1d465 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake @@ -0,0 +1,7 @@ +add_executable(mytest test.cpp) + +file(GENERATE OUTPUT runtest_info.cmake CONTENT [[ +set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>") +]]) + +set_property(INSTALL bar/test.cpp PROPERTY CPACK_TEST_PROP $<TARGET_FILE_NAME:mytest>) diff --git a/Tests/RunCMake/CPackInstallProperties/check.cmake b/Tests/RunCMake/CPackInstallProperties/check.cmake new file mode 100644 index 0000000..65aa467 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/check.cmake @@ -0,0 +1,12 @@ +function(test_property FILE NAME EXPECTED_VALUE) + get_property(ACTUAL_VALUE INSTALL "${FILE}" PROPERTY "${NAME}") + + if(NOT "${ACTUAL_VALUE}" STREQUAL "${EXPECTED_VALUE}") + message(FATAL_ERROR "${NAME}@${FILE}: property mismatch expected [${EXPECTED_VALUE}] actual [${ACTUAL_VALUE}] (Config:${CPACK_BUILD_CONFIG})") + endif() +endfunction() + +set(CPACK_BUILD_CONFIG Debug) +include(${RunCMake_TEST_BINARY_DIR}/CPackProperties.cmake) + +include(${RunCMake_TEST_BINARY_DIR}/runtest_info.cmake OPTIONAL) diff --git a/Tests/RunCMake/CPackInstallProperties/test.cpp b/Tests/RunCMake/CPackInstallProperties/test.cpp new file mode 100644 index 0000000..237c8ce --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/test.cpp @@ -0,0 +1 @@ +int main() {} diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeOkNoC.cmake b/Tests/RunCMake/CheckModules/CheckTypeSizeOkNoC.cmake new file mode 100644 index 0000000..b2dcd7f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeOkNoC.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) +include(CheckTypeSize) +check_type_size(int SIZEOF_INT LANGUAGE CXX) +check_type_size(int SIZEOF_INT BUILTIN_TYPES_ONLY LANGUAGE CXX) diff --git a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake index fda7ebf..5b4e57e 100644 --- a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake @@ -12,3 +12,5 @@ run_cmake(CheckTypeSizeUnknownLanguage) run_cmake(CheckTypeSizeMissingLanguage) run_cmake(CheckTypeSizeUnknownArgument) run_cmake(CheckTypeSizeMixedArgs) + +run_cmake(CheckTypeSizeOkNoC) diff --git a/Tests/RunCMake/ExternalData/MissingData-result.txt b/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ExternalData/MissingData-result.txt +++ b/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt diff --git a/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt b/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt new file mode 100644 index 0000000..2143ba4 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: unknown option '-bad-arg1'$ diff --git a/Tests/RunCMake/ExternalData/Directory3-result.txt b/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ExternalData/Directory3-result.txt +++ b/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt diff --git a/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt b/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt new file mode 100644 index 0000000..d2efa53 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: no command given$ diff --git a/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt b/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt b/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt new file mode 100644 index 0000000..d2efa53 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: no command given$ diff --git a/Tests/RunCMake/CommandLine/E_env-set-stdout.txt b/Tests/RunCMake/CommandLine/E_env-set-stdout.txt new file mode 100644 index 0000000..feff117 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-set-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: 1$ diff --git a/Tests/RunCMake/CommandLine/E_env-set.cmake b/Tests/RunCMake/CommandLine/E_env-set.cmake new file mode 100644 index 0000000..c2639b6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-set.cmake @@ -0,0 +1,5 @@ +if(DEFINED ENV{TEST_ENV}) + message(STATUS "TEST_ENV is correctly set in environment: $ENV{TEST_ENV}") +else() + message(FATAL_ERROR "TEST_ENV is incorrectly not set in environment") +endif() diff --git a/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt b/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt new file mode 100644 index 0000000..a1d5c01 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly not set in environment$ diff --git a/Tests/RunCMake/CommandLine/E_env-unset.cmake b/Tests/RunCMake/CommandLine/E_env-unset.cmake new file mode 100644 index 0000000..04976fb --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-unset.cmake @@ -0,0 +1,5 @@ +if(DEFINED ENV{TEST_ENV}) + message(FATAL_ERROR "TEST_ENV is incorrectly set in environment") +else() + message(STATUS "TEST_ENV is correctly not set in environment") +endif() diff --git a/Tests/RunCMake/CommandLine/P_directory-result.txt b/Tests/RunCMake/CommandLine/P_directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/P_directory-stderr.txt b/Tests/RunCMake/CommandLine/P_directory-stderr.txt new file mode 100644 index 0000000..b8319a1 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_directory-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Error processing file: .*/Tests/RunCMake/CommandLine$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 3aaeac0..5622a5b 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -31,7 +31,15 @@ if(UNIX) ) endif() +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) +run_cmake_command(E_env-set ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake) +run_cmake_command(E_env-unset ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -E env --unset=TEST_ENV ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake) + run_cmake_command(E_sleep-no-args ${CMAKE_COMMAND} -E sleep) run_cmake_command(E_sleep-bad-arg1 ${CMAKE_COMMAND} -E sleep x) run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1) run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1) + +run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}) diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt index 17b8a5c..82a34d5 100644 --- a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt @@ -1,4 +1,11 @@ CMake Debug Log: + Boolean compatibility of property "BOOL_PROP7" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property is implied by use. + \* Target "iface1" property value "FALSE" \(Agree\) ++ +CMake Debug Log: Boolean compatibility of property "BOOL_PROP1" for target "CompatibleInterface" \(result: "TRUE"\): @@ -40,13 +47,6 @@ CMake Debug Log: \* Target "iface2" property value "FALSE" \(Agree\) + CMake Debug Log: - Boolean compatibility of property "BOOL_PROP7" for target - "CompatibleInterface" \(result: "FALSE"\): - - \* Target "CompatibleInterface" property is implied by use. - \* Target "iface1" property value "FALSE" \(Agree\) -+ -CMake Debug Log: String compatibility of property "STRING_PROP1" for target "CompatibleInterface" \(result: "prop1"\): diff --git a/Tests/RunCMake/CompileFeatures/CMakeLists.txt b/Tests/RunCMake/CompileFeatures/CMakeLists.txt new file mode 100644 index 0000000..3482e6b --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle-result.txt b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle-stderr.txt b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle-stderr.txt new file mode 100644 index 0000000..a584d7d --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle-stderr.txt @@ -0,0 +1,7 @@ +CMake Error in CMakeLists.txt: + The COMPILE_FEATURES property of target "empty1" was evaluated when + computing the link implementation, and the "CXX_STANDARD" was "98" for that + computation. Computing the COMPILE_FEATURES based on the link + implementation resulted in a higher "CXX_STANDARD" "11". This is not + permitted. The COMPILE_FEATURES may not both depend on and be depended on + by the link implementation. diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake new file mode 100644 index 0000000..9d56bc0 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake @@ -0,0 +1,15 @@ + +add_library(empty1 empty.cpp) + +add_library(empty2 INTERFACE) +add_library(empty3 INTERFACE) +target_compile_features(empty3 INTERFACE cxx_constexpr) + +target_link_libraries(empty1 + # When starting, $<COMPILE_FEATURES:cxx_final> is '0', so 'freeze' the + # CXX_STANDARD at 98 during computation. + $<$<COMPILE_FEATURES:cxx_final>:empty2> + # This would add cxx_constexpr, but that would require CXX_STANDARD = 11, + # which is not allowed after freeze. Report an error. + empty3 +) diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-result.txt b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-stderr.txt b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved.cmake new file mode 100644 index 0000000..0df548b --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved.cmake @@ -0,0 +1,14 @@ + +add_library(empty1 empty.cpp) + +add_library(empty2 INTERFACE) +add_library(empty3 INTERFACE) +target_compile_features(empty3 INTERFACE cxx_constexpr) + +target_link_libraries(empty1 + $<$<COMPILE_FEATURES:cxx_final>:empty2> + empty3 +) +# This, or populating the COMPILE_FEATURES property with a feature in the +# same standard as cxx_final, solves the cycle above. +set_property(TARGET empty1 PROPERTY CXX_STANDARD 11) diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCFeatures-result.txt b/Tests/RunCMake/CompileFeatures/NoSupportedCFeatures-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCFeatures-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCFeatures-stderr.txt b/Tests/RunCMake/CompileFeatures/NoSupportedCFeatures-stderr.txt new file mode 100644 index 0000000..fd18c88 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCFeatures-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NoSupportedCFeatures.cmake:[0-9]+ \(target_compile_features\): + target_compile_features no known features for C compiler + + "[^"]*" + + version *[.0-9]+\. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCFeatures.cmake b/Tests/RunCMake/CompileFeatures/NoSupportedCFeatures.cmake new file mode 100644 index 0000000..3624d4b --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCFeatures.cmake @@ -0,0 +1,5 @@ + +enable_language(C) + +add_library(no_features empty.c) +target_compile_features(no_features PRIVATE c_static_assert) diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCFeaturesGenex-result.txt b/Tests/RunCMake/CompileFeatures/NoSupportedCFeaturesGenex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCFeaturesGenex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCFeaturesGenex-stderr.txt b/Tests/RunCMake/CompileFeatures/NoSupportedCFeaturesGenex-stderr.txt new file mode 100644 index 0000000..df647e8 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCFeaturesGenex-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + No known features for C compiler + + "[^"]*" + + version *[.0-9]+\. diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCFeaturesGenex.cmake b/Tests/RunCMake/CompileFeatures/NoSupportedCFeaturesGenex.cmake new file mode 100644 index 0000000..b6053aa --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCFeaturesGenex.cmake @@ -0,0 +1,5 @@ + +enable_language(C) + +add_library(no_features empty.c) +target_compile_features(no_features PRIVATE $<1:c_static_assert>) diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures-result.txt b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures-stderr.txt b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures-stderr.txt new file mode 100644 index 0000000..fc882cb --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NoSupportedCxxFeatures.cmake:3 \(target_compile_features\): + target_compile_features no known features for CXX compiler + + "[^"]*" + + version *[.0-9]+\. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures.cmake b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures.cmake new file mode 100644 index 0000000..5121948 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures.cmake @@ -0,0 +1,3 @@ + +add_library(no_features empty.cpp) +target_compile_features(no_features PRIVATE cxx_constexpr) diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex-result.txt b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex-stderr.txt b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex-stderr.txt new file mode 100644 index 0000000..66d0d41 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + No known features for CXX compiler + + "[^"]*" + + version *[.0-9]+\. diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex.cmake b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex.cmake new file mode 100644 index 0000000..490f187 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex.cmake @@ -0,0 +1,3 @@ + +add_library(no_features empty.cpp) +target_compile_features(no_features PRIVATE $<1:cxx_constexpr>) diff --git a/Tests/RunCMake/CompileFeatures/NonValidTarget1-result.txt b/Tests/RunCMake/CompileFeatures/NonValidTarget1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NonValidTarget1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NonValidTarget1-stderr.txt b/Tests/RunCMake/CompileFeatures/NonValidTarget1-stderr.txt new file mode 100644 index 0000000..7f3b43b --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NonValidTarget1-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget1.cmake:[0-9]+ \(add_custom_command\): + Error evaluating generator expression: + + \$<COMPILE_FEATURES:cxx_final> + + \$<COMPILE_FEATURE> may only be used with binary targets. It may not be + used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CompileFeatures/NonValidTarget1.cmake b/Tests/RunCMake/CompileFeatures/NonValidTarget1.cmake new file mode 100644 index 0000000..c6707c1 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NonValidTarget1.cmake @@ -0,0 +1,17 @@ + +set(genexvar $<COMPILE_FEATURES:cxx_final>) + +if (HAVE_FINAL) + set(expected_result 1) +else() + set(expected_result 0) +endif() + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file${HAVE_FINAL}.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file${genexvar}.cpp" +) + +add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file${genexvar}.cpp") +if (HAVE_FINAL) + target_compile_features(empty PRIVATE cxx_final) +endif() diff --git a/Tests/RunCMake/CompileFeatures/NonValidTarget2-result.txt b/Tests/RunCMake/CompileFeatures/NonValidTarget2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NonValidTarget2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NonValidTarget2-stderr.txt b/Tests/RunCMake/CompileFeatures/NonValidTarget2-stderr.txt new file mode 100644 index 0000000..635150c --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NonValidTarget2-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget2.cmake:4 \(add_custom_target\): + Error evaluating generator expression: + + \$<COMPILE_FEATURES:cxx_final> + + \$<COMPILE_FEATURE> may only be used with binary targets. It may not be + used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CompileFeatures/NonValidTarget2.cmake b/Tests/RunCMake/CompileFeatures/NonValidTarget2.cmake new file mode 100644 index 0000000..eb84692 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NonValidTarget2.cmake @@ -0,0 +1,8 @@ + +set(genexvar $<COMPILE_FEATURES:cxx_final>) + +add_custom_target(copy_target + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file${genexvar}.txt" +) + +add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file${genexvar}.cpp") diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeature-stderr.txt new file mode 100644 index 0000000..ff60e50 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature-stderr.txt @@ -0,0 +1,2 @@ +CMake Error in CMakeLists.txt: + Specified unknown feature "not_a_feature" for target "somelib". diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature.cmake b/Tests/RunCMake/CompileFeatures/NotAFeature.cmake new file mode 100644 index 0000000..35246c8 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature.cmake @@ -0,0 +1,3 @@ + +add_library(somelib STATIC empty.cpp) +set_property(TARGET somelib PROPERTY COMPILE_FEATURES "not_a_feature") diff --git a/Tests/RunCMake/CompileFeatures/NotAFeatureGenex-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeatureGenex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeatureGenex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NotAFeatureGenex-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeatureGenex-stderr.txt new file mode 100644 index 0000000..ff60e50 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeatureGenex-stderr.txt @@ -0,0 +1,2 @@ +CMake Error in CMakeLists.txt: + Specified unknown feature "not_a_feature" for target "somelib". diff --git a/Tests/RunCMake/CompileFeatures/NotAFeatureGenex.cmake b/Tests/RunCMake/CompileFeatures/NotAFeatureGenex.cmake new file mode 100644 index 0000000..ad2bd37 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeatureGenex.cmake @@ -0,0 +1,3 @@ + +add_library(somelib STATIC empty.cpp) +set_property(TARGET somelib PROPERTY COMPILE_FEATURES "$<1:not_a_feature>") diff --git a/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-stderr.txt new file mode 100644 index 0000000..ff60e50 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-stderr.txt @@ -0,0 +1,2 @@ +CMake Error in CMakeLists.txt: + Specified unknown feature "not_a_feature" for target "somelib". diff --git a/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive.cmake b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive.cmake new file mode 100644 index 0000000..7311aec --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive.cmake @@ -0,0 +1,6 @@ + +add_library(iface INTERFACE) +set_property(TARGET iface PROPERTY INTERFACE_COMPILE_FEATURES "not_a_feature") + +add_library(somelib STATIC empty.cpp) +target_link_libraries(somelib iface) diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-stderr.txt new file mode 100644 index 0000000..60a8e51 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-stderr.txt @@ -0,0 +1,11 @@ +CMake Debug Log at NotAFeature_OriginDebug.cmake:4 \(set_property\): + Used compile features for target somelib: + + \* not_a_feature + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error in CMakeLists.txt: + Specified unknown feature "not_a_feature" for target "somelib". diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug.cmake b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug.cmake new file mode 100644 index 0000000..350c2ea --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_DEBUG_TARGET_PROPERTIES COMPILE_FEATURES) +add_library(somelib STATIC empty.cpp) +set_property(TARGET somelib PROPERTY COMPILE_FEATURES "not_a_feature") diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-stderr.txt new file mode 100644 index 0000000..08e20a8 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-stderr.txt @@ -0,0 +1,11 @@ +CMake Debug Log at NotAFeature_OriginDebugGenex.cmake:4 \(set_property\): + Used compile features for target somelib: + + \* not_a_feature + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error in CMakeLists.txt: + Specified unknown feature "not_a_feature" for target "somelib". diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex.cmake b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex.cmake new file mode 100644 index 0000000..2122981 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_DEBUG_TARGET_PROPERTIES COMPILE_FEATURES) +add_library(somelib STATIC empty.cpp) +set_property(TARGET somelib PROPERTY COMPILE_FEATURES "$<1:not_a_feature>") diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-stderr.txt new file mode 100644 index 0000000..23c3305 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-stderr.txt @@ -0,0 +1,11 @@ +CMake Debug Log at NotAFeature_OriginDebugTransitive.cmake:6 \(target_link_libraries\): + Used compile features for target somelib: + + \* not_a_feature + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error in CMakeLists.txt: + Specified unknown feature "not_a_feature" for target "somelib". diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive.cmake b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive.cmake new file mode 100644 index 0000000..05d0073 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive.cmake @@ -0,0 +1,6 @@ + +set(CMAKE_DEBUG_TARGET_PROPERTIES COMPILE_FEATURES) +add_library(iface INTERFACE) +set_property(TARGET iface PROPERTY INTERFACE_COMPILE_FEATURES "not_a_feature") +add_library(somelib STATIC empty.cpp) +target_link_libraries(somelib iface) diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features-stderr.txt new file mode 100644 index 0000000..d819d15 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at NotAFeature_OriginDebug_target_compile_features.cmake:4 \(target_compile_features\): + target_compile_features specified unknown feature "not_a_feature" for + target "somelib". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features.cmake b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features.cmake new file mode 100644 index 0000000..467d9a1 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_DEBUG_TARGET_PROPERTIES COMPILE_FEATURES) +add_library(somelib STATIC empty.cpp) +target_compile_features(somelib PRIVATE not_a_feature) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11-stderr.txt new file mode 100644 index 0000000..0fc9112 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX11" , but CMake does not + know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11.cmake new file mode 100644 index 0000000..f60504f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11.cmake @@ -0,0 +1,5 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 11) +set_property(TARGET foo PROPERTY CXX_EXTENSIONS FALSE) +set_property(TARGET foo PROPERTY CXX_STANDARD_REQUIRED TRUE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-stderr.txt new file mode 100644 index 0000000..5c68a1c --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX11" \(with compiler + extensions\), but CMake does not know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.cmake new file mode 100644 index 0000000..10b251a --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.cmake @@ -0,0 +1,4 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 11) +set_property(TARGET foo PROPERTY CXX_STANDARD_REQUIRED TRUE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-stderr.txt new file mode 100644 index 0000000..5c68a1c --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX11" \(with compiler + extensions\), but CMake does not know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.cmake new file mode 100644 index 0000000..29703db --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 11) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-stderr.txt new file mode 100644 index 0000000..0fc9112 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX11" , but CMake does not + know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.cmake new file mode 100644 index 0000000..c480997 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.cmake @@ -0,0 +1,5 @@ + +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 11) +set_property(TARGET foo PROPERTY CXX_EXTENSIONS FALSE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98-stderr.txt new file mode 100644 index 0000000..47c8688 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX98" , but CMake does not + know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98.cmake new file mode 100644 index 0000000..fd9fb60 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98.cmake @@ -0,0 +1,5 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 98) +set_property(TARGET foo PROPERTY CXX_STANDARD_REQUIRED TRUE) +set_property(TARGET foo PROPERTY CXX_EXTENSIONS FALSE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-stderr.txt new file mode 100644 index 0000000..b4fdf8a --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX98" \(with compiler + extensions\), but CMake does not know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake new file mode 100644 index 0000000..4ea595e --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake @@ -0,0 +1,4 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 98) +set_property(TARGET foo PROPERTY CXX_STANDARD_REQUIRED TRUE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-stderr.txt new file mode 100644 index 0000000..b4fdf8a --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX98" \(with compiler + extensions\), but CMake does not know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.cmake new file mode 100644 index 0000000..0e3ef8d --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 98) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-stderr.txt new file mode 100644 index 0000000..47c8688 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX98" , but CMake does not + know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.cmake new file mode 100644 index 0000000..7562264 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.cmake @@ -0,0 +1,5 @@ + +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 98) +set_property(TARGET foo PROPERTY CXX_EXTENSIONS FALSE) diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake new file mode 100644 index 0000000..1892a5c --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake @@ -0,0 +1,54 @@ +include(RunCMake) + +run_cmake(NotAFeature) +run_cmake(NotAFeatureGenex) +run_cmake(NotAFeatureTransitive) +run_cmake(NotAFeature_OriginDebug) +run_cmake(NotAFeature_OriginDebugGenex) +run_cmake(NotAFeature_OriginDebugTransitive) +run_cmake(NotAFeature_OriginDebug_target_compile_features) + +run_cmake(generate_feature_list) +file(READ + "${RunCMake_BINARY_DIR}/generate_feature_list-build/c_features.txt" + C_FEATURES +) +file(READ + "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx_features.txt" + CXX_FEATURES +) + +if (NOT C_FEATURES) + run_cmake(NoSupportedCFeatures) + run_cmake(NoSupportedCFeaturesGenex) +endif() + +if (NOT CXX_FEATURES) + run_cmake(NoSupportedCxxFeatures) + run_cmake(NoSupportedCxxFeaturesGenex) +else() + run_cmake(LinkImplementationFeatureCycle) + run_cmake(LinkImplementationFeatureCycleSolved) + + if (";${CXX_FEATURES};" MATCHES ";cxx_final;") + set(RunCMake_TEST_OPTIONS "-DHAVE_FINAL=1") + endif() + run_cmake(NonValidTarget1) + run_cmake(NonValidTarget2) + unset(RunCMake_TEST_OPTIONS) +endif() + +foreach(standard 98 11) + file(READ + "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt" + CXX${standard}_FLAG + ) + if (CXX${standard}_FLAG STREQUAL NOTFOUND) + run_cmake(RequireCXX${standard}) + run_cmake(RequireCXX${standard}Variable) + endif() + if (CXX${standard}EXT_FLAG STREQUAL NOTFOUND) + run_cmake(RequireCXX${standard}Ext) + run_cmake(RequireCXX${standard}ExtVariable) + endif() +endforeach() diff --git a/Tests/RunCMake/CompileFeatures/empty.c b/Tests/RunCMake/CompileFeatures/empty.c new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/empty.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CompileFeatures/empty.cpp b/Tests/RunCMake/CompileFeatures/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake new file mode 100644 index 0000000..09e17b1 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake @@ -0,0 +1,29 @@ + +enable_language(C) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/c_features.txt" + "${CMAKE_C_COMPILE_FEATURES}" +) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_features.txt" + "${CMAKE_CXX_COMPILE_FEATURES}" +) + +foreach(standard 98 11) + set(CXX${standard}_FLAG NOTFOUND) + if (DEFINED CMAKE_CXX${standard}_STANDARD_COMPILE_OPTION) + set(CXX${standard}_FLAG ${CMAKE_CXX${standard}_STANDARD_COMPILE_OPTION}) + endif() + + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx${standard}_flag.txt" + "${CXX${standard}_FLAG}" + ) + set(CXX${standard}EXT_FLAG NOTFOUND) + if (DEFINED CMAKE_CXX${standard}_EXTENSION_COMPILE_OPTION) + set(CXX${standard}EXT_FLAG ${CMAKE_CXX${standard}_EXTENSION_COMPILE_OPTION}) + endif() + + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx${standard}ext_flag.txt" + "${CXX${standard}EXT_FLAG}" + ) +endforeach() diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt b/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt index bb87f4c..92fe233 100644 --- a/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt +++ b/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt @@ -1,4 +1,4 @@ -- Detecting C compiler ABI info --- Detecting C compiler ABI info - failed +-- Detecting C compiler ABI info - failed.* -- Configuring done -- Generating done diff --git a/Tests/RunCMake/ExternalData/Directory1-stderr.txt b/Tests/RunCMake/ExternalData/Directory1-stderr.txt index 85c250f..2bc3c60 100644 --- a/Tests/RunCMake/ExternalData/Directory1-stderr.txt +++ b/Tests/RunCMake/ExternalData/Directory1-stderr.txt @@ -7,7 +7,7 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Directory1 - that does not exist as a file \(with or without an extension\)! + that is directory instead of a file! Call Stack \(most recent call first\): .* Directory1.cmake:3 \(ExternalData_Add_Test\) diff --git a/Tests/RunCMake/ExternalData/Directory3-stderr.txt b/Tests/RunCMake/ExternalData/Directory3-stderr.txt index 56a341e..ceed2a0 100644 --- a/Tests/RunCMake/ExternalData/Directory3-stderr.txt +++ b/Tests/RunCMake/ExternalData/Directory3-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): +CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Data file referenced by argument DATA{Directory3/\*} @@ -12,3 +12,4 @@ Call Stack \(most recent call first\): .* Directory3.cmake:3 \(ExternalData_Add_Test\) CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalData/MissingData-stderr.txt b/Tests/RunCMake/ExternalData/MissingData-stderr.txt index e794f95..39ed2f1 100644 --- a/Tests/RunCMake/ExternalData/MissingData-stderr.txt +++ b/Tests/RunCMake/ExternalData/MissingData-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): +CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): Data file referenced by argument DATA{MissingData.txt} @@ -10,5 +10,6 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): that does not exist as a file \(with or without an extension\)! Call Stack \(most recent call first\): .* - MissingData.cmake:2 \(ExternalData_Add_Test\) + MissingData.cmake:4 \(ExternalData_Expand_Arguments\) CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalData/MissingData-stdout.txt b/Tests/RunCMake/ExternalData/MissingData-stdout.txt new file mode 100644 index 0000000..addd40e --- /dev/null +++ b/Tests/RunCMake/ExternalData/MissingData-stdout.txt @@ -0,0 +1 @@ +-- Missing data reference correctly transformed! diff --git a/Tests/RunCMake/ExternalData/MissingData.cmake b/Tests/RunCMake/ExternalData/MissingData.cmake index b3c8a5c..f5fefd5 100644 --- a/Tests/RunCMake/ExternalData/MissingData.cmake +++ b/Tests/RunCMake/ExternalData/MissingData.cmake @@ -1,5 +1,10 @@ include(ExternalData) -ExternalData_Add_Test(Data - NAME Test - COMMAND ${CMAKE_COMMAND} -E echo DATA{MissingData.txt} - ) + +set(output "${CMAKE_SOURCE_DIR}/MissingData.txt") +ExternalData_Expand_Arguments(Data args DATA{MissingData.txt}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Missing data reference correctly transformed!") +else() + message(FATAL_ERROR "Missing data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt b/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt new file mode 100644 index 0000000..315af5e --- /dev/null +++ b/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stderr.txt @@ -0,0 +1,15 @@ +CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{MissingData.txt,Data.txt} + + corresponds to source tree path + + MissingData.txt + + that does not exist as a file \(with or without an extension\)! +Call Stack \(most recent call first\): + .* + MissingDataWithAssociated.cmake:4 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stdout.txt b/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stdout.txt new file mode 100644 index 0000000..addd40e --- /dev/null +++ b/Tests/RunCMake/ExternalData/MissingDataWithAssociated-stdout.txt @@ -0,0 +1 @@ +-- Missing data reference correctly transformed! diff --git a/Tests/RunCMake/ExternalData/MissingDataWithAssociated.cmake b/Tests/RunCMake/ExternalData/MissingDataWithAssociated.cmake new file mode 100644 index 0000000..a4c4638 --- /dev/null +++ b/Tests/RunCMake/ExternalData/MissingDataWithAssociated.cmake @@ -0,0 +1,10 @@ +include(ExternalData) + +set(output "${CMAKE_BINARY_DIR}/MissingData.txt") +ExternalData_Expand_Arguments(Data args DATA{MissingData.txt,Data.txt}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Missing data reference correctly transformed!") +else() + message(FATAL_ERROR "Missing data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake index 93ff08f..04e3d59 100644 --- a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake @@ -15,6 +15,7 @@ run_cmake(LinkContentMD5) run_cmake(LinkContentSHA1) run_cmake(LinkDirectory1) run_cmake(MissingData) +run_cmake(MissingDataWithAssociated) run_cmake(NoLinkInSource) run_cmake(NoURLTemplates) run_cmake(NormalData1) diff --git a/Tests/RunCMake/FeatureSummary/CMakeLists.txt b/Tests/RunCMake/FeatureSummary/CMakeLists.txt new file mode 100644 index 0000000..72abfc8 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.11) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt new file mode 100644 index 0000000..9a3f023 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt @@ -0,0 +1,7 @@ +-- The following features have been enabled: + + \* Foo , Foo\. + +-- The following features have been disabled: + + \* Bar , Bar\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake new file mode 100644 index 0000000..ec5ebcb --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt new file mode 100644 index 0000000..4d8f25f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt @@ -0,0 +1,7 @@ +-- The following features have been disabled: + + \* Bar , Bar\. + +-- The following features have been enabled: + + \* Foo , Foo\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake new file mode 100644 index 0000000..d04ba88 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT DISABLED_FEATURES ENABLED_FEATURES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt new file mode 100644 index 0000000..18d9ebd --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + The WHAT argument of FEATURE_SUMMARY\(\) contains ALL, which cannot be + combined with other values\. +Call Stack \(most recent call first\): + FeatureSummaryWhatListAll\.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake new file mode 100644 index 0000000..1877ea5 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ENABLED_FEATURES ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt new file mode 100644 index 0000000..3ad3750 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + The WHAT argument of FEATURE_SUMMARY\(\) contains FOO, which is not a valid + value\. +Call Stack \(most recent call first\): + FeatureSummaryWhatListUnknown\.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake new file mode 100644 index 0000000..46088d4 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ENABLED_FEATURES FOO) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt new file mode 100644 index 0000000..240632d --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt @@ -0,0 +1 @@ + \* Foo , Foo\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake new file mode 100644 index 0000000..593dfb6 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ENABLED_FEATURES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt new file mode 100644 index 0000000..c78853c --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + The WHAT argument of FEATURE_SUMMARY\(\) contains FOO, which is not a valid + value\. +Call Stack \(most recent call first\): + FeatureSummaryWhatSingleUnknown\.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake new file mode 100644 index 0000000..c2d6d2e --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT FOO) diff --git a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake new file mode 100644 index 0000000..1417338 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(FeatureSummaryWhatAll) +run_cmake(FeatureSummaryWhatSingle) +run_cmake(FeatureSummaryWhatSingleUnknown) +run_cmake(FeatureSummaryWhatList) +run_cmake(FeatureSummaryWhatListUnknown) +run_cmake(FeatureSummaryWhatListAll) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index f07431c..f23fa19 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -8,3 +8,30 @@ run_cmake(EmptyCondition1) run_cmake(EmptyCondition2) run_cmake(BadCondition) run_cmake(DebugEvaluate) + +set(timeformat "%Y%j%H%M%S") + +file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") +set(RunCMake_TEST_FILE "WriteIfDifferent") +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/WriteIfDifferent-build") +run_cmake(WriteIfDifferent-prepare) +unset(RunCMake_TEST_FILE) +unset(RunCMake_TEST_BINARY_DIR) +file(TIMESTAMP "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt" timestamp ${timeformat}) +if(NOT timestamp) + message(SEND_ERROR "Could not get timestamp for \"${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt\"") +endif() + +execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) + +set(RunCMake_TEST_NO_CLEAN ON) +run_cmake(WriteIfDifferent) +file(TIMESTAMP "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt" timestamp_after ${timeformat}) +if(NOT timestamp_after) + message(SEND_ERROR "Could not get timestamp for \"${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt\"") +endif() +unset(RunCMake_TEST_NO_CLEAN) + +if (NOT timestamp_after STREQUAL timestamp) + message(SEND_ERROR "WriteIfDifferent changed output file.") +endif() diff --git a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt b/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/WriteIfDifferent-stderr.txt b/Tests/RunCMake/File_Generate/WriteIfDifferent-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/File_Generate/WriteIfDifferent-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/File_Generate/WriteIfDifferent.cmake b/Tests/RunCMake/File_Generate/WriteIfDifferent.cmake new file mode 100644 index 0000000..d1d832a --- /dev/null +++ b/Tests/RunCMake/File_Generate/WriteIfDifferent.cmake @@ -0,0 +1,5 @@ + +file(GENERATE + OUTPUT output_file.txt + CONTENT "123" +) diff --git a/Tests/RunCMake/FindPkgConfig/CMakeLists.txt b/Tests/RunCMake/FindPkgConfig/CMakeLists.txt new file mode 100644 index 0000000..72abfc8 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.11) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake new file mode 100644 index 0000000..924976e --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake @@ -0,0 +1,41 @@ +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +enable_language(C) + +# Prepare environment and variables +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") +if(WIN32) + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem") + set(ENV{PKG_CONFIG_PATH} "C:\\baz") +else() + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") + set(ENV{PKG_CONFIG_PATH} "/baz") +endif() + + +find_package(PkgConfig) + +if(WIN32) + set(expected_path "C:\\baz") +else() + set(expected_path "/baz") +endif() + + +pkg_check_modules(FOO "${expected_path}") + +if(NOT "FOO_FOUND") + message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") +endif() + + + +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) + +pkg_check_modules(BAR "${expected_path}" NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) + +if(NOT "BAR_FOUND") + message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake new file mode 100644 index 0000000..4a66e85 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake @@ -0,0 +1,51 @@ +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +enable_language(C) + +# Prepare environment and variables +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") +if(WIN32) + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem") + set(ENV{PKG_CONFIG_PATH} "C:\\baz") +else() + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") + set(ENV{PKG_CONFIG_PATH} "/baz") +endif() + + +find_package(PkgConfig) + + +if(NOT DEFINED CMAKE_SYSTEM_NAME + OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" + AND NOT CMAKE_CROSSCOMPILING)) + if(EXISTS "/etc/debian_version") # is this a debian system ? + if(CMAKE_LIBRARY_ARCHITECTURE MATCHES "^(i386-linux-gnu|x86_64-linux-gnu)$") + # Cannot create directories for all the existing architectures... + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() + else() + # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if(uselib64) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() + endif() +else() + if(WIN32) + set(expected_path "C:\\baz;${CMAKE_CURRENT_SOURCE_DIR}\\pc-foo\\lib\\pkgconfig;${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar\\lib\\pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() +endif() + + +pkg_check_modules(FOO "${expected_path}") + +if(NOT "FOO_FOUND") + message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake new file mode 100644 index 0000000..0b057b8 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake @@ -0,0 +1,51 @@ +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +enable_language(C) + +# Prepare environment and variables +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") +if(WIN32) + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem") + set(ENV{PKG_CONFIG_PATH} "C:\\baz") +else() + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") + set(ENV{PKG_CONFIG_PATH} "/baz") +endif() + + +find_package(PkgConfig) + + +if(NOT DEFINED CMAKE_SYSTEM_NAME + OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" + AND NOT CMAKE_CROSSCOMPILING)) + if(EXISTS "/etc/debian_version") # is this a debian system ? + if(CMAKE_LIBRARY_ARCHITECTURE MATCHES "^(i386-linux-gnu|x86_64-linux-gnu)$") + # Cannot create directories for all the existing architectures... + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + endif() + else() + # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if(uselib64) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + endif() + endif() +else() + if(WIN32) + set(expected_path "C:\\baz;${CMAKE_CURRENT_SOURCE_DIR}\\pc-foo\\lib\\pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + endif() +endif() + + +pkg_check_modules(FOO "${expected_path}" NO_CMAKE_ENVIRONMENT_PATH) + +if(NOT "FOO_FOUND") + message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake new file mode 100644 index 0000000..a3154f1 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake @@ -0,0 +1,51 @@ +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +enable_language(C) + +# Prepare environment and variables +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") +if(WIN32) + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem") + set(ENV{PKG_CONFIG_PATH} "C:\\baz") +else() + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") + set(ENV{PKG_CONFIG_PATH} "/baz") +endif() + + +find_package(PkgConfig) + + +if(NOT DEFINED CMAKE_SYSTEM_NAME + OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" + AND NOT CMAKE_CROSSCOMPILING)) + if(EXISTS "/etc/debian_version") # is this a debian system ? + if(CMAKE_LIBRARY_ARCHITECTURE MATCHES "^(i386-linux-gnu|x86_64-linux-gnu)$") + # Cannot create directories for all the existing architectures... + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() + else() + # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if(uselib64) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() + endif() +else() + if(WIN32) + set(expected_path "C:\\baz;${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar\\lib\\pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() +endif() + + +pkg_check_modules(FOO "${expected_path}" NO_CMAKE_PATH) + +if(NOT "FOO_FOUND") + message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake new file mode 100644 index 0000000..bca93bb --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(FindPkgConfig_NO_PKGCONFIG_PATH) +run_cmake(FindPkgConfig_PKGCONFIG_PATH) +run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH) +run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH) diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat new file mode 100755 index 0000000..f2f86b0 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat @@ -0,0 +1,18 @@ +@ECHO OFF +IF "%1"=="" ( + EXIT /B 255 +) +IF "%1"=="--version" ( + ECHO 0.0-cmake-dummy + EXIT /B 0 +) + +IF "%1"=="--exists" ( + SHIFT + ECHO Expected: %* + ECHO Found: %PKG_CONFIG_PATH% + IF NOT "%*"=="%PKG_CONFIG_PATH%" ( + EXIT /B 1 + ) +) +EXIT /B 0 diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh new file mode 100755 index 0000000..852e841 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# This is a replacement for pkg-config that compares the string passed +# to the --exists argument with the PKG_CONFIG_PATH environment variable +# and returns 1 if they are different. + +case $1 in + --version) + echo "0.0-cmake-dummy" + ;; + --exists) + shift + echo "Expected: $@" + echo "Found: ${PKG_CONFIG_PATH}" + [ "$@" = "${PKG_CONFIG_PATH}" ] || exit 1 + ;; + *) + exit 255 + ;; +esac diff --git a/Tests/RunCMake/FindPkgConfig/pc-bar/lib/i386-linux-gnu/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-bar/lib/i386-linux-gnu/pkgconfig/.placeholder new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-bar/lib/i386-linux-gnu/pkgconfig/.placeholder diff --git a/Tests/RunCMake/FindPkgConfig/pc-bar/lib/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-bar/lib/pkgconfig/.placeholder new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-bar/lib/pkgconfig/.placeholder diff --git a/Tests/RunCMake/FindPkgConfig/pc-bar/lib/x86_64-linux-gnu/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-bar/lib/x86_64-linux-gnu/pkgconfig/.placeholder new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-bar/lib/x86_64-linux-gnu/pkgconfig/.placeholder diff --git a/Tests/RunCMake/FindPkgConfig/pc-bar/lib64/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-bar/lib64/pkgconfig/.placeholder new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-bar/lib64/pkgconfig/.placeholder diff --git a/Tests/RunCMake/FindPkgConfig/pc-foo/lib/i386-linux-gnu/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-foo/lib/i386-linux-gnu/pkgconfig/.placeholder new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-foo/lib/i386-linux-gnu/pkgconfig/.placeholder diff --git a/Tests/RunCMake/FindPkgConfig/pc-foo/lib/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-foo/lib/pkgconfig/.placeholder new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-foo/lib/pkgconfig/.placeholder diff --git a/Tests/RunCMake/FindPkgConfig/pc-foo/lib/x86_64-linux-gnu/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-foo/lib/x86_64-linux-gnu/pkgconfig/.placeholder new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-foo/lib/x86_64-linux-gnu/pkgconfig/.placeholder diff --git a/Tests/RunCMake/FindPkgConfig/pc-foo/lib64/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-foo/lib64/pkgconfig/.placeholder new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-foo/lib64/pkgconfig/.placeholder diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-stderr.txt new file mode 100644 index 0000000..dd7a183 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-CXX_COMPILER_ID.cmake:4 \(add_custom_command\): + Error evaluating generator expression: + + \$<CXX_COMPILER_ID> + + \$<CXX_COMPILER_ID> may only be used with binary targets. It may not be + used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID.cmake new file mode 100644 index 0000000..7dd38da --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<CXX_COMPILER_ID>.cpp" +) + +add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-stderr.txt new file mode 100644 index 0000000..d4a064a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-CXX_COMPILER_VERSION.cmake:4 \(add_custom_command\): + Error evaluating generator expression: + + \$<CXX_COMPILER_VERSION> + + \$<CXX_COMPILER_VERSION> may only be used with binary targets. It may not + be used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION.cmake new file mode 100644 index 0000000..1afb2b5 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<CXX_COMPILER_VERSION>.cpp" +) + +add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-stderr.txt new file mode 100644 index 0000000..b8e53ed --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-C_COMPILER_ID.cmake:4 \(add_custom_command\): + Error evaluating generator expression: + + \$<C_COMPILER_ID> + + \$<C_COMPILER_ID> may only be used with binary targets. It may not be used + with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID.cmake new file mode 100644 index 0000000..2d92ee3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<C_COMPILER_ID>.cpp" +) + +add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-stderr.txt new file mode 100644 index 0000000..551efe9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-C_COMPILER_VERSION.cmake:4 \(add_custom_command\): + Error evaluating generator expression: + + \$<C_COMPILER_VERSION> + + \$<C_COMPILER_VERSION> may only be used with binary targets. It may not be + used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION.cmake new file mode 100644 index 0000000..9b8a531 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<C_COMPILER_VERSION>.cpp" +) + +add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-stderr.txt new file mode 100644 index 0000000..0e87538 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-TARGET_POLICY.cmake:4 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_POLICY:CMP0004> + + \$<TARGET_POLICY:prop> may only be used with binary targets. It may not be + used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY.cmake new file mode 100644 index 0000000..10b37b5 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_POLICY:CMP0004>.cpp" +) + +add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-stderr.txt new file mode 100644 index 0000000..08ad3c2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at NonValidTarget-TARGET_PROPERTY.cmake:4 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:NotAProperty> + + \$<TARGET_PROPERTY:prop> may only be used with binary targets. It may not + be used with add_custom_command or add_custom_target. Specify the target + to read a property from using the \$<TARGET_PROPERTY:tgt,prop> signature + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY.cmake new file mode 100644 index 0000000..64abc5f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_PROPERTY:NotAProperty>.cpp" +) + +add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index f3f99ed..c8f3fdf 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -10,3 +10,9 @@ run_cmake(BadTargetName) run_cmake(BadTargetTypeObject) run_cmake(BadInstallPrefix) run_cmake(CMP0044-WARN) +run_cmake(NonValidTarget-C_COMPILER_ID) +run_cmake(NonValidTarget-CXX_COMPILER_ID) +run_cmake(NonValidTarget-C_COMPILER_VERSION) +run_cmake(NonValidTarget-CXX_COMPILER_VERSION) +run_cmake(NonValidTarget-TARGET_PROPERTY) +run_cmake(NonValidTarget-TARGET_POLICY) diff --git a/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt index bf1f190..d0d526c 100644 --- a/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt +++ b/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt @@ -1,4 +1,4 @@ -CMake Error: +CMake Error at CMakeLists.txt:[0-9]+ \(project\): Generator .* diff --git a/Tests/RunCMake/GeneratorToolset/BadToolset-toolchain.cmake b/Tests/RunCMake/GeneratorToolset/BadToolset-toolchain.cmake new file mode 100644 index 0000000..7bbf327 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolset-toolchain.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR_TOOLSET "Bad Toolset") diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-stderr.txt new file mode 100644 index 0000000..d0d526c --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + does not support toolset specification, but toolset + + Bad Toolset + + was specified.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetToolchain.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index 1ccc1ad..d39f33f 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -12,6 +12,17 @@ else() endif() set(RunCMake_GENERATOR_TOOLSET "") + set(RunCMake_TEST_OPTIONS -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) + +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012]|Xcode" AND NOT XCODE_BELOW_3) + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake) + run_cmake(TestToolsetToolchain) + unset(RunCMake_TEST_OPTIONS) +else() + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/BadToolset-toolchain.cmake) + run_cmake(BadToolsetToolchain) + unset(RunCMake_TEST_OPTIONS) +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TestToolset-toolchain.cmake b/Tests/RunCMake/GeneratorToolset/TestToolset-toolchain.cmake new file mode 100644 index 0000000..bee2ae4 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolset-toolchain.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR_TOOLSET "Test Toolset") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-stderr.txt new file mode 100644 index 0000000..0623e90 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TestToolsetToolchain.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at TestToolsetToolchain.cmake:[0-9]+ \(message\): + CMAKE_(VS|XCODE)_PLATFORM_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain.cmake new file mode 100644 index 0000000..7c1c415 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetToolchain.cmake @@ -0,0 +1,25 @@ +if("x${CMAKE_GENERATOR_TOOLSET}" STREQUAL "xTest Toolset") + message(SEND_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset\"!") +endif() +if(CMAKE_GENERATOR MATCHES "Visual Studio") + if("x${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "xTest Toolset") + message(SEND_ERROR "CMAKE_VS_PLATFORM_TOOLSET is \"Test Toolset\" as expected.") + else() + message(FATAL_ERROR + "CMAKE_VS_PLATFORM_TOOLSET is \"${CMAKE_VS_PLATFORM_TOOLSET}\" " + "but should be \"Test Toolset\"!") + endif() +endif() +if(CMAKE_GENERATOR MATCHES "Xcode") + if("x${CMAKE_XCODE_PLATFORM_TOOLSET}" STREQUAL "xTest Toolset") + message(SEND_ERROR "CMAKE_XCODE_PLATFORM_TOOLSET is \"Test Toolset\" as expected.") + else() + message(FATAL_ERROR + "CMAKE_XCODE_PLATFORM_TOOLSET is \"${CMAKE_XCODE_PLATFORM_TOOLSET}\" " + "but should be \"Test Toolset\"!") + endif() +endif() diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression1-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression1-stderr.txt index a1cac36..859dc3f 100644 --- a/Tests/RunCMake/ObjectLibrary/BadSourceExpression1-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression1-stderr.txt @@ -1,6 +1,8 @@ CMake Error at BadSourceExpression1.cmake:1 \(add_library\): - Unrecognized generator expression: + Error evaluating generator expression: \$<BAD_EXPRESSION> + + Expression did not evaluate to a known generator expression Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression2-stderr.txt index f1fcbe8..7060c61 100644 --- a/Tests/RunCMake/ObjectLibrary/BadSourceExpression2-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression2-stderr.txt @@ -1,4 +1,8 @@ CMake Error at BadSourceExpression2.cmake:1 \(add_library\): + Error evaluating generator expression: + + \$<TARGET_OBJECTS:DoesNotExist> + Objects of target "DoesNotExist" referenced but no such target exists. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt index ad14a35..838b3d8 100644 --- a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt @@ -1,4 +1,8 @@ CMake Error at BadSourceExpression3.cmake:2 \(add_library\): + Error evaluating generator expression: + + \$<TARGET_OBJECTS:NotObjLib> + Objects of target "NotObjLib" referenced but is not an OBJECT library. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 1d1c523..4ed2f43 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -25,7 +25,9 @@ function(run_cmake test) unset(expect_std${o}) endif() endforeach() - set(RunCMake_TEST_SOURCE_DIR "${top_src}") + if (NOT RunCMake_TEST_SOURCE_DIR) + set(RunCMake_TEST_SOURCE_DIR "${top_src}") + endif() if(NOT RunCMake_TEST_BINARY_DIR) set(RunCMake_TEST_BINARY_DIR "${top_bin}/${test}-build") endif() @@ -36,6 +38,9 @@ function(run_cmake test) if(NOT DEFINED RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS "") endif() + if (NOT RunCMake_TEST_FILE) + set(RunCMake_TEST_FILE "${test}") + endif() if(APPLE) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) endif() @@ -52,7 +57,8 @@ function(run_cmake test) COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" -G "${RunCMake_GENERATOR}" -T "${RunCMake_GENERATOR_TOOLSET}" - -DRunCMake_TEST=${test} + -DRunCMake_TEST=${RunCMake_TEST_FILE} + --no-warn-unused-cli ${RunCMake_TEST_OPTIONS} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" OUTPUT_VARIABLE actual_stdout diff --git a/Tests/RunCMake/Syntax/AtWithVariable-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariable-stderr.txt new file mode 100644 index 0000000..5dcd4d7 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariable-stderr.txt @@ -0,0 +1 @@ +-->wrong<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariable.cmake b/Tests/RunCMake/Syntax/AtWithVariable.cmake new file mode 100644 index 0000000..2bbf61d --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariable.cmake @@ -0,0 +1,9 @@ +set(right "wrong") +set(var "\${right}") +# Expanded here. +set(ref "@var@") + +# 'right' is dereferenced because 'var' was dereferenced when +# assigning to 'ref' above. +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/AtWithVariableAtOnly-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariableAtOnly-stderr.txt new file mode 100644 index 0000000..cbd1be4 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableAtOnly-stderr.txt @@ -0,0 +1 @@ +-->\${right}<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariableAtOnly.cmake b/Tests/RunCMake/Syntax/AtWithVariableAtOnly.cmake new file mode 100644 index 0000000..e06484c --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableAtOnly.cmake @@ -0,0 +1,8 @@ +set(right "wrong") +set(var "\${right}") +# Expanded here. +set(ref "@var@") + +# No dereference done at all. +string(CONFIGURE "${ref}" output @ONLY) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile-stderr.txt new file mode 100644 index 0000000..90bffb6 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile-stderr.txt @@ -0,0 +1,5 @@ +-->==>\${right}<== +==><== +==>\${var}<== +==>\${empty}<== +<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile.cmake b/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile.cmake new file mode 100644 index 0000000..bdd7bcd --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile.cmake @@ -0,0 +1,9 @@ +set(right "wrong") +set(var "\${right}") + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/atfile.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/atfile.txt" + @ONLY) +file(READ "${CMAKE_CURRENT_BINARY_DIR}/atfile.txt" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion-stderr.txt new file mode 100644 index 0000000..cbd1be4 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion-stderr.txt @@ -0,0 +1 @@ +-->\${right}<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion.cmake b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion.cmake new file mode 100644 index 0000000..840c7f0 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion.cmake @@ -0,0 +1,8 @@ +# Literal since 'var' is not defined. +set(ref "@var@") +set(right "wrong") +set(var "\${right}") + +# 'var' is dereferenced here. +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly-stderr.txt new file mode 100644 index 0000000..cbd1be4 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly-stderr.txt @@ -0,0 +1 @@ +-->\${right}<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly.cmake b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly.cmake new file mode 100644 index 0000000..b657506 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly.cmake @@ -0,0 +1,8 @@ +# Literal since 'var' is not defined. +set(ref "@var@") +set(right "wrong") +set(var "\${right}") + +# 'var' is dereferenced, but now 'right' +string(CONFIGURE "${ref}" output @ONLY) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/AtWithVariableFile-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariableFile-stderr.txt new file mode 100644 index 0000000..43f029f --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableFile-stderr.txt @@ -0,0 +1,5 @@ +-->==>\${right}<== +==><== +==>\${right}<== +==><== +<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariableFile.cmake b/Tests/RunCMake/Syntax/AtWithVariableFile.cmake new file mode 100644 index 0000000..c709099 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableFile.cmake @@ -0,0 +1,8 @@ +set(right "wrong") +set(var "\${right}") + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/atfile.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/atfile.txt") +file(READ "${CMAKE_CURRENT_BINARY_DIR}/atfile.txt" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/CMP0053-At-NEW-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-NEW-stderr.txt new file mode 100644 index 0000000..e3e5332 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-NEW-stderr.txt @@ -0,0 +1 @@ +^-->\${right}<--$ diff --git a/Tests/RunCMake/Syntax/CMP0053-At-NEW.cmake b/Tests/RunCMake/Syntax/CMP0053-At-NEW.cmake new file mode 100644 index 0000000..40dbe46 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-NEW.cmake @@ -0,0 +1,9 @@ +cmake_policy(SET CMP0053 NEW) + +set(right "wrong") +set(var "\${right}") +# Not expanded here with the new policy. +set(ref "@var@") + +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt new file mode 100644 index 0000000..acfa30a --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt @@ -0,0 +1 @@ +^-->wrong<--$ diff --git a/Tests/RunCMake/Syntax/CMP0053-At-OLD.cmake b/Tests/RunCMake/Syntax/CMP0053-At-OLD.cmake new file mode 100644 index 0000000..666f107 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-OLD.cmake @@ -0,0 +1,9 @@ +cmake_policy(SET CMP0053 OLD) + +set(right "wrong") +set(var "\${right}") +# Expanded here with the old policy. +set(ref "@var@") + +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines-stderr.txt new file mode 100644 index 0000000..ec37021 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines-stderr.txt @@ -0,0 +1,27 @@ +^CMake Warning \(dev\) at CMP0053-At-WARN-newlines.cmake:4 \(set\): + Policy CMP0053 is not set: Simplify variable reference and escape sequence + evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + For input: + + ' + @var@ + ' + + the old evaluation rules produce: + + ' + \${right} + ' + + but the new evaluation rules produce: + + ' + @var@ + ' + + Using the old result for compatibility since the policy is not set. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines.cmake b/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines.cmake new file mode 100644 index 0000000..c493505 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines.cmake @@ -0,0 +1,6 @@ +set(right "wrong") +set(var "\${right}") +# Expanded here with the old policy. +set(ref " +@var@ +") diff --git a/Tests/RunCMake/Syntax/CMP0053-At-WARN-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-WARN-stderr.txt new file mode 100644 index 0000000..697b7b3 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-WARN-stderr.txt @@ -0,0 +1,21 @@ +^CMake Warning \(dev\) at CMP0053-At-WARN.cmake:4 \(set\): + Policy CMP0053 is not set: Simplify variable reference and escape sequence + evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + For input: + + '@var@' + + the old evaluation rules produce: + + '\${right}' + + but the new evaluation rules produce: + + '@var@' + + Using the old result for compatibility since the policy is not set. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/Syntax/CMP0053-At-WARN.cmake b/Tests/RunCMake/Syntax/CMP0053-At-WARN.cmake new file mode 100644 index 0000000..19c7f53 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-WARN.cmake @@ -0,0 +1,4 @@ +set(right "wrong") +set(var "\${right}") +# Expanded here with the old policy. +set(ref "@var@") diff --git a/Tests/RunCMake/Syntax/CMP0053-NUL-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NUL-stderr.txt new file mode 100644 index 0000000..09c7e7c --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NUL-stderr.txt @@ -0,0 +1,56 @@ +^CMake Warning \(dev\) at CMP0053-NUL.cmake:1 \(set\): + Policy CMP0053 is not set: Simplify variable reference and escape sequence + evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + For input: + + '\\0' + + the old evaluation rules produce: + + '' + + but the new evaluation rules produce an error: + + Syntax error in cmake code at + .*/Tests/RunCMake/Syntax/CMP0053-NUL.cmake:1 + when parsing string + \\0 + Invalid character escape '\\0'. + + Using the old result for compatibility since the policy is not set. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at CMP0053-NUL.cmake:2 \(set\): + Policy CMP0053 is not set: Simplify variable reference and escape sequence + evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + For input: + + '\\0' + + the old evaluation rules produce: + + '' + + but the new evaluation rules produce an error: + + Syntax error in cmake code at + .*/Tests/RunCMake/Syntax/CMP0053-NUL.cmake:2 + when parsing string + \\0 + Invalid character escape '\\0'. + + Using the old result for compatibility since the policy is not set. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +--><-- +--><-- +--><-- +--><--$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NUL.cmake b/Tests/RunCMake/Syntax/CMP0053-NUL.cmake new file mode 100644 index 0000000..9ae0906 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NUL.cmake @@ -0,0 +1,6 @@ +set(qnul "\0") +set(nul \0) +message(-->${nul}<--) +message(-->${qnul}<--) +message("-->${nul}<--") +message("-->${qnul}<--") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-stderr.txt new file mode 100644 index 0000000..9575778 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CMP0053-NameWithCarriageReturn.cmake:2 \(message\): + message called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn.cmake new file mode 100644 index 0000000..b8a403d --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var\rwith\rcarriagereturn}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturnQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturnQuoted.cmake new file mode 100644 index 0000000..bb0d93f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturnQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var\rwith\rcarriagereturn}") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-stderr.txt new file mode 100644 index 0000000..df67d37 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CMP0053-NameWithEscapedSpaces.cmake:2 \(message\): + message called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces.cmake new file mode 100644 index 0000000..805b2ca --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var\ with\ escaped\ space}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpacesQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpacesQuoted.cmake new file mode 100644 index 0000000..58d8e8f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpacesQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var\ with\ escaped\ space}") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-stderr.txt new file mode 100644 index 0000000..059044f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CMP0053-NameWithEscapedTabs.cmake:2 \(message\): + message called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs.cmake new file mode 100644 index 0000000..214ab5d --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var\ with\ escaped\ tab}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabsQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabsQuoted.cmake new file mode 100644 index 0000000..aa5123f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabsQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var\ with\ escaped\ tab}") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-stderr.txt new file mode 100644 index 0000000..41f86e6 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CMP0053-NameWithNewline.cmake:2 \(message\): + message called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline.cmake new file mode 100644 index 0000000..45b532e --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var\nwith\nnewline}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewlineQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithNewlineQuoted.cmake new file mode 100644 index 0000000..6fe568d --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithNewlineQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var\nwith\nnewline}") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-stderr.txt new file mode 100644 index 0000000..95e8684 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at CMP0053-NameWithSpaces.cmake:2 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake:2 + + when parsing string + + \${var + + There is an unterminated variable reference. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake new file mode 100644 index 0000000..dae7d25 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var with space}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-stderr.txt new file mode 100644 index 0000000..c4f3cfe --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at CMP0053-NameWithSpacesQuoted.cmake:2 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake:2 + + when parsing string + + \${var with space} + + Invalid character \(' '\) in a variable name: 'var' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake new file mode 100644 index 0000000..e252cff --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var with space}") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-stderr.txt new file mode 100644 index 0000000..b1678b3 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at CMP0053-NameWithTabs.cmake:2 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake:2 + + when parsing string + + \${var + + There is an unterminated variable reference. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake new file mode 100644 index 0000000..45e3045 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var with tab}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-stderr.txt new file mode 100644 index 0000000..78adb5e --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at CMP0053-NameWithTabsQuoted.cmake:2 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake:2 + + when parsing string + + \${var with tab} + + Invalid character \(' '\) in a variable name: 'var' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake new file mode 100644 index 0000000..498675f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var with tab}") diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-ParenInENV-stderr.txt new file mode 100644 index 0000000..7020c7e --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-ParenInENV-stderr.txt @@ -0,0 +1 @@ +-->value<-- diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInENV.cmake b/Tests/RunCMake/Syntax/CMP0053-ParenInENV.cmake new file mode 100644 index 0000000..b5cdf0f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-ParenInENV.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0053 NEW) +set("ENV{e(x)}" value) +message(-->$ENV{e\(x\)}<--) diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV-stderr.txt new file mode 100644 index 0000000..7020c7e --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV-stderr.txt @@ -0,0 +1 @@ +-->value<-- diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV.cmake b/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV.cmake new file mode 100644 index 0000000..5559d4b --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0053 NEW) +set("ENV{e(x)}" value) +message("-->$ENV{e\(x\)}<--") diff --git a/Tests/RunCMake/Syntax/CMP0053-WARN-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-WARN-stderr.txt new file mode 100644 index 0000000..c706939 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-WARN-stderr.txt @@ -0,0 +1,28 @@ +^CMake Warning \(dev\) at CMP0053-WARN.cmake:2 \(message\): + Policy CMP0053 is not set: Simplify variable reference and escape sequence + evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + For input: + + '\\' + + the old evaluation rules produce: + + '\\' + + but the new evaluation rules produce an error: + + Syntax error in cmake code at + .*/Tests/RunCMake/Syntax/CMP0053-WARN.cmake:2 + when parsing string + \\ + Invalid character escape '\\' \(at end of input\). + + Using the old result for compatibility since the policy is not set. +Call Stack \(most recent call first\): + CMP0053-WARN.cmake:5 \(escape\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +\\$ diff --git a/Tests/RunCMake/Syntax/CMP0053-WARN.cmake b/Tests/RunCMake/Syntax/CMP0053-WARN.cmake new file mode 100644 index 0000000..6e8b07b --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-WARN.cmake @@ -0,0 +1,5 @@ +macro (escape str) + message("${str}") +endmacro () + +escape("\\") diff --git a/Tests/RunCMake/Syntax/CMakeLists.txt b/Tests/RunCMake/Syntax/CMakeLists.txt index 618473a..4b3de84 100644 --- a/Tests/RunCMake/Syntax/CMakeLists.txt +++ b/Tests/RunCMake/Syntax/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.9) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Syntax/Escape2-result.txt b/Tests/RunCMake/Syntax/Escape2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/Escape2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/Escape2-stderr.txt b/Tests/RunCMake/Syntax/Escape2-stderr.txt new file mode 100644 index 0000000..cc3bdf0 --- /dev/null +++ b/Tests/RunCMake/Syntax/Escape2-stderr.txt @@ -0,0 +1,13 @@ +CMake Error at Escape2.cmake:4 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/Escape2.cmake:4 + + when parsing string + + \\ + + Invalid character escape '\\' \(at end of input\). +Call Stack \(most recent call first\): + Escape2.cmake:7 \(escape\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/Escape2.cmake b/Tests/RunCMake/Syntax/Escape2.cmake new file mode 100644 index 0000000..078a822 --- /dev/null +++ b/Tests/RunCMake/Syntax/Escape2.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0053 NEW) + +macro (escape str) + message("${str}") +endmacro () + +escape("\\") diff --git a/Tests/RunCMake/Syntax/EscapeChar-char-result.txt b/Tests/RunCMake/Syntax/EscapeChar-char-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeChar-char-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in b/Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in new file mode 100644 index 0000000..d1d908c --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in @@ -0,0 +1,12 @@ +CMake Error at EscapeChar-@char@-@testnum@.cmake:3 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/EscapeChar-@char@-@testnum@.cmake:3 + + when parsing string + + -->\\@char@<-- + + Invalid character escape '\\@char@'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/EscapeChar-char.cmake.in b/Tests/RunCMake/Syntax/EscapeChar-char.cmake.in new file mode 100644 index 0000000..6f265e5 --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeChar-char.cmake.in @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0053 NEW) + +message("-->\@char@<--") diff --git a/Tests/RunCMake/Syntax/EscapeCharsAllowed-stderr.txt b/Tests/RunCMake/Syntax/EscapeCharsAllowed-stderr.txt new file mode 100644 index 0000000..e658de7 --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeCharsAllowed-stderr.txt @@ -0,0 +1,12 @@ +^-->semicolon<-- +-->dollar<-- +-->brace<-- +-->bracket<-- +-->newline<-- +-->octothorpe<-- +-->splat<-- +-->caret<-- +-->paren<-- +-->dquote<-- +-->top-levelsemicolon<-- +-->top-level;escaped;semicolon<--$ diff --git a/Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake b/Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake new file mode 100644 index 0000000..e9c568d --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake @@ -0,0 +1,26 @@ +cmake_policy(SET CMP0053 NEW) + +set("semicolon;in;name" semicolon) +set("dollar$in$name" dollar) +set("brace{in}name" brace) +set("bracket[in]name" bracket) +set("newline\nin\nname" newline) +set("octothorpe\#in\#name" octothorpe) +set("splat\@in\@name" splat) +set("caret\^in\^name" caret) +set("paren\(in\)name" paren) +set("dquote\"in\"name" dquote) + +message("-->${semicolon\;in\;name}<--") +message("-->${dollar\$in\$name}<--") +message("-->${brace\{in\}name}<--") +message("-->${bracket\[in\]name}<--") +message("-->${newline\nin\nname}<--") +message("-->${octothorpe\#in\#name}<--") +message("-->${splat\@in\@name}<--") +message("-->${caret\^in\^name}<--") +message("-->${paren\(in\)name}<--") +message("-->${dquote\"in\"name}<--") + +message(-->top-level;semicolon<--) +message(-->top-level\;escaped\;semicolon<--) diff --git a/Tests/RunCMake/Syntax/EscapeCharsDisallowed.cmake b/Tests/RunCMake/Syntax/EscapeCharsDisallowed.cmake new file mode 100644 index 0000000..eef01a0 --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeCharsDisallowed.cmake @@ -0,0 +1,42 @@ +set(disallowed_chars + a b c d e f g h i j l m o p q s u v w x y z + A B C D E F G H I J L M N O P Q R S T U V W X Y Z + 0 1 2 3 4 5 6 6 7 8 9) +set(testnum 0) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/CMakeLists.txt" + COPYONLY) + +foreach (char IN LISTS disallowed_chars) + configure_file( + "${RunCMake_SOURCE_DIR}/EscapeChar-char.cmake.in" + "${RunCMake_BINARY_DIR}/EscapeChar-${char}-${testnum}.cmake" + @ONLY) + configure_file( + "${RunCMake_SOURCE_DIR}/EscapeChar-char-stderr.txt.in" + "${RunCMake_BINARY_DIR}/EscapeChar-${char}-${testnum}-stderr.txt" + @ONLY) + configure_file( + "${RunCMake_SOURCE_DIR}/EscapeChar-char-result.txt" + "${RunCMake_BINARY_DIR}/EscapeChar-${char}-${testnum}-result.txt" + COPYONLY) + + math(EXPR testnum "${testnum} + 1") +endforeach () + +function (run_tests) + set(GENERATED_RUNCMAKE_TESTS TRUE) + # Find the tests in the binary directory. + set(RunCMake_SOURCE_DIR "${RunCMake_BINARY_DIR}") + + set(testnum 0) + foreach (char IN LISTS disallowed_chars) + run_cmake("EscapeChar-${char}-${testnum}") + + math(EXPR testnum "${testnum} + 1") + endforeach () +endfunction () + +run_tests() diff --git a/Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt b/Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt new file mode 100644 index 0000000..077272d --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt @@ -0,0 +1 @@ +-->"<-- diff --git a/Tests/RunCMake/Syntax/EscapeQuotes.cmake b/Tests/RunCMake/Syntax/EscapeQuotes.cmake new file mode 100644 index 0000000..46d2b6f --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeQuotes.cmake @@ -0,0 +1,9 @@ +set(var "\"") +set(ref "@var@") +set(rref "\${var}") + +string(CONFIGURE "${ref}" output ESCAPE_QUOTES) +message("-->${output}<--") + +string(CONFIGURE "${rref}" output ESCAPE_QUOTES) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/EscapedAt-stderr.txt b/Tests/RunCMake/Syntax/EscapedAt-stderr.txt new file mode 100644 index 0000000..a51c0d3 --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapedAt-stderr.txt @@ -0,0 +1 @@ +-->\\n<-- diff --git a/Tests/RunCMake/Syntax/EscapedAt.cmake b/Tests/RunCMake/Syntax/EscapedAt.cmake new file mode 100644 index 0000000..1ced620 --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapedAt.cmake @@ -0,0 +1,5 @@ +set(var "n") +set(ref "\\@var@") + +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/ExpandInAt-stderr.txt b/Tests/RunCMake/Syntax/ExpandInAt-stderr.txt new file mode 100644 index 0000000..5da8b60 --- /dev/null +++ b/Tests/RunCMake/Syntax/ExpandInAt-stderr.txt @@ -0,0 +1 @@ +-->@foo@<-- diff --git a/Tests/RunCMake/Syntax/ExpandInAt.cmake b/Tests/RunCMake/Syntax/ExpandInAt.cmake new file mode 100644 index 0000000..98f0277 --- /dev/null +++ b/Tests/RunCMake/Syntax/ExpandInAt.cmake @@ -0,0 +1,6 @@ +set("\${varname}" bar) +set(var foo) +set(ref "@\${var}@") + +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturn-result.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturn-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturn-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt new file mode 100644 index 0000000..7448b59 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithCarriageReturn.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithCarriageReturn.cmake:1 + + when parsing string + + \${var\\rwith\\rcarriagereturn} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturn.cmake b/Tests/RunCMake/Syntax/NameWithCarriageReturn.cmake new file mode 100644 index 0000000..614f554 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturn.cmake @@ -0,0 +1 @@ +message(${var\rwith\rcarriagereturn}) diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt new file mode 100644 index 0000000..f5e03ed --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithCarriageReturnQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted.cmake:1 + + when parsing string + + \${var\\rwith\\rcarriagereturn} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted.cmake b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted.cmake new file mode 100644 index 0000000..bac69e4 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted.cmake @@ -0,0 +1 @@ +message("${var\rwith\rcarriagereturn}") diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-result.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt new file mode 100644 index 0000000..fa16a8a --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithEscapedSpaces.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithEscapedSpaces.cmake:1 + + when parsing string + + \${var\\ with\\ escaped\\ space} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpaces.cmake b/Tests/RunCMake/Syntax/NameWithEscapedSpaces.cmake new file mode 100644 index 0000000..6cb8401 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpaces.cmake @@ -0,0 +1 @@ +message(${var\ with\ escaped\ space}) diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt new file mode 100644 index 0000000..07cbf24 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithEscapedSpacesQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted.cmake:1 + + when parsing string + + \${var\\ with\\ escaped\\ space} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted.cmake b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted.cmake new file mode 100644 index 0000000..2bd4bfd --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted.cmake @@ -0,0 +1 @@ +message("${var\ with\ escaped\ space}") diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabs-result.txt b/Tests/RunCMake/Syntax/NameWithEscapedTabs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt new file mode 100644 index 0000000..d7fc38a --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithEscapedTabs.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithEscapedTabs.cmake:1 + + when parsing string + + \${var\\ with\\ escaped\\ tab} + + Invalid escape sequence \\.? +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabs.cmake b/Tests/RunCMake/Syntax/NameWithEscapedTabs.cmake new file mode 100644 index 0000000..c6faa7a --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabs.cmake @@ -0,0 +1 @@ +message(${var\ with\ escaped\ tab}) diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-stderr.txt new file mode 100644 index 0000000..915dbaa --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithEscapedTabsQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted.cmake:1 + + when parsing string + + \${var\\ with\\ escaped\\ tab} + + Invalid escape sequence \\.? +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted.cmake b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted.cmake new file mode 100644 index 0000000..d9be763 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted.cmake @@ -0,0 +1 @@ +message("${var\ with\ escaped\ tab}") diff --git a/Tests/RunCMake/Syntax/NameWithNewline-result.txt b/Tests/RunCMake/Syntax/NameWithNewline-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewline-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt new file mode 100644 index 0000000..5cc111b --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithNewline.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithNewline.cmake:1 + + when parsing string + + \${var\\nwith\\nnewline} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithNewline.cmake b/Tests/RunCMake/Syntax/NameWithNewline.cmake new file mode 100644 index 0000000..583bcb0 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewline.cmake @@ -0,0 +1 @@ +message(${var\nwith\nnewline}) diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt new file mode 100644 index 0000000..0067c2f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithNewlineQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithNewlineQuoted.cmake:1 + + when parsing string + + \${var\\nwith\\nnewline} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted.cmake b/Tests/RunCMake/Syntax/NameWithNewlineQuoted.cmake new file mode 100644 index 0000000..da6d2cf --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewlineQuoted.cmake @@ -0,0 +1 @@ +message("${var\nwith\nnewline}") diff --git a/Tests/RunCMake/Syntax/NameWithSpaces-result.txt b/Tests/RunCMake/Syntax/NameWithSpaces-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpaces-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt new file mode 100644 index 0000000..04bc226 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithSpaces.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithSpaces.cmake:1 + + when parsing string + + \${var + + syntax error, unexpected \$end, expecting } \(5\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithSpaces.cmake b/Tests/RunCMake/Syntax/NameWithSpaces.cmake new file mode 100644 index 0000000..01febe9 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpaces.cmake @@ -0,0 +1 @@ +message(${var with space}) diff --git a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt new file mode 100644 index 0000000..66cf9a2 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithSpacesQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithSpacesQuoted.cmake:1 + + when parsing string + + \${var with space} + + syntax error, unexpected cal_SYMBOL, expecting } \(17\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithSpacesQuoted.cmake b/Tests/RunCMake/Syntax/NameWithSpacesQuoted.cmake new file mode 100644 index 0000000..3fba53f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpacesQuoted.cmake @@ -0,0 +1 @@ +message("${var with space}") diff --git a/Tests/RunCMake/Syntax/NameWithTabs-result.txt b/Tests/RunCMake/Syntax/NameWithTabs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt new file mode 100644 index 0000000..e888096 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithTabs.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithTabs.cmake:1 + + when parsing string + + \${var + + syntax error, unexpected \$end, expecting } \(5\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithTabs.cmake b/Tests/RunCMake/Syntax/NameWithTabs.cmake new file mode 100644 index 0000000..c3b1bea --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabs.cmake @@ -0,0 +1 @@ +message(${var with tab}) diff --git a/Tests/RunCMake/Syntax/NameWithTabsQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithTabsQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabsQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt new file mode 100644 index 0000000..b020074 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithTabsQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithTabsQuoted.cmake:1 + + when parsing string + + \${var with tab} + + syntax error, unexpected cal_SYMBOL, expecting } \(15\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithTabsQuoted.cmake b/Tests/RunCMake/Syntax/NameWithTabsQuoted.cmake new file mode 100644 index 0000000..8ddb85d --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabsQuoted.cmake @@ -0,0 +1 @@ +message("${var with tab}") diff --git a/Tests/RunCMake/Syntax/ParenInENV-result.txt b/Tests/RunCMake/Syntax/ParenInENV-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInENV-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt new file mode 100644 index 0000000..7ecfe11 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt @@ -0,0 +1,20 @@ +CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): + Syntax Warning in cmake code at + + .*/Tests/RunCMake/Syntax/ParenInENV.cmake:2:21 + + Argument not separated from preceding token by whitespace. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at ParenInENV.cmake:2 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/ParenInENV.cmake:2 + + when parsing string + + -->\$ENV{e + + syntax error, unexpected \$end, expecting } \(9\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/ParenInENV.cmake b/Tests/RunCMake/Syntax/ParenInENV.cmake new file mode 100644 index 0000000..148f726 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInENV.cmake @@ -0,0 +1,2 @@ +set("ENV{e(x)}" value) +message(-->$ENV{e(x)}<--) diff --git a/Tests/RunCMake/Syntax/ParenInQuotedENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInQuotedENV-stderr.txt new file mode 100644 index 0000000..7020c7e --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInQuotedENV-stderr.txt @@ -0,0 +1 @@ +-->value<-- diff --git a/Tests/RunCMake/Syntax/ParenInQuotedENV.cmake b/Tests/RunCMake/Syntax/ParenInQuotedENV.cmake new file mode 100644 index 0000000..6333717 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInQuotedENV.cmake @@ -0,0 +1,2 @@ +set("ENV{e(x)}" value) +message("-->$ENV{e(x)}<--") diff --git a/Tests/RunCMake/Syntax/ParenInVarName0-result.txt b/Tests/RunCMake/Syntax/ParenInVarName0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt b/Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt new file mode 100644 index 0000000..0a6b60f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at ParenInVarName0.cmake:4 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/ParenInVarName0.cmake:4 + + when parsing string + + -->\${e\(x\)}<-- + + Invalid character \('\('\) in a variable name: 'e' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/ParenInVarName0.cmake b/Tests/RunCMake/Syntax/ParenInVarName0.cmake new file mode 100644 index 0000000..f863d20 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName0.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0053 NEW) + +set("e(x)" value) +message("-->${e(x)}<--") diff --git a/Tests/RunCMake/Syntax/ParenInVarName1-result.txt b/Tests/RunCMake/Syntax/ParenInVarName1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt new file mode 100644 index 0000000..81b1717 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at ParenInVarName1.cmake:4 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/ParenInVarName1.cmake:4 + + when parsing string + + -->\${e\(x\)}<-- + + syntax error, unexpected cal_SYMBOL, expecting } \(10\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/ParenInVarName1.cmake b/Tests/RunCMake/Syntax/ParenInVarName1.cmake new file mode 100644 index 0000000..9fdc87b --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName1.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0053 OLD) + +set("{e(x)}" value) +message("-->${e(x)}<--") diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index 5f05cfc..cecd338 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -5,6 +5,14 @@ run_cmake(BOM-UTF-16-LE) run_cmake(BOM-UTF-16-BE) run_cmake(BOM-UTF-32-LE) run_cmake(BOM-UTF-32-BE) +run_cmake(CMP0053-At-OLD) +run_cmake(CMP0053-At-NEW) +run_cmake(CMP0053-At-WARN) +run_cmake(CMP0053-At-WARN-newlines) +run_cmake(CMP0053-WARN) +run_cmake(CMP0053-NUL) +run_cmake(CMP0053-ParenInENV) +run_cmake(CMP0053-ParenInQuotedENV) run_cmake(CommandSpaces) run_cmake(CommandTabs) run_cmake(CommandNewlines) @@ -25,6 +33,7 @@ run_cmake(StringNoSpace) run_cmake(OneLetter) run_cmake(Unquoted0) run_cmake(Unquoted1) +run_cmake(Unquoted2) run_cmake(Bracket0) run_cmake(Bracket1) run_cmake(Bracket2) @@ -43,12 +52,59 @@ run_cmake(BracketNoSpace3) run_cmake(BracketNoSpace4) run_cmake(BracketNoSpace5) run_cmake(Escape1) +run_cmake(Escape2) +run_cmake(EscapeCharsAllowed) +include("${RunCMake_SOURCE_DIR}/EscapeCharsDisallowed.cmake") run_cmake(ParenNoSpace0) run_cmake(ParenNoSpace1) run_cmake(ParenNoSpace2) +run_cmake(ParenInVarName0) +run_cmake(ParenInVarName1) run_cmake(UnterminatedCall1) run_cmake(UnterminatedCall2) run_cmake(UnterminatedString) +run_cmake(UnterminatedBrace0) +run_cmake(UnterminatedBrace1) +run_cmake(UnterminatedBrace2) run_cmake(UnterminatedBracket0) run_cmake(UnterminatedBracket1) run_cmake(UnterminatedBracketComment) + +# Variable expansion tests +run_cmake(ExpandInAt) +run_cmake(EscapedAt) +run_cmake(EscapeQuotes) +run_cmake(AtWithVariable) +run_cmake(AtWithVariableEmptyExpansion) +run_cmake(AtWithVariableAtOnly) +run_cmake(AtWithVariableEmptyExpansionAtOnly) +run_cmake(AtWithVariableFile) +run_cmake(AtWithVariableAtOnlyFile) +run_cmake(ParenInENV) +run_cmake(ParenInQuotedENV) + +# Variable name tests +run_cmake(NameWithSpaces) +run_cmake(NameWithTabs) +run_cmake(NameWithNewline) +run_cmake(NameWithCarriageReturn) +run_cmake(NameWithEscapedSpaces) +run_cmake(NameWithEscapedTabs) +run_cmake(NameWithSpacesQuoted) +run_cmake(NameWithTabsQuoted) +run_cmake(NameWithNewlineQuoted) +run_cmake(NameWithCarriageReturnQuoted) +run_cmake(NameWithEscapedSpacesQuoted) +run_cmake(NameWithEscapedTabsQuoted) +run_cmake(CMP0053-NameWithSpaces) +run_cmake(CMP0053-NameWithTabs) +run_cmake(CMP0053-NameWithNewline) +run_cmake(CMP0053-NameWithCarriageReturn) +run_cmake(CMP0053-NameWithEscapedSpaces) +run_cmake(CMP0053-NameWithEscapedTabs) +run_cmake(CMP0053-NameWithSpacesQuoted) +run_cmake(CMP0053-NameWithTabsQuoted) +run_cmake(CMP0053-NameWithNewlineQuoted) +run_cmake(CMP0053-NameWithCarriageReturnQuoted) +run_cmake(CMP0053-NameWithEscapedSpacesQuoted) +run_cmake(CMP0053-NameWithEscapedTabsQuoted) diff --git a/Tests/RunCMake/Syntax/Unquoted2-stderr.txt b/Tests/RunCMake/Syntax/Unquoted2-stderr.txt new file mode 100644 index 0000000..eb8883e --- /dev/null +++ b/Tests/RunCMake/Syntax/Unquoted2-stderr.txt @@ -0,0 +1 @@ +^\[\[UnquotedBracketArgument1\]\]$ diff --git a/Tests/RunCMake/Syntax/Unquoted2.cmake b/Tests/RunCMake/Syntax/Unquoted2.cmake new file mode 100644 index 0000000..d94057d --- /dev/null +++ b/Tests/RunCMake/Syntax/Unquoted2.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0053 NEW) + +message(\[[Unquoted Bracket Argument 1]]) diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0-result.txt b/Tests/RunCMake/Syntax/UnterminatedBrace0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt new file mode 100644 index 0000000..1e0ce49 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at UnterminatedBrace0.cmake:2 \(set\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake:2 + + when parsing string + + \${ + + syntax error, unexpected \$end, expecting } \(2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake new file mode 100644 index 0000000..0da1290 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 3.0) +set(var "${") diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt new file mode 100644 index 0000000..4e3c2b5 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning \(dev\) at UnterminatedBrace1.cmake:3 \(set\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake:3 + + when parsing string + + \${ + + syntax error, unexpected \$end, expecting } \(2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake new file mode 100644 index 0000000..93fba34 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +cmake_policy(SET CMP0010 OLD) +set(var "${") diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt b/Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt new file mode 100644 index 0000000..b332d34 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at UnterminatedBrace2.cmake:4 \(set\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake:4 + + when parsing string + + \${ + + There is an unterminated variable reference. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake new file mode 100644 index 0000000..a650e5b --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.0) +cmake_policy(SET CMP0010 OLD) +cmake_policy(SET CMP0053 NEW) +set(var "${") diff --git a/Tests/RunCMake/Syntax/atfile.txt.in b/Tests/RunCMake/Syntax/atfile.txt.in new file mode 100644 index 0000000..3775919 --- /dev/null +++ b/Tests/RunCMake/Syntax/atfile.txt.in @@ -0,0 +1,4 @@ +==>@var@<== +==>@empty@<== +==>${var}<== +==>${empty}<== diff --git a/Tests/RunCMake/TargetObjects/BadContext-result.txt b/Tests/RunCMake/TargetObjects/BadContext-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetObjects/BadContext-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt new file mode 100644 index 0000000..92f2c91 --- /dev/null +++ b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadContext.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_OBJECTS:NoTarget> + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake. It is not suitable for writing out elsewhere. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error: + Error evaluating generator expression: + + \$<TARGET_OBJECTS:NoTarget> + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake. It is not suitable for writing out elsewhere. diff --git a/Tests/RunCMake/TargetObjects/BadContext.cmake b/Tests/RunCMake/TargetObjects/BadContext.cmake new file mode 100644 index 0000000..67962a4 --- /dev/null +++ b/Tests/RunCMake/TargetObjects/BadContext.cmake @@ -0,0 +1,4 @@ + +file(GENERATE OUTPUT test_output CONTENT $<TARGET_OBJECTS:NoTarget>) + +install(FILES $<TARGET_OBJECTS:NoTarget> DESTINATION objects) diff --git a/Tests/RunCMake/TargetObjects/CMakeLists.txt b/Tests/RunCMake/TargetObjects/CMakeLists.txt new file mode 100644 index 0000000..be9d403 --- /dev/null +++ b/Tests/RunCMake/TargetObjects/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST}) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake b/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake new file mode 100644 index 0000000..85c76e2 --- /dev/null +++ b/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(BadContext) diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index f30c9a9..f4b744b 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -16,6 +16,7 @@ \* CMP0041 \* CMP0042 \* CMP0046 + \* CMP0052 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake b/Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake new file mode 100644 index 0000000..464df36 --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake @@ -0,0 +1,13 @@ + +cmake_policy(SET CMP0026 OLD) + +add_library(objlib OBJECT + empty_1.cpp +) + +add_executable(my_exe + empty_2.cpp + $<TARGET_OBJECTS:objlib> +) + +get_target_property( loc my_exe LOCATION) diff --git a/Tests/RunCMake/TargetSources/CMakeLists.txt b/Tests/RunCMake/TargetSources/CMakeLists.txt new file mode 100644 index 0000000..f452db1 --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed-result.txt b/Tests/RunCMake/TargetSources/ConfigNotAllowed-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetSources/ConfigNotAllowed-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt b/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt new file mode 100644 index 0000000..1de5dd7 --- /dev/null +++ b/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt @@ -0,0 +1,14 @@ +CMake Error in CMakeLists.txt: + Target "somelib" has source files which vary by configuration. This is not + supported by the "[^"]+" generator. + + Config "Debug": + + .*/Tests/RunCMake/TargetSources/empty_1.cpp + .*/Tests/RunCMake/TargetSources/empty_2.cpp + .*/Tests/RunCMake/TargetSources/CMakeLists.txt + + Config "Release": + + .*/Tests/RunCMake/TargetSources/empty_1.cpp + .*/Tests/RunCMake/TargetSources/CMakeLists.txt diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed.cmake b/Tests/RunCMake/TargetSources/ConfigNotAllowed.cmake new file mode 100644 index 0000000..02af379 --- /dev/null +++ b/Tests/RunCMake/TargetSources/ConfigNotAllowed.cmake @@ -0,0 +1,2 @@ + +add_library(somelib empty_1.cpp $<$<CONFIG:Debug>:empty_2.cpp>) diff --git a/Tests/RunCMake/TargetSources/OriginDebug-result.txt b/Tests/RunCMake/TargetSources/OriginDebug-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/TargetSources/OriginDebug-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt new file mode 100644 index 0000000..11bc96c --- /dev/null +++ b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt @@ -0,0 +1,31 @@ +CMake Debug Log at OriginDebug.cmake:13 \(add_library\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/TargetSources/empty_2.cpp + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +.* +CMake Debug Log at OriginDebug.cmake:16 \(set_property\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/TargetSources/empty_3.cpp + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +.* +CMake Debug Log at OriginDebug.cmake:20 \(target_sources\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/TargetSources/empty_4.cpp + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +.* +CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/TargetSources/empty_1.cpp + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/OriginDebug.cmake b/Tests/RunCMake/TargetSources/OriginDebug.cmake new file mode 100644 index 0000000..5fe9ba7 --- /dev/null +++ b/Tests/RunCMake/TargetSources/OriginDebug.cmake @@ -0,0 +1,20 @@ + +cmake_minimum_required(VERSION 3.0) + +project(OriginDebug) + +set(CMAKE_DEBUG_TARGET_PROPERTIES SOURCES) + +add_library(iface INTERFACE) +set_property(TARGET iface PROPERTY INTERFACE_SOURCES + empty_1.cpp +) + +add_library(OriginDebug empty_2.cpp) +target_link_libraries(OriginDebug iface) + +set_property(TARGET OriginDebug APPEND PROPERTY SOURCES + empty_3.cpp +) + +target_sources(OriginDebug PRIVATE empty_4.cpp) diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt new file mode 100644 index 0000000..fad7073 --- /dev/null +++ b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt @@ -0,0 +1,40 @@ +CMake Debug Log at OriginDebug.cmake:13 \(add_library\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/TargetSources/empty_2.cpp + +Call Stack \(most recent call first\): + OriginDebugIDE.cmake:4 \(include\) + CMakeLists.txt:3 \(include\) ++ +CMake Debug Log at OriginDebug.cmake:16 \(set_property\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/TargetSources/empty_3.cpp + +Call Stack \(most recent call first\): + OriginDebugIDE.cmake:4 \(include\) + CMakeLists.txt:3 \(include\) ++ +CMake Debug Log at OriginDebug.cmake:20 \(target_sources\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/TargetSources/empty_4.cpp + +Call Stack \(most recent call first\): + OriginDebugIDE.cmake:4 \(include\) + CMakeLists.txt:3 \(include\) ++ +CMake Debug Log: + Used sources for target OriginDebug: + + * .*CMakeLists.txt ++ +CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/TargetSources/empty_1.cpp + +Call Stack \(most recent call first\): + OriginDebugIDE.cmake:4 \(include\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake b/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake new file mode 100644 index 0000000..a3cc3a8 --- /dev/null +++ b/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake @@ -0,0 +1,4 @@ + +# Separate test for the IDEs, because they show the CMakeLists.txt file +# as a source file. +include(${CMAKE_CURRENT_LIST_DIR}/OriginDebug.cmake) diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake new file mode 100644 index 0000000..1d2eaec --- /dev/null +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCMake) + +if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) + run_cmake(ConfigNotAllowed) + run_cmake(OriginDebugIDE) +else() + run_cmake(OriginDebug) +endif() + +run_cmake(CMP0026-LOCATION) diff --git a/Tests/RunCMake/TargetSources/empty_1.cpp b/Tests/RunCMake/TargetSources/empty_1.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/TargetSources/empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/empty_2.cpp b/Tests/RunCMake/TargetSources/empty_2.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/TargetSources/empty_2.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/empty_3.cpp b/Tests/RunCMake/TargetSources/empty_3.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/TargetSources/empty_3.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/empty_4.cpp b/Tests/RunCMake/TargetSources/empty_4.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/TargetSources/empty_4.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMakeLists.txt new file mode 100644 index 0000000..872338d --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-stderr.txt new file mode 100644 index 0000000..62c4ff1 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + Unparsed arguments: GarbageArg +Call Stack \(most recent call first\): + ExtraArgs.cmake:4 \(write_compiler_detection_header\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs.cmake new file mode 100644 index 0000000..c2a21af --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX Pref + GarbageArg + COMPILERS GNU + FEATURES cxx_final +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-stderr.txt new file mode 100644 index 0000000..3c0c076 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + write_compiler_detection_header: FILE parameter missing. +Call Stack \(most recent call first\): + FileTypo.cmake:4 \(write_compiler_detection_header\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo.cmake new file mode 100644 index 0000000..c90eda2 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo.cmake @@ -0,0 +1,7 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE_TYPO "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX Pref +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-stderr.txt new file mode 100644 index 0000000..b4d7e08 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at InvalidArgs.cmake:4 \(write_compiler_detection_header\): + write_compiler_detection_header Function invoked with incorrect arguments + for function named: write_compiler_detection_header +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at InvalidArgs.cmake:6 \(write_compiler_detection_header\): + write_compiler_detection_header Function invoked with incorrect arguments + for function named: write_compiler_detection_header +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs.cmake new file mode 100644 index 0000000..cfebae1 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs.cmake @@ -0,0 +1,6 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header() + +write_compiler_detection_header(FILE) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-stderr.txt new file mode 100644 index 0000000..f34c9e1 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + Unsupported feature cxx_not_a_feature. +Call Stack \(most recent call first\): + InvalidCXXFeature.cmake:4 \(write_compiler_detection_header\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature.cmake new file mode 100644 index 0000000..da870fa --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX PREF_ + COMPILERS GNU + FEATURES cxx_not_a_feature + VERSION 3.1 +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-stderr.txt new file mode 100644 index 0000000..f35f9f9 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + Unsupported compiler NOT_A_COMPILER. +Call Stack \(most recent call first\): + InvalidCompiler.cmake:4 \(write_compiler_detection_header\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler.cmake new file mode 100644 index 0000000..ecd0957 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX PREF_ + COMPILERS NOT_A_COMPILER + FEATURES cxx_final + VERSION 3.1 +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt new file mode 100644 index 0000000..0445744 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + Unsupported feature not_a_feature. +Call Stack \(most recent call first\): + InvalidFeature.cmake:4 \(write_compiler_detection_header\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature.cmake new file mode 100644 index 0000000..cd83968 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX PREF_ + COMPILERS GNU + FEATURES not_a_feature + VERSION 3.1 +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-stderr.txt new file mode 100644 index 0000000..9451348 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + Invalid arguments. write_compiler_detection_header requires at least one + compiler. +Call Stack \(most recent call first\): + NoCompiler.cmake:4 \(write_compiler_detection_header\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler.cmake new file mode 100644 index 0000000..2dc14e9 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX PREF_ + # COMPILERS + FEATURES cxx_final + VERSION 3.1 +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-stderr.txt new file mode 100644 index 0000000..193f297 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + Invalid arguments. write_compiler_detection_header requires at least one + feature. +Call Stack \(most recent call first\): + NoFeature.cmake:4 \(write_compiler_detection_header\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature.cmake new file mode 100644 index 0000000..1fbc129 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX PREF_ + COMPILERS GNU + # FEATURES + VERSION 3.1 +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt new file mode 100644 index 0000000..8d4db34 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + VERSION compatibility for write_compiler_detection_header is set to 3.0, + which is too low. It must be set to at least 3.1.0. Either set the + VERSION parameter to the write_compiler_detection_header function, or + update your minimum required CMake version with the cmake_minimum_required + command. +Call Stack \(most recent call first\): + OldVersion.cmake:4 \(write_compiler_detection_header\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion.cmake new file mode 100644 index 0000000..a6e3022 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX Pref + VERSION 3.0 + COMPILERS GNU + FEATURES cxx_final +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-stderr.txt new file mode 100644 index 0000000..5fdcdb8 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + write_compiler_detection_header: PREFIX parameter missing. +Call Stack \(most recent call first\): + PrefixTypo.cmake:4 \(write_compiler_detection_header\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo.cmake new file mode 100644 index 0000000..8b6774c --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo.cmake @@ -0,0 +1,7 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX_TYPO Pref +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake new file mode 100644 index 0000000..be79d41 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake @@ -0,0 +1,12 @@ +include(RunCMake) + +run_cmake(InvalidArgs) +run_cmake(NoCompiler) +run_cmake(NoFeature) +run_cmake(FileTypo) +run_cmake(PrefixTypo) +run_cmake(ExtraArgs) +run_cmake(OldVersion) +run_cmake(InvalidCompiler) +run_cmake(InvalidFeature) +run_cmake(InvalidCXXFeature) diff --git a/Tests/RunCMake/XcodeProject/CMakeLists.txt b/Tests/RunCMake/XcodeProject/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake new file mode 100644 index 0000000..8e4026b --- /dev/null +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(XcodeFileType) diff --git a/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake b/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake new file mode 100644 index 0000000..7882d7f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake @@ -0,0 +1,10 @@ +set(expect-default "explicitFileType = sourcecode") +set(expect-explicit "explicitFileType = \"sourcecode.c.h\"") +set(expect-lastKnown "lastKnownFileType = \"sourcecode.c.h\"") +foreach(src default explicit lastKnown) + file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeFileType.xcodeproj/project.pbxproj actual-${src} + REGEX "PBXFileReference.*src-${src}") + if(NOT actual-${src} MATCHES "${expect-${src}}") + message(SEND_ERROR "src-${src} does not match '${expect-${src}}':\n ${actual-${src}}") + endif() +endforeach() diff --git a/Tests/RunCMake/XcodeProject/XcodeFileType.cmake b/Tests/RunCMake/XcodeProject/XcodeFileType.cmake new file mode 100644 index 0000000..7faa781 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeFileType.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(main main.c src-default src-explicit src-lastKnown) +set_property(SOURCE src-explicit PROPERTY XCODE_EXPLICIT_FILE_TYPE sourcecode.c.h) +set_property(SOURCE src-lastKnown PROPERTY XCODE_LAST_KNOWN_FILE_TYPE sourcecode.c.h) diff --git a/Tests/RunCMake/XcodeProject/main.c b/Tests/RunCMake/XcodeProject/main.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/main.c diff --git a/Tests/RunCMake/XcodeProject/src-default b/Tests/RunCMake/XcodeProject/src-default new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/src-default diff --git a/Tests/RunCMake/XcodeProject/src-explicit b/Tests/RunCMake/XcodeProject/src-explicit new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/src-explicit diff --git a/Tests/RunCMake/XcodeProject/src-lastKnown b/Tests/RunCMake/XcodeProject/src-lastKnown new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/src-lastKnown diff --git a/Tests/RunCMake/configure_file/CMakeLists.txt b/Tests/RunCMake/configure_file/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/configure_file/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/configure_file/NO-BOM.cmake b/Tests/RunCMake/configure_file/NO-BOM.cmake new file mode 100644 index 0000000..003d526 --- /dev/null +++ b/Tests/RunCMake/configure_file/NO-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(NO-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/NO-BOM.txt) diff --git a/Tests/RunCMake/configure_file/NO-BOM.txt.in b/Tests/RunCMake/configure_file/NO-BOM.txt.in new file mode 100644 index 0000000..557db03 --- /dev/null +++ b/Tests/RunCMake/configure_file/NO-BOM.txt.in @@ -0,0 +1 @@ +Hello World diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake new file mode 100644 index 0000000..c8bfa57 --- /dev/null +++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(NO-BOM) +run_cmake(UTF8-BOM) +run_cmake(UTF16LE-BOM) +run_cmake(UTF16BE-BOM) +run_cmake(UTF32LE-BOM) +run_cmake(UTF32BE-BOM) diff --git a/Tests/RunCMake/configure_file/UTF16BE-BOM-result.txt b/Tests/RunCMake/configure_file/UTF16BE-BOM-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16BE-BOM-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/UTF16BE-BOM-stderr.txt b/Tests/RunCMake/configure_file/UTF16BE-BOM-stderr.txt new file mode 100644 index 0000000..5132c4d --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16BE-BOM-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at UTF16BE-BOM.cmake:2 \(configure_file\): + File starts with a Byte-Order-Mark that is not UTF-8: + + .*/Tests/RunCMake/configure_file/UTF16BE-BOM.txt.in +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/UTF16BE-BOM.cmake b/Tests/RunCMake/configure_file/UTF16BE-BOM.cmake new file mode 100644 index 0000000..c570742 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16BE-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(UTF16BE-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/UTF16BE-BOM.txt) diff --git a/Tests/RunCMake/configure_file/UTF16BE-BOM.txt.in b/Tests/RunCMake/configure_file/UTF16BE-BOM.txt.in Binary files differnew file mode 100644 index 0000000..70fd9cb --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16BE-BOM.txt.in diff --git a/Tests/RunCMake/configure_file/UTF16LE-BOM-result.txt b/Tests/RunCMake/configure_file/UTF16LE-BOM-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16LE-BOM-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/UTF16LE-BOM-stderr.txt b/Tests/RunCMake/configure_file/UTF16LE-BOM-stderr.txt new file mode 100644 index 0000000..8f997bc --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16LE-BOM-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at UTF16LE-BOM.cmake:2 \(configure_file\): + File starts with a Byte-Order-Mark that is not UTF-8: + + .*/Tests/RunCMake/configure_file/UTF16LE-BOM.txt.in +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/UTF16LE-BOM.cmake b/Tests/RunCMake/configure_file/UTF16LE-BOM.cmake new file mode 100644 index 0000000..05c9cd7 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16LE-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(UTF16LE-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/UTF16LE-BOM.txt) diff --git a/Tests/RunCMake/configure_file/UTF16LE-BOM.txt.in b/Tests/RunCMake/configure_file/UTF16LE-BOM.txt.in Binary files differnew file mode 100644 index 0000000..036f8c5 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16LE-BOM.txt.in diff --git a/Tests/RunCMake/configure_file/UTF32BE-BOM-result.txt b/Tests/RunCMake/configure_file/UTF32BE-BOM-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32BE-BOM-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/UTF32BE-BOM-stderr.txt b/Tests/RunCMake/configure_file/UTF32BE-BOM-stderr.txt new file mode 100644 index 0000000..12811aa --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32BE-BOM-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at UTF32BE-BOM.cmake:2 \(configure_file\): + File starts with a Byte-Order-Mark that is not UTF-8: + + .*/Tests/RunCMake/configure_file/UTF32BE-BOM.txt.in +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/UTF32BE-BOM.cmake b/Tests/RunCMake/configure_file/UTF32BE-BOM.cmake new file mode 100644 index 0000000..0c6ea87 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32BE-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(UTF32BE-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/UTF32BE-BOM.txt) diff --git a/Tests/RunCMake/configure_file/UTF32BE-BOM.txt.in b/Tests/RunCMake/configure_file/UTF32BE-BOM.txt.in Binary files differnew file mode 100644 index 0000000..c87cfd5 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32BE-BOM.txt.in diff --git a/Tests/RunCMake/configure_file/UTF32LE-BOM-result.txt b/Tests/RunCMake/configure_file/UTF32LE-BOM-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32LE-BOM-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/UTF32LE-BOM-stderr.txt b/Tests/RunCMake/configure_file/UTF32LE-BOM-stderr.txt new file mode 100644 index 0000000..fa9e01a --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32LE-BOM-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at UTF32LE-BOM.cmake:2 \(configure_file\): + File starts with a Byte-Order-Mark that is not UTF-8: + + .*/Tests/RunCMake/configure_file/UTF32LE-BOM.txt.in +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/UTF32LE-BOM.cmake b/Tests/RunCMake/configure_file/UTF32LE-BOM.cmake new file mode 100644 index 0000000..b6351b0 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32LE-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(UTF32LE-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/UTF32LE-BOM.txt) diff --git a/Tests/RunCMake/configure_file/UTF32LE-BOM.txt.in b/Tests/RunCMake/configure_file/UTF32LE-BOM.txt.in Binary files differnew file mode 100644 index 0000000..27c8183 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32LE-BOM.txt.in diff --git a/Tests/RunCMake/configure_file/UTF8-BOM.cmake b/Tests/RunCMake/configure_file/UTF8-BOM.cmake new file mode 100644 index 0000000..af2adae --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF8-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(UTF8-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/UTF8-BOM.txt) diff --git a/Tests/RunCMake/configure_file/UTF8-BOM.txt.in b/Tests/RunCMake/configure_file/UTF8-BOM.txt.in new file mode 100644 index 0000000..abc0aca --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF8-BOM.txt.in @@ -0,0 +1 @@ +Hello World diff --git a/Tests/RunCMake/file/CMakeLists.txt b/Tests/RunCMake/file/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/file/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/file/FileOpenFailRead-result.txt b/Tests/RunCMake/file/FileOpenFailRead-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/FileOpenFailRead-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/FileOpenFailRead-stderr.txt b/Tests/RunCMake/file/FileOpenFailRead-stderr.txt new file mode 100644 index 0000000..23d4337 --- /dev/null +++ b/Tests/RunCMake/file/FileOpenFailRead-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at FileOpenFailRead.cmake:[0-9]+ \(file\): + file failed to open for reading \(.*\): + + .*/Tests/RunCMake/file/does_not_exist/file.txt +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/file/FileOpenFailRead.cmake b/Tests/RunCMake/file/FileOpenFailRead.cmake new file mode 100644 index 0000000..4d4c6dc --- /dev/null +++ b/Tests/RunCMake/file/FileOpenFailRead.cmake @@ -0,0 +1 @@ +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist/file.txt" content) diff --git a/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt b/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt new file mode 100644 index 0000000..561a6b1 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt @@ -0,0 +1,8 @@ +-- Before Installing +-- Installing: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Installing: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- After Installing diff --git a/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake b/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake new file mode 100644 index 0000000..0bc1d18 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake @@ -0,0 +1,10 @@ +set(src ${CMAKE_CURRENT_SOURCE_DIR}/dir) +set(dst ${CMAKE_CURRENT_BINARY_DIR}/dir) +file(REMOVE RECURSE ${dst}) +message(STATUS "Before Installing") +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_NEVER) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_LAZY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_ALWAYS) +message(STATUS "After Installing") diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt new file mode 100644 index 0000000..557b817 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt @@ -0,0 +1,32 @@ +CMake Error at INSTALL-MESSAGE-bad.cmake:1 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:2 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:3 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:4 \(file\): + file option MESSAGE_ALWAYS may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:5 \(file\): + file option MESSAGE_LAZY may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:6 \(file\): + file option MESSAGE_NEVER may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake b/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake new file mode 100644 index 0000000..f878c69 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake @@ -0,0 +1,6 @@ +file(INSTALL DESTINATION dir MESSAGE_ALWAYS MESSAGE_LAZY) +file(INSTALL DESTINATION dir MESSAGE_ALWAYS MESSAGE_NEVER) +file(INSTALL DESTINATION dir MESSAGE_LAZY MESSAGE_NEVER) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_ALWAYS) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_LAZY) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_NEVER) diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake new file mode 100644 index 0000000..bf14263 --- /dev/null +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(INSTALL-DIRECTORY) +run_cmake(INSTALL-MESSAGE-bad) +run_cmake(FileOpenFailRead) diff --git a/Tests/RunCMake/file/dir/empty.txt b/Tests/RunCMake/file/dir/empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/dir/empty.txt diff --git a/Tests/RunCMake/find_dependency/CMakeLists.txt b/Tests/RunCMake/find_dependency/CMakeLists.txt new file mode 100644 index 0000000..04d09f2 --- /dev/null +++ b/Tests/RunCMake/find_dependency/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}") +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version-result.txt b/Tests/RunCMake/find_dependency/EXACT-no-version-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_dependency/EXACT-no-version-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt b/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt new file mode 100644 index 0000000..348f8bb --- /dev/null +++ b/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): + Invalid arguments to find_dependency. EXACT may only be specified if a + VERSION is specified +Call Stack \(most recent call first\): + EXACT-no-version.cmake:4 \(find_dependency\) + CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version.cmake b/Tests/RunCMake/find_dependency/EXACT-no-version.cmake new file mode 100644 index 0000000..b05665b7 --- /dev/null +++ b/Tests/RunCMake/find_dependency/EXACT-no-version.cmake @@ -0,0 +1,4 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 EXACT) diff --git a/Tests/RunCMake/find_dependency/Pack1/Pack1Config.cmake b/Tests/RunCMake/find_dependency/Pack1/Pack1Config.cmake new file mode 100644 index 0000000..7d55ef6 --- /dev/null +++ b/Tests/RunCMake/find_dependency/Pack1/Pack1Config.cmake @@ -0,0 +1,2 @@ + +add_library(Pack1::Lib INTERFACE IMPORTED) diff --git a/Tests/RunCMake/find_dependency/Pack1/Pack1ConfigVersion.cmake b/Tests/RunCMake/find_dependency/Pack1/Pack1ConfigVersion.cmake new file mode 100644 index 0000000..dfb7b6c --- /dev/null +++ b/Tests/RunCMake/find_dependency/Pack1/Pack1ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "1.3") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/Tests/RunCMake/find_dependency/RunCMakeTest.cmake b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake new file mode 100644 index 0000000..9403136 --- /dev/null +++ b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(EXACT-no-version) +run_cmake(empty-version) +run_cmake(empty-arg-3) +run_cmake(invalid-arg-3) +run_cmake(extra-args) diff --git a/Tests/RunCMake/find_dependency/empty-arg-3-result.txt b/Tests/RunCMake/find_dependency/empty-arg-3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-arg-3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt b/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt new file mode 100644 index 0000000..bf9b02b --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): + Invalid arguments to find_dependency +Call Stack \(most recent call first\): + empty-arg-3.cmake:4 \(find_dependency\) + CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/empty-arg-3.cmake b/Tests/RunCMake/find_dependency/empty-arg-3.cmake new file mode 100644 index 0000000..b08200a --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-arg-3.cmake @@ -0,0 +1,4 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 1.2 "") diff --git a/Tests/RunCMake/find_dependency/empty-version-result.txt b/Tests/RunCMake/find_dependency/empty-version-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-version-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_dependency/empty-version-stderr.txt b/Tests/RunCMake/find_dependency/empty-version-stderr.txt new file mode 100644 index 0000000..b5e9f46 --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-version-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*/Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): + Invalid arguments to find_dependency. VERSION is empty +Call Stack \(most recent call first\): + empty-version.cmake:4 \(find_dependency\) + CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/empty-version.cmake b/Tests/RunCMake/find_dependency/empty-version.cmake new file mode 100644 index 0000000..e6f17cd --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-version.cmake @@ -0,0 +1,4 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 "") diff --git a/Tests/RunCMake/find_dependency/extra-args-result.txt b/Tests/RunCMake/find_dependency/extra-args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_dependency/extra-args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_dependency/extra-args-stderr.txt b/Tests/RunCMake/find_dependency/extra-args-stderr.txt new file mode 100644 index 0000000..83a7f02 --- /dev/null +++ b/Tests/RunCMake/find_dependency/extra-args-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): + Invalid arguments to find_dependency +Call Stack \(most recent call first\): + extra-args.cmake:4 \(find_dependency\) + CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/extra-args.cmake b/Tests/RunCMake/find_dependency/extra-args.cmake new file mode 100644 index 0000000..209645a --- /dev/null +++ b/Tests/RunCMake/find_dependency/extra-args.cmake @@ -0,0 +1,4 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 1.2 EXACT PATHS "${CMAKE_BINARY_DIR}") diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3-result.txt b/Tests/RunCMake/find_dependency/invalid-arg-3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_dependency/invalid-arg-3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt b/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt new file mode 100644 index 0000000..fee8d5d --- /dev/null +++ b/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): + Invalid arguments to find_dependency +Call Stack \(most recent call first\): + invalid-arg-3.cmake:4 \(find_dependency\) + CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3.cmake b/Tests/RunCMake/find_dependency/invalid-arg-3.cmake new file mode 100644 index 0000000..40ede07 --- /dev/null +++ b/Tests/RunCMake/find_dependency/invalid-arg-3.cmake @@ -0,0 +1,4 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 1.2 EXACTYPO) diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-result.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-stderr.txt new file mode 100644 index 0000000..f0adc9f --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*Tests/RunCMake/include_directories/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-result.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-stderr.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-result.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-stderr.txt new file mode 100644 index 0000000..054bff5 --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-stderr.txt @@ -0,0 +1,20 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0052 is not set: Reject source and build dirs in installed + INTERFACE_INCLUDE_DIRECTORIES. Run "cmake --help-policy CMP0052" for + policy details. Use the cmake_policy command to set the policy and + suppress this warning. + + Directory: + + ".*Tests/RunCMake/include_directories/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo" + + in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory + of the install directory: + + ".*Tests/RunCMake/include_directories/prefix" + + however it is also a subdirectory of the build tree: + + ".*Tests/RunCMake/include_directories/prefix/BinInInstallPrefix-CMP0052-WARN-build" + +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/include_directories/CMakeLists.txt b/Tests/RunCMake/include_directories/CMakeLists.txt index f452db1..3482e6b 100644 --- a/Tests/RunCMake/include_directories/CMakeLists.txt +++ b/Tests/RunCMake/include_directories/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.0) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include_directories/DirInInstallPrefix-result.txt b/Tests/RunCMake/include_directories/DirInInstallPrefix-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/DirInInstallPrefix-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/DirInInstallPrefix-stderr.txt b/Tests/RunCMake/include_directories/DirInInstallPrefix-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/DirInInstallPrefix-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake b/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake new file mode 100644 index 0000000..d6f08bd --- /dev/null +++ b/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake @@ -0,0 +1,9 @@ + +add_library(testTarget empty.cpp) +target_include_directories(testTarget INTERFACE "${CMAKE_INSTALL_PREFIX}/dir") + +install(TARGETS testTarget EXPORT testTargets + DESTINATION lib +) + +install(EXPORT testTargets DESTINATION lib/cmake) diff --git a/Tests/RunCMake/include_directories/InstallInBinDir-result.txt b/Tests/RunCMake/include_directories/InstallInBinDir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallInBinDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include_directories/InstallInBinDir-stderr.txt b/Tests/RunCMake/include_directories/InstallInBinDir-stderr.txt new file mode 100644 index 0000000..254fae1 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallInBinDir-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*Tests/RunCMake/include_directories/InstallInBinDir-build/foo" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/include_directories/InstallInSrcDir-result.txt b/Tests/RunCMake/include_directories/InstallInSrcDir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallInSrcDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include_directories/InstallInSrcDir-stderr.txt b/Tests/RunCMake/include_directories/InstallInSrcDir-stderr.txt new file mode 100644 index 0000000..7be3044 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallInSrcDir-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*Tests/RunCMake/include_directories/copy/foo" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface-result.txt b/Tests/RunCMake/include_directories/InstallPrefixInInterface-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallPrefixInInterface-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface-stderr.txt b/Tests/RunCMake/include_directories/InstallPrefixInInterface-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallPrefixInInterface-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake b/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake new file mode 100644 index 0000000..0f08e58 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake @@ -0,0 +1,11 @@ + +project(InstallPrefixInInterface) + +add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") +target_include_directories(testTarget INTERFACE "${CMAKE_INSTALL_PREFIX}/foo") + +install(TARGETS testTarget EXPORT testTargets + DESTINATION lib +) + +install(EXPORT testTargets DESTINATION lib/cmake) diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-result.txt b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-stderr.txt b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-result.txt b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-stderr.txt b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index c00b924..c5b29d0 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -12,3 +12,131 @@ run_cmake(CMP0021) run_cmake(install_config) run_cmake(incomplete-genex) run_cmake(export-NOWARN) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/DirInInstallPrefix/prefix") +run_cmake(DirInInstallPrefix) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/copy/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/copy/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/SourceDirectoryInInterface.cmake" + "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" + COPYONLY +) +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix") +set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface") +set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/copy") +run_cmake(InstallInSrcDir) +unset(RunCMake_TEST_SOURCE_DIR) +unset(RunCMake_TEST_FILE) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix") +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/InstallInBinDir-build") +set(RunCMake_TEST_FILE "${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface") +run_cmake(InstallInBinDir) +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_FILE) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/prefix/src/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/prefix/src/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/SourceDirectoryInInterface.cmake" + "${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake" + COPYONLY +) + +foreach(policyStatus "" NEW OLD) + if (NOT "${policyStatus}" STREQUAL "") + set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus}) + else() + unset(policyOption) + set(policyStatus WARN) + endif() + set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}) + # Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run + # the test suite in-source properly. Otherwise the install directory would be + # a subdirectory or the source directory, which is allowed and tested separately + # below. + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build") + set(RunCMake_TEST_FILE "${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface") + run_cmake(BinInInstallPrefix-CMP0052-${policyStatus}) + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_FILE) + + set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface") + run_cmake(SrcInInstallPrefix-CMP0052-${policyStatus}) + unset(RunCMake_TEST_SOURCE_DIR) + unset(RunCMake_TEST_FILE) +endforeach() + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix") +run_cmake(InstallPrefixInInterface) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/installToSrc/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/installToSrc/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/InstallPrefixInInterface.cmake" + "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake" + COPYONLY +) +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface/prefix") +set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface") +set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrc") +run_cmake(InstallToPrefixInSrcDirOutOfSource) +unset(RunCMake_TEST_SOURCE_DIR) +unset(RunCMake_TEST_FILE) + + +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/installToSrcInSrc") +set(RunCMake_TEST_NO_CLEAN ON) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/installToSrcInSrc/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/installToSrcInSrc/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/InstallPrefixInInterface.cmake" + "${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface.cmake" + COPYONLY +) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface/prefix") +set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface") +set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") +run_cmake(InstallToPrefixInSrcDirInSource) +unset(RunCMake_TEST_SOURCE_DIR) +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_FILE) +unset(RunCMake_TEST_NO_CLEAN) diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-result.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-stderr.txt new file mode 100644 index 0000000..afa43e0 --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*Tests/RunCMake/include_directories/prefix/src/foo" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-result.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-stderr.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-result.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-stderr.txt new file mode 100644 index 0000000..0b13fd8 --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-stderr.txt @@ -0,0 +1,20 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0052 is not set: Reject source and build dirs in installed + INTERFACE_INCLUDE_DIRECTORIES. Run "cmake --help-policy CMP0052" for + policy details. Use the cmake_policy command to set the policy and + suppress this warning. + + Directory: + + ".*Tests/RunCMake/include_directories/prefix/src/foo" + + in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory + of the install directory: + + ".*Tests/RunCMake/include_directories/prefix" + + however it is also a subdirectory of the source tree: + + ".*Tests/RunCMake/include_directories/prefix/src" + +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake new file mode 100644 index 0000000..2c716e1 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake @@ -0,0 +1,13 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix) +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +if(out MATCHES "-- Installing: [^\n]*prefix/dir") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}Installation output was not quiet:\n${out}") +endif() +set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt) +if(NOT EXISTS "${f}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n") +endif() diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake new file mode 100644 index 0000000..eefb837 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake @@ -0,0 +1,3 @@ +set(CMAKE_INSTALL_MESSAGE "ALWAYS") +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix") +install(DIRECTORY dir/ DESTINATION dir MESSAGE_NEVER) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt new file mode 100644 index 0000000..166ba6f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at DIRECTORY-PATTERN-MESSAGE_NEVER.cmake:[0-9]+ \(install\): + install DIRECTORY does not allow "MESSAGE_NEVER" after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake new file mode 100644 index 0000000..de844f7 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake @@ -0,0 +1 @@ +install(DIRECTORY src DESTINATION src PATTERN *.txt MESSAGE_NEVER) diff --git a/Tests/RunCMake/install/DIRECTORY-message-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-check.cmake new file mode 100644 index 0000000..857681f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message-check.cmake @@ -0,0 +1,28 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix) +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +set(expect " +-- Installing: [^\n]*/prefix/dir\r? +-- Installing: [^\n]*/prefix/dir/empty.txt\r? +") +if(NOT out MATCHES "${expect}") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}First install did not say 'Installing' as expected:\n${out}") +endif() +set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt) +if(NOT EXISTS "${f}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n") +endif() +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +set(expect " +-- Up-to-date: [^\n]*/prefix/dir\r? +-- Up-to-date: [^\n]*/prefix/dir/empty.txt\r? +") +if(NOT out MATCHES "${expect}") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}Second install did not say 'Up-to-date' as expected:\n${out}") +endif() diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake new file mode 100644 index 0000000..c7e6018 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake @@ -0,0 +1,24 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix) +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +set(expect " +-- Installing: [^\n]*/prefix/dir\r? +-- Installing: [^\n]*/prefix/dir/empty.txt\r? +") +if(NOT out MATCHES "${expect}") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}First install did not say 'Installing' as expected:\n${out}") +endif() +set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt) +if(NOT EXISTS "${f}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n") +endif() +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +if(out MATCHES "(Installing|Up-to-date)") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}Second install was not silent as expected:\n${out}") +endif() diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake new file mode 100644 index 0000000..ed43567 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake @@ -0,0 +1,3 @@ +set(CMAKE_INSTALL_MESSAGE "LAZY") +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix") +install(DIRECTORY dir/ DESTINATION dir) diff --git a/Tests/RunCMake/install/DIRECTORY-message.cmake b/Tests/RunCMake/install/DIRECTORY-message.cmake new file mode 100644 index 0000000..913ed15 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message.cmake @@ -0,0 +1,3 @@ +set(CMAKE_INSTALL_MESSAGE "ALWAYS") +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix") +install(DIRECTORY dir/ DESTINATION dir) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index c8dc379..53b91f3 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -1,4 +1,8 @@ include(RunCMake) +run_cmake(DIRECTORY-MESSAGE_NEVER) +run_cmake(DIRECTORY-PATTERN-MESSAGE_NEVER) +run_cmake(DIRECTORY-message) +run_cmake(DIRECTORY-message-lazy) run_cmake(SkipInstallRulesWarning) run_cmake(SkipInstallRulesNoWarning1) run_cmake(SkipInstallRulesNoWarning2) diff --git a/Tests/RunCMake/install/dir/empty.txt b/Tests/RunCMake/install/dir/empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/install/dir/empty.txt diff --git a/Tests/RunCMake/set/ParentScope-result.txt b/Tests/RunCMake/set/ParentScope-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/set/ParentScope-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/set/PARENT_SCOPE.cmake b/Tests/RunCMake/set/ParentScope.cmake index 9bd6bca..9bd6bca 100644 --- a/Tests/RunCMake/set/PARENT_SCOPE.cmake +++ b/Tests/RunCMake/set/ParentScope.cmake diff --git a/Tests/RunCMake/set/RunCMakeTest.cmake b/Tests/RunCMake/set/RunCMakeTest.cmake index 5d036e3..1b51ea2 100644 --- a/Tests/RunCMake/set/RunCMakeTest.cmake +++ b/Tests/RunCMake/set/RunCMakeTest.cmake @@ -1,3 +1,3 @@ include(RunCMake) -run_cmake(PARENT_SCOPE) +run_cmake(ParentScope) diff --git a/Tests/RunCMake/target_compile_features/CMakeLists.txt b/Tests/RunCMake/target_compile_features/CMakeLists.txt new file mode 100644 index 0000000..3482e6b --- /dev/null +++ b/Tests/RunCMake/target_compile_features/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake new file mode 100644 index 0000000..33faf2b --- /dev/null +++ b/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake @@ -0,0 +1,13 @@ +include(RunCMake) + +run_cmake(not_enough_args) +run_cmake(alias_target) +run_cmake(utility_target) +run_cmake(invalid_args) +run_cmake(invalid_args_on_interface) +run_cmake(imported_target) +run_cmake(no_target) +run_cmake(not_a_cxx_feature) +run_cmake(no_matching_cxx_feature) +run_cmake(not_a_c_feature) +run_cmake(no_matching_c_feature) diff --git a/Tests/RunCMake/target_compile_features/alias_target-result.txt b/Tests/RunCMake/target_compile_features/alias_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/alias_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/alias_target-stderr.txt b/Tests/RunCMake/target_compile_features/alias_target-stderr.txt new file mode 100644 index 0000000..417bf62 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/alias_target-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at alias_target.cmake:4 \(target_compile_features\): + target_compile_features can not be used on an ALIAS target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/alias_target.cmake b/Tests/RunCMake/target_compile_features/alias_target.cmake new file mode 100644 index 0000000..d35ddba --- /dev/null +++ b/Tests/RunCMake/target_compile_features/alias_target.cmake @@ -0,0 +1,4 @@ + +add_executable(main empty.cpp) +add_executable(Alias::Main ALIAS main) +target_compile_features(Alias::Main PRIVATE cxx_delegating_constructors) diff --git a/Tests/RunCMake/target_compile_features/empty.c b/Tests/RunCMake/target_compile_features/empty.c new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/target_compile_features/empty.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_compile_features/empty.cpp b/Tests/RunCMake/target_compile_features/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/target_compile_features/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_compile_features/imported_target-result.txt b/Tests/RunCMake/target_compile_features/imported_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/imported_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/imported_target-stderr.txt b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt new file mode 100644 index 0000000..c6ff5ec --- /dev/null +++ b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at imported_target.cmake:3 \(target_compile_features\): + Cannot specify compile features for imported target "main". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/imported_target.cmake b/Tests/RunCMake/target_compile_features/imported_target.cmake new file mode 100644 index 0000000..e248c2f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/imported_target.cmake @@ -0,0 +1,3 @@ + +add_library(main INTERFACE IMPORTED) +target_compile_features(main INTERFACE cxx_delegating_constructors) diff --git a/Tests/RunCMake/target_compile_features/invalid_args-result.txt b/Tests/RunCMake/target_compile_features/invalid_args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/invalid_args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/invalid_args-stderr.txt b/Tests/RunCMake/target_compile_features/invalid_args-stderr.txt new file mode 100644 index 0000000..bd5b7b9 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/invalid_args-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at invalid_args.cmake:3 \(target_compile_features\): + target_compile_features called with invalid arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/invalid_args.cmake b/Tests/RunCMake/target_compile_features/invalid_args.cmake new file mode 100644 index 0000000..1a7fb37 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/invalid_args.cmake @@ -0,0 +1,3 @@ + +add_executable(main empty.cpp) +target_compile_features(main INVALID cxx_delegating_constructors) diff --git a/Tests/RunCMake/target_compile_features/invalid_args_on_interface-result.txt b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt new file mode 100644 index 0000000..c30209a --- /dev/null +++ b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at invalid_args_on_interface.cmake:3 \(target_compile_features\): + target_compile_features may only be set INTERFACE properties on INTERFACE + targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/invalid_args_on_interface.cmake b/Tests/RunCMake/target_compile_features/invalid_args_on_interface.cmake new file mode 100644 index 0000000..324d0f3 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/invalid_args_on_interface.cmake @@ -0,0 +1,3 @@ + +add_library(main INTERFACE) +target_compile_features(main PRIVATE cxx_delegating_constructors) diff --git a/Tests/RunCMake/target_compile_features/no_matching_c_feature-result.txt b/Tests/RunCMake/target_compile_features/no_matching_c_feature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/no_matching_c_feature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/no_matching_c_feature-stderr.txt b/Tests/RunCMake/target_compile_features/no_matching_c_feature-stderr.txt new file mode 100644 index 0000000..96b959c --- /dev/null +++ b/Tests/RunCMake/target_compile_features/no_matching_c_feature-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at no_matching_c_feature.cmake:[0-9][0-9]? \((target_compile_features|message)\): + The compiler feature "gnu_c_dummy" is not known to C compiler + + "GNU" + + version 4.8.1. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/no_matching_c_feature.cmake b/Tests/RunCMake/target_compile_features/no_matching_c_feature.cmake new file mode 100644 index 0000000..a44caf2 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/no_matching_c_feature.cmake @@ -0,0 +1,15 @@ + +if (NOT ";${CMAKE_C_COMPILE_FEATURES};" MATCHES ";gnu_c_typeof;") + # Simulate passing the test. + message(SEND_ERROR + "The compiler feature \"gnu_c_dummy\" is not known to C compiler\n\"GNU\"\nversion 4.8.1." + ) + return() +endif() + +add_executable(main empty.c) + +target_compile_features(main + PRIVATE + gnu_c_typeof +) diff --git a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-result.txt b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt new file mode 100644 index 0000000..f976dfe --- /dev/null +++ b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at no_matching_cxx_feature.cmake:[0-9][0-9]? \((target_compile_features|message)\): + The compiler feature "[^"]+" is not known to CXX compiler + + "[^"]*" + + version *[.0-9]+\. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake new file mode 100644 index 0000000..ab1fd76 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake @@ -0,0 +1,26 @@ + +if (NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";gnu_cxx_typeof;" + AND NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";msvc_cxx_sealed;" ) + # Simulate passing the test. + message(SEND_ERROR + "The compiler feature \"gnu_cxx_dummy\" is not known to CXX compiler\n\"GNU\"\nversion 4.8.1." + ) + return() +endif() + +if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";gnu_cxx_typeof;") + set(feature msvc_cxx_sealed) + if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";msvc_cxx_sealed;") + # If a compiler supports both extensions, remove one of them. + list(REMOVE_ITEM CMAKE_CXX_COMPILE_FEATURES msvc_cxx_sealed) + endif() +else() + set(feature gnu_cxx_typeof) +endif() + +add_executable(main empty.cpp) + +target_compile_features(main + PRIVATE + ${feature} +) diff --git a/Tests/RunCMake/target_compile_features/no_target-result.txt b/Tests/RunCMake/target_compile_features/no_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/no_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/no_target-stderr.txt b/Tests/RunCMake/target_compile_features/no_target-stderr.txt new file mode 100644 index 0000000..323ba7a --- /dev/null +++ b/Tests/RunCMake/target_compile_features/no_target-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at no_target.cmake:2 \(target_compile_features\): + Cannot specify compile features for target "main" which is not built by + this project. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/no_target.cmake b/Tests/RunCMake/target_compile_features/no_target.cmake new file mode 100644 index 0000000..3f0afe2 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/no_target.cmake @@ -0,0 +1,2 @@ + +target_compile_features(main INTERFACE cxx_delegating_constructors) diff --git a/Tests/RunCMake/target_compile_features/not_a_c_feature-result.txt b/Tests/RunCMake/target_compile_features/not_a_c_feature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/not_a_c_feature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/not_a_c_feature-stderr.txt b/Tests/RunCMake/target_compile_features/not_a_c_feature-stderr.txt new file mode 100644 index 0000000..6dd00f3 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/not_a_c_feature-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at not_a_c_feature.cmake:3 \(target_compile_features\): + target_compile_features specified unknown feature "c_not_a_feature" for + target "main". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/not_a_c_feature.cmake b/Tests/RunCMake/target_compile_features/not_a_c_feature.cmake new file mode 100644 index 0000000..0420698 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/not_a_c_feature.cmake @@ -0,0 +1,6 @@ + +add_executable(main empty.c) +target_compile_features(main + PRIVATE + c_not_a_feature +) diff --git a/Tests/RunCMake/target_compile_features/not_a_cxx_feature-result.txt b/Tests/RunCMake/target_compile_features/not_a_cxx_feature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/not_a_cxx_feature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt b/Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt new file mode 100644 index 0000000..efa2bad --- /dev/null +++ b/Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at not_a_cxx_feature.cmake:3 \(target_compile_features\): + target_compile_features specified unknown feature "cxx_not_a_feature" for + target "main". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/not_a_cxx_feature.cmake b/Tests/RunCMake/target_compile_features/not_a_cxx_feature.cmake new file mode 100644 index 0000000..0207b72 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/not_a_cxx_feature.cmake @@ -0,0 +1,6 @@ + +add_executable(main empty.cpp) +target_compile_features(main + PRIVATE + cxx_not_a_feature +) diff --git a/Tests/RunCMake/target_compile_features/not_enough_args-result.txt b/Tests/RunCMake/target_compile_features/not_enough_args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/not_enough_args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt b/Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt new file mode 100644 index 0000000..2f8d812 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at not_enough_args.cmake:3 \(target_compile_features\): + target_compile_features called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/not_enough_args.cmake b/Tests/RunCMake/target_compile_features/not_enough_args.cmake new file mode 100644 index 0000000..9561230 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/not_enough_args.cmake @@ -0,0 +1,3 @@ + +add_executable(main empty.cpp) +target_compile_features(main) diff --git a/Tests/RunCMake/target_compile_features/utility_target-result.txt b/Tests/RunCMake/target_compile_features/utility_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_features/utility_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_features/utility_target-stderr.txt b/Tests/RunCMake/target_compile_features/utility_target-stderr.txt new file mode 100644 index 0000000..d239059 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/utility_target-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at utility_target.cmake:4 \(target_compile_features\): + target_compile_features called with non-compilable target type +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/utility_target.cmake b/Tests/RunCMake/target_compile_features/utility_target.cmake new file mode 100644 index 0000000..8919056 --- /dev/null +++ b/Tests/RunCMake/target_compile_features/utility_target.cmake @@ -0,0 +1,4 @@ + +add_custom_target(utility) + +target_compile_features(utility PRIVATE cxx_delegating_constructors) |