diff options
Diffstat (limited to 'Tests')
205 files changed, 1438 insertions, 60 deletions
diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index 9467fae..c50b4e6 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -1,7 +1,15 @@ - cmake_minimum_required(VERSION 2.8.11) project(AliasTarget) +set(CMAKE_CXX_STANDARD 98) + +# Those versions of the HP compiler that need a flag to get proper C++98 +# template support also need a flag to use the newer C++ library. +if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND + CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") +endif () + add_library(foo SHARED empty.cpp) add_library(PREFIX::Foo ALIAS foo) add_library(Another::Alias ALIAS foo) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b397171..5014ef3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -411,6 +411,8 @@ if(BUILD_TESTING) ADD_TEST_MACRO(Module.GenerateExportHeader GenerateExportHeader) ADD_TEST_MACRO(Module.FindDependency FindDependency) + ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader) + if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-fPIE run_pic_test) @@ -2267,6 +2269,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release PASS_REGULAR_EXPRESSION "${CTestTestBadExe_REGEX}") configure_file( + "${CMake_SOURCE_DIR}/Tests/CTestTestBadGenerator/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestBadGenerator/test.cmake" + @ONLY ESCAPE_QUOTES) + add_test(CTestTestBadGenerator ${CMAKE_CTEST_COMMAND} + -C "\${CTestTest_CONFIG}" + -S "${CMake_BINARY_DIR}/Tests/CTestTestBadGenerator/test.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestBadGenerator/testOutput.log" + ) + set_property(TEST CTestTestBadGenerator PROPERTY + PASS_REGULAR_EXPRESSION "could not create generator named \"Bad Generator\"") + + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestParallel/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestParallel/test.cmake" @ONLY ESCAPE_QUOTES) diff --git a/Tests/CTestTestBadGenerator/CMakeLists.txt b/Tests/CTestTestBadGenerator/CMakeLists.txt new file mode 100644 index 0000000..d46d9bf --- /dev/null +++ b/Tests/CTestTestBadGenerator/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(CTestTestDepends NONE) +include(CTest) diff --git a/Tests/CTestTestBadGenerator/CTestConfig.cmake b/Tests/CTestTestBadGenerator/CTestConfig.cmake new file mode 100644 index 0000000..ef98189 --- /dev/null +++ b/Tests/CTestTestBadGenerator/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestBadGenerator") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestBadGenerator/test.cmake.in b/Tests/CTestTestBadGenerator/test.cmake.in new file mode 100644 index 0000000..fe4fba8 --- /dev/null +++ b/Tests/CTestTestBadGenerator/test.cmake.in @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.0) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Depends") + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestBadGenerator") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestBadGenerator") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "Bad Generator") +set(CTEST_CMAKE_GENERATOR_TOOLSET "") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index ce5004b..adf50d5 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -11,25 +11,60 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES) return() endif() -macro(run_test feature) - if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ${feature}) - add_library(test_${feature} OBJECT ${feature}.cpp) +macro(run_test feature lang) + if (";${CMAKE_${lang}_COMPILE_FEATURES};" MATCHES ${feature}) + add_library(test_${feature} OBJECT ${feature}) set_property(TARGET test_${feature} PROPERTY COMPILE_FEATURES "${feature}" ) else() - message("Not supported: ${feature}") + list(APPEND ${lang}_non_features ${feature}) endif() endmacro() -foreach(feature ${CMAKE_CXX_KNOWN_FEATURES}) - run_test(${feature}) +get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) +foreach(feature ${cxx_features}) + run_test(${feature} CXX) +endforeach() + +if (CMAKE_CXX_COMPILER_ID STREQUAL GNU + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + list(REMOVE_ITEM CXX_non_features + cxx_alignof + ) +endif() + +set(CXX_ext cpp) +set(CXX_standard_flag 11) +foreach(lang CXX) + if (CMAKE_${lang}_COMPILE_FEATURES) + foreach(feature ${${lang}_non_features}) + message("Testing feature : ${feature}") + try_compile(${feature}_works + "${CMAKE_CURRENT_BINARY_DIR}/${feature}_test" + "${CMAKE_CURRENT_SOURCE_DIR}/feature_test.${${lang}_ext}" + COMPILE_DEFINITIONS "-DTEST=${CMAKE_CURRENT_SOURCE_DIR}/${feature}.${${lang}_ext}" + CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD=${${lang}_standard_flag}" + OUTPUT_VARIABLE OUTPUT + ) + if (${feature}_works) + message(SEND_ERROR + "Feature ${feature} expected not to work for ${lang} ${CMAKE_${lang}_COMPILER_ID}-${CMAKE_${lang}_COMPILER_VERSION}. + Update the supported features or blacklist it.\n${OUTPUT}") + else() + message("Testing feature : ${feature} -- Fails, as expected.") + endif() + endforeach() + endif() endforeach() add_executable(CompileFeatures main.cpp) set_property(TARGET CompileFeatures PROPERTY COMPILE_FEATURES "cxx_auto_type" ) +set_property(TARGET CompileFeatures + PROPERTY CXX_STANDARD_REQUIRED TRUE +) add_executable(GenexCompileFeatures main.cpp) set_property(TARGET GenexCompileFeatures diff --git a/Tests/CompileFeatures/cxx_template_template_parameters.cpp b/Tests/CompileFeatures/cxx_template_template_parameters.cpp new file mode 100644 index 0000000..0fdd18d --- /dev/null +++ b/Tests/CompileFeatures/cxx_template_template_parameters.cpp @@ -0,0 +1,18 @@ + +template<template <typename> class T, typename U> +void someFunc(T<U>) +{ + +} + +template<typename T> +struct A +{ + +}; + +void otherFunc() +{ + A<int> a; + someFunc(a); +} diff --git a/Tests/CompileFeatures/feature_test.cpp b/Tests/CompileFeatures/feature_test.cpp new file mode 100644 index 0000000..4406c16 --- /dev/null +++ b/Tests/CompileFeatures/feature_test.cpp @@ -0,0 +1,10 @@ + +#define STRINGIFY_IMPL(X) #X +#define STRINGIFY(X) STRINGIFY_IMPL(X) + +#include STRINGIFY(TEST) + +int main() +{ + return 0; +} diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index d250f53..5fa46bf 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -392,6 +392,21 @@ if(NOT RESULT STREQUAL "a[b]c[d]e") "string(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")") endif() +# +# This tests needs Ansi C++98 +# +set(CMAKE_CXX_STANDARD 98) +# +# GNU extensions are needed for stricmp() on Windows. +# +set(CMAKE_CXX_EXTENSIONS TRUE) + +# Those versions of the HP compiler that need a flag to get proper C++98 +# template support also need a flag to use the newer C++ library. +if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND + CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") +endif () # # Create the libs and the main exe diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index bb00341..d3d9132 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -362,6 +362,21 @@ if(NOT RESULT STREQUAL "a[b]c[d]e") "string(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")") endif() +# +# This tests needs Ansi C++98 +# +set(CMAKE_CXX_STANDARD 98) +# +# GNU extensions are needed for stricmp() on Windows. +# +set(CMAKE_CXX_EXTENSIONS TRUE) + +# Those versions of the HP compiler that need a flag to get proper C++98 +# template support also need a flag to use the newer C++ library. +if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND + CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") +endif () # # Create the libs and the main exe diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt index 1f30c67..18d9b76 100644 --- a/Tests/ExportImport/Import/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt @@ -50,9 +50,9 @@ macro(do_try_compile prefix) auto value = 0; return value; } - " ${prefix}IMPORTED_IFACE_CONSTEXPR) + " ${prefix}IMPORTED_IFACE_AUTO_TYPE) - if(NOT ${prefix}IMPORTED_IFACE_CONSTEXPR) + if(NOT ${prefix}IMPORTED_IFACE_AUTO_TYPE) message(SEND_ERROR "${prefix} try_compile with IMPORTED INTERFACE target failed!\n\n${OUTPUT}") endif() endif() diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index a77713f..092bf20 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -320,18 +320,55 @@ endif() #----------------------------------------------------------------------------- # Test export(PACKAGE) with find_package. + +# Choose a unique version. +string(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION}) +string(RANDOM LENGTH 4 ALPHABET "0123456789" v) +set(version "${version}.${v}") + message(STATUS "Preparing export(PACKAGE) test project") try_compile(EXPORTER_COMPILED - ${FindPackageTest_BINARY_DIR}/Exporter + ${FindPackageTest_BINARY_DIR}/Exporter-build ${FindPackageTest_SOURCE_DIR}/Exporter CMakeTestExportPackage dummy + CMAKE_FLAGS "-UCMAKE_EXPORT_NO_PACKAGE_REGISTRY" + -Dversion=${version} OUTPUT_VARIABLE output) message(STATUS "Searching for export(PACKAGE) test project") set(CMakeTestExportPackage_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) -string(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION}) find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED) +message(STATUS "Searching for export(PACKAGE) test project with CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE") +set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY TRUE) +set(CMakeTestExportPackage_DIR "" CACHE FILEPATH + "Wipe out find results for testing." FORCE) +find_package(CMakeTestExportPackage 1.${version} EXACT QUIET) +if(CMakeTestExportPackage_FOUND) + message(SEND_ERROR "CMakeTestExportPackage should not be FOUND!") +endif() +unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY) + +message(STATUS "Remove export(PACKAGE) test project") +file(REMOVE_RECURSE ${FindPackageTest_BINARY_DIR}/Exporter-build) +set(CMakeTestExportPackage_DIR "" CACHE FILEPATH + "Wipe out find results for testing." FORCE) +find_package(CMakeTestExportPackage QUIET) # Should clean the user package cache +# +message(STATUS "Preparing export(PACKAGE) test project with CMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE") +try_compile(EXPORTER_COMPILED + ${FindPackageTest_BINARY_DIR}/Exporter-build + ${FindPackageTest_SOURCE_DIR}/Exporter + CMakeTestExportPackage dummy + CMAKE_FLAGS "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=TRUE" + -Dversion=${version} + OUTPUT_VARIABLE output) +message(STATUS "Searching for export(PACKAGE) test project") +find_package(CMakeTestExportPackage 1.${version} EXACT QUIET) +if(CMakeTestExportPackage_FOUND) + message(SEND_ERROR "CMakeTestExportPackage should not be FOUND!") +endif() + #----------------------------------------------------------------------------- # Test configure_package_config_file(). diff --git a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in index 42bd84e..6eac6e6 100644 --- a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in +++ b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in @@ -1,5 +1,5 @@ # Test config file. -set(PACKAGE_VERSION "1.@CMAKE_VERSION@") +set(PACKAGE_VERSION "1.@version@") if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}") set(PACKAGE_VERSION_COMPATIBLE 1) set(PACKAGE_VERSION_EXACT 1) diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index bf867a9..b52c44d 100644 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt @@ -57,6 +57,15 @@ endif() include(GenerateExportHeader) +set(CMAKE_CXX_STANDARD 98) + +# Those versions of the HP compiler that need a flag to get proper C++98 +# template support also need a flag to use the newer C++ library. +if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND + CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") +endif () + add_subdirectory(lib_shared_and_static) add_compiler_export_flags() diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt new file mode 100644 index 0000000..6c5e0be --- /dev/null +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -0,0 +1,79 @@ +cmake_minimum_required(VERSION 3.0.0) +project(WriteCompilerDetectionHeader) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +include(WriteCompilerDetectionHeader) + +get_property(cxx_known_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h" + PREFIX TEST + COMPILERS GNU + VERSION 3.1 + PROLOG "// something" + EPILOG "// more" + FEATURES + ${cxx_known_features} +) + +if (NOT CMAKE_CXX_COMPILE_FEATURES) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" + "int main(int,char**) { return 0; }\n" + ) + add_executable(WriteCompilerDetectionHeader "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") + + include(CheckCXXSourceCompiles) + check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n" + file_include_works + ) + if (file_include_works) + message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h was expected to cause an error, but did not.") + endif() + return() +endif() + +macro(set_defines target true_defs false_defs) + set(defines) + foreach(def ${true_defs}) + list(APPEND defines ${def}=1) + endforeach() + foreach(def ${false_defs}) + list(APPEND defines ${def}=0) + endforeach() + target_compile_definitions(${target} + PRIVATE + ${defines} + ) +endmacro() + +if (CMAKE_CXX_COMPILER_ID STREQUAL GNU) + # False for C++98 mode. + list(APPEND false_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS) + list(APPEND false_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES) +endif() + +add_executable(WriteCompilerDetectionHeader main.cpp) +set_property(TARGET WriteCompilerDetectionHeader PROPERTY CXX_STANDARD 98) +set_defines(WriteCompilerDetectionHeader "${true_defs}" "${false_defs}") + +if(MSVC) + return() # MSVC has only one mode. +endif() + +# Since GNU 4.7 +if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;") + list(APPEND true_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS) + list(REMOVE_ITEM false_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS) +endif() + +# Since GNU 4.4 +if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_variadic_templates;") + list(APPEND true_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES) + list(REMOVE_ITEM false_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES) +endif() + +add_executable(WriteCompilerDetectionHeader_11 main.cpp) +set_property(TARGET WriteCompilerDetectionHeader_11 PROPERTY CXX_STANDARD 11) +set_defines(WriteCompilerDetectionHeader_11 "${true_defs}" "${false_defs}") diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.cpp b/Tests/Module/WriteCompilerDetectionHeader/main.cpp new file mode 100644 index 0000000..8b4ea52 --- /dev/null +++ b/Tests/Module/WriteCompilerDetectionHeader/main.cpp @@ -0,0 +1,19 @@ + +#include "test_compiler_detection.h" + +#define JOIN_IMPL(A, B) A ## B +#define JOIN(A, B) JOIN_IMPL(A, B) +#define CHECK(FEATURE) (JOIN(TEST_COMPILER_, FEATURE) == JOIN(EXPECTED_COMPILER_, FEATURE)) + +#if !CHECK(CXX_DELEGATING_CONSTRUCTORS) +#error cxx_delegating_constructors expected availability did not match. +#endif + +#if !CHECK(CXX_VARIADIC_TEMPLATES) +#error cxx_variadic_templates expected availability did not match. +#endif + +int main() +{ + return 0; +} diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt index c6ed15d..ecdece8 100644 --- a/Tests/Plugin/CMakeLists.txt +++ b/Tests/Plugin/CMakeLists.txt @@ -24,6 +24,16 @@ include_directories( ${Plugin_SOURCE_DIR}/include ) +# We need proper C++98 support from the compiler +set(CMAKE_CXX_STANDARD 98) + +# Those versions of the HP compiler that need a flag to get proper C++98 +# template support also need a flag to use the newer C++ library. +if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND + CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") +endif () + # Create an executable that exports an API for use by plugins. add_executable(example_exe src/example_exe.cxx) set_target_properties(example_exe PROPERTIES diff --git a/Tests/Qt4Targets/CMakeLists.txt b/Tests/Qt4Targets/CMakeLists.txt index 7430084..ae0a02b 100644 --- a/Tests/Qt4Targets/CMakeLists.txt +++ b/Tests/Qt4Targets/CMakeLists.txt @@ -37,29 +37,44 @@ set_property(TARGET Qt4WrapMacroTest PROPERTY AUTOMOC OFF) target_include_directories(Qt4WrapMacroTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/interface") target_link_libraries(Qt4WrapMacroTest Qt4::QtGui) -set(timeformat "%Y%j%H%M%S") -try_compile(RESULT - "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild" - "${CMAKE_CURRENT_SOURCE_DIR}/IncrementalMoc" - IncrementalMoc - CMAKE_FLAGS -DADD_DEF=0 "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}") -file(TIMESTAMP "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild/moc_foo.cpp" tsvar_before "${timeformat}") -if (NOT tsvar_before) - message(SEND_ERROR "Unable to read timestamp from moc file from first build!") -endif() +macro(test_incremental def) + set(timeformat "%Y%j%H%M%S") + try_compile(RESULT + "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild_${def}" + "${CMAKE_CURRENT_SOURCE_DIR}/IncrementalMoc" + IncrementalMoc + CMAKE_FLAGS -D${def}=0 "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output + ) + file(TIMESTAMP "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild_${def}/moc_foo.cpp" tsvar_before "${timeformat}") + if (NOT tsvar_before) + message(SEND_ERROR + "Unable to read timestamp from moc file from first build with -D${def}!\n" + "try_compile output:\n${output}" + ) + endif() -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 2) # Ensure that the timestamp will change. + execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 2) # Ensure that the timestamp will change. -try_compile(RESULT - "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild" - "${CMAKE_CURRENT_SOURCE_DIR}/IncrementalMoc" - IncrementalMoc - CMAKE_FLAGS -DADD_DEF=1 "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}") -file(TIMESTAMP "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild/moc_foo.cpp" tsvar_after "${timeformat}") -if (NOT tsvar_after) - message(SEND_ERROR "Unable to read timestamp from moc file from second build!") -endif() + try_compile(RESULT + "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild_${def}" + "${CMAKE_CURRENT_SOURCE_DIR}/IncrementalMoc" + IncrementalMoc + CMAKE_FLAGS -D${def}=1 "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output + ) + file(TIMESTAMP "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild_${def}/moc_foo.cpp" tsvar_after "${timeformat}") + if (NOT tsvar_after) + message(SEND_ERROR + "Unable to read timestamp from moc file from second build!\n" + "try_compile output:\n${output}" + ) + endif() -if (NOT tsvar_after GREATER tsvar_before) - message(SEND_ERROR "Rebuild did not re-create moc file. Before: ${tsvar_before}. After: ${tsvar_after}") -endif() + if (NOT tsvar_after GREATER tsvar_before) + message(SEND_ERROR "Rebuild did not re-create moc file with -D${def}. Before: ${tsvar_before}. After: ${tsvar_after}") + endif() +endmacro() + +test_incremental(ADD_TARGET_DEF) +test_incremental(ADD_DIR_DEF) diff --git a/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt b/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt index 4ba0ced..65e2b64 100644 --- a/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt +++ b/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt @@ -4,10 +4,18 @@ project(IncrementalMoc) find_package(Qt4 REQUIRED) -qt4_generate_moc(foo.h moc_foo.cpp) +if (ADD_TARGET_DEF) + set(target_args TARGET testlib) +endif() + +if (ADD_DIR_DEF) + add_definitions(-DNEW_DEF) +endif() + +qt4_generate_moc(foo.h moc_foo.cpp ${target_args}) add_library(testlib foo.cpp moc_foo.cpp) target_link_libraries(testlib Qt4::QtCore) -if (ADD_DEF) +if (ADD_TARGET_DEF) target_compile_definitions(testlib PRIVATE NEW_DEF) endif() diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt new file mode 100644 index 0000000..17a7db0 --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(otherlib ../empty.cpp) diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt index 9b88194..d122c4a 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt @@ -10,3 +10,16 @@ CMake Warning \(dev\) at CMP0026-WARN.cmake:5 \(get_target_property\): 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 CMP0026-WARN.cmake:8 \(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 "otherlib". 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/CMP0026-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake index 89c5a8a..bfc9203 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake @@ -3,3 +3,6 @@ enable_language(CXX) add_library(somelib empty.cpp) get_target_property(_loc somelib LOCATION) + +add_subdirectory(CMP0026-WARN-Dir) +get_target_property(_loc otherlib LOCATION) diff --git a/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt b/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt @@ -0,0 +1 @@ +0 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-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-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt index f1b0357..ae2e468 100644 --- a/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt @@ -12,4 +12,20 @@ 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"$ +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 index fd595ce..744598f 100644 --- a/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake @@ -6,3 +6,9 @@ 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/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e797a73..7f6ebf1 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -54,6 +54,7 @@ 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) diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures-stderr.txt b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures-stderr.txt index 8b029ac..fc882cb 100644 --- a/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures-stderr.txt +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeatures-stderr.txt @@ -1,5 +1,5 @@ CMake Error at NoSupportedCxxFeatures.cmake:3 \(target_compile_features\): - target_compile_features no known features for compiler + target_compile_features no known features for CXX compiler "[^"]*" diff --git a/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex-stderr.txt b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex-stderr.txt index d8366b2..66d0d41 100644 --- a/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex-stderr.txt +++ b/Tests/RunCMake/CompileFeatures/NoSupportedCxxFeaturesGenex-stderr.txt @@ -1,5 +1,5 @@ CMake Error in CMakeLists.txt: - No known features for compiler + No known features for CXX compiler "[^"]*" 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..10b251a --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11.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/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..9e726c8 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.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 TRUE) +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..8f6755f --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.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 TRUE) 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..29703db --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.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/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..4ea595e --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98.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/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..fdf4cc7 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake @@ -0,0 +1,5 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 98) +set_property(TARGET foo PROPERTY CXX_EXTENSIONS TRUE) +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..a26a22d --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.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 TRUE) 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..0e3ef8d --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.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/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake index 43d4cb3..bb4e0f9 100644 --- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake @@ -10,11 +10,26 @@ run_cmake(NotAFeature_OriginDebug_target_compile_features) run_cmake(generate_feature_list) file(READ - "${RunCMake_BINARY_DIR}/generate_feature_list-build/features.txt" - FEATURES + "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx_features.txt" + CXX_FEATURES ) -if (NOT FEATURES) +if (NOT CXX_FEATURES) run_cmake(NoSupportedCxxFeatures) run_cmake(NoSupportedCxxFeaturesGenex) 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/generate_feature_list.cmake b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake index 2bbbd17..beb15fc 100644 --- a/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake +++ b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake @@ -1,4 +1,23 @@ -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/features.txt" +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/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/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/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/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 dcabd8a..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,20 @@ 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) @@ -65,3 +82,29 @@ 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/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..842eb3f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + VERSION parameter too low. +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/target_compile_features/no_matching_cxx_feature-stderr.txt b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt index 4c76c7a..f976dfe 100644 --- a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt +++ b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt @@ -1,5 +1,5 @@ CMake Error at no_matching_cxx_feature.cmake:[0-9][0-9]? \((target_compile_features|message)\): - The compiler feature "[^"]+" is not known to compiler + The compiler feature "[^"]+" is not known to CXX compiler "[^"]*" diff --git a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake index 0452dbf..ab1fd76 100644 --- a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake +++ b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake @@ -3,7 +3,7 @@ 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 compiler\n\"GNU\"\nversion 4.8.1." + "The compiler feature \"gnu_cxx_dummy\" is not known to CXX compiler\n\"GNU\"\nversion 4.8.1." ) return() endif() diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index be6d8fe..4fa5a86 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -127,12 +127,6 @@ string(LENGTH ${substringres} lengthres) file(RELATIVE_PATH relpath "/usr/local/bin" "/usr/X11R6/bin/xnest") -# Escaping test -set(var "\\ \" \ \t \n \r \# \( \) \0") -message("Output: [${var}]") -set(var \\ \" \ \t \n \r \# \( \) \0) -message("Output: [${var}]") - # Make-style unquoted argument test set(var $(VAR1)$(VAR2)/$(VAR3)) message("Output: [${var}]") @@ -141,13 +135,6 @@ if(NOT result) message(SEND_ERROR "Unquoted $(VAR) syntax is broken.") endif() -# Obscure environment variable name -set("ENV{x+(y)}" "Obscure environment variable value") -message("Output: [$ENV{x+(y)}]") -if(NOT "$ENV{x+(y)}" STREQUAL "Obscure environment variable value") - message(SEND_ERROR "Environment variable \"ENV{x+(y)}\" does not work.") -endif() - # Make directories test file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Includes" diff --git a/Tests/SystemInformation/SystemInformation.in b/Tests/SystemInformation/SystemInformation.in index 954a2fe..9966e8d 100644 --- a/Tests/SystemInformation/SystemInformation.in +++ b/Tests/SystemInformation/SystemInformation.in @@ -26,6 +26,7 @@ CMAKE_CXX11_STANDARD_COMPILE_OPTION == "${CMAKE_CXX11_STANDARD_COMPILE_OPTION}" CMAKE_CXX98_EXTENSION_COMPILE_OPTION == "${CMAKE_CXX98_EXTENSION_COMPILE_OPTION}" CMAKE_CXX11_EXTENSION_COMPILE_OPTION == "${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}" CMAKE_CXX_COMPILE_FEATURES == "${CMAKE_CXX_COMPILE_FEATURES}" +CMAKE_CXX98_COMPILE_FEATURES == "${CMAKE_CXX98_COMPILE_FEATURES}" CMAKE_CXX11_COMPILE_FEATURES == "${CMAKE_CXX11_COMPILE_FEATURES}" // C shared library flag |