diff options
Diffstat (limited to 'Tests')
535 files changed, 4995 insertions, 501 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 11978db..3b4ff60 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -42,7 +42,7 @@ list(APPEND _cmake_options "-DTEST_LINK_DEPENDS=${TEST_LINK_DEPENDS}") list(APPEND _cmake_options "-DCMAKE_FORCE_DEPFILES=1") -if(NOT CMAKE_GENERATOR MATCHES "Visual Studio ([^89]|[89][0-9])") +if(NOT CMAKE_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])") set(TEST_MULTI3 1) list(APPEND _cmake_options "-DTEST_MULTI3=1") endif() diff --git a/Tests/CMakeCommands/add_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/add_compile_definitions/CMakeLists.txt new file mode 100644 index 0000000..2eb887e --- /dev/null +++ b/Tests/CMakeCommands/add_compile_definitions/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.1) + +project(add_compile_definitions LANGUAGES CXX) + +add_compile_definitions(TEST_DEFINITION + $<$<COMPILE_LANGUAGE:CXX>:LANG_$<COMPILE_LANGUAGE>> + $<$<EQUAL:0,1>:UNEXPECTED_DEFINITION>) + +add_executable(add_compile_definitions main.cpp) + +add_library(imp UNKNOWN IMPORTED) +get_target_property(_res imp COMPILE_DEFINITIONS) +if (_res) + message(SEND_ERROR "add_compile_definitions populated the COMPILE_DEFINITIONS target property") +endif() diff --git a/Tests/CMakeCommands/add_compile_definitions/main.cpp b/Tests/CMakeCommands/add_compile_definitions/main.cpp new file mode 100644 index 0000000..b382922 --- /dev/null +++ b/Tests/CMakeCommands/add_compile_definitions/main.cpp @@ -0,0 +1,17 @@ + +#ifndef TEST_DEFINITION +#error Expected TEST_DEFINITION +#endif + +#ifndef LANG_CXX +#error Expected LANG_CXX +#endif + +#ifdef UNPEXTED_DEFINITION +#error Unexpected UNPEXTED_DEFINITION +#endif + +int main(void) +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt index 5096a58..9664025 100644 --- a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required(VERSION 3.0) -cmake_policy(SET CMP0057 NEW) +cmake_minimum_required(VERSION 3.3) project(target_compile_features) set(CMAKE_VERBOSE_MAKEFILE ON) @@ -19,7 +18,8 @@ if (c_restrict IN_LIST CMAKE_C_COMPILE_FEATURES) target_link_libraries(c_restrict_user_specific c_lib_restrict_specific) endif() -if (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES) +if (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES AND + NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") add_executable(c_target_compile_features_meta main.c) target_compile_features(c_target_compile_features_meta PRIVATE c_std_99 diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 06df53f..126076d 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -49,3 +49,6 @@ if(TEST_CompileCommandOutput) endif() add_subdirectory(PseudoMemcheck) + +add_executable(testAffinity testAffinity.cxx) +target_link_libraries(testAffinity CMakeLib) diff --git a/Tests/CMakeLib/testAffinity.cxx b/Tests/CMakeLib/testAffinity.cxx new file mode 100644 index 0000000..4b82280 --- /dev/null +++ b/Tests/CMakeLib/testAffinity.cxx @@ -0,0 +1,18 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmAffinity.h" + +#include <cstddef> +#include <iostream> +#include <set> + +int main() +{ + std::set<size_t> cpus = cmAffinity::GetProcessorsAvailable(); + if (!cpus.empty()) { + std::cout << "CPU affinity mask count is '" << cpus.size() << "'.\n"; + } else { + std::cout << "CPU affinity not supported on this platform.\n"; + } + return 0; +} diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect index fa436cb..1ffd6b9 100644 --- a/Tests/CMakeLib/testRST.expect +++ b/Tests/CMakeLib/testRST.expect @@ -16,7 +16,13 @@ Variable ``<PLACEHOLDER>_VARIABLE`` with leading placeholder. Variable ``VARIABLE_<PLACEHOLDER>`` with trailing placeholder. Variable ``<PLACEHOLDER>_VARIABLE`` with leading placeholder and target. Variable ``VARIABLE_<PLACEHOLDER>`` with trailing placeholder and target. +Environment variable ``SOME_ENV_VAR``. +Environment variable ``some env var`` with space and target. Generator ``Some Generator`` with space. +Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``. +Inline link Link Text. +Inline link Link Text <With \-escaped Brackets>. +Inline literal ``__`` followed by inline link Link Text. First TOC entry. diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst index 54952dd..c8587c0 100644 --- a/Tests/CMakeLib/testRST.rst +++ b/Tests/CMakeLib/testRST.rst @@ -23,7 +23,13 @@ Variable :variable:`<PLACEHOLDER>_VARIABLE` with leading placeholder. Variable :variable:`VARIABLE_<PLACEHOLDER>` with trailing placeholder. Variable :variable:`<PLACEHOLDER>_VARIABLE <target>` with leading placeholder and target. Variable :variable:`VARIABLE_<PLACEHOLDER> <target>` with trailing placeholder and target. +Environment variable :envvar:`SOME_ENV_VAR`. +Environment variable :envvar:`some env var <SOME_ENV_VAR>` with space and target. Generator :generator:`Some Generator` with space. +Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``. +Inline link `Link Text <ExternalDest>`_. +Inline link `Link Text \<With \\-escaped Brackets\> <ExternalDest>`_. +Inline literal ``__`` followed by inline link `Link Text <InternalDest_>`_. .. |not replaced| replace:: not replaced through toctree .. |not replaced in literal| replace:: replaced in parsed literal diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 08bfebe..ea64646 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -64,7 +64,7 @@ if(BUILD_TESTING) set(CMake_TEST_DEVENV "") if(CMAKE_VS_DEVENV_COMMAND) set(CMake_TEST_DEVENV "${CMAKE_VS_DEVENV_COMMAND}") - elseif(CMAKE_GENERATOR MATCHES "Visual Studio [89] " AND + elseif(CMAKE_GENERATOR MATCHES "Visual Studio 9 " AND NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") set(CMake_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") endif() @@ -345,9 +345,10 @@ if(BUILD_TESTING) endif() endif() - if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^89]|[89][0-9])") + if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") ADD_TEST_MACRO(CSharpOnly CSharpOnly) ADD_TEST_MACRO(CSharpLinkToCxx CSharpLinkToCxx) + ADD_TEST_MACRO(CSharpLinkFromCxx CSharpLinkFromCxx) endif() ADD_TEST_MACRO(COnly COnly) @@ -816,6 +817,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ADD_TEST_MACRO(CustomCommandByproducts CustomCommandByproducts) + ADD_TEST_MACRO(CommandLength CommandLength) + ADD_TEST_MACRO(EmptyDepends ${CMAKE_CTEST_COMMAND}) add_test(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND} @@ -948,6 +951,44 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if(CTEST_TEST_CPACK) + add_test(CPackUseDefaultVersion ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackUseDefaultVersion" + "${CMake_BINARY_DIR}/Tests/CPackUseDefaultVersion" + ${build_generator_args} + --build-project CPackUseDefaultVersion + --build-two-config + --build-options ${build_options} + ${CPackUseDefaultVersion_BUILD_OPTIONS}) + set_tests_properties(CPackUseDefaultVersion PROPERTIES PASS_REGULAR_EXPRESSION "CPACK_PACKAGE_VERSION=0\\.1\\.1") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackUseDefaultVersion") + + add_test(CPackUseProjectVersion ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackUseProjectVersion" + "${CMake_BINARY_DIR}/Tests/CPackUseProjectVersion" + ${build_generator_args} + --build-project CPackUseProjectVersion + --build-two-config + --build-options ${build_options} + ${CPackUseProjectVersion_BUILD_OPTIONS}) + set_tests_properties(CPackUseProjectVersion PROPERTIES PASS_REGULAR_EXPRESSION "CPACK_PACKAGE_VERSION=1\\.2\\.3") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackUseProjectVersion") + + add_test(CPackUseShortProjectVersion ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackUseShortProjectVersion" + "${CMake_BINARY_DIR}/Tests/CPackUseShortProjectVersion" + ${build_generator_args} + --build-project CPackUseShortProjectVersion + --build-two-config + --build-options ${build_options} + ${CPackUseProjectVersion_BUILD_OPTIONS}) + set_tests_properties(CPackUseShortProjectVersion PROPERTIES PASS_REGULAR_EXPRESSION "CPACK_PACKAGE_VERSION=2") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackUseShortProjectVersion") + endif() + if(CTEST_RUN_CPackComponents) set(CPackComponents_BUILD_OPTIONS) if(APPLE) @@ -1323,6 +1364,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindBZip2) endif() + if(CMake_TEST_FindCURL) + add_subdirectory(FindCURL) + endif() + if(CMake_TEST_FindDoxygen) add_subdirectory(FindDoxygen) endif() @@ -1352,6 +1397,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindICU) endif() + if(CMake_TEST_FindJPEG) + add_subdirectory(FindJPEG) + endif() + if(CMake_TEST_FindJsonCpp) add_subdirectory(FindJsonCpp) endif() @@ -1364,6 +1413,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindLibUV) endif() + if(CMake_TEST_FindLibXml2) + add_subdirectory(FindLibXml2) + endif() + if(CMake_TEST_FindLTTngUST) add_subdirectory(FindLTTngUST) endif() @@ -1416,13 +1469,36 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindXercesC) endif() + if(CMake_TEST_FindPython) + add_subdirectory(FindPython) + endif() + + if(CMake_TEST_UseSWIG) + add_subdirectory(UseSWIG) + endif() + add_subdirectory(FindThreads) # Matlab module - if(CMake_TEST_FindMatlab) + # CMake_TEST_FindMatlab: indicates to look for Matlab (from PATH for Linux) + # CMake_TEST_FindMatlab_MCR: indicates the MCR is installed + # CMake_TEST_FindMatlab_MCR_ROOT_DIR: indicates an optional root directory for the MCR, required on Linux + if(CMake_TEST_FindMatlab OR CMake_TEST_FindMatlab_MCR OR (NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "")) + set(FindMatlab_additional_test_options ) + if(CMake_TEST_FindMatlab_MCR OR NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "") + set(FindMatlab_additional_test_options -DIS_MCR=TRUE) + endif() + if(NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "") + set(FindMatlab_additional_test_options ${FindMatlab_additional_test_options} "-DMCR_ROOT:FILEPATH=${CMake_TEST_FindMatlab_MCR_ROOT_DIR}") + endif() + set(FindMatlab.basic_checks_BUILD_OPTIONS ${FindMatlab_additional_test_options}) ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>) + set(FindMatlab.versions_checks_BUILD_OPTIONS ${FindMatlab_additional_test_options}) ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>) + set(FindMatlab.components_checks_BUILD_OPTIONS ${FindMatlab_additional_test_options}) ADD_TEST_MACRO(FindMatlab.components_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>) + set(FindMatlab.failure_reports_BUILD_OPTIONS ${FindMatlab_additional_test_options}) + ADD_TEST_MACRO(FindMatlab.failure_reports ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>) endif() find_package(GTK2 QUIET) @@ -1443,6 +1519,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject") set_tests_properties(ExternalProject PROPERTIES + RUN_SERIAL 1 TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) add_test(NAME ExternalProjectSubdir @@ -1482,6 +1559,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal") set_tests_properties(ExternalProjectLocal PROPERTIES + RUN_SERIAL 1 TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) add_test(ExternalProjectUpdateSetup ${CMAKE_CTEST_COMMAND} @@ -1497,6 +1575,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate") set_tests_properties(ExternalProjectUpdateSetup PROPERTIES + RUN_SERIAL 1 TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) add_test(NAME ExternalProjectUpdate @@ -1511,6 +1590,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate") set_tests_properties(ExternalProjectUpdate PROPERTIES + RUN_SERIAL 1 TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT} WORKING_DIRECTORY ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate DEPENDS ExternalProjectUpdateSetup ) @@ -1910,7 +1990,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() if(MSVC AND NOT MSVC_VERSION LESS 1310 - AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio [89]( |$)" + AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio 9 " OR CMAKE_SIZEOF_VOID_P EQUAL 4) ) ADD_TEST_MACRO(VSMASM VSMASM) @@ -1921,7 +2001,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ADD_TEST_MACRO(SBCS SBCS) endif() - if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio [89]( |$)" + if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio 9 " AND NOT CMAKE_GENERATOR_TOOLSET) ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx) endif() @@ -2120,7 +2200,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() - if(CMAKE_GENERATOR MATCHES "Visual Studio ([^89]|[89][0-9])" AND nasm) + if(CMAKE_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])" AND nasm) ADD_TEST_MACRO(VSNASM VSNASM) endif() @@ -2728,6 +2808,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --output-log "${CMake_BINARY_DIR}/Tests/CTestConfig/ScriptWithArgs.log" ) + ADD_TEST_MACRO(CMakeCommands.add_compile_definitions add_compile_definitions) ADD_TEST_MACRO(CMakeCommands.add_compile_options add_compile_options) ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries) ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 443d366..a53e441 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -86,7 +86,7 @@ foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG endforeach() foreach(VTEST BISON Boost CUDA DOXYGEN FLEX GIF GTK2 - HDF5 LibArchive OPENSCENEGRAPH RUBY SWIG Protobuf) + HDF5 JPEG LibArchive OPENSCENEGRAPH RUBY SWIG Protobuf) check_version_string(${VTEST} ${VTEST}_VERSION) endforeach() diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index c84fa74..204d54c 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -33,7 +33,7 @@ add_CMakeOnly_test(CompilerIdCXX) if(CMAKE_Fortran_COMPILER) add_CMakeOnly_test(CompilerIdFortran) endif() -if(CMAKE_GENERATOR MATCHES "Visual Studio ([^89]|[89][0-9])") +if(CMAKE_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])") add_CMakeOnly_test(CompilerIdCSharp) endif() diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in index 8145db7..4f2aaea 100644 --- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in +++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in @@ -308,13 +308,11 @@ message("======================================================================= if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "") # developers are allowed to have local additions and modifications... - set(is_dashboard 0) message("interactive test run") message("") else() - set(is_dashboard 1) message("dashboard test run") message("") @@ -341,7 +339,7 @@ endif() # Not even developers. # if(nonadditions) - if(in_source_build AND is_dashboard) + if(in_source_build) message(" warning: test results confounded because this is an 'in-source' build - cannot distinguish between non-added files that are in-source build products and diff --git a/Tests/CPackUseDefaultVersion/CMakeLists.txt b/Tests/CPackUseDefaultVersion/CMakeLists.txt new file mode 100644 index 0000000..9f21f3a --- /dev/null +++ b/Tests/CPackUseDefaultVersion/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.2) +project(CPackUseProjectVersion NONE) + +include(CPack) + +message("CPACK_PACKAGE_VERSION=${CPACK_PACKAGE_VERSION}") diff --git a/Tests/CPackUseProjectVersion/CMakeLists.txt b/Tests/CPackUseProjectVersion/CMakeLists.txt new file mode 100644 index 0000000..d4770ae --- /dev/null +++ b/Tests/CPackUseProjectVersion/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.2) +project(CPackUseProjectVersion VERSION 1.2.3 LANGUAGES NONE) + +include(CPack) + +message("CPACK_PACKAGE_VERSION=${CPACK_PACKAGE_VERSION}") diff --git a/Tests/CPackUseShortProjectVersion/CMakeLists.txt b/Tests/CPackUseShortProjectVersion/CMakeLists.txt new file mode 100644 index 0000000..855bc64 --- /dev/null +++ b/Tests/CPackUseShortProjectVersion/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.2) +project(CPackUseProjectVersion VERSION 2 LANGUAGES NONE) + +include(CPack) + +message("CPACK_PACKAGE_VERSION=${CPACK_PACKAGE_VERSION}") diff --git a/Tests/CSharpLinkFromCxx/.gitattributes b/Tests/CSharpLinkFromCxx/.gitattributes new file mode 100644 index 0000000..57a39049 --- /dev/null +++ b/Tests/CSharpLinkFromCxx/.gitattributes @@ -0,0 +1 @@ +UsefulManagedCppClass.* -format.clang-format diff --git a/Tests/CSharpLinkFromCxx/CMakeLists.txt b/Tests/CSharpLinkFromCxx/CMakeLists.txt new file mode 100644 index 0000000..9a1a993 --- /dev/null +++ b/Tests/CSharpLinkFromCxx/CMakeLists.txt @@ -0,0 +1,19 @@ +# Take a C# shared library and link it to a managed C++ shared library +cmake_minimum_required(VERSION 3.10) +project (CSharpLinkFromCxx CXX CSharp) + +add_library(CSharpLibrary SHARED UsefulCSharpClass.cs) + +# we have to change the default flags for the +# managed C++ project to build +string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) + +# The C# project is a dependency of the C++/CLI project +add_library(ManagedCppLibrary SHARED UsefulManagedCppClass.cpp UsefulManagedCppClass.hpp) +target_compile_options(ManagedCppLibrary PRIVATE "/clr") +target_link_libraries(ManagedCppLibrary PUBLIC CSharpLibrary) + +# Main executable for the test framework +add_executable(CSharpLinkFromCxx CSharpLinkFromCxx.cs) +target_link_libraries(CSharpLinkFromCxx PRIVATE ManagedCppLibrary) diff --git a/Tests/CSharpLinkFromCxx/CSharpLinkFromCxx.cs b/Tests/CSharpLinkFromCxx/CSharpLinkFromCxx.cs new file mode 100644 index 0000000..31a74eb --- /dev/null +++ b/Tests/CSharpLinkFromCxx/CSharpLinkFromCxx.cs @@ -0,0 +1,16 @@ +using System; +using CSharpLibrary; + +namespace CSharpLinkFromCxx +{ + internal class CSharpLinkFromCxx + { + public static void Main(string[] args) + { + Console.WriteLine("Starting test for CSharpLinkFromCxx"); + + var useful = new UsefulManagedCppClass(); + useful.RunTest(); + } + } +} diff --git a/Tests/CSharpLinkFromCxx/UsefulCSharpClass.cs b/Tests/CSharpLinkFromCxx/UsefulCSharpClass.cs new file mode 100644 index 0000000..749e57d --- /dev/null +++ b/Tests/CSharpLinkFromCxx/UsefulCSharpClass.cs @@ -0,0 +1,12 @@ +using System; + +namespace CSharpLibrary +{ + public class UsefulCSharpClass + { + public string GetSomethingUseful() + { + return "Something Useful"; + } + } +} diff --git a/Tests/CSharpLinkFromCxx/UsefulManagedCppClass.cpp b/Tests/CSharpLinkFromCxx/UsefulManagedCppClass.cpp new file mode 100644 index 0000000..9468812 --- /dev/null +++ b/Tests/CSharpLinkFromCxx/UsefulManagedCppClass.cpp @@ -0,0 +1,15 @@ +#include "UsefulManagedCppClass.hpp" + +namespace CSharpLibrary +{ + UsefulManagedCppClass::UsefulManagedCppClass() + { + auto useful = gcnew UsefulCSharpClass(); + m_usefulString = useful->GetSomethingUseful(); + } + + void UsefulManagedCppClass::RunTest() + { + Console::WriteLine("Printing from Managed CPP Class: " + m_usefulString); + } +} diff --git a/Tests/CSharpLinkFromCxx/UsefulManagedCppClass.hpp b/Tests/CSharpLinkFromCxx/UsefulManagedCppClass.hpp new file mode 100644 index 0000000..def7cea --- /dev/null +++ b/Tests/CSharpLinkFromCxx/UsefulManagedCppClass.hpp @@ -0,0 +1,16 @@ +using namespace System; + +namespace CSharpLibrary +{ + public ref class UsefulManagedCppClass + { + public: + + UsefulManagedCppClass(); + void RunTest(); + + private: + + String^ m_usefulString; + }; +} diff --git a/Tests/CTestTest/test.cmake.in b/Tests/CTestTest/test.cmake.in index 589bd44..23166a7 100644 --- a/Tests/CTestTest/test.cmake.in +++ b/Tests/CTestTest/test.cmake.in @@ -62,7 +62,7 @@ COVERAGE_COMMAND:FILEPATH=@COVERAGE_COMMAND@ set (CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@/Tests/CTestTest") -# set any extra environment varibles here +# set any extra environment variables here set (CTEST_ENVIRONMENT ) diff --git a/Tests/CommandLength/CMakeLists.txt b/Tests/CommandLength/CMakeLists.txt new file mode 100644 index 0000000..6836051 --- /dev/null +++ b/Tests/CommandLength/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.10) +project(CommandLength C) + +add_executable(CommandLength test.c) +add_custom_command(TARGET CommandLength POST_BUILD VERBATIM + COMMAND ${CMAKE_COMMAND} -E make_directory log) + +set(msg "xxxx $$$$ yyyy") +set(msg "${msg} ${msg}") +set(msg "${msg} ${msg}") +set(msg "${msg} ${msg}") +set(msg "${msg} ${msg}") +foreach(i RANGE 1 1000) + add_custom_command(TARGET CommandLength POST_BUILD VERBATIM + COMMAND ${CMAKE_COMMAND} -E echo "${i} ${msg}" > log/${i} + ) +endforeach() diff --git a/Tests/CommandLength/test.c b/Tests/CommandLength/test.c new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/CommandLength/test.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index b560acd..b0bc656 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -224,54 +224,22 @@ if (C_expected_features) add_executable(CompileFeaturesGenex_C genex_test.c) set_property(TARGET CompileFeaturesGenex_C PROPERTY C_STANDARD 11) - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) - list(APPEND expected_defs - EXPECT_C_STATIC_ASSERT=1 - ) - else() - list(APPEND expected_defs - EXPECT_C_STATIC_ASSERT=0 + foreach(f + c_restrict + c_static_assert + c_function_prototypes ) - endif() - elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" - OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang") - list(APPEND expected_defs - EXPECT_C_STATIC_ASSERT=1 - ) - elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel") - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15) - list(APPEND expected_defs - EXPECT_C_STATIC_ASSERT=1 - ) + if(${f} IN_LIST C_expected_features) + set(expect_${f} 1) else() - list(APPEND expected_defs - EXPECT_C_STATIC_ASSERT=0 - ) + set(expect_${f} 0) endif() - elseif (CMAKE_C_COMPILER_ID STREQUAL "SunPro") - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.13) - list(APPEND expected_defs - EXPECT_C_STATIC_ASSERT=1 - ) - else() - list(APPEND expected_defs - EXPECT_C_STATIC_ASSERT=0 - ) - endif() - endif() - - list(APPEND expected_defs - EXPECT_C_FUNCTION_PROTOTYPES=1 - EXPECT_C_RESTRICT=1 - ) - - target_compile_definitions(CompileFeaturesGenex_C PRIVATE - HAVE_C_FUNCTION_PROTOTYPES=$<COMPILE_FEATURES:c_function_prototypes> - HAVE_C_RESTRICT=$<COMPILE_FEATURES:c_restrict> - HAVE_C_STATIC_ASSERT=$<COMPILE_FEATURES:c_static_assert> - ${expected_defs} - ) + string(TOUPPER "${f}" F) + target_compile_definitions(CompileFeaturesGenex_C PRIVATE + EXPECT_${F}=${expect_${f}} + HAVE_${F}=$<COMPILE_FEATURES:${f}> + ) + endforeach() endif() if (CMAKE_CXX_COMPILE_FEATURES) @@ -280,6 +248,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) if (std_flag_idx EQUAL -1) add_executable(default_dialect default_dialect.cpp) target_compile_definitions(default_dialect PRIVATE + DEFAULT_CXX20=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},20> DEFAULT_CXX17=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},17> DEFAULT_CXX14=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},14> DEFAULT_CXX11=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},11> @@ -318,144 +287,62 @@ else() add_executable(IfaceCompileFeatures main.cpp) target_link_libraries(IfaceCompileFeatures iface) - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=1 - -DEXPECT_INHERITING_CONSTRUCTORS=1 - -DEXPECT_FINAL=1 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1 - ) - elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=1 - -DEXPECT_INHERITING_CONSTRUCTORS=0 - -DEXPECT_FINAL=1 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 - ) - else() - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=0 - -DEXPECT_INHERITING_CONSTRUCTORS=0 - -DEXPECT_FINAL=0 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 - ) - endif() - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=1 - -DEXPECT_INHERITING_CONSTRUCTORS=1 - -DEXPECT_FINAL=1 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1 - ) - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=1 - -DEXPECT_INHERITING_CONSTRUCTORS=1 - -DEXPECT_FINAL=1 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1 - ) - else() - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=1 - -DEXPECT_INHERITING_CONSTRUCTORS=0 - -DEXPECT_FINAL=1 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 - ) - endif() - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0) - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=1 - -DEXPECT_INHERITING_CONSTRUCTORS=1 - -DEXPECT_FINAL=1 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1 - ) - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.0) - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=1 - -DEXPECT_INHERITING_CONSTRUCTORS=0 - -DEXPECT_FINAL=1 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 - ) - else() - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=0 - -DEXPECT_INHERITING_CONSTRUCTORS=0 - -DEXPECT_FINAL=0 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 - ) - endif() - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=1 - -DEXPECT_INHERITING_CONSTRUCTORS=1 - -DEXPECT_FINAL=1 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1 - ) - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=1 - -DEXPECT_INHERITING_CONSTRUCTORS=1 - -DEXPECT_FINAL=1 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1 - ) - elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=1 - -DEXPECT_INHERITING_CONSTRUCTORS=0 - -DEXPECT_FINAL=1 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 + foreach(f + cxx_final + cxx_override + cxx_auto_type + cxx_inheriting_constructors ) + if(${f} IN_LIST CXX_expected_features) + set(expect_${f} 1) else() - add_definitions( - -DEXPECT_OVERRIDE_CONTROL=0 - -DEXPECT_INHERITING_CONSTRUCTORS=0 - -DEXPECT_FINAL=0 - -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 - ) + set(expect_${f} 0) endif() + endforeach() + + if(expect_cxx_final AND expect_cxx_override) + set(expect_override_control 1) + else() + set(expect_override_control 0) + endif() + if(expect_cxx_inheriting_constructors AND expect_cxx_final) + set(expect_inheriting_constructors_and_final 1) + else() + set(expect_inheriting_constructors_and_final 0) endif() - add_executable(CompileFeaturesGenex genex_test.cpp) - set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) - target_compile_definitions(CompileFeaturesGenex PRIVATE + set(genex_test_defs HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override> HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type> HAVE_INHERITING_CONSTRUCTORS=$<COMPILE_FEATURES:cxx_inheriting_constructors> HAVE_FINAL=$<COMPILE_FEATURES:cxx_final> HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$<COMPILE_FEATURES:cxx_inheriting_constructors,cxx_final> - ) + EXPECT_OVERRIDE_CONTROL=${expect_override_control} + EXPECT_INHERITING_CONSTRUCTORS=${expect_cxx_inheriting_constructors} + EXPECT_FINAL=${expect_cxx_final} + EXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=${expect_inheriting_constructors_and_final} + ) if (CMAKE_CXX_STANDARD_DEFAULT) - target_compile_definitions(CompileFeaturesGenex PRIVATE + list(APPEND genex_test_defs TEST_CXX_STD HAVE_CXX_STD_11=$<COMPILE_FEATURES:cxx_std_11> HAVE_CXX_STD_14=$<COMPILE_FEATURES:cxx_std_14> HAVE_CXX_STD_17=$<COMPILE_FEATURES:cxx_std_17> + HAVE_CXX_STD_20=$<COMPILE_FEATURES:cxx_std_20> ) endif() + add_executable(CompileFeaturesGenex genex_test.cpp) + set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) + target_compile_definitions(CompileFeaturesGenex PRIVATE ${genex_test_defs}) + add_executable(CompileFeaturesGenex2 genex_test.cpp) target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_std_11) - target_compile_definitions(CompileFeaturesGenex2 PRIVATE - HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override> - HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type> - HAVE_INHERITING_CONSTRUCTORS=$<COMPILE_FEATURES:cxx_inheriting_constructors> - HAVE_FINAL=$<COMPILE_FEATURES:cxx_final> - HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$<COMPILE_FEATURES:cxx_inheriting_constructors,cxx_final> - ) + target_compile_definitions(CompileFeaturesGenex2 PRIVATE ${genex_test_defs}) add_library(std_11_iface INTERFACE) target_compile_features(std_11_iface INTERFACE cxx_std_11) add_executable(CompileFeaturesGenex3 genex_test.cpp) target_link_libraries(CompileFeaturesGenex3 PRIVATE std_11_iface) - target_compile_definitions(CompileFeaturesGenex3 PRIVATE - HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override> - HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type> - HAVE_INHERITING_CONSTRUCTORS=$<COMPILE_FEATURES:cxx_inheriting_constructors> - HAVE_FINAL=$<COMPILE_FEATURES:cxx_final> - HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$<COMPILE_FEATURES:cxx_inheriting_constructors,cxx_final> - ) + target_compile_definitions(CompileFeaturesGenex3 PRIVATE ${genex_test_defs}) endif() diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp index 0de1125..7ddcfe7 100644 --- a/Tests/CompileFeatures/default_dialect.cpp +++ b/Tests/CompileFeatures/default_dialect.cpp @@ -8,7 +8,11 @@ struct Outputter; #define CXX_STD __cplusplus #endif -#if DEFAULT_CXX17 +#if DEFAULT_CXX20 +#if CXX_STD <= 201703L +Outputter<CXX_STD> o; +#endif +#elif DEFAULT_CXX17 #if CXX_STD <= 201402L Outputter<CXX_STD> o; #endif diff --git a/Tests/CompileFeatures/genex_test.c b/Tests/CompileFeatures/genex_test.c index 1d54840..e58d793 100644 --- a/Tests/CompileFeatures/genex_test.c +++ b/Tests/CompileFeatures/genex_test.c @@ -8,7 +8,7 @@ #error EXPECT_C_RESTRICT not defined #endif -#if !EXPECT_C_STATIC_ASSERT +#if !HAVE_C_STATIC_ASSERT #if EXPECT_C_STATIC_ASSERT #error "Expect c_static_assert feature" #endif @@ -18,11 +18,17 @@ #endif #endif -#if !EXPECT_C_FUNCTION_PROTOTYPES +#if !HAVE_C_FUNCTION_PROTOTYPES +#if EXPECT_C_FUNCTION_PROTOTYPES #error Expect c_function_prototypes support #endif +#else +#if !EXPECT_C_FUNCTION_PROTOTYPES +#error Expect no c_function_prototypes support +#endif +#endif -#if !EXPECT_C_RESTRICT +#if !HAVE_C_RESTRICT #if EXPECT_C_RESTRICT #error Expect c_restrict support #endif diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 692e0de..c9f1710 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -18,9 +18,21 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS "-DTEST_DEFINE" "-DNEEDS_ESCAPE=\"E$CAPE\"" "$<$<CXX_COMPILER_ID:GNU>:-DTEST_DEFINE_GNU>" + "SHELL:" # produces no options ${c_tests} ${cxx_tests} ) +if(BORLAND OR WATCOM) + # these compilers do not support separate -D flags + target_compile_definitions(CompileOptions PRIVATE NO_DEF_TESTS) +else() + set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS + "SHELL:-D DEF_A" + "$<1:SHELL:-D DEF_B>" + "SHELL:-D 'DEF_C' -D \"DEF_D\"" + [[SHELL:-D "DEF_STR=\"string with spaces\""]] + ) +endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland|Embarcadero") set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp index 63a0480..4779b88 100644 --- a/Tests/CompileOptions/main.cpp +++ b/Tests/CompileOptions/main.cpp @@ -12,6 +12,28 @@ #endif #endif +#ifndef NO_DEF_TESTS +#ifndef DEF_A +#error Expected definition DEF_A +#endif + +#ifndef DEF_B +#error Expected definition DEF_B +#endif + +#ifndef DEF_C +#error Expected definition DEF_C +#endif + +#ifndef DEF_D +#error Expected definition DEF_D +#endif + +#ifndef DEF_STR +#error Expected definition DEF_STR +#endif +#endif + #include <string.h> int main() @@ -20,6 +42,9 @@ int main() #ifdef TEST_OCTOTHORPE && strcmp(TEST_OCTOTHORPE, "#") == 0 #endif +#ifndef NO_DEF_TESTS + && strcmp(DEF_STR, "string with spaces") == 0 +#endif && strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0 && strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == diff --git a/Tests/Complex/Cache/CMakeCache.txt b/Tests/Complex/Cache/CMakeCache.txt index 17c55aa..727faa2 100644 --- a/Tests/Complex/Cache/CMakeCache.txt +++ b/Tests/Complex/Cache/CMakeCache.txt @@ -5,7 +5,7 @@ # If you do want to change a value, simply edit, save, and exit the editor. # The syntax for the file is as follows: # KEY:TYPE=VALUE -# KEY is the name of a varible in the cache. +# KEY is the name of a variable in the cache. # TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!. # VALUE is the current value for the KEY. diff --git a/Tests/ComplexOneConfig/Cache/CMakeCache.txt b/Tests/ComplexOneConfig/Cache/CMakeCache.txt index 17c55aa..727faa2 100644 --- a/Tests/ComplexOneConfig/Cache/CMakeCache.txt +++ b/Tests/ComplexOneConfig/Cache/CMakeCache.txt @@ -5,7 +5,7 @@ # If you do want to change a value, simply edit, save, and exit the editor. # The syntax for the file is as follows: # KEY:TYPE=VALUE -# KEY is the name of a varible in the cache. +# KEY is the name of a variable in the cache. # TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!. # VALUE is the current value for the KEY. diff --git a/Tests/Contracts/PLplot/CMakeLists.txt b/Tests/Contracts/PLplot/CMakeLists.txt index b87b4c3..8e95ba3 100644 --- a/Tests/Contracts/PLplot/CMakeLists.txt +++ b/Tests/Contracts/PLplot/CMakeLists.txt @@ -9,7 +9,7 @@ if(NOT PLplot_GIT_TAG) set(PLplot_GIT_TAG "plplot-5.13.0") endif() ExternalProject_Add(PLplot - GIT_REPOSITORY "https://git.code.sf.net/p/plplot/plplot.git" + GIT_REPOSITORY "https://git.code.sf.net/p/plplot/plplot" GIT_TAG "${PLplot_GIT_TAG}" PREFIX "${PLplot_PREFIX}" CMAKE_ARGS diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index 5ad6e6b..59f3e84 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -2,6 +2,11 @@ ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard) ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX) ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) +ADD_TEST_MACRO(CudaOnly.LinkSystemDeviceLibraries CudaOnlyLinkSystemDeviceLibraries) ADD_TEST_MACRO(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols) ADD_TEST_MACRO(CudaOnly.SeparateCompilation CudaOnlySeparateCompilation) ADD_TEST_MACRO(CudaOnly.WithDefs CudaOnlyWithDefs) + +if(MSVC) + ADD_TEST_MACRO(CudaOnly.PDB CudaOnlyPDB) +endif() diff --git a/Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt b/Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt new file mode 100644 index 0000000..62be1e6 --- /dev/null +++ b/Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(CudaOnlyLinkSystemDeviceLibraries CUDA) + +string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_35,code=compute_35 -gencode arch=compute_35,code=sm_35") +set(CMAKE_CUDA_STANDARD 11) + +add_executable(CudaOnlyLinkSystemDeviceLibraries main.cu) +set_target_properties( CudaOnlyLinkSystemDeviceLibraries + PROPERTIES CUDA_SEPARABLE_COMPILATION ON) +target_link_libraries( CudaOnlyLinkSystemDeviceLibraries PRIVATE cublas_device) + +if(APPLE) + # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime. + set_property(TARGET CudaOnlyLinkSystemDeviceLibraries PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) +endif() diff --git a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu b/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu new file mode 100644 index 0000000..7eecec1 --- /dev/null +++ b/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu @@ -0,0 +1,77 @@ + +#include <cublas_v2.h> +#include <cuda_runtime.h> +#include <iostream> + +__global__ void deviceCublasSgemm(int n, float alpha, float beta, + const float* d_A, const float* d_B, + float* d_C) +{ + cublasHandle_t cnpHandle; + cublasStatus_t status = cublasCreate(&cnpHandle); + + if (status != CUBLAS_STATUS_SUCCESS) { + return; + } + + // Call function defined in the cublas_device system static library. + // This way we can verify that we properly pass system libraries to the + // device link line + status = cublasSgemm(cnpHandle, CUBLAS_OP_N, CUBLAS_OP_N, n, n, n, &alpha, + d_A, n, d_B, n, &beta, d_C, n); + + cublasDestroy(cnpHandle); +} + +int choose_cuda_device() +{ + int nDevices = 0; + cudaError_t err = cudaGetDeviceCount(&nDevices); + if (err != cudaSuccess) { + std::cerr << "Failed to retrieve the number of CUDA enabled devices" + << std::endl; + return 1; + } + for (int i = 0; i < nDevices; ++i) { + cudaDeviceProp prop; + cudaError_t err = cudaGetDeviceProperties(&prop, i); + if (err != cudaSuccess) { + std::cerr << "Could not retrieve properties from CUDA device " << i + << std::endl; + return 1; + } + + if (prop.major > 3 || (prop.major == 3 && prop.minor >= 5)) { + err = cudaSetDevice(i); + if (err != cudaSuccess) { + std::cout << "Could not select CUDA device " << i << std::endl; + } else { + return 0; + } + } + } + + std::cout << "Could not find a CUDA enabled card supporting compute >=3.5" + << std::endl; + return 1; +} + +int main(int argc, char** argv) +{ + int ret = choose_cuda_device(); + if (ret) { + return 0; + } + + // initial values that will make sure that the cublasSgemm won't actually + // do any work + int n = 0; + float alpha = 1; + float beta = 1; + float* d_A = nullptr; + float* d_B = nullptr; + float* d_C = nullptr; + deviceCublasSgemm<<<1, 1>>>(n, alpha, beta, d_A, d_B, d_C); + + return 0; +} diff --git a/Tests/CudaOnly/PDB/CMakeLists.txt b/Tests/CudaOnly/PDB/CMakeLists.txt new file mode 100644 index 0000000..34e1e5c --- /dev/null +++ b/Tests/CudaOnly/PDB/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.11) +project (CudaOnlyPDB CUDA) + +add_executable(CudaOnlyPDB main.cu) +set_target_properties(CudaOnlyPDB PROPERTIES + PDB_NAME LinkPDBName + PDB_OUTPUT_DIRECTORY LinkPDBDir + COMPILE_PDB_NAME CompPDBName + COMPILE_PDB_OUTPUT_DIRECTORY CompPDBDir + ) + +set(pdbs + ${CMAKE_CURRENT_BINARY_DIR}/CompPDBDir/${CMAKE_CFG_INTDIR}/CompPDBName.pdb + ${CMAKE_CURRENT_BINARY_DIR}/LinkPDBDir/${CMAKE_CFG_INTDIR}/LinkPDBName.pdb + ) +add_custom_command(TARGET CudaOnlyPDB POST_BUILD + COMMAND ${CMAKE_COMMAND} -Dconfig=$<CONFIG> "-Dpdbs=${pdbs}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/check_pdbs.cmake + ) diff --git a/Tests/CudaOnly/PDB/check_pdbs.cmake b/Tests/CudaOnly/PDB/check_pdbs.cmake new file mode 100644 index 0000000..5e01ca7 --- /dev/null +++ b/Tests/CudaOnly/PDB/check_pdbs.cmake @@ -0,0 +1,10 @@ +if(NOT "${config}" MATCHES "[Dd][Ee][Bb]") + return() +endif() +foreach(pdb ${pdbs}) + if(EXISTS "${pdb}") + message(STATUS "PDB Exists: ${pdb}") + else() + message(SEND_ERROR "PDB MISSING:\n ${pdb}") + endif() +endforeach() diff --git a/Tests/CudaOnly/PDB/main.cu b/Tests/CudaOnly/PDB/main.cu new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/CudaOnly/PDB/main.cu @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index eeae3f0..0f1a556 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -83,11 +83,23 @@ set_property(TARGET testLib7 PROPERTY OUTPUT_NAME testLib7-$<CONFIG>) add_library(testLib8 OBJECT testLib8A.c testLib8B.c sub/testLib8C.c) if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]") - set(maybe_testLib8 testLib8) + set(maybe_OBJECTS_DESTINATION OBJECTS DESTINATION $<1:lib>) else() - set(maybe_testLib8 "") + set(maybe_OBJECTS_DESTINATION "") endif() +cmake_policy(PUSH) +cmake_policy(SET CMP0022 NEW) +add_library(testLib9ObjPub OBJECT testLib9ObjPub.c) +target_compile_definitions(testLib9ObjPub INTERFACE testLib9ObjPub_USED) +add_library(testLib9ObjPriv OBJECT testLib9ObjPriv.c) +target_compile_definitions(testLib9ObjPriv INTERFACE testLib9ObjPriv_USED) +add_library(testLib9ObjIface OBJECT testLib9ObjIface.c) +target_compile_definitions(testLib9ObjIface INTERFACE testLib9ObjIface_USED) +add_library(testLib9 STATIC testLib9.c) +target_link_libraries(testLib9 INTERFACE testLib9ObjIface PUBLIC testLib9ObjPub PRIVATE testLib9ObjPriv) +cmake_policy(POP) + # Test using the target_link_libraries command to set the # LINK_INTERFACE_LIBRARIES* properties. We construct two libraries # providing the same two symbols. In each library one of the symbols @@ -344,6 +356,14 @@ install(FILES set_property(TARGET testLib2 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USING_TESTLIB2) set_property(TARGET testLib3 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USING_TESTLIB3) +set_target_properties(testLib3 PROPERTIES + EXPORT_PROPERTIES "EXPORTED_PROPERTY1" + EXPORTED_PROPERTY1 "EXPORTING_TESTLIB3") +set_target_properties(testLib4 PROPERTIES + EXPORTED_PROPERTY2 "EXPORTING_TESTLIB4_1" + EXPORTED_PROPERTY3 "EXPORTING_TESTLIB4_2") +set_property(TARGET testLib4 PROPERTY + EXPORT_PROPERTIES EXPORTED_PROPERTY2 EXPORTED_PROPERTY3) set_property(TARGET cmp0022NEW APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2) # set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLibIncludeRequired2) # TODO: Test for error @@ -483,7 +503,8 @@ install( TARGETS testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe4 testExe2lib testLib4lib testLib4libdbg testLib4libopt - testLib6 testLib7 ${maybe_testLib8} + testLib6 testLib7 testLib8 + testLib9 testLibCycleA testLibCycleB testLibNoSONAME cmp0022NEW cmp0022OLD @@ -492,10 +513,15 @@ install( RUNTIME DESTINATION $<1:bin> LIBRARY DESTINATION $<1:lib> NAMELINK_SKIP ARCHIVE DESTINATION $<1:lib> - OBJECTS DESTINATION $<1:lib> + ${maybe_OBJECTS_DESTINATION} FRAMEWORK DESTINATION Frameworks BUNDLE DESTINATION Applications ) +install( + TARGETS + testLib9ObjPub testLib9ObjPriv testLib9ObjIface + EXPORT exp + ) if (APPLE) file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/testLib4.framework/Headers) file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/testLib4.framework/Headers) @@ -545,7 +571,8 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 FILE ExportBuildTree.cmake ) export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe4 testExe2lib - ${maybe_testLib8} + testLib8 + testLib9 testLib9ObjPub testLib9ObjPriv testLib9ObjIface testLib4lib testLib4libdbg testLib4libopt testLibCycleA testLibCycleB testLibNoSONAME diff --git a/Tests/ExportImport/Export/testLib9.c b/Tests/ExportImport/Export/testLib9.c new file mode 100644 index 0000000..fe8610b --- /dev/null +++ b/Tests/ExportImport/Export/testLib9.c @@ -0,0 +1,15 @@ +#ifndef testLib9ObjPub_USED +#error "testLib9ObjPub_USED not defined!" +#endif +#ifndef testLib9ObjPriv_USED +#error "testLib9ObjPriv_USED not defined!" +#endif +#ifdef testLib9ObjIface_USED +#error "testLib9ObjIface_USED defined but should not be!" +#endif +int testLib9ObjPub(void); +int testLib9ObjPriv(void); +int testLib9(void) +{ + return (testLib9ObjPub() + testLib9ObjPriv()); +} diff --git a/Tests/ExportImport/Export/testLib9ObjIface.c b/Tests/ExportImport/Export/testLib9ObjIface.c new file mode 100644 index 0000000..e75440a --- /dev/null +++ b/Tests/ExportImport/Export/testLib9ObjIface.c @@ -0,0 +1,11 @@ +/* Duplicate symbols from other sources to verify that this source + is not included when the object library is used. */ +int testLib9ObjMissing(void); +int testLib9ObjPub(void) +{ + return testLib9ObjMissing(); +} +int testLib9ObjPriv(void) +{ + return testLib9ObjMissing(); +} diff --git a/Tests/ExportImport/Export/testLib9ObjPriv.c b/Tests/ExportImport/Export/testLib9ObjPriv.c new file mode 100644 index 0000000..6fa63cc --- /dev/null +++ b/Tests/ExportImport/Export/testLib9ObjPriv.c @@ -0,0 +1,4 @@ +int testLib9ObjPriv(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLib9ObjPub.c b/Tests/ExportImport/Export/testLib9ObjPub.c new file mode 100644 index 0000000..66e2624 --- /dev/null +++ b/Tests/ExportImport/Export/testLib9ObjPub.c @@ -0,0 +1,4 @@ +int testLib9ObjPub(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 01960ea..39a89dc 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -32,6 +32,20 @@ add_executable(imp_testExe1 ${Import_BINARY_DIR}/exp_generated4.c ) +function(checkForProperty _TARGET _PROP _EXPECTED) + get_target_property(EXPORTED_PROPERTY ${_TARGET} "${_PROP}") + if (NOT EXPORTED_PROPERTY STREQUAL "${_EXPECTED}") + message(SEND_ERROR "${_TARGET} was expected to export \"${_PROP}\" with value \"${_EXPECTED}\" but got \"${EXPORTED_PROPERTY}\"") + endif() +endfunction() + +checkForProperty(bld_testLib3 "EXPORTED_PROPERTY1" "EXPORTING_TESTLIB3") +checkForProperty(exp_testLib3 "EXPORTED_PROPERTY1" "EXPORTING_TESTLIB3") +checkForProperty(bld_testLib4 "EXPORTED_PROPERTY2" "EXPORTING_TESTLIB4_1") +checkForProperty(exp_testLib4 "EXPORTED_PROPERTY2" "EXPORTING_TESTLIB4_1") +checkForProperty(bld_testLib4 "EXPORTED_PROPERTY3" "EXPORTING_TESTLIB4_2") +checkForProperty(exp_testLib4 "EXPORTED_PROPERTY3" "EXPORTING_TESTLIB4_2") + # Try linking to a library imported from the install tree. target_link_libraries(imp_testExe1 exp_testLib2 @@ -229,15 +243,44 @@ add_library(imp_lib1b STATIC imp_lib1.c) target_link_libraries(imp_lib1b bld_testLib2) if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]") - # Create a executable that is using objects imported from the install tree - add_executable(imp_testLib8 imp_testLib8.c $<TARGET_OBJECTS:exp_testLib8>) + set(bld_objlib_type OBJECT_LIBRARY) + + # Create executables using objects imported from the install tree + add_executable(imp_testLib8_src imp_testLib8.c $<TARGET_OBJECTS:exp_testLib8>) + add_executable(imp_testLib8_link imp_testLib8.c) + target_link_libraries(imp_testLib8_link exp_testLib8) if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT XCODE_VERSION VERSION_LESS 5) - # Create a executable that is using objects imported from the build tree - add_executable(imp_testLib8b imp_testLib8.c $<TARGET_OBJECTS:bld_testLib8>) + # Create executables using objects imported from the build tree + add_executable(imp_testLib8b_src imp_testLib8.c $<TARGET_OBJECTS:bld_testLib8>) + add_executable(imp_testLib8b_link imp_testLib8.c) + target_link_libraries(imp_testLib8b_link bld_testLib8) endif() +else() + set(bld_objlib_type INTERFACE_LIBRARY) endif() +# Create an executable that uses a library imported from the install tree +# that itself was built using an object library. Verify we get the usage +# requirements. +add_executable(imp_testLib9 imp_testLib9.c) +target_link_libraries(imp_testLib9 exp_testLib9) +# Similarly for importing from the build tree. +add_executable(imp_testLib9b imp_testLib9.c) +target_link_libraries(imp_testLib9b bld_testLib9) + +# Check that object libraries were transformed on export as expected. +foreach(vis Pub Priv Iface) + get_property(type TARGET exp_testLib9Obj${vis} PROPERTY TYPE) + if(NOT type STREQUAL INTERFACE_LIBRARY) + message(FATAL_ERROR "exp_testLib9Obj${vis} type is '${type}', not 'INTERFACE_LIBRARY'") + endif() + get_property(type TARGET bld_testLib9Obj${vis} PROPERTY TYPE) + if(NOT type STREQUAL "${bld_objlib_type}") + message(FATAL_ERROR "bld_testLib9Obj${vis} type is '${type}', not '${bld_objlib_type}'") + endif() +endforeach() + #----------------------------------------------------------------------------- # Test that handling imported targets, including transitive dependencies, # works in CheckFunctionExists (...and hopefully all other try_compile() checks diff --git a/Tests/ExportImport/Import/A/imp_testLib9.c b/Tests/ExportImport/Import/A/imp_testLib9.c new file mode 100644 index 0000000..f9c05fd --- /dev/null +++ b/Tests/ExportImport/Import/A/imp_testLib9.c @@ -0,0 +1,16 @@ +#ifndef testLib9ObjPub_USED +#error "testLib9ObjPub_USED not defined!" +#endif +#ifdef testLib9ObjPriv_USED +#error "testLib9ObjPriv_USED defined but should not be!" +#endif +#ifndef testLib9ObjIface_USED +#error "testLib9ObjIface_USED not defined!" +#endif + +int testLib9(void); + +int main() +{ + return testLib9(); +} diff --git a/Tests/FindCURL/CMakeLists.txt b/Tests/FindCURL/CMakeLists.txt new file mode 100644 index 0000000..0cfd629 --- /dev/null +++ b/Tests/FindCURL/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindCURL.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindCURL/Test" + "${CMake_BINARY_DIR}/Tests/FindCURL/Test" + ${build_generator_args} + --build-project TestFindCURL + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindCURL/Test/CMakeLists.txt b/Tests/FindCURL/Test/CMakeLists.txt new file mode 100644 index 0000000..f0e5568 --- /dev/null +++ b/Tests/FindCURL/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.10) +project(TestFindCURL C) +include(CTest) + +find_package(CURL REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_CURL_VERSION="${CURL_VERSION_STRING}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt CURL::CURL) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${CURL_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${CURL_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindCURL/Test/main.c b/Tests/FindCURL/Test/main.c new file mode 100644 index 0000000..263775f --- /dev/null +++ b/Tests/FindCURL/Test/main.c @@ -0,0 +1,17 @@ +#include <curl/curl.h> +#include <stdio.h> +#include <stdlib.h> + +int main() +{ + struct curl_slist* slist; + + curl_global_init(0); + + slist = curl_slist_append(NULL, "CMake"); + curl_slist_free_all(slist); + + curl_global_cleanup(); + + return 0; +} diff --git a/Tests/FindJPEG/CMakeLists.txt b/Tests/FindJPEG/CMakeLists.txt new file mode 100644 index 0000000..c8663c5 --- /dev/null +++ b/Tests/FindJPEG/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindJPEG.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindJPEG/Test" + "${CMake_BINARY_DIR}/Tests/FindJPEG/Test" + ${build_generator_args} + --build-project TestFindJPEG + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindJPEG/Test/CMakeLists.txt b/Tests/FindJPEG/Test/CMakeLists.txt new file mode 100644 index 0000000..a744f85 --- /dev/null +++ b/Tests/FindJPEG/Test/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindJPEG C) +include(CTest) + +find_package(JPEG) + +add_executable(test_jpeg_tgt main.c) +target_link_libraries(test_jpeg_tgt JPEG::JPEG) +add_test(NAME test_jpeg_tgt COMMAND test_jpeg_tgt) + +add_executable(test_jpeg_var main.c) +target_include_directories(test_jpeg_var PRIVATE ${JPEG_INCLUDE_DIRS}) +target_link_libraries(test_jpeg_var PRIVATE ${JPEG_LIBRARIES}) +add_test(NAME test_jpeg_var COMMAND test_jpeg_var) diff --git a/Tests/FindJPEG/Test/main.c b/Tests/FindJPEG/Test/main.c new file mode 100644 index 0000000..c6e48f0 --- /dev/null +++ b/Tests/FindJPEG/Test/main.c @@ -0,0 +1,16 @@ +#include <assert.h> +#include <stdio.h> + +#include <jpeglib.h> + +int main() +{ + /* Without any JPEG file to open, test that the call fails as + expected. This tests that linking worked. */ + struct jpeg_decompress_struct cinfo; + struct jpeg_error_mgr jerr; + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_decompress(&cinfo); + + return 0; +} diff --git a/Tests/FindLibXml2/CMakeLists.txt b/Tests/FindLibXml2/CMakeLists.txt new file mode 100644 index 0000000..6c2464f --- /dev/null +++ b/Tests/FindLibXml2/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindLibXml2.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindLibXml2/Test" + "${CMake_BINARY_DIR}/Tests/FindLibXml2/Test" + ${build_generator_args} + --build-project TestFindLibXml2 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindLibXml2/Test/CMakeLists.txt b/Tests/FindLibXml2/Test/CMakeLists.txt new file mode 100644 index 0000000..df5d8c3 --- /dev/null +++ b/Tests/FindLibXml2/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindLibXml2 C) +include(CTest) + +find_package(LibXml2 REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_LibXml2_VERSION="${LIBXML2_VERSION_STRING}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt LibXml2::LibXml2) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${LIBXML2_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${LIBXML2_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindLibXml2/Test/main.c b/Tests/FindLibXml2/Test/main.c new file mode 100644 index 0000000..264f07d --- /dev/null +++ b/Tests/FindLibXml2/Test/main.c @@ -0,0 +1,19 @@ +#include <assert.h> +#include <libxml/tree.h> +#include <string.h> + +int main() +{ + xmlDoc* doc; + + xmlInitParser(); + + doc = xmlNewDoc(BAD_CAST "1.0"); + xmlFreeDoc(doc); + + assert(strstr(CMAKE_EXPECTED_LibXml2_VERSION, LIBXML_DOTTED_VERSION)); + + xmlCleanupParser(); + + return 0; +} diff --git a/Tests/FindMatlab/basic_checks/CMakeLists.txt b/Tests/FindMatlab/basic_checks/CMakeLists.txt index bf54427..4a74d93 100644 --- a/Tests/FindMatlab/basic_checks/CMakeLists.txt +++ b/Tests/FindMatlab/basic_checks/CMakeLists.txt @@ -8,8 +8,23 @@ set(MATLAB_FIND_DEBUG TRUE) # the success of the following command is dependent on the current configuration: # - on 32bits builds (cmake is building with 32 bits), it looks for 32 bits Matlab # - on 64bits builds (cmake is building with 64 bits), it looks for 64 bits Matlab -find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY MAIN_PROGRAM) +if(IS_MCR) + set(components MX_LIBRARY) + set(RUN_UNIT_TESTS FALSE) +else() + set(RUN_UNIT_TESTS TRUE) + set(components MX_LIBRARY MAIN_PROGRAM) +endif() + +if(NOT "${MCR_ROOT}" STREQUAL "") + set(Matlab_ROOT_DIR "${MCR_ROOT}") + if(NOT EXISTS "${MCR_ROOT}") + message(FATAL_ERROR "MCR does not exist ${MCR_ROOT}") + endif() +endif() + +find_package(Matlab REQUIRED COMPONENTS ${components}) matlab_add_mex( @@ -21,37 +36,39 @@ matlab_add_mex( DOCUMENTATION ${CMAKE_CURRENT_SOURCE_DIR}/../help_text1.m.txt ) +if(RUN_UNIT_TESTS) + matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-1 + TIMEOUT 300 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests1.m + ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1> + ) + + # timeout tests, TIMEOUT set to very short on purpose + matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-2 + TIMEOUT 15 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests_timeout.m + ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1> + ) + set_tests_properties(${PROJECT_NAME}_matlabtest-2 PROPERTIES WILL_FAIL TRUE) + + + # testing the test without the unittest framework of Matlab + matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-3 + TIMEOUT 300 + NO_UNITTEST_FRAMEWORK + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests2.m + ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1> + ) -matlab_add_unit_test( - NAME ${PROJECT_NAME}_matlabtest-1 - TIMEOUT 90 - UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests1.m - ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1> - ) - -matlab_add_unit_test( - NAME ${PROJECT_NAME}_matlabtest-2 - TIMEOUT 15 - UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests_timeout.m - ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1> - ) -set_tests_properties(${PROJECT_NAME}_matlabtest-2 PROPERTIES WILL_FAIL TRUE) - - -# testing the test without the unittest framework of Matlab -matlab_add_unit_test( - NAME ${PROJECT_NAME}_matlabtest-3 - TIMEOUT 30 - NO_UNITTEST_FRAMEWORK - UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests2.m - ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1> - ) - -matlab_add_unit_test( - NAME ${PROJECT_NAME}_matlabtest-4 - TIMEOUT 30 - NO_UNITTEST_FRAMEWORK - UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests3.m - ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1> - ) -set_tests_properties(${PROJECT_NAME}_matlabtest-4 PROPERTIES WILL_FAIL TRUE) + matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-4 + TIMEOUT 300 + NO_UNITTEST_FRAMEWORK + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests3.m + ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1> + ) + set_tests_properties(${PROJECT_NAME}_matlabtest-4 PROPERTIES WILL_FAIL TRUE) +endif() diff --git a/Tests/FindMatlab/components_checks/CMakeLists.txt b/Tests/FindMatlab/components_checks/CMakeLists.txt index 3dec093..da6a2b0 100644 --- a/Tests/FindMatlab/components_checks/CMakeLists.txt +++ b/Tests/FindMatlab/components_checks/CMakeLists.txt @@ -5,10 +5,18 @@ project(component_checks) set(MATLAB_FIND_DEBUG TRUE) +if(NOT "${MCR_ROOT}" STREQUAL "") + set(Matlab_ROOT_DIR "${MCR_ROOT}") + if(NOT EXISTS "${MCR_ROOT}") + message(FATAL_ERROR "MCR does not exist ${MCR_ROOT}") + endif() +endif() + # the success of the following command is dependent on the current configuration: # - on 32bits builds (cmake is building with 32 bits), it looks for 32 bits Matlab # - on 64bits builds (cmake is building with 64 bits), it looks for 64 bits Matlab -find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY ENG_LIBRARY MAT_LIBRARY MAIN_PROGRAM) +find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY ENG_LIBRARY MAT_LIBRARY + OPTIONAL_COMPONENTS MAIN_PROGRAM) message(STATUS "FindMatlab libraries: ${Matlab_LIBRARIES}") diff --git a/Tests/FindMatlab/failure_reports/CMakeLists.txt b/Tests/FindMatlab/failure_reports/CMakeLists.txt new file mode 100644 index 0000000..e597a4a --- /dev/null +++ b/Tests/FindMatlab/failure_reports/CMakeLists.txt @@ -0,0 +1,56 @@ + +cmake_minimum_required (VERSION 2.8.12) +enable_testing() +project(failure_reports) + +# gather tests about proper failure reports + +set(MATLAB_FIND_DEBUG TRUE) + +if(IS_MCR) + set(components MX_LIBRARY) + set(RUN_UNIT_TESTS FALSE) +else() + set(RUN_UNIT_TESTS TRUE) + set(components MX_LIBRARY MAIN_PROGRAM) +endif() + +if(NOT "${MCR_ROOT}" STREQUAL "") + set(Matlab_ROOT_DIR "${MCR_ROOT}") + if(NOT EXISTS "${MCR_ROOT}") + message(FATAL_ERROR "MCR does not exist ${MCR_ROOT}") + endif() +endif() + +find_package(Matlab REQUIRED COMPONENTS ${components}) + +# main extensions for testing, same as other tests +matlab_add_mex( + # target name + NAME cmake_matlab_test_wrapper1 + # output name + OUTPUT_NAME cmake_matlab_mex1 + SRC ${CMAKE_CURRENT_SOURCE_DIR}/../matlab_wrapper1.cpp + DOCUMENTATION ${CMAKE_CURRENT_SOURCE_DIR}/../help_text1.m.txt + ) + +if(RUN_UNIT_TESTS) + # the unit test file does not exist: the failure should be properly reported + matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-1 + TIMEOUT 300 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../nonexistantfile.m + ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1> + ) + set_tests_properties(${PROJECT_NAME}_matlabtest-1 PROPERTIES WILL_FAIL TRUE) + + # without the unit test framework + matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-2 + TIMEOUT 300 + NO_UNITTEST_FRAMEWORK + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../nonexistantfile2.m + ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1> + ) + set_tests_properties(${PROJECT_NAME}_matlabtest-2 PROPERTIES WILL_FAIL TRUE) +endif() diff --git a/Tests/FindMatlab/versions_checks/CMakeLists.txt b/Tests/FindMatlab/versions_checks/CMakeLists.txt index 5d20685..d015730 100644 --- a/Tests/FindMatlab/versions_checks/CMakeLists.txt +++ b/Tests/FindMatlab/versions_checks/CMakeLists.txt @@ -7,6 +7,13 @@ set(MATLAB_FIND_DEBUG TRUE) set(MATLAB_ADDITIONAL_VERSIONS "dummy=14.9") +if(NOT "${MCR_ROOT}" STREQUAL "") + set(Matlab_ROOT_DIR "${MCR_ROOT}") + if(NOT EXISTS "${MCR_ROOT}") + message(FATAL_ERROR "MCR does not exist ${MCR_ROOT}") + endif() +endif() + # the success of the following command is dependent on the current configuration # in this case, we are only interested in the version macros find_package(Matlab) diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt new file mode 100644 index 0000000..639d29c --- /dev/null +++ b/Tests/FindPython/CMakeLists.txt @@ -0,0 +1,69 @@ +add_test(NAME FindPython.Python2 COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python2" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2" + ${build_generator_args} + --build-project TestPython2 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + +add_test(NAME FindPython.Python2Fail COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Fail" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2Fail" + ${build_generator_args} + --build-project TestPython2Fail + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +set_tests_properties(FindPython.Python2Fail PROPERTIES + PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: foobar\\)") + +add_test(NAME FindPython.Python3 COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python3" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3" + ${build_generator_args} + --build-project TestPython3 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + +add_test(NAME FindPython.Python3Fail COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python3Fail" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3Fail" + ${build_generator_args} + --build-project TestPython3Fail + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +set_tests_properties(FindPython.Python3Fail PROPERTIES + PASS_REGULAR_EXPRESSION "Could NOT find Python3 \\(missing: foobar\\)") + +add_test(NAME FindPython.Python COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + +add_test(NAME FindPython.MultiplePackages COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages" + "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages" + ${build_generator_args} + --build-project TestMultiplePackages + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindPython/MultiplePackages/CMakeLists.txt b/Tests/FindPython/MultiplePackages/CMakeLists.txt new file mode 100644 index 0000000..5c85155 --- /dev/null +++ b/Tests/FindPython/MultiplePackages/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestMultiplePackages C) + +find_package (Python2 REQUIRED COMPONENTS Interpreter Development) +find_package (Python3 REQUIRED COMPONENTS Interpreter Development) + +# Must find Python 3 +find_package (Python REQUIRED) + +if (NOT Python3_EXECUTABLE STREQUAL Python_EXECUTABLE) + message (FATAL_ERROR + "Python interpreters do not match:\n" + " Python_EXECUTABLE='${Python_EXECUTABLE}'\n" + " Python3_EXECUTABLE='${Python3_EXECUTABLE}'\n" + ) +endif() + + +Python2_add_library (spam2 MODULE ../spam.c) +target_compile_definitions (spam2 PRIVATE PYTHON2) + +Python3_add_library (spam3 MODULE ../spam.c) +target_compile_definitions (spam3 PRIVATE PYTHON3) + + +add_test (NAME python2_spam2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" + "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") + +add_test (NAME python3_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" + "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt new file mode 100644 index 0000000..bebd23f --- /dev/null +++ b/Tests/FindPython/Python/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython C) + +include(CTest) + +find_package(Python 3 REQUIRED COMPONENTS Interpreter Development) +if (NOT Python_FOUND) + message (FATAL_ERROR "Fail to found Python 3") +endif() + +Python_add_library (spam3 MODULE ../spam.c) +target_compile_definitions (spam3 PRIVATE PYTHON3) + +add_test (NAME python_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" + "${Python_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt new file mode 100644 index 0000000..9622b6f --- /dev/null +++ b/Tests/FindPython/Python2/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython2 C) + +include(CTest) + +find_package(Python2 3 QUIET) +if (Python2_FOUND) + message (FATAL_ERROR "Wrong python version found: ${Python2_VERSION}") +endif() + +find_package(Python2 REQUIRED COMPONENTS Interpreter Development) +if (NOT Python2_FOUND) + message (FATAL_ERROR "Fail to found Python 2") +endif() + +Python2_add_library (spam2 MODULE ../spam.c) +target_compile_definitions (spam2 PRIVATE PYTHON2) + +add_test (NAME python2_spam2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam2>" + "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") diff --git a/Tests/FindPython/Python2Fail/CMakeLists.txt b/Tests/FindPython/Python2Fail/CMakeLists.txt new file mode 100644 index 0000000..989688f --- /dev/null +++ b/Tests/FindPython/Python2Fail/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython2Fail C) + +include(CTest) + +find_package(Python2 REQUIRED COMPONENTS Interpreter Development foobar) + +Python2_add_library (spam2 MODULE ../spam.c) +target_compile_definitions (spam2 PRIVATE PYTHON2) + +add_test (NAME python2_spam2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam2>" + "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt new file mode 100644 index 0000000..cb86eae --- /dev/null +++ b/Tests/FindPython/Python3/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython3 C) + +include(CTest) + +find_package(Python3 2 QUIET) +if (Python3_FOUND) + message (FATAL_ERROR "Wrong python version found: ${Python3_VERSION}") +endif() + +find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +if (NOT Python3_FOUND) + message (FATAL_ERROR "Fail to found Python 3") +endif() + +Python3_add_library (spam3 MODULE ../spam.c) +target_compile_definitions (spam3 PRIVATE PYTHON3) + +add_test (NAME python3_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" + "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") diff --git a/Tests/FindPython/Python3Fail/CMakeLists.txt b/Tests/FindPython/Python3Fail/CMakeLists.txt new file mode 100644 index 0000000..cd46c88 --- /dev/null +++ b/Tests/FindPython/Python3Fail/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython3Fail C) + +include(CTest) + +find_package(Python3 REQUIRED COMPONENTS Interpreter Development foobar) + +Python3_add_library (spam3 MODULE ../spam.c) +target_compile_definitions (spam3 PRIVATE PYTHON3) + +add_test (NAME python3_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" + "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") diff --git a/Tests/FindPython/spam.c b/Tests/FindPython/spam.c new file mode 100644 index 0000000..1c65d54 --- /dev/null +++ b/Tests/FindPython/spam.c @@ -0,0 +1,41 @@ + +#include <Python.h> + +static PyObject* spam_system(PyObject* self, PyObject* args) +{ + const char* command; + int sts; + + if (!PyArg_ParseTuple(args, "s", &command)) + return NULL; + sts = system(command); + /* return PyLong_FromLong(sts); */ + return Py_BuildValue("i", sts); +} + +static PyMethodDef SpamMethods[] = { + { "system", spam_system, METH_VARARGS, "Execute a shell command." }, + { NULL, NULL, 0, NULL } /* Sentinel */ +}; + +#if defined(PYTHON2) +PyMODINIT_FUNC initspam2(void) +{ + (void)Py_InitModule("spam2", SpamMethods); +} +#endif + +#if defined(PYTHON3) +static struct PyModuleDef spammodule = { + PyModuleDef_HEAD_INIT, "spam3", /* name of module */ + NULL, /* module documentation, may be NULL */ + -1, /* size of per-interpreter state of the module, + or -1 if the module keeps state in global variables. */ + SpamMethods +}; + +PyMODINIT_FUNC PyInit_spam3(void) +{ + return PyModule_Create(&spammodule); +} +#endif diff --git a/Tests/FortranModules/Submodules/CMakeLists.txt b/Tests/FortranModules/Submodules/CMakeLists.txt index bf0152f..ab8e0f9 100644 --- a/Tests/FortranModules/Submodules/CMakeLists.txt +++ b/Tests/FortranModules/Submodules/CMakeLists.txt @@ -1 +1,23 @@ -add_executable(submod main.f90 provide.f90) +# The program units in this file consist of a module/submodule +# tree represented by the following graph: +# +# parent +# | +# / \ +# / \ +# child sibling +# | +# grandchild +# | +# GreatGrandChild +# +# where the parent node is a module and all other nodes are submodules. + +add_executable(submod + main.f90 + parent.f90 + child.f90 + grandchild.f90 + greatgrandchild.f90 + sibling.f90 + ) diff --git a/Tests/FortranModules/Submodules/child.f90 b/Tests/FortranModules/Submodules/child.f90 new file mode 100644 index 0000000..838ab61 --- /dev/null +++ b/Tests/FortranModules/Submodules/child.f90 @@ -0,0 +1,10 @@ +! Test the notation for a 1st-generation direct +! descendant of a parent module +submodule ( parent ) child + implicit none +contains + module function child_function() result(child_stuff) + logical :: child_stuff + child_stuff=.true. + end function +end submodule child diff --git a/Tests/FortranModules/Submodules/grandchild.f90 b/Tests/FortranModules/Submodules/grandchild.f90 new file mode 100644 index 0000000..1aef63e --- /dev/null +++ b/Tests/FortranModules/Submodules/grandchild.f90 @@ -0,0 +1,8 @@ +! Test the notation for an Nth-generation descendant +! for N>1, which necessitates the colon. +submodule ( parent : child ) grandchild +contains + module subroutine grandchild_subroutine() + print *,"Test passed." + end subroutine +end submodule grandchild diff --git a/Tests/FortranModules/Submodules/greatgrandchild.f90 b/Tests/FortranModules/Submodules/greatgrandchild.f90 new file mode 100644 index 0000000..85404ea --- /dev/null +++ b/Tests/FortranModules/Submodules/greatgrandchild.f90 @@ -0,0 +1,8 @@ +! Test the notation for an Nth-generation descendant +! for N>1, which necessitates the colon. +submodule ( parent : grandchild ) GreatGrandChild +contains + module subroutine GreatGrandChild_subroutine() + print *,"Test passed." + end subroutine +end submodule GreatGrandChild diff --git a/Tests/FortranModules/Submodules/main.f90 b/Tests/FortranModules/Submodules/main.f90 index 3c750ce..3cd2989 100644 --- a/Tests/FortranModules/Submodules/main.f90 +++ b/Tests/FortranModules/Submodules/main.f90 @@ -1,5 +1,7 @@ program main use parent, only : child_function,grandchild_subroutine + use parent, only : sibling_function,GreatGrandChild_subroutine implicit none if (child_function()) call grandchild_subroutine + if (sibling_function()) call GreatGrandChild_subroutine end program diff --git a/Tests/FortranModules/Submodules/parent.f90 b/Tests/FortranModules/Submodules/parent.f90 new file mode 100644 index 0000000..3180b70 --- /dev/null +++ b/Tests/FortranModules/Submodules/parent.f90 @@ -0,0 +1,22 @@ +module parent + implicit none + + interface + + ! Test Fortran 2008 "module function" syntax + module function child_function() result(child_stuff) + logical :: child_stuff + end function + module function sibling_function() result(sibling_stuff) + logical :: sibling_stuff + end function + + ! Test Fortran 2008 "module subroutine" syntax + module subroutine grandchild_subroutine() + end subroutine + module subroutine GreatGrandChild_subroutine() + end subroutine + + end interface + +end module parent diff --git a/Tests/FortranModules/Submodules/provide.f90 b/Tests/FortranModules/Submodules/provide.f90 deleted file mode 100644 index 0ad216a..0000000 --- a/Tests/FortranModules/Submodules/provide.f90 +++ /dev/null @@ -1,57 +0,0 @@ -! The program units in this file consist of a -! module/submodule tree represented by the following -! graph: -! -! parent -! | -! / \ -! / \ -! child sibling -! | -! grandchild -! -! where the parent node is a module and all other -! nodes are submodules. - -module parent - implicit none - - interface - - ! Test Fortran 2008 "module function" syntax - module function child_function() result(child_stuff) - logical :: child_stuff - end function - - ! Test Fortran 2008 "module subroutine" syntax - module subroutine grandchild_subroutine() - end subroutine - - end interface - -end module parent - -! Test the notation for a 1st-generation direct -! descendant of a parent module -submodule ( parent ) child - implicit none -contains - module function child_function() result(child_stuff) - logical :: child_stuff - child_stuff=.true. - end function -end submodule child - -! Empty submodule for checking disambiguation of -! nodes at the same vertical level in the tree -submodule ( parent ) sibling -end submodule sibling - -! Test the notation for an Nth-generation descendant -! for N>1, which necessitates the colon. -submodule ( parent : child ) grandchild -contains - module subroutine grandchild_subroutine() - print *,"Test passed." - end subroutine -end submodule grandchild diff --git a/Tests/FortranModules/Submodules/sibling.f90 b/Tests/FortranModules/Submodules/sibling.f90 new file mode 100644 index 0000000..8c0943d --- /dev/null +++ b/Tests/FortranModules/Submodules/sibling.f90 @@ -0,0 +1,9 @@ +! Empty submodule for checking disambiguation of +! nodes at the same vertical level in the tree +submodule ( parent ) sibling +contains + module function sibling_function() result(sibling_stuff) + logical :: sibling_stuff + sibling_stuff=.true. + end function +end submodule sibling diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 19d12e5..3d08704 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -57,6 +57,11 @@ add_custom_target(check-part1 ALL -Dtest_strequal_angle_r_comma=$<STREQUAL:$<ANGLE-R>,$<COMMA>> -Dtest_strequal_both_empty=$<STREQUAL:,> -Dtest_strequal_one_empty=$<STREQUAL:something,> + -Dtest_inlist_true=$<IN_LIST:a,a$<SEMICOLON>b> + -Dtest_inlist_false=$<IN_LIST:c,a$<SEMICOLON>b> + -Dtest_inlist_empty_1=$<IN_LIST:a,> + -Dtest_inlist_empty_2=$<IN_LIST:,a> + -Dtest_inlist_empty_3=$<IN_LIST:,> -Dtest_angle_r=$<ANGLE-R> -Dtest_comma=$<COMMA> -Dtest_semicolon=$<SEMICOLON> diff --git a/Tests/GeneratorExpression/check-part1.cmake b/Tests/GeneratorExpression/check-part1.cmake index 60b193f..41bcd6d 100644 --- a/Tests/GeneratorExpression/check-part1.cmake +++ b/Tests/GeneratorExpression/check-part1.cmake @@ -49,6 +49,11 @@ check(test_strequal_semicolon "1") check(test_strequal_angle_r_comma "0") check(test_strequal_both_empty "1") check(test_strequal_one_empty "0") +check(test_inlist_true "1") +check(test_inlist_false "0") +check(test_inlist_empty_1 "0") +check(test_inlist_empty_2 "0") +check(test_inlist_empty_3 "0") check(test_angle_r ">") check(test_comma ",") check(test_semicolon ";") diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index db18462..b7b8320 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -65,6 +65,10 @@ else() PROPERTIES COMPILE_FLAGS "-ITarProp") endif() +add_library(ordertest ordertest.cpp) +target_include_directories(ordertest SYSTEM PUBLIC SystemIncludeDirectories/systemlib) +target_include_directories(ordertest PUBLIC SystemIncludeDirectories/userlib) + add_subdirectory(StandardIncludeDirectories) add_subdirectory(TargetIncludeDirectories) diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/ordertest.h b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/ordertest.h new file mode 100644 index 0000000..28915e6 --- /dev/null +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/ordertest.h @@ -0,0 +1 @@ +#error ordertest.h includes from systemlib diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/userlib/ordertest.h b/Tests/IncludeDirectories/SystemIncludeDirectories/userlib/ordertest.h new file mode 100644 index 0000000..fa882cb --- /dev/null +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/userlib/ordertest.h @@ -0,0 +1 @@ +/* empty file */ diff --git a/Tests/IncludeDirectories/ordertest.cpp b/Tests/IncludeDirectories/ordertest.cpp new file mode 100644 index 0000000..7e24f77 --- /dev/null +++ b/Tests/IncludeDirectories/ordertest.cpp @@ -0,0 +1 @@ +#include "ordertest.h" diff --git a/Tests/Module/ExternalData/Data5/CMakeLists.txt b/Tests/Module/ExternalData/Data5/CMakeLists.txt index 13c7fab..ea67f05 100644 --- a/Tests/Module/ExternalData/Data5/CMakeLists.txt +++ b/Tests/Module/ExternalData/Data5/CMakeLists.txt @@ -2,21 +2,21 @@ ExternalData_Add_Test(Data5.A NAME Data5Check.A COMMAND ${CMAKE_COMMAND} - -D Data5=DATA{../Data.dat} + -D Data5=DATA{Data5.dat} -P ${CMAKE_CURRENT_SOURCE_DIR}/Data5Check.cmake ) ExternalData_Add_Target(Data5.A) ExternalData_Add_Test(Data5.B NAME Data5Check.B COMMAND ${CMAKE_COMMAND} - -D Data5=DATA{../Data.dat} + -D Data5=DATA{Data5.dat} -P ${CMAKE_CURRENT_SOURCE_DIR}/Data5Check.cmake ) ExternalData_Add_Target(Data5.B) ExternalData_Add_Test(Data5.C NAME Data5Check.C COMMAND ${CMAKE_COMMAND} - -D Data5=DATA{../Data.dat} + -D Data5=DATA{Data5.dat} -P ${CMAKE_CURRENT_SOURCE_DIR}/Data5Check.cmake ) ExternalData_Add_Target(Data5.C) diff --git a/Tests/Module/ExternalData/Data5/Data5.dat.md5 b/Tests/Module/ExternalData/Data5/Data5.dat.md5 new file mode 100644 index 0000000..70e39bd --- /dev/null +++ b/Tests/Module/ExternalData/Data5/Data5.dat.md5 @@ -0,0 +1 @@ +8c018830e3efa5caf3c7415028335a57 diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index 52d4613..45bb229 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -190,7 +190,7 @@ write_compiler_detection_header( ALLOW_UNKNOWN_COMPILERS ) -# intentionally abuse the TEST_NULLPR variable: this will only work +# intentionally abuse the TEST_NULLPTR variable: this will only work # with the fallback code. check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection_allow_unknown.h\" int main() {\n int i = TEST_NULLPTR;\n return 0; }\n" @@ -199,3 +199,16 @@ int main() {\n int i = TEST_NULLPTR;\n return 0; }\n" if (NOT file_include_works_allow_unknown) message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection_allow_unknown.h was expected to work, but did not.") endif() + +# test for BARE_FEATURES + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection_bare_features.h" + PREFIX TEST + COMPILERS GNU Clang AppleClang MSVC SunPro Intel + VERSION 3.1 + BARE_FEATURES cxx_nullptr cxx_override cxx_noexcept cxx_final +) + +add_executable(WriteCompilerDetectionHeaderBareFeatures main_bare.cpp) +set_property(TARGET WriteCompilerDetectionHeaderBareFeatures PROPERTY CXX_STANDARD 11) diff --git a/Tests/Module/WriteCompilerDetectionHeader/main_bare.cpp b/Tests/Module/WriteCompilerDetectionHeader/main_bare.cpp new file mode 100644 index 0000000..6954318 --- /dev/null +++ b/Tests/Module/WriteCompilerDetectionHeader/main_bare.cpp @@ -0,0 +1,23 @@ +#include "test_compiler_detection_bare_features.h" + +class base +{ +public: + virtual ~base() {} + virtual void baz() = 0; +}; + +class foo final +{ +public: + virtual ~foo() {} + char* bar; + void baz() noexcept override { bar = nullptr; } +}; + +int main() +{ + foo f; + + return 0; +} diff --git a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt index 10a2f59..76a93d2 100644 --- a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt +++ b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt @@ -16,11 +16,11 @@ if ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}") # Use a separate variable for computation. set(MAXPATH "${CMAKE_OBJECT_PATH_MAX}") - # VS8 adds "OutOfSource/SubDir/OutOfSourceSubdir/../../../" to the + # VS adds "OutOfSource/SubDir/OutOfSourceSubdir/../../../" to the # path of the source file for no good reason. Reduce the length # limit by 46 characters to account for it. It should still be long # enough to require special object file name conversion. - if(${CMAKE_GENERATOR} MATCHES "Visual Studio (8|10)") + if(${CMAKE_GENERATOR} MATCHES "Visual Studio") math(EXPR MAXPATH "${MAXPATH} - 46") endif() diff --git a/Tests/PolicyScope/CMakeLists.txt b/Tests/PolicyScope/CMakeLists.txt index 413195a..353842b 100644 --- a/Tests/PolicyScope/CMakeLists.txt +++ b/Tests/PolicyScope/CMakeLists.txt @@ -52,6 +52,10 @@ if(1) # CMP0002 should be changed when this function is invoked cmake_policy(GET CMP0002 cmp) check(CMP0002 "OLD" "${cmp}") + + # The undocumented PARENT_SCOPE option sees the caller's setting. + cmake_policy(GET CMP0002 cmp PARENT_SCOPE) + check(CMP0002 "NEW" "${cmp}") endfunction() # Unset CMP0002 @@ -61,6 +65,10 @@ if(1) cmake_policy(GET CMP0002 cmp) check(CMP0002 "" "${cmp}") + # The undocumented PARENT_SCOPE option sees the caller's setting. + cmake_policy(GET CMP0002 cmp PARENT_SCOPE) + check(CMP0002 "NEW" "${cmp}") + # Setting the policy should work here and also in the caller. cmake_policy(SET CMP0002 OLD) cmake_policy(GET CMP0002 cmp) diff --git a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt index 2e6a5bd..52e2488 100644 --- a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt +++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt @@ -45,8 +45,7 @@ file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") # - Change a resource files listed in the .qrc file # - Rebuild execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/input.txt") -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/input.txt") +file(TOUCH "${rccDepBD}/resPlain/input.txt" "${rccDepBD}/resGen/input.txt") execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) if (result) message(SEND_ERROR "Second build of rccDepends failed.") @@ -63,7 +62,7 @@ if (NOT rdGenAfter GREATER rdGenBefore) endif() -message("Changing a the .qrc file") +message("Changing the .qrc file") # - Acquire binary timestamps before the build file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") @@ -97,8 +96,7 @@ file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") # - Change a newly added resource files listed in the .qrc file # - Rebuild execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/inputAdded.txt") -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/inputAdded.txt") +file(TOUCH "${rccDepBD}/resPlain/inputAdded.txt" "${rccDepBD}/resGen/inputAdded.txt") execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) if (result) message(SEND_ERROR "Fourth build of rccDepends failed.") diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index 86a9896..2027c4f 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -88,12 +88,14 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) -DCMAKE_ANDROID_ARM_MODE=0 ) run_cmake(ndk-badarm) - set(RunCMake_TEST_OPTIONS - -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} - -DCMAKE_ANDROID_ARM_NEON=0 - ) - run_cmake(ndk-badneon) + if("armeabi" IN_LIST _abis_) + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_ANDROID_NDK=${ndk} + -DCMAKE_ANDROID_ARM_NEON=0 + ) + run_cmake(ndk-badneon) + endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=${ndk} diff --git a/Tests/RunCMake/Android/android_lib.cxx b/Tests/RunCMake/Android/android_lib.cxx new file mode 100644 index 0000000..82f9d27 --- /dev/null +++ b/Tests/RunCMake/Android/android_lib.cxx @@ -0,0 +1,4 @@ +int android_lib() +{ + return 0; +} diff --git a/Tests/RunCMake/Android/check_binary.cmake b/Tests/RunCMake/Android/check_binary.cmake new file mode 100644 index 0000000..1d1b01a --- /dev/null +++ b/Tests/RunCMake/Android/check_binary.cmake @@ -0,0 +1,8 @@ +if(NOT EXISTS "${file}") + message(FATAL_ERROR "Missing file:\n ${file}") +endif() +execute_process(COMMAND "${objdump}" -p ${file} OUTPUT_VARIABLE out) +if(out MATCHES "NEEDED[^\n]*stdc\\+\\+") + string(REPLACE "\n" "\n " out " ${out}") + message(FATAL_ERROR "File:\n ${file}\ndepends on libstdc++:\n${out}") +endif() diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake index 015f202..f931be1 100644 --- a/Tests/RunCMake/Android/common.cmake +++ b/Tests/RunCMake/Android/common.cmake @@ -92,6 +92,23 @@ if(CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a") endif() add_executable(android_c android.c) add_executable(android_cxx android.cxx) +add_library(android_cxx_lib SHARED android_lib.cxx) + +set(objdump "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}objdump") +if(NOT EXISTS "${objdump}") + message(FATAL_ERROR "Expected tool missing:\n ${objdump}") +endif() + +if(NOT CMAKE_ANDROID_STL_TYPE MATCHES "^(system|stlport_static|stlport_shared)$") + foreach(tgt android_cxx android_cxx_lib) + add_custom_command(TARGET ${tgt} POST_BUILD + COMMAND ${CMAKE_COMMAND} + -Dobjdump=${objdump} + -Dfile=$<TARGET_FILE:${tgt}> + -P ${CMAKE_CURRENT_SOURCE_DIR}/check_binary.cmake + ) + endforeach() +endif() # Test that an explicit /usr/include is ignored in favor of # appearing as a standard include directory at the end. diff --git a/Tests/RunCMake/Android/ndk-badvernum-stderr.txt b/Tests/RunCMake/Android/ndk-badvernum-stderr.txt index 25bbaf9..adacaf1 100644 --- a/Tests/RunCMake/Android/ndk-badvernum-stderr.txt +++ b/Tests/RunCMake/Android/ndk-badvernum-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at .*/Modules/Platform/Android/Determine-Compiler-NDK.cmake:[0-9]+ \(message\): - Android: No toolchain for ABI 'armeabi' found in the NDK: + Android: No toolchain for ABI 'armeabi(-v7a)?' found in the NDK: .* diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index c52f44e..690c5b4 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -121,6 +121,9 @@ if(CMAKE_GENERATOR STREQUAL "Ninja") -DCMAKE_C_OUTPUT_EXTENSION=${CMAKE_C_OUTPUT_EXTENSION} -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX} -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}) + if(CMAKE_Fortran_COMPILER) + list(APPEND Ninja_ARGS -DTEST_Fortran=1) + endif() add_RunCMake_test(Ninja) endif() add_RunCMake_test(CTest) @@ -188,6 +191,7 @@ if (QT4_FOUND) endif() add_RunCMake_test(CompatibleInterface) add_RunCMake_test(Syntax) +add_RunCMake_test(WorkingDirectory) add_RunCMake_test(add_custom_command) add_RunCMake_test(add_custom_target) @@ -305,13 +309,13 @@ endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") add_RunCMake_test(include_external_msproject) - if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([89]|10)" AND NOT CMAKE_VS_DEVENV_COMMAND) + if("${CMAKE_GENERATOR}" MATCHES "Visual Studio (9|10)" AND NOT CMAKE_VS_DEVENV_COMMAND) set(NO_USE_FOLDERS 1) endif() add_RunCMake_test(VSSolution -DNO_USE_FOLDERS=${NO_USE_FOLDERS}) endif() -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^89]|[89][0-9])") +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^9]|9[0-9])") add_RunCMake_test(VS10Project) endif() @@ -334,12 +338,21 @@ add_RunCMake_test(CheckIPOSupported) add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(CommandLineTar) -add_RunCMake_test(install) +if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)) + set(NO_NAMELINK 1) +else() + set(NO_NAMELINK 0) +endif() + +add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN}) add_RunCMake_test(CPackCommandLine) add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) add_RunCMake_test(FetchContent) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + set(CTestCommandLine_ARGS -DTEST_AFFINITY=$<TARGET_FILE:testAffinity>) +endif() add_RunCMake_test(CTestCommandLine) add_RunCMake_test(CacheNewline) # Only run this test on unix platforms that support @@ -355,8 +368,16 @@ set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES) add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) # Matlab module related tests -if(CMake_TEST_FindMatlab) - add_RunCMake_test(FindMatlab) +if(CMake_TEST_FindMatlab OR CMake_TEST_FindMatlab_MCR OR (NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "")) + set(FindMatlab_additional_test_options ) + if(CMake_TEST_FindMatlab_MCR OR NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "") + set(FindMatlab_additional_test_options -DIS_MCR=TRUE) + endif() + if(NOT "${CMake_TEST_FindMatlab_MCR_ROOT_DIR}" STREQUAL "") + set(FindMatlab_additional_test_options ${FindMatlab_additional_test_options} "-DMCR_ROOT:FILEPATH=${CMake_TEST_FindMatlab_MCR_ROOT_DIR}") + endif() + + add_RunCMake_test(FindMatlab ${FindMatlab_additional_test_options}) endif() add_executable(pseudo_emulator pseudo_emulator.c) @@ -426,6 +447,7 @@ if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN) set_property(TEST RunCMake.Android PROPERTY TIMEOUT ${CMake_TEST_ANDROID_TIMEOUT}) endif() -if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^89]|[89][0-9])") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|9[0-9])") add_RunCMake_test(CSharpCustomCommand) + add_RunCMake_test(CSharpReferenceImport) endif() diff --git a/Tests/RunCMake/CSharpReferenceImport/CMakeLists.txt b/Tests/RunCMake/CSharpReferenceImport/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLib.cmake b/Tests/RunCMake/CSharpReferenceImport/ImportLib.cmake new file mode 100644 index 0000000..5ad6e76 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLib.cmake @@ -0,0 +1,45 @@ +enable_language(CXX CSharp) + +if(NOT DEFINED exportFileName OR + NOT DEFINED exportNameSpace OR + NOT DEFINED exportTargetName) + message(FATAL_ERROR "export information missing") +endif() + +add_library(${exportTargetName}CSharp SHARED + ImportLib.cs) + +# native c++ dll +add_library(${exportTargetName}Native SHARED + ImportLibNative.h + ImportLibNative.cxx) + +# mixed c++ dll +add_library(${exportTargetName}Mixed SHARED + ImportLibMixed.cxx + ImportLibMixedNative.h + ImportLibMixedNative.cxx) +set_target_properties(${exportTargetName}Mixed PROPERTIES + COMMON_LANGUAGE_RUNTIME "") + +# pure c++ dll +add_library(${exportTargetName}Pure SHARED + ImportLibPure.cxx) +set_target_properties(${exportTargetName}Pure PROPERTIES + COMMON_LANGUAGE_RUNTIME "pure") + +# safe c++ dll +add_library(${exportTargetName}Safe SHARED + ImportLibSafe.cxx) +set_target_properties(${exportTargetName}Safe PROPERTIES + COMMON_LANGUAGE_RUNTIME "safe") + +# generate export file +export(TARGETS + ${exportTargetName}CSharp + ${exportTargetName}Native + ${exportTargetName}Mixed + ${exportTargetName}Pure + ${exportTargetName}Safe + NAMESPACE "${exportNameSpace}:" + FILE "${exportFileName}") diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLib.cs b/Tests/RunCMake/CSharpReferenceImport/ImportLib.cs new file mode 100644 index 0000000..4eb28af --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLib.cs @@ -0,0 +1,8 @@ +using System; + +public +class ImportLibCSharp +{ +public + static void Message() { Console.WriteLine("ImportLibCSharp"); } +} diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLibMixed.cxx b/Tests/RunCMake/CSharpReferenceImport/ImportLibMixed.cxx new file mode 100644 index 0000000..d0b810e --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLibMixed.cxx @@ -0,0 +1,8 @@ +using namespace System; + +public +ref class ImportLibMixed +{ +public: + static void Message() { Console::WriteLine("ImportLibMixed"); } +}; diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLibMixedNative.cxx b/Tests/RunCMake/CSharpReferenceImport/ImportLibMixedNative.cxx new file mode 100644 index 0000000..c85a776 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLibMixedNative.cxx @@ -0,0 +1,8 @@ +#include "ImportLibMixedNative.h" + +#include <iostream> + +void ImportLibMixedNative::Message() +{ + std::cout << "ImportLibMixedNative" << std::endl; +} diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLibMixedNative.h b/Tests/RunCMake/CSharpReferenceImport/ImportLibMixedNative.h new file mode 100644 index 0000000..8d5eb62 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLibMixedNative.h @@ -0,0 +1,13 @@ +#pragma once + +#ifdef ImportLibMixed_EXPORTS +#define mixedAPI __declspec(dllexport) +#else +#define mixedAPI __declspec(dllimport) +#endif + +class mixedAPI ImportLibMixedNative +{ +public: + static void Message(); +}; diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLibNative.cxx b/Tests/RunCMake/CSharpReferenceImport/ImportLibNative.cxx new file mode 100644 index 0000000..8e08b9a --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLibNative.cxx @@ -0,0 +1,8 @@ +#include "ImportLibNative.h" + +#include <iostream> + +void ImportLibNative::Message() +{ + std::cout << "ImportLibNative" << std::endl; +} diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLibNative.h b/Tests/RunCMake/CSharpReferenceImport/ImportLibNative.h new file mode 100644 index 0000000..7c85626 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLibNative.h @@ -0,0 +1,13 @@ +#pragma once + +#ifdef ImportLibNative_EXPORTS +#define nativeAPI __declspec(dllexport) +#else +#define nativeAPI __declspec(dllimport) +#endif + +class nativeAPI ImportLibNative +{ +public: + static void Message(); +}; diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLibPure.cxx b/Tests/RunCMake/CSharpReferenceImport/ImportLibPure.cxx new file mode 100644 index 0000000..271e375 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLibPure.cxx @@ -0,0 +1,8 @@ +using namespace System; + +public +ref class ImportLibPure +{ +public: + static void Message() { Console::WriteLine("ImportLibPure"); } +}; diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLibSafe.cxx b/Tests/RunCMake/CSharpReferenceImport/ImportLibSafe.cxx new file mode 100644 index 0000000..13b40da --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLibSafe.cxx @@ -0,0 +1,8 @@ +using namespace System; + +public +ref class ImportLibSafe +{ +public: + static void Message() { Console::WriteLine("ImportLibSafe"); } +}; diff --git a/Tests/RunCMake/CSharpReferenceImport/ReferenceImport.cmake b/Tests/RunCMake/CSharpReferenceImport/ReferenceImport.cmake new file mode 100644 index 0000000..c65f623 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ReferenceImport.cmake @@ -0,0 +1,88 @@ +enable_language(CXX CSharp) + +if(NOT DEFINED exportFileName OR + NOT DEFINED exportNameSpace OR + NOT DEFINED exportTargetName) + message(FATAL_ERROR "export information missing") +endif() + +# Include generated export file. +if(NOT EXISTS "${exportFileName}") + message(FATAL_ERROR "exportFileNameCSharp does not exist: ${exportFileName}") +endif() +include(${exportFileName}) + +# Verify expected targets are imported +set(linkNames linkNameCSharp linkNameNative linkNameMixed + linkNamePure linkNameSafe) +set(linkNameCSharp "${exportNameSpace}:${exportTargetName}CSharp") +set(linkNameNative "${exportNameSpace}:${exportTargetName}Native") +set(linkNameMixed "${exportNameSpace}:${exportTargetName}Mixed") +set(linkNamePure "${exportNameSpace}:${exportTargetName}Pure") +set(linkNameSafe "${exportNameSpace}:${exportTargetName}Safe") +foreach(l ${linkNames}) + if(NOT TARGET ${${l}}) + message(FATAL_ERROR "imported target not found (${${l}})") + endif() +endforeach() + +# Test referencing managed assemblies from C# executable. +add_executable(ReferenceImportCSharp ReferenceImport.cs) +target_link_libraries(ReferenceImportCSharp + ${linkNameCSharp} + ${linkNameNative} # ignored + ${linkNameMixed} + ${linkNamePure} + ${linkNameSafe} + ) + +# native C++ executable. +add_executable(ReferenceImportNative ReferenceImportNative.cxx) +target_link_libraries(ReferenceImportNative + ${linkNameCSharp} # ignored + ${linkNameNative} + ${linkNameMixed} + ${linkNamePure} # ignored + ${linkNameSafe} # ignored + ) +add_custom_command(TARGET ReferenceImportNative POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$<TARGET_FILE:${linkNameNative}>" + "${CMAKE_BINARY_DIR}/$<CONFIG>" + ) + +# mixed C++ executable. +add_executable(ReferenceImportMixed ReferenceImportMixed.cxx) +target_link_libraries(ReferenceImportMixed + ${linkNameCSharp} + ${linkNameNative} + ${linkNameMixed} + ${linkNamePure} + ${linkNameSafe} + ) +set_target_properties(ReferenceImportMixed PROPERTIES + COMMON_LANGUAGE_RUNTIME "") + +# pure C++ executable. +add_executable(ReferenceImportPure ReferenceImportPure.cxx) +target_link_libraries(ReferenceImportPure + ${linkNameCSharp} + ${linkNameNative} # ignored + ${linkNameMixed} + ${linkNamePure} + ${linkNameSafe} + ) +set_target_properties(ReferenceImportPure PROPERTIES + COMMON_LANGUAGE_RUNTIME "pure") + +# native C++ executable. +add_executable(ReferenceImportSafe ReferenceImportSafe.cxx) +target_link_libraries(ReferenceImportSafe + ${linkNameCSharp} + ${linkNameNative} # ignored + ${linkNameMixed} + ${linkNamePure} + ${linkNameSafe} + ) +set_target_properties(ReferenceImportSafe PROPERTIES + COMMON_LANGUAGE_RUNTIME "safe") diff --git a/Tests/RunCMake/CSharpReferenceImport/ReferenceImport.cs b/Tests/RunCMake/CSharpReferenceImport/ReferenceImport.cs new file mode 100644 index 0000000..24175f6 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ReferenceImport.cs @@ -0,0 +1,13 @@ +using System; + +public class ReferenceImport +{ + public static void Main() + { + Console.WriteLine("ReferenceImportCSharp"); + ImportLibMixed.Message(); + ImportLibPure.Message(); + ImportLibSafe.Message(); + ImportLibCSharp.Message(); + } +} diff --git a/Tests/RunCMake/CSharpReferenceImport/ReferenceImportMixed.cxx b/Tests/RunCMake/CSharpReferenceImport/ReferenceImportMixed.cxx new file mode 100644 index 0000000..53ecd42 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ReferenceImportMixed.cxx @@ -0,0 +1,20 @@ +// clang-format off + +using namespace System; + +#using <ImportLibMixed.dll> +#using <ImportLibPure.dll> +#using <ImportLibSafe.dll> +#using <ImportLibCSharp.dll> + +#include "ImportLibNative.h" + +int main() +{ + Console::WriteLine("ReferenceImportMixed"); + ImportLibNative::Message(); + ImportLibMixed::Message(); + ImportLibPure::Message(); + ImportLibSafe::Message(); + ImportLibCSharp::Message(); +}; diff --git a/Tests/RunCMake/CSharpReferenceImport/ReferenceImportNative.cxx b/Tests/RunCMake/CSharpReferenceImport/ReferenceImportNative.cxx new file mode 100644 index 0000000..831a2c4 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ReferenceImportNative.cxx @@ -0,0 +1,13 @@ +// clang-format off + +#include "ImportLibNative.h" +#include "ImportLibMixedNative.h" + +#include <iostream> + +int main() +{ + std::cout << "ReferenceImportNative" << std::endl; + ImportLibNative::Message(); + ImportLibMixedNative::Message(); +}; diff --git a/Tests/RunCMake/CSharpReferenceImport/ReferenceImportPure.cxx b/Tests/RunCMake/CSharpReferenceImport/ReferenceImportPure.cxx new file mode 100644 index 0000000..2c5dd66 --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ReferenceImportPure.cxx @@ -0,0 +1,17 @@ +// clang-format off + +using namespace System; + +#using <ImportLibMixed.dll> +#using <ImportLibPure.dll> +#using <ImportLibSafe.dll> +#using <ImportLibCSharp.dll> + +int main() +{ + Console::WriteLine("ReferenceImportPure"); + ImportLibMixed::Message(); + ImportLibPure::Message(); + ImportLibSafe::Message(); + ImportLibCSharp::Message(); +}; diff --git a/Tests/RunCMake/CSharpReferenceImport/ReferenceImportSafe.cxx b/Tests/RunCMake/CSharpReferenceImport/ReferenceImportSafe.cxx new file mode 100644 index 0000000..277c96f --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/ReferenceImportSafe.cxx @@ -0,0 +1,17 @@ +// clang-format off + +using namespace System; + +#using <ImportLibMixed.dll> +#using <ImportLibPure.dll> +#using <ImportLibSafe.dll> +#using <ImportLibCSharp.dll> + +int main() +{ + Console::WriteLine("ReferenceImportSafe"); + ImportLibMixed::Message(); + ImportLibPure::Message(); + ImportLibSafe::Message(); + ImportLibCSharp::Message(); +}; diff --git a/Tests/RunCMake/CSharpReferenceImport/RunCMakeTest.cmake b/Tests/RunCMake/CSharpReferenceImport/RunCMakeTest.cmake new file mode 100644 index 0000000..c44e59e --- /dev/null +++ b/Tests/RunCMake/CSharpReferenceImport/RunCMakeTest.cmake @@ -0,0 +1,41 @@ +include(RunCMake) + +set(RunCMake_TEST_NO_CLEAN 1) + +set(exportFileName "${RunCMake_BINARY_DIR}/module.cmake") +set(exportNameSpace "ex") +set(exportTargetName "ImportLib") + +set(RunCMake_TEST_OPTIONS_BASE ${RunCMake_TEST_OPTIONS} + "-DexportNameSpace:INTERNAL=${exportNameSpace}" + "-DexportTargetName:INTERNAL=${exportTargetName}") + +file(REMOVE "${exportFileName}") + +# generate C# & C++ assemblies for use as imported target +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ImportLib-build) +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + +set(RunCMake_TEST_OPTIONS ${RunCMake_TEST_OPTIONS_BASE} + "-DexportFileName:INTERNAL=${exportFileName}" + # make sure we know the RunCMake_TEST if configuring the project again + # with cmake-gui for debugging. + "-DRunCMake_TEST:INTERNAL=ImportLib") + +run_cmake(ImportLib) +run_cmake_command(ImportLib-build ${CMAKE_COMMAND} --build . --config Debug) + +# generate C# & managed C++ programs which reference imported managed assemblies. +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ReferenceImport-build) +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + +set(RunCMake_TEST_OPTIONS ${RunCMake_TEST_OPTIONS_BASE} + "-DexportFileName:INTERNAL=${exportFileName}" + # make sure we know the RunCMake_TEST if configuring the project again + # with cmake-gui for debugging. + "-DRunCMake_TEST:INTERNAL=ReferenceImport") + +run_cmake(ReferenceImport) +run_cmake_command(ReferenceImport-build ${CMAKE_COMMAND} --build . --config Debug) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 0fafea5..3033c9c 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -141,3 +141,23 @@ function(run_TestOutputSize) ) endfunction() run_TestOutputSize() + +function(run_TestAffinity) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestAffinity) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + # Create a test with affinity enabled. The default PROCESSORS + # value is 1, so our expected output checks that this is the + # number of processors in the mask. + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " + add_test(Affinity \"${TEST_AFFINITY}\") + set_tests_properties(Affinity PROPERTIES PROCESSOR_AFFINITY ON) +") + # Run ctest with a large parallel level so that the value is + # not responsible for capping the number of processors available. + run_cmake_command(TestAffinity ${CMAKE_CTEST_COMMAND} -V -j 64) +endfunction() +if(TEST_AFFINITY) + run_TestAffinity() +endif() diff --git a/Tests/RunCMake/CTestCommandLine/TestAffinity-stdout.txt b/Tests/RunCMake/CTestCommandLine/TestAffinity-stdout.txt new file mode 100644 index 0000000..e23d30b --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestAffinity-stdout.txt @@ -0,0 +1 @@ +1: CPU affinity (mask count is '1'|not supported on this platform)\. diff --git a/Tests/RunCMake/CheckModules/CMP0075-stderr.txt b/Tests/RunCMake/CheckModules/CMP0075-stderr.txt new file mode 100644 index 0000000..960fe94 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CMP0075-stderr.txt @@ -0,0 +1,50 @@ +^CMake Warning \(dev\) at [^ +]*/Modules/CheckIncludeFile.cmake:[0-9]+ \(message\): + Policy CMP0075 is not set: Include file check macros honor + CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + CMAKE_REQUIRED_LIBRARIES is set to: + + does_not_exist + + For compatibility with CMake 3.11 and below this check is ignoring it. +Call Stack \(most recent call first\): + CMP0075.cmake:11 \(check_include_file\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/CheckIncludeFileCXX.cmake:[0-9]+ \(message\): + Policy CMP0075 is not set: Include file check macros honor + CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + CMAKE_REQUIRED_LIBRARIES is set to: + + does_not_exist + + For compatibility with CMake 3.11 and below this check is ignoring it. +Call Stack \(most recent call first\): + CMP0075.cmake:26 \(check_include_file_cxx\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/CheckIncludeFiles.cmake:[0-9]+ \(message\): + Policy CMP0075 is not set: Include file check macros honor + CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + CMAKE_REQUIRED_LIBRARIES is set to: + + does_not_exist + + For compatibility with CMake 3.11 and below this check is ignoring it. +Call Stack \(most recent call first\): + CMP0075.cmake:41 \(check_include_files\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CheckModules/CMP0075.cmake b/Tests/RunCMake/CheckModules/CMP0075.cmake new file mode 100644 index 0000000..4a3b720 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CMP0075.cmake @@ -0,0 +1,124 @@ +enable_language(C) +enable_language(CXX) +include(CheckIncludeFile) +include(CheckIncludeFileCXX) +include(CheckIncludeFiles) + +set(CMAKE_REQUIRED_LIBRARIES does_not_exist) + +#============================================================================ + +check_include_file("stddef.h" HAVE_STDDEF_H_1) +if(NOT HAVE_STDDEF_H_1) + message(SEND_ERROR "HAVE_STDDEF_H_1 failed but should have passed.") +endif() +if(NOT _CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_1 did not warn but should have") +endif() +check_include_file("stddef.h" HAVE_STDDEF_H_2) # second does not warn +if(NOT HAVE_STDDEF_H_2) + message(SEND_ERROR "HAVE_STDDEF_H_2 failed but should have passed.") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_file_cxx("stddef.h" HAVE_STDDEF_H_CXX_1) +if(NOT HAVE_STDDEF_H_CXX_1) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_1 failed but should have passed.") +endif() +if(NOT _CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_1 did not warn but should have") +endif() +check_include_file_cxx("stddef.h" HAVE_STDDEF_H_CXX_2) # second does not warn +if(NOT HAVE_STDDEF_H_CXX_2) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_2 failed but should have passed.") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H_1) +if(NOT HAVE_STDLIB_H_1) + message(SEND_ERROR "HAVE_STDLIB_H_1 failed but should have passed.") +endif() +if(NOT _CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDLIB_H_1 did not warn but should have") +endif() +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H_2) # second does not warn +if(NOT HAVE_STDLIB_H_2) + message(SEND_ERROR "HAVE_STDLIB_H_2 failed but should have passed.") +endif() +unset(_CIF_CMP0075_WARNED) + +#============================================================================ +cmake_policy(SET CMP0075 OLD) +# These should not warn. +# These should pass the checks due to ignoring 'does_not_exist'. + +check_include_file("stddef.h" HAVE_STDDEF_H_3) +if(NOT HAVE_STDDEF_H_3) + message(SEND_ERROR "HAVE_STDDEF_H_3 failed but should have passed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_3 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_file_cxx("stddef.h" HAVE_STDDEF_H_CXX_3) +if(NOT HAVE_STDDEF_H_CXX_3) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_3 failed but should have passed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_3 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H_3) +if(NOT HAVE_STDLIB_H_3) + message(SEND_ERROR "HAVE_STDLIB_H_3 failed but should have passed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDLIB_H_3 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) + +#============================================================================ +cmake_policy(SET CMP0075 NEW) +# These should not warn. +# These should fail the checks due to requiring 'does_not_exist'. + +check_include_file("stddef.h" HAVE_STDDEF_H_4) +if(HAVE_STDDEF_H_4) + message(SEND_ERROR "HAVE_STDDEF_H_4 passed but should have failed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_4 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_file_cxx("stddef.h" HAVE_STDDEF_H_CXX_4) +if(HAVE_STDDEF_H_CXX_4) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_4 passed but should have failed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_4 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H_4) +if(HAVE_STDLIB_H_4) + message(SEND_ERROR "HAVE_STDLIB_H_4 passed but should have failed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDLIB_H_4 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) diff --git a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake index c5aaa64..8a046e1 100644 --- a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(CMP0075) + run_cmake(CheckStructHasMemberOk) run_cmake(CheckStructHasMemberUnknownLanguage) run_cmake(CheckStructHasMemberMissingLanguage) diff --git a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-OFF.cmake deleted file mode 100644 index e69de29..0000000 --- a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-OFF.cmake +++ /dev/null diff --git a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON-stderr.txt deleted file mode 100644 index 2f2cbd3..0000000 --- a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Warning: - The "Visual Studio 8 2005" generator is deprecated and will be removed in a - future version of CMake. - - Add CMAKE_WARN_VS8=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 120a472..d8dbeec 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -78,13 +78,6 @@ if(RunCMake_GENERATOR STREQUAL "Ninja") unset(RunCMake_TEST_NO_CLEAN) endif() -if(RunCMake_GENERATOR MATCHES "^Visual Studio 8 2005") - set(RunCMake_WARN_VS8 1) - run_cmake(DeprecateVS8-WARN-ON) - unset(RunCMake_WARN_VS8) - run_cmake(DeprecateVS8-WARN-OFF) -endif() - if(UNIX) run_cmake_command(E_create_symlink-no-arg ${CMAKE_COMMAND} -E create_symlink diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1.cmake b/Tests/RunCMake/FindMatlab/MatlabTest1.cmake index 1cbc1c2..b4cc741 100644 --- a/Tests/RunCMake/FindMatlab/MatlabTest1.cmake +++ b/Tests/RunCMake/FindMatlab/MatlabTest1.cmake @@ -3,6 +3,9 @@ cmake_minimum_required (VERSION 2.8.12) enable_testing() project(test_should_fail) +if(NOT "${matlab_root}" STREQUAL "") + set(Matlab_ROOT_DIR ${matlab_root}) +endif() find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY) matlab_add_mex( diff --git a/Tests/RunCMake/FindMatlab/MatlabTest2.cmake b/Tests/RunCMake/FindMatlab/MatlabTest2.cmake index d5b0e6d..4295d3c 100644 --- a/Tests/RunCMake/FindMatlab/MatlabTest2.cmake +++ b/Tests/RunCMake/FindMatlab/MatlabTest2.cmake @@ -6,4 +6,8 @@ if(NOT DEFINED matlab_required) set(matlab_required REQUIRED) endif() +if(NOT DEFINED Matlab_ROOT_DIR AND NOT "${matlab_root}" STREQUAL "") + set(Matlab_ROOT_DIR ${matlab_root}) +endif() + find_package(Matlab ${matlab_required} COMPONENTS MX_LIBRARY) diff --git a/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake b/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake index f0eb6b4..deebf89 100644 --- a/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake @@ -1,5 +1,13 @@ include(RunCMake) + + +if(NOT "${MCR_ROOT}" STREQUAL "") + if(NOT EXISTS "${MCR_ROOT}") + message(FATAL_ERROR "MCR does not exist ${MCR_ROOT}") + endif() + set(RunCMake_TEST_OPTIONS "-Dmatlab_root=${MCR_ROOT}") +endif() run_cmake(MatlabTest1) if(RunCMake_GENERATOR MATCHES "Make" AND UNIX) @@ -11,6 +19,9 @@ if(RunCMake_GENERATOR MATCHES "Make" AND UNIX) message(STATUS "RerunFindMatlab: first configuration to extract real Matlab_ROOT_DIR") set(RunCMake_TEST_OPTIONS "-Dmatlab_required=REQUIRED") + if(NOT "${MCR_ROOT}" STREQUAL "") + set(RunCMake_TEST_OPTIONS ${RunCMake_TEST_OPTIONS} "-Dmatlab_root=${MCR_ROOT}") + endif() run_cmake(MatlabTest2) message(STATUS "RerunFindMatlab: flushing the variables") diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt deleted file mode 100644 index 444da45..0000000 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at COMPILE_LANGUAGE-unknown-lang.cmake:4 \(target_compile_options\): - Error evaluating generator expression: - - \$<COMPILE_LANGUAGE:CXX> - - \$<COMPILE_LANGUAGE:...> Unknown language. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake index cec12a3..00dd290 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake @@ -1,4 +1,4 @@ enable_language(C) add_executable(empty empty.c) -target_compile_options(empty PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wall>) +target_compile_options(empty PRIVATE $<$<COMPILE_LANGUAGE:CXX>:$<TARGET_EXISTS:too,many,parameters>>) diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-check.cmake b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-check.cmake new file mode 100644 index 0000000..df76740 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/GENEX_EVAL-generated.txt" content) + +set(expected "BEFORE_PROPERTY1_AFTER") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-stderr.txt b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-stderr.txt new file mode 100644 index 0000000..012dff6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-stderr.txt @@ -0,0 +1,26 @@ +^CMake Error at GENEX_EVAL-recursion1.cmake:7 \(add_custom_target\): + Error evaluating generator expression: + + \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY>> + + Dependency loop found. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at GENEX_EVAL-recursion1.cmake:7 \(add_custom_target\): + Loop step 1 + + \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at GENEX_EVAL-recursion1.cmake:7 \(add_custom_target\): + Loop step 2 + + \$<TARGET_GENEX_EVAL:recursion,\$<TARGET_PROPERTY:recursion,CUSTOM_PROPERTY>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1.cmake b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1.cmake new file mode 100644 index 0000000..6596a81 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library (recursion SHARED empty.c) +set_property (TARGET recursion PROPERTY CUSTOM_PROPERTY "$<GENEX_EVAL:$<TARGET_PROPERTY:CUSTOM_PROPERTY>>") + +add_custom_target (drive + COMMAND echo "$<TARGET_GENEX_EVAL:recursion,$<TARGET_PROPERTY:recursion,CUSTOM_PROPERTY>>" + DEPENDS recursion) diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-stderr.txt b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-stderr.txt new file mode 100644 index 0000000..fd954e6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-stderr.txt @@ -0,0 +1,26 @@ +^CMake Error at GENEX_EVAL-recursion2.cmake:8 \(add_custom_target\): + Error evaluating generator expression: + + \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY1>> + + Dependency loop found. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at GENEX_EVAL-recursion2.cmake:8 \(add_custom_target\): + Loop step 1 + + \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY2>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at GENEX_EVAL-recursion2.cmake:8 \(add_custom_target\): + Loop step 2 + + \$<TARGET_GENEX_EVAL:recursion,\$<TARGET_PROPERTY:recursion,CUSTOM_PROPERTY1>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2.cmake b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2.cmake new file mode 100644 index 0000000..773749f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2.cmake @@ -0,0 +1,10 @@ + +enable_language(C) + +add_library(recursion SHARED empty.c) +set_property (TARGET recursion PROPERTY CUSTOM_PROPERTY1 "$<GENEX_EVAL:$<TARGET_PROPERTY:CUSTOM_PROPERTY2>>") +set_property (TARGET recursion PROPERTY CUSTOM_PROPERTY2 "$<GENEX_EVAL:$<TARGET_PROPERTY:CUSTOM_PROPERTY1>>") + +add_custom_target (drive + COMMAND echo "$<TARGET_GENEX_EVAL:recursion,$<TARGET_PROPERTY:recursion,CUSTOM_PROPERTY1>>" + DEPENDS recursion) diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL.cmake b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL.cmake new file mode 100644 index 0000000..ab8988b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL.cmake @@ -0,0 +1,11 @@ + +cmake_policy(VERSION 3.11) + +enable_language(C) + +add_library (example SHARED empty.c) +set_property (TARGET example PROPERTY CUSTOM_PROPERTY1 "PROPERTY1") +set_property (TARGET example PROPERTY CUSTOM_PROPERTY2 "$<TARGET_PROPERTY:CUSTOM_PROPERTY1>") +set_property (TARGET example PROPERTY CUSTOM_PROPERTY3 "$<GENEX_EVAL:BEFORE_$<TARGET_PROPERTY:CUSTOM_PROPERTY2>_AFTER>") + +file(GENERATE OUTPUT "GENEX_EVAL-generated.txt" CONTENT "$<TARGET_GENEX_EVAL:example,$<TARGET_PROPERTY:example,CUSTOM_PROPERTY3>>") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 2486259..3905c5f 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -34,6 +34,23 @@ run_cmake(OUTPUT_NAME-recursion) run_cmake(TARGET_PROPERTY-LOCATION) run_cmake(TARGET_PROPERTY-SOURCES) run_cmake(LINK_ONLY-not-linking) +run_cmake(TARGET_EXISTS-no-arg) +run_cmake(TARGET_EXISTS-empty-arg) +run_cmake(TARGET_EXISTS) +run_cmake(TARGET_EXISTS-not-a-target) +run_cmake(TARGET_NAME_IF_EXISTS-no-arg) +run_cmake(TARGET_NAME_IF_EXISTS-empty-arg) +run_cmake(TARGET_NAME_IF_EXISTS) +run_cmake(TARGET_NAME_IF_EXISTS-not-a-target) +run_cmake(TARGET_GENEX_EVAL-no-arg) +run_cmake(TARGET_GENEX_EVAL-no-target) +run_cmake(TARGET_GENEX_EVAL-non-valid-target) +run_cmake(TARGET_GENEX_EVAL-recursion1) +run_cmake(TARGET_GENEX_EVAL-recursion2) +run_cmake(TARGET_GENEX_EVAL) +run_cmake(GENEX_EVAL-recursion1) +run_cmake(GENEX_EVAL-recursion2) +run_cmake(GENEX_EVAL) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-check.cmake new file mode 100644 index 0000000..c4c3a51 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_EXISTS-generated.txt" content) + +set(expected "1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-stderr.txt new file mode 100644 index 0000000..1df6e28 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TARGET_EXISTS-empty-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_EXISTS:> + + \$<TARGET_EXISTS:tgt> expression requires a non-empty valid target name. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg.cmake new file mode 100644 index 0000000..e387abc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_EXISTS-generated.txt CONTENT "$<TARGET_EXISTS:${empty}>") diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-stderr.txt new file mode 100644 index 0000000..69e6130 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TARGET_EXISTS-no-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_EXISTS> + + \$<TARGET_EXISTS> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg.cmake new file mode 100644 index 0000000..0a5ce32 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_EXISTS-generated.txt CONTENT "$<TARGET_EXISTS>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target-check.cmake new file mode 100644 index 0000000..35ba267 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_EXISTS-not-a-target-generated.txt" content) + +set(expected "0") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target.cmake new file mode 100644 index 0000000..d8a8d3e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_EXISTS-not-a-target-generated.txt CONTENT "$<TARGET_EXISTS:just-random-string>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS.cmake new file mode 100644 index 0000000..9a83b34 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0070 NEW) +add_custom_target(foo) +file(GENERATE OUTPUT TARGET_EXISTS-generated.txt CONTENT "$<TARGET_EXISTS:foo>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-check.cmake new file mode 100644 index 0000000..124a583 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_GENEX_EVAL-generated.txt" content) + +set(expected "BEFORE_PROPERTY1_AFTER") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-stderr.txt new file mode 100644 index 0000000..9b0844f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at TARGET_GENEX_EVAL-no-arg.cmake:4 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_GENEX_EVAL:> + + \$<TARGET_GENEX_EVAL> expression requires 2 comma separated parameters, but + got 1 instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg.cmake new file mode 100644 index 0000000..2dc13ea --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg.cmake @@ -0,0 +1,7 @@ + +cmake_policy(VERSION 3.11) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_GENEX_EVAL:>.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-stderr.txt new file mode 100644 index 0000000..647fd85 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at TARGET_GENEX_EVAL-no-target.cmake:2 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_GENEX_EVAL:,> + + \$<TARGET_GENEX_EVAL:tgt, ...> expression requires a non-empty valid target + name. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target.cmake new file mode 100644 index 0000000..df4f0ea --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target.cmake @@ -0,0 +1,5 @@ + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_GENEX_EVAL:,>.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-stderr.txt new file mode 100644 index 0000000..cc44d4b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at TARGET_GENEX_EVAL-non-valid-target.cmake:2 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_GENEX_EVAL:bad-target,> + + \$<TARGET_GENEX_EVAL:tgt, ...> target "bad-target" not found. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target.cmake new file mode 100644 index 0000000..8db7375 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target.cmake @@ -0,0 +1,5 @@ + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_GENEX_EVAL:bad-target,>.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-stderr.txt new file mode 100644 index 0000000..bba2234 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at TARGET_GENEX_EVAL-recursion1.cmake:7 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_GENEX_EVAL:recursion,\$<TARGET_PROPERTY:CUSTOM_PROPERTY>> + + Self reference on target "recursion". + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1.cmake new file mode 100644 index 0000000..b75d211 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library (recursion SHARED empty.c) +set_property (TARGET recursion PROPERTY CUSTOM_PROPERTY "$<TARGET_GENEX_EVAL:recursion,$<TARGET_PROPERTY:CUSTOM_PROPERTY>>") + +add_custom_target (drive + COMMAND echo "$<TARGET_GENEX_EVAL:recursion,$<TARGET_PROPERTY:recursion,CUSTOM_PROPERTY>>" + DEPENDS recursion) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-stderr.txt new file mode 100644 index 0000000..73f6b77 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-stderr.txt @@ -0,0 +1,26 @@ +^CMake Error at TARGET_GENEX_EVAL-recursion2.cmake:10 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_GENEX_EVAL:recursion1,\$<TARGET_PROPERTY:recursion1,CUSTOM_PROPERTY1>> + + Dependency loop found. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at TARGET_GENEX_EVAL-recursion2.cmake:10 \(add_custom_target\): + Loop step 1 + + \$<TARGET_GENEX_EVAL:recursion2,\$<TARGET_PROPERTY:recursion2,CUSTOM_PROPERTY2>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at TARGET_GENEX_EVAL-recursion2.cmake:10 \(add_custom_target\): + Loop step 2 + + \$<TARGET_GENEX_EVAL:recursion1,\$<TARGET_PROPERTY:recursion1,CUSTOM_PROPERTY1>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2.cmake new file mode 100644 index 0000000..a28dfc3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2.cmake @@ -0,0 +1,12 @@ + +enable_language(C) + +add_library (recursion1 SHARED empty.c) +set_property (TARGET recursion1 PROPERTY CUSTOM_PROPERTY1 "$<TARGET_GENEX_EVAL:recursion2,$<TARGET_PROPERTY:recursion2,CUSTOM_PROPERTY2>>") + +add_library (recursion2 SHARED empty.c) +set_property (TARGET recursion2 PROPERTY CUSTOM_PROPERTY2 "$<TARGET_GENEX_EVAL:recursion1,$<TARGET_PROPERTY:recursion1,CUSTOM_PROPERTY1>>") + +add_custom_target (drive + COMMAND echo "$<TARGET_GENEX_EVAL:recursion1,$<TARGET_PROPERTY:recursion1,CUSTOM_PROPERTY1>>" + DEPENDS recursion) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL.cmake new file mode 100644 index 0000000..68b3712 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL.cmake @@ -0,0 +1,10 @@ + +cmake_policy(VERSION 3.11) + +enable_language(C) + +add_library (example SHARED empty.c) +set_property (TARGET example PROPERTY CUSTOM_PROPERTY1 "PROPERTY1") +set_property (TARGET example PROPERTY CUSTOM_PROPERTY2 "BEFORE_$<TARGET_PROPERTY:CUSTOM_PROPERTY1>_AFTER") + +file(GENERATE OUTPUT "TARGET_GENEX_EVAL-generated.txt" CONTENT "$<TARGET_GENEX_EVAL:example,$<TARGET_PROPERTY:example,CUSTOM_PROPERTY2>>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake new file mode 100644 index 0000000..2f57430 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated.txt" content) + +set(expected "foo") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt new file mode 100644 index 0000000..5ee13b7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TARGET_NAME_IF_EXISTS-empty-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_NAME_IF_EXISTS:> + + \$<TARGET_NAME_IF_EXISTS:tgt> expression requires a non-empty valid target + name. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake new file mode 100644 index 0000000..f5034f4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS:${empty}>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt new file mode 100644 index 0000000..4122425 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TARGET_NAME_IF_EXISTS-no-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_NAME_IF_EXISTS> + + \$<TARGET_NAME_IF_EXISTS> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake new file mode 100644 index 0000000..3293094 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake new file mode 100644 index 0000000..2085c16 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-not-a-target-generated.txt" content) + +if(content) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected an empty string") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake new file mode 100644 index 0000000..a054e6c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-not-a-target-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS:just-random-string>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake new file mode 100644 index 0000000..0ce3b1d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0070 NEW) +add_custom_target(foo) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS:foo>") diff --git a/Tests/RunCMake/Ninja/NoWorkToDo-nowork-stdout.txt b/Tests/RunCMake/Ninja/NoWorkToDo-nowork-stdout.txt new file mode 100644 index 0000000..60a9228 --- /dev/null +++ b/Tests/RunCMake/Ninja/NoWorkToDo-nowork-stdout.txt @@ -0,0 +1 @@ +^ninja: no work to do diff --git a/Tests/RunCMake/Ninja/NoWorkToDo.cmake b/Tests/RunCMake/Ninja/NoWorkToDo.cmake new file mode 100644 index 0000000..a2fa0cb --- /dev/null +++ b/Tests/RunCMake/Ninja/NoWorkToDo.cmake @@ -0,0 +1,2 @@ +enable_language(C) +add_executable(hello hello.c) diff --git a/Tests/RunCMake/Ninja/RspFileC.cmake b/Tests/RunCMake/Ninja/RspFileC.cmake new file mode 100644 index 0000000..4a40682 --- /dev/null +++ b/Tests/RunCMake/Ninja/RspFileC.cmake @@ -0,0 +1,2 @@ +set(ENV{CMAKE_NINJA_FORCE_RESPONSE_FILE} 1) +enable_language(C) diff --git a/Tests/RunCMake/Ninja/RspFileCXX.cmake b/Tests/RunCMake/Ninja/RspFileCXX.cmake new file mode 100644 index 0000000..9e61ffe --- /dev/null +++ b/Tests/RunCMake/Ninja/RspFileCXX.cmake @@ -0,0 +1,2 @@ +set(ENV{CMAKE_NINJA_FORCE_RESPONSE_FILE} 1) +enable_language(CXX) diff --git a/Tests/RunCMake/Ninja/RspFileFortran.cmake b/Tests/RunCMake/Ninja/RspFileFortran.cmake new file mode 100644 index 0000000..8c18e37 --- /dev/null +++ b/Tests/RunCMake/Ninja/RspFileFortran.cmake @@ -0,0 +1,2 @@ +set(ENV{CMAKE_NINJA_FORCE_RESPONSE_FILE} 1) +enable_language(Fortran) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index b3720fb..b6e6cd4 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -21,6 +21,15 @@ function(run_NinjaToolMissing) endfunction() run_NinjaToolMissing() +function(run_NoWorkToDo) + run_cmake(NoWorkToDo) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoWorkToDo-build) + run_cmake_command(NoWorkToDo-build ${CMAKE_COMMAND} --build .) + run_cmake_command(NoWorkToDo-nowork ${CMAKE_COMMAND} --build . -- -d explain) +endfunction() +run_NoWorkToDo() + function(run_CMP0058 case) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build) @@ -40,6 +49,12 @@ run_CMP0058(NEW-by) run_cmake(CustomCommandDepfile) +run_cmake(RspFileC) +run_cmake(RspFileCXX) +if(TEST_Fortran) + run_cmake(RspFileFortran) +endif() + function(run_CommandConcat) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CommandConcat-build) set(RunCMake_TEST_NO_CLEAN 1) diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt deleted file mode 100644 index b91ffd0..0000000 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt +++ /dev/null @@ -1,9 +0,0 @@ -CMake Error at BadObjSource2.cmake:1 \(add_library\): - OBJECT library "A" contains: - - bad.obj - - but may contain only sources that compile, header files, and other files - that would not affect linking of a normal library. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/CMakeLists.txt b/Tests/RunCMake/ObjectLibrary/CMakeLists.txt index a17c8cd..d1b0d2c 100644 --- a/Tests/RunCMake/ObjectLibrary/CMakeLists.txt +++ b/Tests/RunCMake/ObjectLibrary/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.10) project(${RunCMake_TEST} C) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt b/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt deleted file mode 100644 index 5420159..0000000 --- a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at ExportNotSupported.cmake:[0-9]+ \(export\): - export given OBJECT library "A" which may not be exported under Xcode with - multiple architectures. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake b/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake deleted file mode 100644 index a3f104e..0000000 --- a/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_library(A OBJECT a.c) -export(TARGETS A FILE AExport.cmake) diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt new file mode 100644 index 0000000..f2f0f94 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt @@ -0,0 +1 @@ +CMake Error: install\(EXPORT "exp" ...\) includes target "UseA" which requires target "A" that is not in the export set. diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake new file mode 100644 index 0000000..9e24609 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake @@ -0,0 +1,6 @@ +add_library(A OBJECT a.c) +add_library(UseA STATIC) +target_link_libraries(UseA PUBLIC A) + +install(TARGETS UseA EXPORT exp ARCHIVE DESTINATION lib) +install(EXPORT exp DESTINATION lib/cmake/exp) diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake new file mode 100644 index 0000000..cdda962 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake @@ -0,0 +1,6 @@ +add_library(A OBJECT a.c) +add_library(UseA STATIC) +target_link_libraries(UseA PUBLIC A) + +install(TARGETS UseA A EXPORT exp ARCHIVE DESTINATION lib) +install(EXPORT exp DESTINATION lib/cmake/exp) diff --git a/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt index 35a0e4f..a7004c1 100644 --- a/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt @@ -1,5 +1,5 @@ CMake Error at InstallNotSupported.cmake:[0-9]+ \(install\): - install TARGETS given OBJECT library "A" which may not be installed under - Xcode with multiple architectures. + install TARGETS given OBJECT library "A" whose objects may not be installed + under Xcode with multiple architectures. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt deleted file mode 100644 index 90e828b..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at LinkObjLHS.cmake:2 \(target_link_libraries\): - Object library target "AnObjLib" may not link to anything. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake deleted file mode 100644 index 5d7831a..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_library(AnObjLib OBJECT a.c) -target_link_libraries(AnObjLib OtherLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake new file mode 100644 index 0000000..4aa7bba --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake @@ -0,0 +1,7 @@ +project(LinkObjLHSShared C) + +add_library(OtherLib SHARED a.c) +target_compile_definitions(OtherLib INTERFACE REQUIRED) + +add_library(AnObjLib OBJECT requires.c) +target_link_libraries(AnObjLib OtherLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake new file mode 100644 index 0000000..261bee7 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake @@ -0,0 +1,7 @@ +project(LinkObjLHSStatic C) + +add_library(OtherLib STATIC a.c) +target_compile_definitions(OtherLib INTERFACE REQUIRED) + +add_library(AnObjLib OBJECT requires.c) +target_link_libraries(AnObjLib OtherLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt deleted file mode 100644 index d5ee4f9..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at LinkObjRHS1.cmake:3 \(target_link_libraries\): - Target "AnObjLib" of type OBJECT_LIBRARY may not be linked into another - target. One may link only to INTERFACE, STATIC or SHARED libraries, or to - executables with the ENABLE_EXPORTS property set. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake deleted file mode 100644 index 113d6a8..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake +++ /dev/null @@ -1,3 +0,0 @@ -add_library(A STATIC a.c) -add_library(AnObjLib OBJECT a.c) -target_link_libraries(A AnObjLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt deleted file mode 100644 index 3295fca..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at LinkObjRHS2.cmake:1 \(add_library\): - Target "A" links to OBJECT library "AnObjLib" but this is not allowed. One - may link only to STATIC or SHARED libraries, or to executables with the - ENABLE_EXPORTS property set. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake deleted file mode 100644 index 6163729..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake +++ /dev/null @@ -1,3 +0,0 @@ -add_library(A SHARED a.c) -target_link_libraries(A AnObjLib) -add_library(AnObjLib OBJECT a.c) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt new file mode 100644 index 0000000..e27f06b --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt @@ -0,0 +1 @@ +[1-9][0-9]* diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt new file mode 100644 index 0000000..4eeb096 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt @@ -0,0 +1 @@ +REQUIRED needs to be defined diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake new file mode 100644 index 0000000..db571a3 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake @@ -0,0 +1,12 @@ +cmake_policy(SET CMP0022 NEW) + +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(AnotherObjLib OBJECT b.c) +target_link_libraries(AnotherObjLib PRIVATE AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe AnotherObjLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt new file mode 100644 index 0000000..e27f06b --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt @@ -0,0 +1 @@ +[1-9][0-9]* diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake new file mode 100644 index 0000000..6bb8d5e --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake @@ -0,0 +1,12 @@ +cmake_policy(SET CMP0022 NEW) + +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(AnotherObjLib OBJECT b.c) +target_link_libraries(AnotherObjLib PUBLIC AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe AnotherObjLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake new file mode 100644 index 0000000..b9030b3 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +add_definitions(-DCOMPILE_FOR_SHARED_LIB) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) +set_target_properties(AnObjLib PROPERTIES POSITION_INDEPENDENT_CODE ON) + +add_library(A SHARED b.c $<TARGET_OBJECTS:AnObjLib>) +target_link_libraries(A PUBLIC AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake new file mode 100644 index 0000000..e2e5fa2 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake @@ -0,0 +1,14 @@ +enable_language(C) + +add_definitions(-DCOMPILE_FOR_SHARED_LIB) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) +set_target_properties(AnObjLib PROPERTIES POSITION_INDEPENDENT_CODE ON) + +add_library(A SHARED b.c) +target_link_libraries(A PRIVATE AnObjLib) +target_compile_definitions(A INTERFACE $<TARGET_PROPERTY:AnObjLib,INTERFACE_COMPILE_DEFINITIONS>) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake new file mode 100644 index 0000000..73fad06 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(A STATIC b.c $<TARGET_OBJECTS:AnObjLib>) +target_link_libraries(A PUBLIC AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake new file mode 100644 index 0000000..9e1ab6d --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake @@ -0,0 +1,11 @@ +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(A STATIC b.c) +target_link_libraries(A PRIVATE AnObjLib) +target_compile_definitions(A INTERFACE $<TARGET_PROPERTY:AnObjLib,INTERFACE_COMPILE_DEFINITIONS>) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt b/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt deleted file mode 100644 index d67b4ae..0000000 --- a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at ObjWithObj.cmake:2 \(add_library\): - Only executables and non-OBJECT libraries may reference target objects. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index b8eed73..c73732f 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -6,17 +6,46 @@ run_cmake(BadSourceExpression3) run_cmake(BadObjSource1) run_cmake(BadObjSource2) if(RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") - run_cmake(ExportNotSupported) run_cmake(ImportNotSupported) run_cmake(InstallNotSupported) else() - run_cmake(Export) run_cmake(Import) run_cmake(Install) + run_cmake(InstallLinkedObj1) + run_cmake(InstallLinkedObj2) endif() -run_cmake(LinkObjLHS) -run_cmake(LinkObjRHS1) -run_cmake(LinkObjRHS2) +run_cmake(Export) + +function (run_object_lib_build name) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${name}) + run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) +endfunction () + +function (run_object_lib_build2 name) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${name}) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) +endfunction () + +run_object_lib_build(LinkObjLHSShared) +run_object_lib_build(LinkObjLHSStatic) +run_object_lib_build(LinkObjRHSShared) +run_object_lib_build(LinkObjRHSStatic) +run_object_lib_build2(LinkObjRHSObject) +run_object_lib_build(LinkObjRHSShared2) +run_object_lib_build(LinkObjRHSStatic2) +run_object_lib_build2(LinkObjRHSObject2) + run_cmake(MissingSource) run_cmake(ObjWithObj) run_cmake(OwnSources) diff --git a/Tests/RunCMake/ObjectLibrary/a.c b/Tests/RunCMake/ObjectLibrary/a.c index 1636303..5beb3f1 100644 --- a/Tests/RunCMake/ObjectLibrary/a.c +++ b/Tests/RunCMake/ObjectLibrary/a.c @@ -1,4 +1,10 @@ -int a(void) +#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) +#define EXPORT __declspec(dllexport) +#else +#define EXPORT +#endif + +EXPORT int a(void) { return 0; } diff --git a/Tests/RunCMake/ObjectLibrary/b.c b/Tests/RunCMake/ObjectLibrary/b.c index 6751907..7549abf 100644 --- a/Tests/RunCMake/ObjectLibrary/b.c +++ b/Tests/RunCMake/ObjectLibrary/b.c @@ -1,4 +1,14 @@ -int b(void) +#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) +#define EXPORT __declspec(dllexport) +#else +#define EXPORT +#endif + +extern int a(void); +EXPORT int b() { - return 0; + return a(); } +#ifndef REQUIRED +#error "REQUIRED needs to be defined" +#endif diff --git a/Tests/RunCMake/ObjectLibrary/exe.c b/Tests/RunCMake/ObjectLibrary/exe.c new file mode 100644 index 0000000..6efdae7 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/exe.c @@ -0,0 +1,14 @@ +#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) +#define IMPORT __declspec(dllimport) +#else +#define IMPORT +#endif + +extern IMPORT int b(void); +int main() +{ + return b(); +} +#ifndef REQUIRED +#error "REQUIRED needs to be defined" +#endif diff --git a/Tests/RunCMake/ObjectLibrary/requires.c b/Tests/RunCMake/ObjectLibrary/requires.c new file mode 100644 index 0000000..d524952 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/requires.c @@ -0,0 +1,8 @@ +#ifdef REQUIRED +int required() +{ + return 0; +} +#else +#error "REQUIRED not defined" +#endif diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index e688830..b2b38ef 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -51,9 +51,6 @@ function(run_cmake test) if(APPLE) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) endif() - if(RunCMake_GENERATOR MATCHES "^Visual Studio 8 2005" AND NOT RunCMake_WARN_VS8) - list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_WARN_VS8=OFF) - endif() if(RunCMake_MAKE_PROGRAM) list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}") endif() @@ -112,6 +109,8 @@ function(run_cmake test) "|clang[^:]*: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled:" "|Error kstat returned" "|Hit xcodebuild bug" + "|ld: 0711-224 WARNING: Duplicate symbol: .__init_aix_libgcc_cxa_atexit" + "|ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information" "|[^\n]*is a member of multiple groups" "|[^\n]*from Time Machine by path" "|[^\n]*Bullseye Testing Technology" diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 8d5139d..5af6fcd 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -23,6 +23,7 @@ \* CMP0065 \* CMP0068 \* CMP0069 + \* CMP0073 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index a8d806f..0d178ce 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -6,6 +6,8 @@ run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) run_cmake(VsDebuggerWorkingDir) +run_cmake(VsDebuggerCommand) run_cmake(VsCSharpCustomTags) run_cmake(VsCSharpReferenceProps) run_cmake(VsCSharpWithoutSources) +run_cmake(VsSdkDirectories) diff --git a/Tests/RunCMake/VS10Project/VsCSharpCustomTags-stderr.txt b/Tests/RunCMake/VS10Project/VsCSharpCustomTags-stderr.txt new file mode 100644 index 0000000..1ea3b51 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpCustomTags-stderr.txt @@ -0,0 +1,3 @@ +^CMake Deprecation Warning in CMakeLists.txt: + The C# target "foo" is of type STATIC_LIBRARY. This is discouraged \(and + may be disabled in future\). Make it a SHARED library instead.$ diff --git a/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake b/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake index 45766a0..96be54b 100644 --- a/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake +++ b/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake @@ -16,8 +16,7 @@ set(fileNames) foreach(e ${fileExtensions}) set(currentFile "${CMAKE_CURRENT_BINARY_DIR}/foo.${e}") list(APPEND fileNames ${currentFile}) - execute_process(COMMAND ${CMAKE_COMMAND} -E touch - "${currentFile}") + file(TOUCH "${currentFile}") string(TOUPPER ${e} eUC) set_source_files_properties("${currentFile}" PROPERTIES diff --git a/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-stderr.txt b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-stderr.txt new file mode 100644 index 0000000..4402b8f --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning in CMakeLists.txt: + The C# target "foo2" is of type STATIC_LIBRARY. This is discouraged \(and + may be disabled in future\). Make it a SHARED library instead. + + +CMake Deprecation Warning in CMakeLists.txt: + The C# target "foo" is of type STATIC_LIBRARY. This is discouraged \(and + may be disabled in future\). Make it a SHARED library instead.$ diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake new file mode 100644 index 0000000..0ded780 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake @@ -0,0 +1,22 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(debuggerCommandSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<LocalDebuggerCommand[^>]*>([^<>]+)</LocalDebuggerCommand>$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command") + message(STATUS "foo.vcxproj has debugger command set") + set(debuggerCommandSet TRUE) + endif() + endif() +endforeach() + +if(NOT debuggerCommandSet) + set(RunCMake_TEST_FAILED "LocalDebuggerCommand not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake new file mode 100644 index 0000000..e29adc4 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + VS_DEBUGGER_COMMAND "my-debugger-command") diff --git a/Tests/RunCMake/VS10Project/VsSdkDirectories-check.cmake b/Tests/RunCMake/VS10Project/VsSdkDirectories-check.cmake new file mode 100644 index 0000000..c21afb6 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsSdkDirectories-check.cmake @@ -0,0 +1,88 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(ExecutablePathSet FALSE) +set(IncludePathSet FALSE) +set(ReferencePathSet FALSE) +set(LibraryPathSet FALSE) +set(LibraryWPathSet FALSE) +set(SourcePathSet FALSE) +set(ExcludePathSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<ExecutablePath[^>]*>([^<>]+)</ExecutablePath>$") + if("${CMAKE_MATCH_1}" STREQUAL "$(VC_ExecutablePath_x86);C:\\Program Files\\Custom-SDK\\;") + message(STATUS "foo.vcxproj has executable path set") + set(ExecutablePathSet TRUE) + endif() + elseif(line MATCHES "^ *<IncludePath[^>]*>([^<>]+)</IncludePath>$") + if("${CMAKE_MATCH_1}" STREQUAL "$(VC_IncludePath);C:\\Program Files\\Custom-SDK\\;") + message(STATUS "foo.vcxproj has include path set") + set(IncludePathSet TRUE) + endif() + elseif(line MATCHES "^ *<ReferencePath[^>]*>([^<>]+)</ReferencePath>$") + if("${CMAKE_MATCH_1}" STREQUAL "$(VC_ReferencesPath_x86);C:\\Program Files\\Custom-SDK\\;") + message(STATUS "foo.vcxproj has reference path set") + set(ReferencePathSet TRUE) + endif() + elseif(line MATCHES "^ *<LibraryPath[^>]*>([^<>]+)</LibraryPath>$") + if("${CMAKE_MATCH_1}" STREQUAL "$(VC_LibraryPath_x86);C:\\Program Files\\Custom-SDK\\;") + message(STATUS "foo.vcxproj has library path set") + set(LibraryPathSet TRUE) + endif() + elseif(line MATCHES "^ *<LibraryWPath[^>]*>([^<>]+)</LibraryWPath>$") + if("${CMAKE_MATCH_1}" STREQUAL "$(WindowsSDK_MetadataPath);C:\\Program Files\\Custom-SDK\\;") + message(STATUS "foo.vcxproj has library WinRT path set") + set(LibraryWPathSet TRUE) + endif() + elseif(line MATCHES "^ *<SourcePath[^>]*>([^<>]+)</SourcePath>$") + if("${CMAKE_MATCH_1}" STREQUAL "$(VC_SourcePath);C:\\Program Files\\Custom-SDK\\;") + message(STATUS "foo.vcxproj has source path set") + set(SourcePathSet TRUE) + endif() + elseif(line MATCHES "^ *<ExcludePath[^>]*>([^<>]+)</ExcludePath>$") + if("${CMAKE_MATCH_1}" STREQUAL "$(VC_IncludePath);C:\\Program Files\\Custom-SDK\\;") + message(STATUS "foo.vcxproj has exclude path set") + set(ExcludePathSet TRUE) + endif() + endif() +endforeach() + +if(NOT ExecutablePathSet) + set(RunCMake_TEST_FAILED "ExecutablePath not found or not set correctly.") + return() +endif() + +if(NOT IncludePathSet) + set(RunCMake_TEST_FAILED "IncludePath not found or not set correctly.") + return() +endif() + +if(NOT ReferencePathSet) + set(RunCMake_TEST_FAILED "ReferencePath not found or not set correctly.") + return() +endif() + +if(NOT LibraryPathSet) + set(RunCMake_TEST_FAILED "LibraryPath not found or not set correctly.") + return() +endif() + +if(NOT LibraryWPathSet) + set(RunCMake_TEST_FAILED "LibraryWPath not found or not set correctly.") + return() +endif() + +if(NOT SourcePathSet) + set(RunCMake_TEST_FAILED "SourcePath not found or not set correctly.") + return() +endif() + +if(NOT ExcludePathSet) + set(RunCMake_TEST_FAILED "ExcludePath not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsSdkDirectories.cmake b/Tests/RunCMake/VS10Project/VsSdkDirectories.cmake new file mode 100644 index 0000000..c8f2a5a --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsSdkDirectories.cmake @@ -0,0 +1,11 @@ +enable_language(CXX) + +set(CMAKE_VS_SDK_EXECUTABLE_DIRECTORIES "$(VC_ExecutablePath_x86);C:\\Program Files\\Custom-SDK\\;") +set(CMAKE_VS_SDK_INCLUDE_DIRECTORIES "$(VC_IncludePath);C:\\Program Files\\Custom-SDK\\;") +set(CMAKE_VS_SDK_REFERENCE_DIRECTORIES "$(VC_ReferencesPath_x86);C:\\Program Files\\Custom-SDK\\;") +set(CMAKE_VS_SDK_LIBRARY_DIRECTORIES "$(VC_LibraryPath_x86);C:\\Program Files\\Custom-SDK\\;") +set(CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES "$(WindowsSDK_MetadataPath);C:\\Program Files\\Custom-SDK\\;") +set(CMAKE_VS_SDK_SOURCE_DIRECTORIES "$(VC_SourcePath);C:\\Program Files\\Custom-SDK\\;") +set(CMAKE_VS_SDK_EXCLUDE_DIRECTORIES "$(VC_IncludePath);C:\\Program Files\\Custom-SDK\\;") + +add_library(foo foo.cpp) diff --git a/Tests/RunCMake/WorkingDirectory/CMakeLists.txt.in b/Tests/RunCMake/WorkingDirectory/CMakeLists.txt.in new file mode 100644 index 0000000..46047b8 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/CMakeLists.txt.in @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.11) +project(@CASE_NAME@ NONE) +include("@RunCMake_SOURCE_DIR@/@CASE_NAME@.cmake") diff --git a/Tests/RunCMake/WorkingDirectory/CTestConfig.cmake.in b/Tests/RunCMake/WorkingDirectory/CTestConfig.cmake.in new file mode 100644 index 0000000..0226230 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/CTestConfig.cmake.in @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "CTestTestWorkingDir.@CASE_NAME@") diff --git a/Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake b/Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake new file mode 100644 index 0000000..a7685ae --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCTest) + +run_ctest(dirNotExist) +run_ctest(buildAndTestNoBuildDir + --build-and-test + ${RunCMake_BINARY_DIR}/buildAndTestNoBuildDir + ${RunCMake_BINARY_DIR}/buildAndTestNoBuildDir/CMakeLists.txt # Deliberately a file + --build-generator "${RunCMake_GENERATOR}" +) diff --git a/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-check.cmake b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-check.cmake new file mode 100644 index 0000000..fcfe461 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS ${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt) + set(RunCMake_TEST_FAILED "Default build dir ${RunCMake_TEST_BINARY_DIR} was used, should not have been") +endif() diff --git a/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-result.txt b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-result.txt new file mode 100644 index 0000000..0617a38 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-result.txt @@ -0,0 +1 @@ +^[^0][0-9]*$ diff --git a/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt new file mode 100644 index 0000000..da89317 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt @@ -0,0 +1 @@ +Failed to change working directory to .*[/\\]buildAndTestNoBuildDir[/\\]CMakeLists.txt : diff --git a/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir.cmake b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir.cmake new file mode 100644 index 0000000..ad795c4 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir.cmake @@ -0,0 +1,7 @@ +# We want a single test that always passes. We should never actually get to +# configure with this file, so we use a successful configure-build-test +# sequence to denote failure of the test case. +include(CTest) +add_test(NAME willPass + COMMAND ${CMAKE_COMMAND} -E touch someFile.txt +) diff --git a/Tests/RunCMake/WorkingDirectory/dirNotExist-result.txt b/Tests/RunCMake/WorkingDirectory/dirNotExist-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/dirNotExist-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt b/Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt new file mode 100644 index 0000000..3cea890 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt @@ -0,0 +1 @@ +Failed to change working directory to .*[/\\]dirNotExist-build[/\\]thisDirWillNotExist : diff --git a/Tests/RunCMake/WorkingDirectory/dirNotExist-stdout.txt b/Tests/RunCMake/WorkingDirectory/dirNotExist-stdout.txt new file mode 100644 index 0000000..58aa6e4 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/dirNotExist-stdout.txt @@ -0,0 +1,10 @@ +Test project .*/Tests/RunCMake/WorkingDirectory/dirNotExist-build +.* +Start 1: dirNotExist +1/1 Test #1: dirNotExist +\.+\*\*\*Not Run +[0-9.]+ sec ++ +0% tests passed, 1 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec ++ +The following tests FAILED: +.* +1 - dirNotExist \(Not Run\)$ diff --git a/Tests/RunCMake/WorkingDirectory/dirNotExist.cmake b/Tests/RunCMake/WorkingDirectory/dirNotExist.cmake new file mode 100644 index 0000000..642386e --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/dirNotExist.cmake @@ -0,0 +1,6 @@ +include(CTest) + +add_test(NAME dirNotExist + COMMAND ${CMAKE_COMMAND} -E touch someFile.txt + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thisDirWillNotExist +) diff --git a/Tests/RunCMake/WorkingDirectory/test.cmake.in b/Tests/RunCMake/WorkingDirectory/test.cmake.in new file mode 100644 index 0000000..8eccd79 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/test.cmake.in @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.11) + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + +ctest_start(Experimental) +ctest_configure() +ctest_build() +ctest_test() diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt index 0445744..f444992 100644 --- a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt @@ -1,5 +1,6 @@ CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): Unsupported feature not_a_feature. Call Stack \(most recent call first\): + .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(_check_feature_lists\) InvalidFeature.cmake:4 \(write_compiler_detection_header\) CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/AssigningMultipleTargets.cmake b/Tests/RunCMake/add_custom_command/AssigningMultipleTargets.cmake new file mode 100644 index 0000000..fe1cceb --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AssigningMultipleTargets.cmake @@ -0,0 +1,13 @@ +enable_language(CXX) + +add_custom_command(OUTPUT generated.cpp + MAIN_DEPENDENCY a.c + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/generate-once.cmake ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp + VERBATIM) + +add_executable(exe1 ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp) +add_executable(exe2 ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp) +add_executable(exe3 ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp) + +add_dependencies(exe1 exe2) +add_dependencies(exe3 exe1) diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake index c12e5aa..0387dbb 100644 --- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -14,3 +14,10 @@ run_cmake(TargetNotInDir) if(${RunCMake_GENERATOR} MATCHES "Visual Studio ([^89]|[89][0-9])") run_cmake(RemoveEmptyCommands) endif() + +run_cmake(AssigningMultipleTargets) +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AssigningMultipleTargets-build) +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_command(AssigningMultipleTargets-build ${CMAKE_COMMAND} --build .) +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_NO_CLEAN) diff --git a/Tests/RunCMake/add_custom_command/a.c b/Tests/RunCMake/add_custom_command/a.c new file mode 100644 index 0000000..707c1c3 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/a.c @@ -0,0 +1,3 @@ +void a() +{ +} diff --git a/Tests/RunCMake/add_custom_command/generate-once.cmake b/Tests/RunCMake/add_custom_command/generate-once.cmake new file mode 100644 index 0000000..2a8e843 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/generate-once.cmake @@ -0,0 +1,8 @@ +if (${CMAKE_ARGC} LESS 4) + message(FATAL_ERROR "Too few arguments") +endif() +set(output "${CMAKE_ARGV3}") +if(EXISTS ${output}) + message(FATAL_ERROR "${output} already exists") +endif() +file(WRITE ${output} "int main() { return 0; }\n") diff --git a/Tests/RunCMake/add_library/CMP0073-stdout.txt b/Tests/RunCMake/add_library/CMP0073-stdout.txt new file mode 100644 index 0000000..84645b8 --- /dev/null +++ b/Tests/RunCMake/add_library/CMP0073-stdout.txt @@ -0,0 +1,3 @@ +-- warn_LIB_DEPENDS='general;bar;' +-- old_LIB_DEPENDS='general;bar;' +-- new_LIB_DEPENDS='' diff --git a/Tests/RunCMake/add_library/CMP0073.cmake b/Tests/RunCMake/add_library/CMP0073.cmake new file mode 100644 index 0000000..b34f5dc --- /dev/null +++ b/Tests/RunCMake/add_library/CMP0073.cmake @@ -0,0 +1,18 @@ +enable_language(C) + +add_library(warn empty.c) +target_link_libraries(warn bar) +message(STATUS "warn_LIB_DEPENDS='${warn_LIB_DEPENDS}'") + +cmake_policy(SET CMP0073 OLD) +add_library(old empty.c) +target_link_libraries(old bar) +message(STATUS "old_LIB_DEPENDS='${old_LIB_DEPENDS}'") + +cmake_policy(SET CMP0073 NEW) +add_library(new empty.c) +target_link_libraries(new bar) +message(STATUS "new_LIB_DEPENDS='${new_LIB_DEPENDS}'") +if(DEFINED new_LIB_DEPENDS) + message(FATAL_ERROR "new_LIB_DEPENDS set but should not be") +endif() diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt index cd6f1e0..1bcc114 100644 --- a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt @@ -1,5 +1,4 @@ -^CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): - Object library target \"TestObjectLibWithoutSources\" may not link to - anything. +^CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\): + No SOURCES given to target: TestObjectLibWithoutSources Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt deleted file mode 100644 index 77a72f1..0000000 --- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt +++ /dev/null @@ -1,16 +0,0 @@ -^CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): - OBJECT library \"TestObjectLibWithoutSources\" contains: - - [^ -]*test(\.cpp)?\.o(bj)? - - but may contain only sources that compile, header files, and other files - that would not affect linking of a normal library. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) - - -CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): - Only executables and non-OBJECT libraries may reference target objects. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/RunCMakeTest.cmake b/Tests/RunCMake/add_library/RunCMakeTest.cmake index 0ba6216..dfadb8f 100644 --- a/Tests/RunCMake/add_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_library/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(CMP0073) + run_cmake(INTERFACEwithNoSources) run_cmake(OBJECTwithNoSources) run_cmake(STATICwithNoSources) diff --git a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON.cmake b/Tests/RunCMake/add_library/empty.c index e69de29..e69de29 100644 --- a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON.cmake +++ b/Tests/RunCMake/add_library/empty.c diff --git a/Tests/RunCMake/cmake_minimum_required/Future.cmake b/Tests/RunCMake/cmake_minimum_required/Future.cmake new file mode 100644 index 0000000..2b5c445 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Future.cmake @@ -0,0 +1 @@ +cmake_minimum_required(VERSION 3.11...99.0 SOME_FUTURE_OPTION) diff --git a/Tests/RunCMake/cmake_minimum_required/Range-stderr.txt b/Tests/RunCMake/cmake_minimum_required/Range-stderr.txt new file mode 100644 index 0000000..7d2bdae --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Range-stderr.txt @@ -0,0 +1,4 @@ +^CMAKE_MINIMUM_REQUIRED_VERSION='3\.10' +CMP0071='NEW' +CMP0072='NEW' +CMP0073=''$ diff --git a/Tests/RunCMake/cmake_minimum_required/Range.cmake b/Tests/RunCMake/cmake_minimum_required/Range.cmake new file mode 100644 index 0000000..0080092 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Range.cmake @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.10...3.11) +message("CMAKE_MINIMUM_REQUIRED_VERSION='${CMAKE_MINIMUM_REQUIRED_VERSION}'") +foreach(policy CMP0071 CMP0072 CMP0073) + cmake_policy(GET ${policy} status) + message("${policy}='${status}'") +endforeach() diff --git a/Tests/RunCMake/cmake_minimum_required/RangeBad-result.txt b/Tests/RunCMake/cmake_minimum_required/RangeBad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/RangeBad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_minimum_required/RangeBad-stderr.txt b/Tests/RunCMake/cmake_minimum_required/RangeBad-stderr.txt new file mode 100644 index 0000000..b2c62fb --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/RangeBad-stderr.txt @@ -0,0 +1,56 @@ +^CMake Error at RangeBad.cmake:1 \(cmake_minimum_required\): + cmake_minimum_required VERSION "3.11..." does not have a version on both + sides of "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:2 \(cmake_minimum_required\): + cmake_minimum_required VERSION "...3.11" does not have a version on both + sides of "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:3 \(cmake_minimum_required\): + cmake_minimum_required VERSION "..." does not have a version on both sides + of "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:4 \(cmake_minimum_required\): + Invalid policy max version value "4". A numeric + major.minor\[.patch\[.tweak\]\] must be given. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:5 \(cmake_minimum_required\): + Policy VERSION range "3.11...3.10" specifies a larger minimum than maximum. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:6 \(cmake_policy\): + cmake_policy VERSION "3.11..." does not have a version on both sides of + "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:7 \(cmake_policy\): + cmake_policy VERSION "...3.11" does not have a version on both sides of + "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:8 \(cmake_policy\): + cmake_policy VERSION "..." does not have a version on both sides of "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:9 \(cmake_policy\): + Invalid policy max version value "4". A numeric + major.minor\[.patch\[.tweak\]\] must be given. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:10 \(cmake_policy\): + Policy VERSION range "3.11...3.10" specifies a larger minimum than maximum. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_minimum_required/RangeBad.cmake b/Tests/RunCMake/cmake_minimum_required/RangeBad.cmake new file mode 100644 index 0000000..2a2dade --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/RangeBad.cmake @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.11...) +cmake_minimum_required(VERSION ...3.11) +cmake_minimum_required(VERSION ...) +cmake_minimum_required(VERSION 3.11...4) +cmake_minimum_required(VERSION 3.11...3.10) +cmake_policy(VERSION 3.11...) +cmake_policy(VERSION ...3.11) +cmake_policy(VERSION ...) +cmake_policy(VERSION 3.11...4) +cmake_policy(VERSION 3.11...3.10) diff --git a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake index e4c65e3..1030211 100644 --- a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake @@ -2,4 +2,8 @@ include(RunCMake) run_cmake(Before24) run_cmake(CompatBefore24) +run_cmake(Future) run_cmake(PolicyBefore24) +run_cmake(Range) +run_cmake(RangeBad) +run_cmake(Unknown) diff --git a/Tests/RunCMake/cmake_minimum_required/Unknown-result.txt b/Tests/RunCMake/cmake_minimum_required/Unknown-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Unknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_minimum_required/Unknown-stderr.txt b/Tests/RunCMake/cmake_minimum_required/Unknown-stderr.txt new file mode 100644 index 0000000..d698642 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Unknown-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at Unknown.cmake:1 \(cmake_minimum_required\): + cmake_minimum_required called with unknown argument "SOME_UNKNOWN_OPTION". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/cmake_minimum_required/Unknown.cmake b/Tests/RunCMake/cmake_minimum_required/Unknown.cmake new file mode 100644 index 0000000..6c70f91 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Unknown.cmake @@ -0,0 +1 @@ +cmake_minimum_required(VERSION 3.11 SOME_UNKNOWN_OPTION) diff --git a/Tests/RunCMake/ctest_start/AppendDifferentModel-check.cmake b/Tests/RunCMake/ctest_start/AppendDifferentModel-check.cmake new file mode 100644 index 0000000..d71b1cf --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendDifferentModel-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^19551112-2204\nContinuousTrack\nContinuous\n$") diff --git a/Tests/RunCMake/ctest_start/AppendDifferentModel-stderr.txt b/Tests/RunCMake/ctest_start/AppendDifferentModel-stderr.txt new file mode 100644 index 0000000..a523f3f --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendDifferentModel-stderr.txt @@ -0,0 +1 @@ +^Model given in TAG does not match model given in ctest_start\(\)$ diff --git a/Tests/RunCMake/ctest_start/AppendDifferentModel-stdout.txt b/Tests/RunCMake/ctest_start/AppendDifferentModel-stdout.txt new file mode 100644 index 0000000..bc9a4c8 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendDifferentModel-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with model Experimental + Source directory: .*/Tests/RunCMake/ctest_start/AppendDifferentModel + Build directory: .*/Tests/RunCMake/ctest_start/AppendDifferentModel-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendDifferentModel/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - ContinuousTrack + Use ContinuousTrack tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/AppendDifferentTrack-stderr.txt b/Tests/RunCMake/ctest_start/AppendDifferentTrack-stderr.txt new file mode 100644 index 0000000..0d6d19d --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendDifferentTrack-stderr.txt @@ -0,0 +1 @@ +^Track given in TAG does not match track given in ctest_start\(\)$ diff --git a/Tests/RunCMake/ctest_start/AppendDifferentTrack-stdout.txt b/Tests/RunCMake/ctest_start/AppendDifferentTrack-stdout.txt new file mode 100644 index 0000000..ab1c1f7 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendDifferentTrack-stdout.txt @@ -0,0 +1,9 @@ +Run dashboard with to-be-determined model + Source directory: .*/Tests/RunCMake/ctest_start/AppendDifferentTrack + Build directory: .*/Tests/RunCMake/ctest_start/AppendDifferentTrack-build + Track: ExperimentalDifferent + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendDifferentTrack/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - ExperimentalDifferent + Use ExperimentalDifferent tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/AppendNoMatchingTrack-stdout.txt b/Tests/RunCMake/ctest_start/AppendNoMatchingTrack-stdout.txt new file mode 100644 index 0000000..55f2d8e --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendNoMatchingTrack-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with model Continuous + Source directory: .*/Tests/RunCMake/ctest_start/AppendNoMatchingTrack + Build directory: .*/Tests/RunCMake/ctest_start/AppendNoMatchingTrack-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendNoMatchingTrack/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - SomeWeirdTrackName + Use SomeWeirdTrackName tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/AppendNoModel-check.cmake b/Tests/RunCMake/ctest_start/AppendNoModel-check.cmake new file mode 100644 index 0000000..d71b1cf --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendNoModel-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^19551112-2204\nContinuousTrack\nContinuous\n$") diff --git a/Tests/RunCMake/ctest_start/AppendNoModel-stdout.txt b/Tests/RunCMake/ctest_start/AppendNoModel-stdout.txt new file mode 100644 index 0000000..f909a44 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendNoModel-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with to-be-determined model + Source directory: .*/Tests/RunCMake/ctest_start/AppendNoModel + Build directory: .*/Tests/RunCMake/ctest_start/AppendNoModel-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendNoModel/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - ContinuousTrack + Use ContinuousTrack tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/AppendOldContinuous-stdout.txt b/Tests/RunCMake/ctest_start/AppendOldContinuous-stdout.txt new file mode 100644 index 0000000..0660f5d --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendOldContinuous-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with model Continuous + Source directory: .*/Tests/RunCMake/ctest_start/AppendOldContinuous + Build directory: .*/Tests/RunCMake/ctest_start/AppendOldContinuous-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendOldContinuous/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - ContinuousTrack + Use ContinuousTrack tag: 19551112-2204 diff --git a/Tests/RunCMake/ctest_start/AppendOldNoModel-result.txt b/Tests/RunCMake/ctest_start/AppendOldNoModel-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendOldNoModel-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/AppendOldNoModel-stderr.txt b/Tests/RunCMake/ctest_start/AppendOldNoModel-stderr.txt new file mode 100644 index 0000000..c7ca1e7 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendOldNoModel-stderr.txt @@ -0,0 +1,3 @@ +^TAG file does not contain model and no model specified in start command +CMake Error at .*/Tests/RunCMake/ctest_start/AppendOldNoModel/test.cmake:[0-9]+ \(ctest_start\): + ctest_start unknown error.$ diff --git a/Tests/RunCMake/ctest_start/AppendOldNoModel-stdout.txt b/Tests/RunCMake/ctest_start/AppendOldNoModel-stdout.txt new file mode 100644 index 0000000..0bdf9e4 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendOldNoModel-stdout.txt @@ -0,0 +1,6 @@ +Run dashboard with to-be-determined model + Source directory: .*/Tests/RunCMake/ctest_start/AppendOldNoModel + Build directory: .*/Tests/RunCMake/ctest_start/AppendOldNoModel-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendOldNoModel/CTestConfig.cmake + Site: test-site + Build name: test-build-name diff --git a/Tests/RunCMake/ctest_start/AppendSameModel-check.cmake b/Tests/RunCMake/ctest_start/AppendSameModel-check.cmake new file mode 100644 index 0000000..d71b1cf --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendSameModel-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^19551112-2204\nContinuousTrack\nContinuous\n$") diff --git a/Tests/RunCMake/ctest_start/AppendSameModel-stdout.txt b/Tests/RunCMake/ctest_start/AppendSameModel-stdout.txt new file mode 100644 index 0000000..4f43626 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendSameModel-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with model Continuous + Source directory: .*/Tests/RunCMake/ctest_start/AppendSameModel + Build directory: .*/Tests/RunCMake/ctest_start/AppendSameModel-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendSameModel/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - ContinuousTrack + Use ContinuousTrack tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/MissingTrackArg-result.txt b/Tests/RunCMake/ctest_start/MissingTrackArg-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArg-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/MissingTrackArg-stderr.txt b/Tests/RunCMake/ctest_start/MissingTrackArg-stderr.txt new file mode 100644 index 0000000..7b42bc9 --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArg-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error at .*/Tests/RunCMake/ctest_start/MissingTrackArg/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start TRACK argument missing track name$ diff --git a/Tests/RunCMake/ctest_start/MissingTrackArgAppend-result.txt b/Tests/RunCMake/ctest_start/MissingTrackArgAppend-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArgAppend-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/MissingTrackArgAppend-stderr.txt b/Tests/RunCMake/ctest_start/MissingTrackArgAppend-stderr.txt new file mode 100644 index 0000000..695bfad --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArgAppend-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error at .*/Tests/RunCMake/ctest_start/MissingTrackArgAppend/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start TRACK argument missing track name$ diff --git a/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-result.txt b/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-stderr.txt b/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-stderr.txt new file mode 100644 index 0000000..9438522 --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error at .*/Tests/RunCMake/ctest_start/MissingTrackArgQuiet/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start TRACK argument missing track name$ diff --git a/Tests/RunCMake/ctest_start/NoModel-result.txt b/Tests/RunCMake/ctest_start/NoModel-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/NoModel-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/NoModel-stderr.txt b/Tests/RunCMake/ctest_start/NoModel-stderr.txt new file mode 100644 index 0000000..a516cf8 --- /dev/null +++ b/Tests/RunCMake/ctest_start/NoModel-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at .*/Tests/RunCMake/ctest_start/NoModel/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start no test model specified and APPEND not specified. Specify + either a test model or the APPEND argument$ diff --git a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake index bf47256..2e8aa75 100644 --- a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake @@ -7,11 +7,40 @@ function(run_ctest_start CASE_NAME) run_ctest(${CASE_NAME}) endfunction() -run_ctest_start(StartQuiet Experimental QUIET) +function(check_tag_contents EXPECTED) + set(_tag_file "${RunCMake_BINARY_DIR}/${CASE_NAME}-build/Testing/TAG") + if(EXISTS "${_tag_file}") + file(READ "${_tag_file}" _tag_contents) + if(NOT _tag_contents MATCHES "${EXPECTED}") + set(RunCMake_TEST_FAILED "Testing/TAG file does not match expected value.\nActual TAG file:\n${_tag_contents}\nExpected TAG file:\n${EXPECTED}\n" PARENT_SCOPE) + endif() + else() + set(RunCMake_TEST_FAILED "Testing/TAG file does not exist." PARENT_SCOPE) + endif() +endfunction() +run_ctest_start(StartQuiet Experimental QUIET) run_ctest_start(ConfigInSource Experimental) - run_ctest_start(FunctionScope Experimental QUIET) +run_ctest_start(WriteModelToTagExperimental Experimental QUIET) +run_ctest_start(WriteModelToTagContinuous Continuous QUIET) +run_ctest_start(WriteModelToTagNightly Nightly QUIET) +run_ctest_start(WriteModelToTagNoMatchingTrack Continuous TRACK SomeWeirdTrackName QUIET) +run_ctest_start(AppendSameModel Continuous APPEND) +run_ctest_start(AppendDifferentModel Experimental APPEND) +run_ctest_start(AppendNoModel APPEND) +run_ctest_start(AppendDifferentTrack TRACK ExperimentalDifferent APPEND) +run_ctest_start(AppendNoMatchingTrack Continuous APPEND) +run_ctest_start(AppendOldContinuous Continuous APPEND) +run_ctest_start(AppendOldNoModel APPEND) +run_ctest_start(NoModel QUIET) +run_ctest_start(MissingTrackArg Experimental TRACK) +run_ctest_start(MissingTrackArgAppend Experimental TRACK APPEND) +run_ctest_start(MissingTrackArgQuiet Experimental TRACK QUIET) +run_ctest_start(TooManyArgs Experimental + ${RunCMake_BINARY_DIR}/TooManyArgs-build + ${RunCMake_BINARY_DIR}/TooManyArgs-build + ${RunCMake_BINARY_DIR}/TooManyArgs-build) function(run_ConfigInBuild) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ConfigInBuild-build) diff --git a/Tests/RunCMake/ctest_start/TooManyArgs-result.txt b/Tests/RunCMake/ctest_start/TooManyArgs-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/TooManyArgs-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/TooManyArgs-stderr.txt b/Tests/RunCMake/ctest_start/TooManyArgs-stderr.txt new file mode 100644 index 0000000..c1d5f22 --- /dev/null +++ b/Tests/RunCMake/ctest_start/TooManyArgs-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error at .*/Tests/RunCMake/ctest_start/TooManyArgs/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start Too many arguments$ diff --git a/Tests/RunCMake/ctest_start/WriteModelToTagContinuous-check.cmake b/Tests/RunCMake/ctest_start/WriteModelToTagContinuous-check.cmake new file mode 100644 index 0000000..4e67bf5 --- /dev/null +++ b/Tests/RunCMake/ctest_start/WriteModelToTagContinuous-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^[0-9-]+\nContinuous\nContinuous\n$") diff --git a/Tests/RunCMake/ctest_start/WriteModelToTagExperimental-check.cmake b/Tests/RunCMake/ctest_start/WriteModelToTagExperimental-check.cmake new file mode 100644 index 0000000..b5bf2cf --- /dev/null +++ b/Tests/RunCMake/ctest_start/WriteModelToTagExperimental-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^[0-9-]+\nExperimental\nExperimental\n$") diff --git a/Tests/RunCMake/ctest_start/WriteModelToTagNightly-check.cmake b/Tests/RunCMake/ctest_start/WriteModelToTagNightly-check.cmake new file mode 100644 index 0000000..35d0566 --- /dev/null +++ b/Tests/RunCMake/ctest_start/WriteModelToTagNightly-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^[0-9-]+\nNightly\nNightly\n$") diff --git a/Tests/RunCMake/ctest_start/WriteModelToTagNoMatchingTrack-check.cmake b/Tests/RunCMake/ctest_start/WriteModelToTagNoMatchingTrack-check.cmake new file mode 100644 index 0000000..bd2862d --- /dev/null +++ b/Tests/RunCMake/ctest_start/WriteModelToTagNoMatchingTrack-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^[0-9-]+\nSomeWeirdTrackName\nContinuous\n$") diff --git a/Tests/RunCMake/ctest_start/test.cmake.in b/Tests/RunCMake/ctest_start/test.cmake.in index 0a27942..172baf7 100644 --- a/Tests/RunCMake/ctest_start/test.cmake.in +++ b/Tests/RunCMake/ctest_start/test.cmake.in @@ -8,11 +8,23 @@ set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") function(setup_tests) ctest_start(${ctest_start_args}) endfunction() +if("@CASE_NAME@" MATCHES "^Append") + if("@CASE_NAME@" MATCHES "^AppendNoMatchingTrack$") + file(WRITE "${CTEST_BINARY_DIRECTORY}/Testing/TAG" "19551112-2204\nSomeWeirdTrackName\n") + else() + file(WRITE "${CTEST_BINARY_DIRECTORY}/Testing/TAG" "19551112-2204\nContinuousTrack\n") + endif() + if(NOT "@CASE_NAME@" MATCHES "^AppendOld") + file(APPEND "${CTEST_BINARY_DIRECTORY}/Testing/TAG" "Continuous\n") + endif() +endif() + set(ctest_start_args "@CASE_CTEST_START_ARGS@") if("@CASE_NAME@" STREQUAL "FunctionScope") setup_tests() diff --git a/Tests/RunCMake/export/ForbiddenToExportImportedProperties-result.txt b/Tests/RunCMake/export/ForbiddenToExportImportedProperties-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportImportedProperties-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/ForbiddenToExportImportedProperties-stderr.txt b/Tests/RunCMake/export/ForbiddenToExportImportedProperties-stderr.txt new file mode 100644 index 0000000..ab03943 --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportImportedProperties-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target \"foo\" contains property \"IMPORTED_FOOBAR\" in EXPORT_PROPERTIES but + IMPORTED_\* and INTERFACE_\* properties are reserved. diff --git a/Tests/RunCMake/export/ForbiddenToExportImportedProperties.cmake b/Tests/RunCMake/export/ForbiddenToExportImportedProperties.cmake new file mode 100644 index 0000000..9c8653d --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportImportedProperties.cmake @@ -0,0 +1,12 @@ +enable_language(CXX) +add_library(foo empty.cpp) +set_target_properties(foo PROPERTIES + IMPORTED_FOOBAR "Some other string" + EXPORT_PROPERTIES "IMPORTED_FOOBAR" +) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-result.txt b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-stderr.txt b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-stderr.txt new file mode 100644 index 0000000..577602b --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target \"foo\" contains property \"INTERFACE_FOOBAR\" in EXPORT_PROPERTIES but + IMPORTED_\* and INTERFACE_\* properties are reserved. diff --git a/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties.cmake b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties.cmake new file mode 100644 index 0000000..bab8de0 --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties.cmake @@ -0,0 +1,12 @@ +enable_language(CXX) +add_library(foo empty.cpp) +set_target_properties(foo PROPERTIES + INTERFACE_FOOBAR "Some string" + EXPORT_PROPERTIES "INTERFACE_FOOBAR" +) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-result.txt b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-stderr.txt b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-stderr.txt new file mode 100644 index 0000000..56488e6 --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target \"foo\" contains property \"JUST_A_PROPERTY\" in EXPORT_PROPERTIES but + this property contains a generator expression. This is not allowed. diff --git a/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp.cmake b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp.cmake new file mode 100644 index 0000000..065cdbc --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp.cmake @@ -0,0 +1,12 @@ +enable_language(CXX) +add_library(foo empty.cpp) +set_target_properties(foo PROPERTIES + JUST_A_PROPERTY "$<C_COMPILER_VERSION:0>" + EXPORT_PROPERTIES "JUST_A_PROPERTY" +) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 6d0b7ca..10ced90 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -5,3 +5,6 @@ run_cmake(TargetNotFound) run_cmake(AppendExport) run_cmake(OldIface) run_cmake(NoExportSet) +run_cmake(ForbiddenToExportInterfaceProperties) +run_cmake(ForbiddenToExportImportedProperties) +run_cmake(ForbiddenToExportPropertyWithGenExp) diff --git a/Tests/RunCMake/export/empty.cpp b/Tests/RunCMake/export/empty.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/export/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-build-stdout.txt b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-build-stdout.txt new file mode 100644 index 0000000..71ab721 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-build-stdout.txt @@ -0,0 +1 @@ +.*b9fbdd8803c036dbe9f5ea6b74db4b9670c78a72 diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_first-stdout.txt b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_first-stdout.txt new file mode 100644 index 0000000..ff90f9c --- /dev/null +++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_first-stdout.txt @@ -0,0 +1,2 @@ +.*Running CMake on GLOB-CONFIGURE_DEPENDS-RerunCMake +.*6bc141b40c0f851d20fa9a1fe5fbdae94acc5de0 diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_second-stdout.txt b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_second-stdout.txt new file mode 100644 index 0000000..cf2a5af --- /dev/null +++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_second-stdout.txt @@ -0,0 +1,2 @@ +.*Running CMake on GLOB-CONFIGURE_DEPENDS-RerunCMake +.*0c3ceab9daa7914fde7410c34cae4049e140aa51 diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-stdout.txt b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-stdout.txt new file mode 100644 index 0000000..66b6c44 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake-stdout.txt @@ -0,0 +1 @@ +.*Running CMake on GLOB-CONFIGURE_DEPENDS-RerunCMake diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake new file mode 100644 index 0000000..fe87c78 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake @@ -0,0 +1,10 @@ +message(STATUS "Running CMake on GLOB-CONFIGURE_DEPENDS-RerunCMake") +file(GLOB_RECURSE + CONTENT_LIST + CONFIGURE_DEPENDS + LIST_DIRECTORIES false + RELATIVE "${CMAKE_CURRENT_BINARY_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}/test/*" + ) +string(SHA1 CONTENT_LIST_HASH "${CONTENT_LIST}") +add_custom_target(CONTENT_ECHO ALL ${CMAKE_COMMAND} -E echo ${CONTENT_LIST_HASH}) diff --git a/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE-result.txt b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE-stderr.txt b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE-stderr.txt new file mode 100644 index 0000000..40083c1 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE-stderr.txt @@ -0,0 +1 @@ +.*CONFIGURE_DEPENDS is invalid for script and find package modes\. diff --git a/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE.cmake b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE.cmake new file mode 100644 index 0000000..9dc0f03 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST CONFIGURE_DEPENDS) diff --git a/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-modified-result.txt b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-modified-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-modified-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-modified-stderr.txt b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-modified-stderr.txt new file mode 100644 index 0000000..d7b36eb --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-modified-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error: The glob expression +.* at GLOB-error-CONFIGURE_DEPENDS-modified\.cmake:[0-9]+ \(file\) +was already present in the glob cache but the directory +contents have changed during the configuration run. +Matching glob expressions: + CONTENT_LIST_1 at GLOB-error-CONFIGURE_DEPENDS-modified\.cmake:[0-9]+ \(file\) + CONTENT_LIST_2 at GLOB-error-CONFIGURE_DEPENDS-modified\.cmake:[0-9]+ \(file\)$ diff --git a/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-modified.cmake b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-modified.cmake new file mode 100644 index 0000000..8d74dea --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-CONFIGURE_DEPENDS-modified.cmake @@ -0,0 +1,21 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/first") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/second") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/third") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/first/one" "one") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/second/two" "two") +file(GLOB_RECURSE CONTENT_LIST_1 + CONFIGURE_DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/test/*" + ) + +file(GLOB_RECURSE CONTENT_LIST_2 + CONFIGURE_DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/test/*" + ) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/third/three" "three") +file(GLOB_RECURSE CONTENT_LIST_3 + CONFIGURE_DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/test/*" + ) diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt new file mode 100644 index 0000000..af3cb2e --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-error-FOLLOW_SYMLINKS\.cmake:[0-9]+ \(file\): + file FOLLOW_SYMLINKS is not a valid parameter for GLOB\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake new file mode 100644 index 0000000..6d467a0 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST FOLLOW_SYMLINKS) diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt new file mode 100644 index 0000000..30cec89 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-error-RELATIVE-no-arg\.cmake:[0-9]+ \(file\): + file GLOB requires a directory after the RELATIVE tag\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake new file mode 100644 index 0000000..a555881 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST RELATIVE) diff --git a/Tests/RunCMake/file/GLOB-noexp-CONFIGURE_DEPENDS-result.txt b/Tests/RunCMake/file/GLOB-noexp-CONFIGURE_DEPENDS-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-CONFIGURE_DEPENDS-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-noexp-CONFIGURE_DEPENDS-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-CONFIGURE_DEPENDS-stderr.txt new file mode 100644 index 0000000..01d204f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-CONFIGURE_DEPENDS-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-noexp-CONFIGURE_DEPENDS\.cmake:[0-9]+ \(file\): + file GLOB requires a glob expression after CONFIGURE_DEPENDS\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-noexp-CONFIGURE_DEPENDS.cmake b/Tests/RunCMake/file/GLOB-noexp-CONFIGURE_DEPENDS.cmake new file mode 100644 index 0000000..9dc0f03 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-CONFIGURE_DEPENDS.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST CONFIGURE_DEPENDS) diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt new file mode 100644 index 0000000..ee6cb0b --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-noexp-LIST_DIRECTORIES\.cmake:[0-9]+ \(file\): + file GLOB requires a glob expression after the bool\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt new file mode 100644 index 0000000..9c66631 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-noexp-RELATIVE\.cmake:[0-9]+ \(file\): + file GLOB requires a glob expression after the directory\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake b/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake new file mode 100644 index 0000000..7b2d404 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST RELATIVE "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/Tests/RunCMake/file/GLOB-sort-dedup-stderr.txt b/Tests/RunCMake/file/GLOB-sort-dedup-stderr.txt new file mode 100644 index 0000000..d2565e4 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-sort-dedup-stderr.txt @@ -0,0 +1,2 @@ +content: 7[ ] +1aAb/\.hide;1aAb/1\.log;1aAb/1\.txt;1aAb/xkcd\.txt;a/1\.log;a/1\.txt;a/boot\.ini diff --git a/Tests/RunCMake/file/GLOB-sort-dedup.cmake b/Tests/RunCMake/file/GLOB-sort-dedup.cmake new file mode 100644 index 0000000..1e1c579 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-sort-dedup.cmake @@ -0,0 +1,21 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/a") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/1aAb") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/a/1.log" "") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/a/1.txt" "") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/a/boot.ini" "") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/1aAb/.hide" "") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/1aAb/1.txt" "") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/1aAb/1.log" "") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/1aAb/xkcd.txt" "") + +file(GLOB CONTENT_LIST + LIST_DIRECTORIES false + RELATIVE "${CMAKE_CURRENT_BINARY_DIR}/test" + "${CMAKE_CURRENT_BINARY_DIR}/test/a/*" + "${CMAKE_CURRENT_BINARY_DIR}/test/*/*" + ) +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB-warn-CONFIGURE_DEPENDS-late-stderr.txt b/Tests/RunCMake/file/GLOB-warn-CONFIGURE_DEPENDS-late-stderr.txt new file mode 100644 index 0000000..af722a4 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-warn-CONFIGURE_DEPENDS-late-stderr.txt @@ -0,0 +1,6 @@ +^CMake Warning \(dev\) at GLOB-warn-CONFIGURE_DEPENDS-late\.cmake:[0-9]+ \(file\): + CONFIGURE_DEPENDS flag was given after a glob expression was already + evaluated\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/file/GLOB-warn-CONFIGURE_DEPENDS-late.cmake b/Tests/RunCMake/file/GLOB-warn-CONFIGURE_DEPENDS-late.cmake new file mode 100644 index 0000000..0b69552 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-warn-CONFIGURE_DEPENDS-late.cmake @@ -0,0 +1,11 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/first") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/second") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/first/one" "Hi, Mom!") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/second/two" "Love you!") + +file(GLOB CONTENT_LIST + "${CMAKE_CURRENT_BINARY_DIR}/test/first/*" + CONFIGURE_DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/test/second/*" + ) diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt new file mode 100644 index 0000000..d0b2bff --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB_RECURSE-noexp-FOLLOW_SYMLINKS\.cmake:[0-9]+ \(file\): + file GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake new file mode 100644 index 0000000..5e5ce92 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake @@ -0,0 +1 @@ +file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS) diff --git a/Tests/RunCMake/file/GLOB_RECURSE-warn-CONFIGURE_DEPENDS-ninja-version-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-warn-CONFIGURE_DEPENDS-ninja-version-stderr.txt new file mode 100644 index 0000000..8d22332 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-warn-CONFIGURE_DEPENDS-ninja-version-stderr.txt @@ -0,0 +1,13 @@ +^CMake Warning \(dev\): + The detected version of Ninja: + + .* + + is less than the version of Ninja required by CMake for adding restat + dependencies to the build\.ninja manifest regeneration target: + + 1\.8 + + Any pre-check scripts, such as those generated for file\(GLOB + CONFIGURE_DEPENDS\), will not be run by Ninja\. +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/file/GLOB_RECURSE-warn-CONFIGURE_DEPENDS-ninja-version.cmake b/Tests/RunCMake/file/GLOB_RECURSE-warn-CONFIGURE_DEPENDS-ninja-version.cmake new file mode 100644 index 0000000..8e80895 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-warn-CONFIGURE_DEPENDS-ninja-version.cmake @@ -0,0 +1,6 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/first") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/first/one" "one") +file(GLOB_RECURSE CONTENT_LIST + CONFIGURE_DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/test/*" + ) diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 3be4fb7..342606b 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -5,6 +5,9 @@ run_cmake(DOWNLOAD-unused-argument) run_cmake(DOWNLOAD-httpheader-not-set) run_cmake(DOWNLOAD-netrc-bad) run_cmake(DOWNLOAD-pass-not-set) +run_cmake(TOUCH) +run_cmake(TOUCH-error-in-source-directory) +run_cmake(TOUCH-error-missing-directory) run_cmake(UPLOAD-unused-argument) run_cmake(UPLOAD-httpheader-not-set) run_cmake(UPLOAD-netrc-bad) @@ -32,13 +35,87 @@ run_cmake(LOCK-lowercase) run_cmake(READ_ELF) run_cmake(GLOB) run_cmake(GLOB_RECURSE) -# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS) + +# tests are valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-sort-dedup) +run_cmake(GLOB-error-FOLLOW_SYMLINKS) run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean) -# test is valid both for GLOB and GLOB_RECURSE run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg) +run_cmake(GLOB-error-RELATIVE-no-arg) +run_cmake(GLOB-error-CONFIGURE_DEPENDS-modified) +run_cmake(GLOB-noexp-CONFIGURE_DEPENDS) run_cmake(GLOB-noexp-LIST_DIRECTORIES) +run_cmake(GLOB-noexp-RELATIVE) +run_cmake_command(GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE ${CMAKE_COMMAND} -P + ${RunCMake_SOURCE_DIR}/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE.cmake) if(NOT WIN32 OR CYGWIN) run_cmake(GLOB_RECURSE-cyclic-recursion) run_cmake(INSTALL-SYMLINK) endif() + +if(RunCMake_GENERATOR STREQUAL "Ninja") + # Detect ninja version so we know what tests can be supported. + execute_process( + COMMAND "${RunCMake_MAKE_PROGRAM}" --version + OUTPUT_VARIABLE ninja_out + ERROR_VARIABLE ninja_out + RESULT_VARIABLE ninja_res + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(ninja_res EQUAL 0 AND "x${ninja_out}" MATCHES "^x[0-9]+\\.[0-9]+") + set(ninja_version "${ninja_out}") + message(STATUS "ninja version: ${ninja_version}") + else() + message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}") + endif() + + if("${ninja_version}" VERSION_LESS 1.8) + message(STATUS "Ninja is too old for GLOB CONFIGURE_DEPENDS; expect a warning.") + endif() +endif() + +if(RunCMake_GENERATOR STREQUAL "Ninja" AND "${ninja_version}" VERSION_LESS 1.8) + run_cmake(GLOB_RECURSE-warn-CONFIGURE_DEPENDS-ninja-version) +else() + run_cmake(GLOB-warn-CONFIGURE_DEPENDS-late) + + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GLOB-CONFIGURE_DEPENDS-RerunCMake-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_DEFAULT_stderr ".*") + if(RunCMake_GENERATOR STREQUAL "Borland Makefiles" OR + RunCMake_GENERATOR STREQUAL "Watcom WMake") + set(fs_delay 3) + else() + set(fs_delay 1.125) + endif() + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/test") + set(tf_1 "${RunCMake_TEST_BINARY_DIR}/test/1.txt") + file(WRITE "${tf_1}" "1") + + message(STATUS "GLOB-RerunCMake: first configuration...") + run_cmake(GLOB-CONFIGURE_DEPENDS-RerunCMake) + run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-build ${CMAKE_COMMAND} --build .) + + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay}) + message(STATUS "GLOB-CONFIGURE_DEPENDS-RerunCMake: add another file...") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/test/sub") + set(tf_2 "${RunCMake_TEST_BINARY_DIR}/test/sub/2.txt") + file(WRITE "${tf_2}" "2") + run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_first ${CMAKE_COMMAND} --build .) + run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-nowork ${CMAKE_COMMAND} --build .) + + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay}) + message(STATUS "GLOB-CONFIGURE_DEPENDS-RerunCMake: remove first test file...") + file(REMOVE "${RunCMake_TEST_BINARY_DIR}/test/1.txt") + run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_second ${CMAKE_COMMAND} --build .) + run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-nowork ${CMAKE_COMMAND} --build .) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_DEFAULT_stderr) +endif() diff --git a/Tests/RunCMake/file/TOUCH-error-in-source-directory-result.txt b/Tests/RunCMake/file/TOUCH-error-in-source-directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-in-source-directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/TOUCH-error-in-source-directory-stderr.txt b/Tests/RunCMake/file/TOUCH-error-in-source-directory-stderr.txt new file mode 100644 index 0000000..f899c75 --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-in-source-directory-stderr.txt @@ -0,0 +1 @@ +.*file attempted to touch a file: diff --git a/Tests/RunCMake/file/TOUCH-error-in-source-directory.cmake b/Tests/RunCMake/file/TOUCH-error-in-source-directory.cmake new file mode 100644 index 0000000..9aa7c56 --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-in-source-directory.cmake @@ -0,0 +1,2 @@ +set(CMAKE_DISABLE_SOURCE_CHANGES ON) +file(TOUCH "${CMAKE_CURRENT_SOURCE_DIR}/touch_test") diff --git a/Tests/RunCMake/file/TOUCH-error-missing-directory-result.txt b/Tests/RunCMake/file/TOUCH-error-missing-directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-missing-directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/TOUCH-error-missing-directory-stderr.txt b/Tests/RunCMake/file/TOUCH-error-missing-directory-stderr.txt new file mode 100644 index 0000000..f52e11a --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-missing-directory-stderr.txt @@ -0,0 +1 @@ +.*file problem touching file: diff --git a/Tests/RunCMake/file/TOUCH-error-missing-directory.cmake b/Tests/RunCMake/file/TOUCH-error-missing-directory.cmake new file mode 100644 index 0000000..0cfb8d9 --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-error-missing-directory.cmake @@ -0,0 +1 @@ +file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/missing/directory/file.to-touch") diff --git a/Tests/RunCMake/file/TOUCH-result.txt b/Tests/RunCMake/file/TOUCH-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/TOUCH-stderr.txt b/Tests/RunCMake/file/TOUCH-stderr.txt new file mode 100644 index 0000000..9f31676 --- /dev/null +++ b/Tests/RunCMake/file/TOUCH-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at TOUCH\.cmake:[0-9]+ \(file\): + file must be called with at least two arguments\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at TOUCH\.cmake:[0-9]+ \(file\): + file must be called with at least two arguments\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/TOUCH.cmake b/Tests/RunCMake/file/TOUCH.cmake new file mode 100644 index 0000000..8931eb5 --- /dev/null +++ b/Tests/RunCMake/file/TOUCH.cmake @@ -0,0 +1,16 @@ +set(file "${CMAKE_CURRENT_BINARY_DIR}/file-to-touch") + +file(REMOVE "${file}") +file(TOUCH_NOCREATE "${file}") +if(EXISTS "${file}") + message(FATAL_ERROR "error: TOUCH_NOCREATE created a file!") +endif() + +file(TOUCH "${file}") +if(NOT EXISTS "${file}") + message(FATAL_ERROR "error: TOUCH did not create a file!") +endif() +file(REMOVE "${file}") + +file(TOUCH) +file(TOUCH_NOCREATE) diff --git a/Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt b/Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt new file mode 100644 index 0000000..4c2e517 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt @@ -0,0 +1,12 @@ +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/env_root + +find_package\(Foo\) +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND + +---------- diff --git a/Tests/RunCMake/find_package/CMP0074-OLD.cmake b/Tests/RunCMake/find_package/CMP0074-OLD.cmake new file mode 100644 index 0000000..4358317 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0074-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0074 OLD) +include(CMP0074-common.cmake) diff --git a/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt new file mode 100644 index 0000000..27fbb86 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt @@ -0,0 +1,32 @@ +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/env_root ++ +CMake Warning \(dev\) at CMP0074-common.cmake:[0-9]+ \(find_package\): + Policy CMP0074 is not set: find_package uses PackageName_ROOT variables. + Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + CMake variable Foo_ROOT is set to: + + .*/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root + + Environment variable Foo_ROOT is set to: + + .*/Tests/RunCMake/find_package/PackageRoot/foo/env_root + + For compatibility, CMake is ignoring the variable. +Call Stack \(most recent call first\): + CMP0074-common.cmake:[0-9]+ \(RunPackageRootTest\) + CMP0074-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +find_package\(Foo\) +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND + +---------- diff --git a/Tests/RunCMake/find_package/CMP0074-WARN.cmake b/Tests/RunCMake/find_package/CMP0074-WARN.cmake new file mode 100644 index 0000000..0d4ada7 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0074-WARN.cmake @@ -0,0 +1,2 @@ +# (do not set CMP0074) +include(CMP0074-common.cmake) diff --git a/Tests/RunCMake/find_package/CMP0074-common.cmake b/Tests/RunCMake/find_package/CMP0074-common.cmake new file mode 100644 index 0000000..bfacd82 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0074-common.cmake @@ -0,0 +1,46 @@ +# (includer selects CMP0074) +cmake_policy(SET CMP0057 NEW) +list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) +set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) + +function(PrintPath label path) + string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}") + message("${label}${out}") +endfunction() + +macro(CleanUpPackageRootTest) + unset(Foo_ROOT) + unset(ENV{Foo_ROOT}) + unset(FOO_TEST_FILE_FOO) + unset(FOO_TEST_FILE_ZOT) + unset(FOO_TEST_PATH_FOO) + unset(FOO_TEST_PATH_ZOT) + unset(FOO_TEST_PROG_FOO) + unset(FOO_TEST_FILE_FOO CACHE) + unset(FOO_TEST_FILE_ZOT CACHE) + unset(FOO_TEST_PATH_FOO CACHE) + unset(FOO_TEST_PATH_ZOT CACHE) + unset(FOO_TEST_PROG_FOO CACHE) +endmacro() + +macro(RunPackageRootTest) + message("----------") + PrintPath("Foo_ROOT :" "${Foo_ROOT}") + PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}") + message("") + + find_package(Foo) + message("find_package(Foo)") + PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}") + PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}") + PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}") + PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}") + PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}") + CleanUpPackageRootTest() + message("") +endmacro() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) +RunPackageRootTest() +message("----------") diff --git a/Tests/RunCMake/find_package/PackageRoot.cmake b/Tests/RunCMake/find_package/PackageRoot.cmake index 4c4f4c2..aa12e9b 100644 --- a/Tests/RunCMake/find_package/PackageRoot.cmake +++ b/Tests/RunCMake/find_package/PackageRoot.cmake @@ -1,5 +1,5 @@ -set(__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT 1) cmake_policy(SET CMP0057 NEW) +cmake_policy(SET CMP0074 NEW) list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) diff --git a/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake b/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake index ba06c09..1ef32cb 100644 --- a/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake +++ b/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake @@ -1,5 +1,5 @@ -set(__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT 1) cmake_policy(SET CMP0057 NEW) +cmake_policy(SET CMP0074 NEW) list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) diff --git a/Tests/RunCMake/find_package/PackageRootNestedModule.cmake b/Tests/RunCMake/find_package/PackageRootNestedModule.cmake index 2795cd4..017834c 100644 --- a/Tests/RunCMake/find_package/PackageRootNestedModule.cmake +++ b/Tests/RunCMake/find_package/PackageRootNestedModule.cmake @@ -1,5 +1,5 @@ -set(__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT 1) cmake_policy(SET CMP0057 NEW) +cmake_policy(SET CMP0074 NEW) list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index d548da0..c068402 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(CMP0074-WARN) +run_cmake(CMP0074-OLD) run_cmake(ComponentRequiredAndOptional) run_cmake(MissingNormal) run_cmake(MissingNormalRequired) diff --git a/Tests/RunCMake/get_property/directory_properties-stderr.txt b/Tests/RunCMake/get_property/directory_properties-stderr.txt index 6d5bcdb..89f5618 100644 --- a/Tests/RunCMake/get_property/directory_properties-stderr.txt +++ b/Tests/RunCMake/get_property/directory_properties-stderr.txt @@ -19,4 +19,12 @@ get_property: -->[^<;]*/Tests/RunCMake/get_property<-- get_directory_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties-build/directory_properties<-- get_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties-build/directory_properties<-- get_directory_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties<-- -get_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties<--$ +get_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties<-- +get_directory_property: --><-- +get_property: --><-- +get_directory_property: -->test1;test2<-- +get_property: -->test1;test2<-- +get_directory_property: -->test1;test2;test3<-- +get_property: -->test1;test2;test3<-- +get_directory_property: -->Sub/test1;Sub/test2<-- +get_property: -->Sub/test1;Sub/test2<--$ diff --git a/Tests/RunCMake/get_property/directory_properties.cmake b/Tests/RunCMake/get_property/directory_properties.cmake index 4e68738..9b978fd 100644 --- a/Tests/RunCMake/get_property/directory_properties.cmake +++ b/Tests/RunCMake/get_property/directory_properties.cmake @@ -28,3 +28,12 @@ check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" BINARY_DIR) check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" SOURCE_DIR) check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}/directory_properties" BINARY_DIR) check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}/directory_properties" SOURCE_DIR) + +check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" TESTS) +add_test(NAME test1 COMMAND "${CMAKE_COMMAND}" -E echo "test1") +add_test(NAME test2 COMMAND "${CMAKE_COMMAND}" -E echo "test2") +check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" TESTS) +add_test(NAME test3 COMMAND "${CMAKE_COMMAND}" -E echo "test3") +check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" TESTS) + +check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}/directory_properties" TESTS) diff --git a/Tests/RunCMake/get_property/directory_properties/CMakeLists.txt b/Tests/RunCMake/get_property/directory_properties/CMakeLists.txt index 7318b97..95106ad 100644 --- a/Tests/RunCMake/get_property/directory_properties/CMakeLists.txt +++ b/Tests/RunCMake/get_property/directory_properties/CMakeLists.txt @@ -4,3 +4,6 @@ subdirs(sub2) add_custom_target(CustomSub) add_library(InterfaceSub INTERFACE) add_library(my::InterfaceSub ALIAS InterfaceSub) + +add_test(Sub/test1 COMMAND "${CMAKE_COMMAND}" -E echo "Sub/test1") +add_test(Sub/test2 COMMAND "${CMAKE_COMMAND}" -E echo "Sub/test2") diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 1a60f0c..f004ce9 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -21,6 +21,10 @@ function(run_install_test case) # Check explicit component. set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-exc) run_cmake_command(${case}-exc ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=exc -P cmake_install.cmake) + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-lib) + run_cmake_command(${case}-lib ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=lib -P cmake_install.cmake) + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-dev) + run_cmake_command(${case}-dev ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=dev -P cmake_install.cmake) endif() endfunction() @@ -59,6 +63,8 @@ run_cmake(EXPORT-OldIFace) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) +run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all) +run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc) if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") run_install_test(FILES-TARGET_OBJECTS) @@ -67,3 +73,4 @@ endif() set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) run_install_test(TARGETS-EXCLUDE_FROM_ALL) +run_install_test(TARGETS-NAMELINK_COMPONENT) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake new file mode 100644 index 0000000..bc9ebd1 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake @@ -0,0 +1,73 @@ +if(WIN32) + set(_check_files + [[lib]] + [[lib/(lib)?namelink-none\.dll]] + [[lib/(lib)?namelink-same\.dll]] + [[lib/(lib)?namelink-sep\.dll]] + [[lib/(lib)?namelink-skip\.dll]] + [[lib/(lib)?namelink-uns-dev\.dll]] + [[lib/(lib)?namelink-uns\.dll]] + ) +elseif(CYGWIN) + set(_check_files + [[lib]] + [[lib/cygnamelink-none\.dll]] + [[lib/cygnamelink-same-1\.dll]] + [[lib/cygnamelink-sep-1\.dll]] + [[lib/cygnamelink-skip-1\.dll]] + [[lib/cygnamelink-uns-1\.dll]] + [[lib/cygnamelink-uns-dev-1\.dll]] + ) +elseif(APPLE) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.dylib]] + [[lib/libnamelink-only\.dylib]] + [[lib/libnamelink-same\.1\.0\.dylib]] + [[lib/libnamelink-same\.1\.dylib]] + [[lib/libnamelink-same\.dylib]] + [[lib/libnamelink-sep\.1\.0\.dylib]] + [[lib/libnamelink-sep\.1\.dylib]] + [[lib/libnamelink-sep\.dylib]] + [[lib/libnamelink-skip\.1\.0\.dylib]] + [[lib/libnamelink-skip\.1\.dylib]] + [[lib/libnamelink-uns-dev\.1\.0\.dylib]] + [[lib/libnamelink-uns-dev\.1\.dylib]] + [[lib/libnamelink-uns-dev\.dylib]] + [[lib/libnamelink-uns\.1\.0\.dylib]] + [[lib/libnamelink-uns\.1\.dylib]] + [[lib/libnamelink-uns\.dylib]] + ) +elseif(NO_NAMELINK) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-sep\.so]] + [[lib/libnamelink-skip\.so]] + [[lib/libnamelink-uns-dev\.so]] + [[lib/libnamelink-uns\.so]] + ) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-only\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-same\.so\.1]] + [[lib/libnamelink-same\.so\.1\.0]] + [[lib/libnamelink-sep\.so]] + [[lib/libnamelink-sep\.so\.1]] + [[lib/libnamelink-sep\.so\.1\.0]] + [[lib/libnamelink-skip\.so\.1]] + [[lib/libnamelink-skip\.so\.1\.0]] + [[lib/libnamelink-uns-dev\.so]] + [[lib/libnamelink-uns-dev\.so\.1]] + [[lib/libnamelink-uns-dev\.so\.1\.0]] + [[lib/libnamelink-uns\.so]] + [[lib/libnamelink-uns\.so\.1]] + [[lib/libnamelink-uns\.so\.1\.0]] + ) +endif() + +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt new file mode 100644 index 0000000..187a826 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TARGETS-NAMELINK_COMPONENT-bad-all\.cmake:5 \(install\): + install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The + NAMELINK_COMPONENT option may be specified only following LIBRARY\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake new file mode 100644 index 0000000..701d093 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +add_library(namelink-lib empty.c) + +install(TARGETS namelink-lib + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev +) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt new file mode 100644 index 0000000..d1002ba --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TARGETS-NAMELINK_COMPONENT-bad-exc\.cmake:5 \(install\): + install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The + NAMELINK_COMPONENT option may be specified only following LIBRARY\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake new file mode 100644 index 0000000..19c12d4 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +add_executable(namelink-exc main.c) + +install(TARGETS namelink-exc + RUNTIME + DESTINATION bin + COMPONENT exc + NAMELINK_COMPONENT dev +) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake new file mode 100644 index 0000000..5396cdb --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake @@ -0,0 +1,11 @@ +if(WIN32 OR CYGWIN OR NO_NAMELINK) + set(_check_files) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-only\.(so|dylib)]] + [[lib/libnamelink-sep\.(so|dylib)]] + [[lib/libnamelink-uns-dev\.(so|dylib)]] + ) +endif() +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake new file mode 100644 index 0000000..3f6be68 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake @@ -0,0 +1,50 @@ +if(WIN32) + set(_check_files + [[lib]] + [[lib/(lib)?namelink-none\.dll]] + [[lib/(lib)?namelink-same\.dll]] + [[lib/(lib)?namelink-sep\.dll]] + [[lib/(lib)?namelink-skip\.dll]] + ) +elseif(CYGWIN) + set(_check_files + [[lib]] + [[lib/cygnamelink-none\.dll]] + [[lib/cygnamelink-same-1\.dll]] + [[lib/cygnamelink-sep-1\.dll]] + [[lib/cygnamelink-skip-1\.dll]] + ) +elseif(APPLE) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.dylib]] + [[lib/libnamelink-same\.1\.0\.dylib]] + [[lib/libnamelink-same\.1\.dylib]] + [[lib/libnamelink-same\.dylib]] + [[lib/libnamelink-sep\.1\.0\.dylib]] + [[lib/libnamelink-sep\.1\.dylib]] + [[lib/libnamelink-skip\.1\.0\.dylib]] + [[lib/libnamelink-skip\.1\.dylib]] + ) +elseif(NO_NAMELINK) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-sep\.so]] + [[lib/libnamelink-skip\.so]] + ) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-same\.so\.1]] + [[lib/libnamelink-same\.so\.1\.0]] + [[lib/libnamelink-sep\.so\.1]] + [[lib/libnamelink-sep\.so\.1\.0]] + [[lib/libnamelink-skip\.so\.1]] + [[lib/libnamelink-skip\.so\.1\.0]] + ) +endif() +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake new file mode 100644 index 0000000..0033c88 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake @@ -0,0 +1,38 @@ +if(WIN32) + set(_check_files + [[lib]] + [[lib/(lib)?namelink-uns-dev\.dll]] + [[lib/(lib)?namelink-uns\.dll]] + ) +elseif(CYGWIN) + set(_check_files + [[lib]] + [[lib/cygnamelink-uns-1\.dll]] + [[lib/cygnamelink-uns-dev-1\.dll]] + ) +elseif(APPLE) + set(_check_files + [[lib]] + [[lib/libnamelink-uns-dev\.1\.0\.dylib]] + [[lib/libnamelink-uns-dev\.1\.dylib]] + [[lib/libnamelink-uns\.1\.0\.dylib]] + [[lib/libnamelink-uns\.1\.dylib]] + [[lib/libnamelink-uns\.dylib]] + ) +elseif(NO_NAMELINK) + set(_check_files + [[lib]] + [[lib/libnamelink-uns-dev\.so]] + [[lib/libnamelink-uns\.so]] + ) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-uns-dev\.so\.1]] + [[lib/libnamelink-uns-dev\.so\.1\.0]] + [[lib/libnamelink-uns\.so]] + [[lib/libnamelink-uns\.so\.1]] + [[lib/libnamelink-uns\.so\.1\.0]] + ) +endif() +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake new file mode 100644 index 0000000..0e684e1 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake @@ -0,0 +1,68 @@ +enable_language(C) + +macro(add_versioned_library NAME) + add_library(${NAME} SHARED obj1.c) + set_target_properties(${NAME} PROPERTIES + VERSION 1.0 + SOVERSION 1 + ) +endmacro() + +add_versioned_library(namelink-sep) +add_versioned_library(namelink-same) +add_versioned_library(namelink-uns) +add_versioned_library(namelink-uns-dev) +add_versioned_library(namelink-only) +add_versioned_library(namelink-skip) +add_library(namelink-none SHARED obj1.c) + +install(TARGETS namelink-sep namelink-none + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev +) +install(TARGETS namelink-same + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib +) +install(TARGETS namelink-uns + RUNTIME + DESTINATION lib + LIBRARY + DESTINATION lib +) +install(TARGETS namelink-uns-dev + RUNTIME + DESTINATION lib + LIBRARY + DESTINATION lib + NAMELINK_COMPONENT dev +) +install(TARGETS namelink-only + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev + NAMELINK_ONLY +) +install(TARGETS namelink-skip + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev + NAMELINK_SKIP +) diff --git a/Tests/RunCMake/list/JOIN-NoArguments-result.txt b/Tests/RunCMake/list/JOIN-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/JOIN-NoArguments-stderr.txt b/Tests/RunCMake/list/JOIN-NoArguments-stderr.txt new file mode 100644 index 0000000..5e1b98f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at JOIN-NoArguments.cmake:1 \(list\): + list sub-command JOIN requires three arguments \(1 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/JOIN-NoArguments.cmake b/Tests/RunCMake/list/JOIN-NoArguments.cmake new file mode 100644 index 0000000..2ab449a --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoArguments.cmake @@ -0,0 +1 @@ +list(JOIN mylist) diff --git a/Tests/RunCMake/list/JOIN-NoVariable-result.txt b/Tests/RunCMake/list/JOIN-NoVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/JOIN-NoVariable-stderr.txt b/Tests/RunCMake/list/JOIN-NoVariable-stderr.txt new file mode 100644 index 0000000..db1d773 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoVariable-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at JOIN-NoVariable.cmake:1 \(list\): + list sub-command JOIN requires three arguments \(2 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/JOIN-NoVariable.cmake b/Tests/RunCMake/list/JOIN-NoVariable.cmake new file mode 100644 index 0000000..b60d8f1 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoVariable.cmake @@ -0,0 +1 @@ +list(JOIN mylist "glue") diff --git a/Tests/RunCMake/list/JOIN-TooManyArguments-result.txt b/Tests/RunCMake/list/JOIN-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/JOIN-TooManyArguments-stderr.txt b/Tests/RunCMake/list/JOIN-TooManyArguments-stderr.txt new file mode 100644 index 0000000..2b09e22 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at JOIN-TooManyArguments.cmake:1 \(list\): + list sub-command JOIN requires three arguments \(4 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/JOIN-TooManyArguments.cmake b/Tests/RunCMake/list/JOIN-TooManyArguments.cmake new file mode 100644 index 0000000..dc651f6 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-TooManyArguments.cmake @@ -0,0 +1 @@ +list(JOIN mylist "glue" out one_too_many) diff --git a/Tests/RunCMake/list/JOIN.cmake b/Tests/RunCMake/list/JOIN.cmake new file mode 100644 index 0000000..24a623e --- /dev/null +++ b/Tests/RunCMake/list/JOIN.cmake @@ -0,0 +1,18 @@ +list(JOIN undefList % out) +if(NOT out STREQUAL "") + message(FATAL_ERROR "\"list(JOIN undefList % out)\" set out to \"${out}\"") +endif() +set(myList a) +list(JOIN myList % out) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"list(JOIN \"a\" % out)\" set out to \"${out}\"") +endif() +set(myList a b) +list(JOIN myList % out) +if(NOT out STREQUAL "a%b") + message(FATAL_ERROR "\"list(JOIN \"a;b\" % out)\" set out to \"${out}\"") +endif() +list(JOIN myList "" out) +if(NOT out STREQUAL "ab") + message(FATAL_ERROR "\"list(JOIN \"a;b\" \"\" out a)\" set out to \"${out}\"") +endif() diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index b002ab3..bdc23a4 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -13,12 +13,15 @@ run_cmake(FILTER-REGEX-InvalidRegex) run_cmake(GET-InvalidIndex) run_cmake(INSERT-InvalidIndex) run_cmake(REMOVE_AT-InvalidIndex) +run_cmake(SUBLIST-InvalidIndex) run_cmake(FILTER-REGEX-TooManyArguments) +run_cmake(JOIN-TooManyArguments) run_cmake(LENGTH-TooManyArguments) run_cmake(REMOVE_DUPLICATES-TooManyArguments) run_cmake(REVERSE-TooManyArguments) run_cmake(SORT-TooManyArguments) +run_cmake(SUBLIST-TooManyArguments) run_cmake(FILTER-NotList) run_cmake(REMOVE_AT-NotList) @@ -31,3 +34,53 @@ run_cmake(FILTER-REGEX-InvalidMode) run_cmake(FILTER-REGEX-InvalidOperator) run_cmake(FILTER-REGEX-Valid0) run_cmake(FILTER-REGEX-Valid1) + +run_cmake(JOIN-NoArguments) +run_cmake(JOIN-NoVariable) +run_cmake(JOIN) + +run_cmake(SUBLIST-NoArguments) +run_cmake(SUBLIST-NoVariable) +run_cmake(SUBLIST-InvalidLength) +run_cmake(SUBLIST) + +run_cmake(TRANSFORM-NoAction) +run_cmake(TRANSFORM-InvalidAction) +# 'action' oriented tests +run_cmake(TRANSFORM-TOUPPER-TooManyArguments) +run_cmake(TRANSFORM-TOLOWER-TooManyArguments) +run_cmake(TRANSFORM-STRIP-TooManyArguments) +run_cmake(TRANSFORM-GENEX_STRIP-TooManyArguments) +run_cmake(TRANSFORM-APPEND-NoArguments) +run_cmake(TRANSFORM-APPEND-TooManyArguments) +run_cmake(TRANSFORM-PREPEND-NoArguments) +run_cmake(TRANSFORM-PREPEND-TooManyArguments) +run_cmake(TRANSFORM-REPLACE-NoArguments) +run_cmake(TRANSFORM-REPLACE-NoEnoughArguments) +run_cmake(TRANSFORM-REPLACE-TooManyArguments) +run_cmake(TRANSFORM-REPLACE-InvalidRegex) +run_cmake(TRANSFORM-REPLACE-InvalidReplace1) +run_cmake(TRANSFORM-REPLACE-InvalidReplace2) +# 'selector' oriented tests +run_cmake(TRANSFORM-Selector-REGEX-NoArguments) +run_cmake(TRANSFORM-Selector-REGEX-TooManyArguments) +run_cmake(TRANSFORM-Selector-REGEX-InvalidRegex) +run_cmake(TRANSFORM-Selector-AT-NoArguments) +run_cmake(TRANSFORM-Selector-AT-BadArgument) +run_cmake(TRANSFORM-Selector-AT-InvalidIndex) +run_cmake(TRANSFORM-Selector-FOR-NoArguments) +run_cmake(TRANSFORM-Selector-FOR-NoEnoughArguments) +run_cmake(TRANSFORM-Selector-FOR-TooManyArguments) +run_cmake(TRANSFORM-Selector-FOR-BadArgument) +run_cmake(TRANSFORM-Selector-FOR-InvalidIndex) +# 'output' oriented tests +run_cmake(TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments) +run_cmake(TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments) +# Successful tests +run_cmake(TRANSFORM-TOUPPER) +run_cmake(TRANSFORM-TOLOWER) +run_cmake(TRANSFORM-STRIP) +run_cmake(TRANSFORM-GENEX_STRIP) +run_cmake(TRANSFORM-APPEND) +run_cmake(TRANSFORM-PREPEND) +run_cmake(TRANSFORM-REPLACE) diff --git a/Tests/RunCMake/list/SUBLIST-InvalidIndex-result.txt b/Tests/RunCMake/list/SUBLIST-InvalidIndex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SUBLIST-InvalidIndex-stderr.txt b/Tests/RunCMake/list/SUBLIST-InvalidIndex-stderr.txt new file mode 100644 index 0000000..5e67b27 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SUBLIST-InvalidIndex.cmake:2 \(list\): + list begin index: 3 is out of range 0 - 2 +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SUBLIST-InvalidIndex.cmake b/Tests/RunCMake/list/SUBLIST-InvalidIndex.cmake new file mode 100644 index 0000000..565b9dc --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidIndex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(SUBLIST mylist 3 -1 result) diff --git a/Tests/RunCMake/list/SUBLIST-InvalidLength-result.txt b/Tests/RunCMake/list/SUBLIST-InvalidLength-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidLength-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SUBLIST-InvalidLength-stderr.txt b/Tests/RunCMake/list/SUBLIST-InvalidLength-stderr.txt new file mode 100644 index 0000000..16c6ecb --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidLength-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SUBLIST-InvalidLength.cmake:2 \(list\): + list length: -2 should be -1 or greater +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SUBLIST-InvalidLength.cmake b/Tests/RunCMake/list/SUBLIST-InvalidLength.cmake new file mode 100644 index 0000000..1dab83f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidLength.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(SUBLIST mylist 0 -2 result) diff --git a/Tests/RunCMake/list/SUBLIST-NoArguments-result.txt b/Tests/RunCMake/list/SUBLIST-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SUBLIST-NoArguments-stderr.txt b/Tests/RunCMake/list/SUBLIST-NoArguments-stderr.txt new file mode 100644 index 0000000..073173c --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SUBLIST-NoArguments.cmake:1 \(list\): + list sub-command SUBLIST requires four arguments \(1 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SUBLIST-NoArguments.cmake b/Tests/RunCMake/list/SUBLIST-NoArguments.cmake new file mode 100644 index 0000000..df38b87 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoArguments.cmake @@ -0,0 +1 @@ +list(SUBLIST mylist) diff --git a/Tests/RunCMake/list/SUBLIST-NoVariable-result.txt b/Tests/RunCMake/list/SUBLIST-NoVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SUBLIST-NoVariable-stderr.txt b/Tests/RunCMake/list/SUBLIST-NoVariable-stderr.txt new file mode 100644 index 0000000..6f80c1a --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoVariable-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SUBLIST-NoVariable.cmake:2 \(list\): + list sub-command SUBLIST requires four arguments \(3 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SUBLIST-NoVariable.cmake b/Tests/RunCMake/list/SUBLIST-NoVariable.cmake new file mode 100644 index 0000000..83edae9 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoVariable.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(SUBLIST mylist 0 -1) diff --git a/Tests/RunCMake/list/SUBLIST-TooManyArguments-result.txt b/Tests/RunCMake/list/SUBLIST-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SUBLIST-TooManyArguments-stderr.txt b/Tests/RunCMake/list/SUBLIST-TooManyArguments-stderr.txt new file mode 100644 index 0000000..eb46844 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SUBLIST-TooManyArguments.cmake:1 \(list\): + list sub-command SUBLIST requires four arguments \(5 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SUBLIST-TooManyArguments.cmake b/Tests/RunCMake/list/SUBLIST-TooManyArguments.cmake new file mode 100644 index 0000000..28f20c1 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-TooManyArguments.cmake @@ -0,0 +1 @@ +list(SUBLIST mylist 0 -1 result one_too_many) diff --git a/Tests/RunCMake/list/SUBLIST.cmake b/Tests/RunCMake/list/SUBLIST.cmake new file mode 100644 index 0000000..fd15c28 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST.cmake @@ -0,0 +1,46 @@ +set(mylist alpha bravo charlie delta) +list(SUBLIST mylist 1 2 result) + +if (NOT result STREQUAL "bravo;charlie") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie\"") +endif() + + +unset(result) +list(SUBLIST mylist 0 2 result) + +if (NOT result STREQUAL "alpha;bravo") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"alpha;bravo\"") +endif() + + +unset(result) +list(SUBLIST mylist 3 2 result) + +if (NOT result STREQUAL "delta") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"delta\"") +endif() + + +unset(result) +list(SUBLIST mylist 2 0 result) +list(LENGTH result length) +if (NOT length EQUAL 0) + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is an empty list") +endif() + + +unset(result) +list(SUBLIST mylist 1 5 result) + +if (NOT result STREQUAL "bravo;charlie;delta") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie;delta\"") +endif() + + +unset(result) +list(SUBLIST mylist 1 -1 result) + +if (NOT result STREQUAL "bravo;charlie;delta") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie;delta\"") +endif() diff --git a/Tests/RunCMake/list/TRANSFORM-APPEND-NoArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-APPEND-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-APPEND-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-APPEND-NoArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-APPEND-NoArguments-stderr.txt new file mode 100644 index 0000000..028f8d5 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-APPEND-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-APPEND-NoArguments.cmake:2 \(list\): + list sub-command TRANSFORM, action APPEND expects 1 argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-APPEND-NoArguments.cmake b/Tests/RunCMake/list/TRANSFORM-APPEND-NoArguments.cmake new file mode 100644 index 0000000..f161187 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-APPEND-NoArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist APPEND) diff --git a/Tests/RunCMake/list/TRANSFORM-APPEND-TooManyArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-APPEND-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-APPEND-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-APPEND-TooManyArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-APPEND-TooManyArguments-stderr.txt new file mode 100644 index 0000000..aeb646d --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-APPEND-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-APPEND-TooManyArguments.cmake:2 \(list\): + list sub-command TRANSFORM, 'one_too_many': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-APPEND-TooManyArguments.cmake b/Tests/RunCMake/list/TRANSFORM-APPEND-TooManyArguments.cmake new file mode 100644 index 0000000..8430a4c --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-APPEND-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist APPEND delta one_too_many) diff --git a/Tests/RunCMake/list/TRANSFORM-APPEND.cmake b/Tests/RunCMake/list/TRANSFORM-APPEND.cmake new file mode 100644 index 0000000..9639088 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-APPEND.cmake @@ -0,0 +1,48 @@ +set(mylist alpha bravo charlie delta) + +list(TRANSFORM mylist APPEND "_A" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha_A;bravo_A;charlie_A;delta_A") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha_A;bravo_A;charlie_A;delta_A\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" AT 1 3 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo_A;charlie;delta_A") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha;bravo_A;charlie;delta_A\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" AT 1 -2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo_A;charlie_A;delta") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha;bravo_A;charlie_A;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" FOR 1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo_A;charlie_A;delta") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha;bravo_A;charlie_A;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" FOR 1 -1 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo_A;charlie_A;delta_A") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha;bravo_A;charlie_A;delta_A\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" FOR 0 -1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha_A;bravo;charlie_A;delta") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha_A;bravo;charlie_A;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" REGEX "(r|t)a" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo_A;charlie;delta_A") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha;bravo_A;charlie;delta_A\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" REGEX "(r|t)a") +if (NOT mylist STREQUAL "alpha;bravo_A;charlie;delta_A") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${mylist}\", expected is \"alpha;bravo_A;charlie;delta_A\"") +endif() diff --git a/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP-TooManyArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP-TooManyArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP-TooManyArguments-stderr.txt new file mode 100644 index 0000000..6071a00 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-GENEX_STRIP-TooManyArguments.cmake:2 \(list\): + list sub-command TRANSFORM, 'one_too_many': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP-TooManyArguments.cmake b/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP-TooManyArguments.cmake new file mode 100644 index 0000000..257d7fe --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist GENEX_STRIP one_too_many) diff --git a/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP.cmake b/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP.cmake new file mode 100644 index 0000000..8045eef --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-GENEX_STRIP.cmake @@ -0,0 +1,49 @@ +set(mylist one "$<1:two\;three>" four "$<TARGET_OBJECTS:some_target>") + +list(TRANSFORM mylist GENEX_STRIP OUTPUT_VARIABLE output) +if (NOT output STREQUAL "one;;four;") + message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one;;four;\"") +endif() + +set(mylist "one $<CONFIG>" "$<1:two\;three>-$<PLATFORM_ID>" "$<ANGLE-R>four" "$<TARGET_OBJECTS:some_target>") +unset(output) +list(TRANSFORM mylist GENEX_STRIP AT 1 3 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "one $<CONFIG>;-;$<ANGLE-R>four;") + message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one $<CONFIG>;-;$<ANGLE-R>four;\"") +endif() + +unset(output) +list(TRANSFORM mylist GENEX_STRIP AT 1 -2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "one $<CONFIG>;-;four;$<TARGET_OBJECTS:some_target>") + message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one $<CONFIG>;-;four;$<TARGET_OBJECTS:some_target>\"") +endif() + +unset(output) +list(TRANSFORM mylist GENEX_STRIP FOR 1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "one $<CONFIG>;-;four;$<TARGET_OBJECTS:some_target>") + message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one $<CONFIG>;-;four;$<TARGET_OBJECTS:some_target>\"") +endif() + +unset(output) +list(TRANSFORM mylist GENEX_STRIP FOR 1 -1 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "one $<CONFIG>;-;four;") + message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one $<CONFIG>;-;four;\"") +endif() + +unset(output) +list(TRANSFORM mylist GENEX_STRIP FOR 0 -1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "one ;$<1:two;three>-$<PLATFORM_ID>;four;$<TARGET_OBJECTS:some_target>") + message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one ;$<1:two;three>-$<PLATFORM_ID>;four;$<TARGET_OBJECTS:some_target>\"") +endif() + +unset(output) +list(TRANSFORM mylist GENEX_STRIP REGEX "(D|G)>" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "one ;-;$<ANGLE-R>four;$<TARGET_OBJECTS:some_target>") + message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one ;-;$<ANGLE-R>four;$<TARGET_OBJECTS:some_target>\"") +endif() + +unset(output) +list(TRANSFORM mylist GENEX_STRIP REGEX "(D|G)>") +if (NOT mylist STREQUAL "one ;-;$<ANGLE-R>four;$<TARGET_OBJECTS:some_target>") + message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${mylist}\", expected is \"one ;-;$<ANGLE-R>four;$<TARGET_OBJECTS:some_target>\"") +endif() diff --git a/Tests/RunCMake/list/TRANSFORM-InvalidAction-result.txt b/Tests/RunCMake/list/TRANSFORM-InvalidAction-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-InvalidAction-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-InvalidAction-stderr.txt b/Tests/RunCMake/list/TRANSFORM-InvalidAction-stderr.txt new file mode 100644 index 0000000..0fa45c9 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-InvalidAction-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-InvalidAction.cmake:2 \(list\): + list sub-command TRANSFORM, BAD_ACTION invalid action. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-InvalidAction.cmake b/Tests/RunCMake/list/TRANSFORM-InvalidAction.cmake new file mode 100644 index 0000000..fb2cc30 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-InvalidAction.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist BAD_ACTION) diff --git a/Tests/RunCMake/list/TRANSFORM-NoAction-result.txt b/Tests/RunCMake/list/TRANSFORM-NoAction-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-NoAction-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-NoAction-stderr.txt b/Tests/RunCMake/list/TRANSFORM-NoAction-stderr.txt new file mode 100644 index 0000000..68e9e9d --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-NoAction-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-NoAction.cmake:2 \(list\): + list sub-command TRANSFORM requires an action to be specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-NoAction.cmake b/Tests/RunCMake/list/TRANSFORM-NoAction.cmake new file mode 100644 index 0000000..3690f14 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-NoAction.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist) diff --git a/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments-stderr.txt new file mode 100644 index 0000000..b4f4e06 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments.cmake:2 \(list\): + list sub-command TRANSFORM, OUTPUT_VARIABLE expects variable name argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments.cmake b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments.cmake new file mode 100644 index 0000000..acc4094 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-NoArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER OUTPUT_VARIABLE) diff --git a/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments-stderr.txt new file mode 100644 index 0000000..9a58346 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments.cmake:2 \(list\): + list sub-command TRANSFORM, 'one_too_many': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments.cmake b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments.cmake new file mode 100644 index 0000000..c4da864 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Output-OUTPUT_VARIABLE-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER OUTPUT_VARIABLE output one_too_many) diff --git a/Tests/RunCMake/list/TRANSFORM-PREPEND-NoArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-PREPEND-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-PREPEND-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-PREPEND-NoArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-PREPEND-NoArguments-stderr.txt new file mode 100644 index 0000000..413ce30 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-PREPEND-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-PREPEND-NoArguments.cmake:2 \(list\): + list sub-command TRANSFORM, action PREPEND expects 1 argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-PREPEND-NoArguments.cmake b/Tests/RunCMake/list/TRANSFORM-PREPEND-NoArguments.cmake new file mode 100644 index 0000000..a8e4530 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-PREPEND-NoArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist PREPEND) diff --git a/Tests/RunCMake/list/TRANSFORM-PREPEND-TooManyArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-PREPEND-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-PREPEND-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-PREPEND-TooManyArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-PREPEND-TooManyArguments-stderr.txt new file mode 100644 index 0000000..6ff1b89 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-PREPEND-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-PREPEND-TooManyArguments.cmake:2 \(list\): + list sub-command TRANSFORM, 'one_too_many': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-PREPEND-TooManyArguments.cmake b/Tests/RunCMake/list/TRANSFORM-PREPEND-TooManyArguments.cmake new file mode 100644 index 0000000..1f904ad --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-PREPEND-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist PREPEND delta one_too_many) diff --git a/Tests/RunCMake/list/TRANSFORM-PREPEND.cmake b/Tests/RunCMake/list/TRANSFORM-PREPEND.cmake new file mode 100644 index 0000000..55b8867 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-PREPEND.cmake @@ -0,0 +1,48 @@ +set(mylist alpha bravo charlie delta) + +list(TRANSFORM mylist PREPEND "P_" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "P_alpha;P_bravo;P_charlie;P_delta") + message (FATAL_ERROR "TRANSFORM(PREPEND) is \"${output}\", expected is \"P_alpha;P_bravo;P_charlie;P_delta\"") +endif() + +unset(output) +list(TRANSFORM mylist PREPEND "P_" AT 1 3 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;P_bravo;charlie;P_delta") + message (FATAL_ERROR "TRANSFORM(PREPEND) is \"${output}\", expected is \"alpha;P_bravo;charlie;P_delta\"") +endif() + +unset(output) +list(TRANSFORM mylist PREPEND "P_" AT 1 -2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;P_bravo;P_charlie;delta") + message (FATAL_ERROR "TRANSFORM(PREPEND) is \"${output}\", expected is \"alpha;P_bravo;P_charlie;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist PREPEND "P_" FOR 1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;P_bravo;P_charlie;delta") + message (FATAL_ERROR "TRANSFORM(PREPEND) is \"${output}\", expected is \"alpha;P_bravo;P_charlie;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist PREPEND "P_" FOR 1 -1 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;P_bravo;P_charlie;P_delta") + message (FATAL_ERROR "TRANSFORM(PREPEND) is \"${output}\", expected is \"alpha;P_bravo;P_charlie;P_delta\"") +endif() + +unset(output) +list(TRANSFORM mylist PREPEND "P_" FOR 0 -1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "P_alpha;bravo;P_charlie;delta") + message (FATAL_ERROR "TRANSFORM(PREPEND) is \"${output}\", expected is \"P_alpha;bravo;P_charlie;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist PREPEND "P_" REGEX "(r|t)a" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;P_bravo;charlie;P_delta") + message (FATAL_ERROR "TRANSFORM(PREPEND) is \"${output}\", expected is \"alpha;P_bravo;charlie;P_delta\"") +endif() + +unset(output) +list(TRANSFORM mylist PREPEND "P_" REGEX "(r|t)a") +if (NOT mylist STREQUAL "alpha;P_bravo;charlie;P_delta") + message (FATAL_ERROR "TRANSFORM(PREPEND) is \"${mylist}\", expected is \"alpha;P_bravo;charlie;P_delta\"") +endif() diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidRegex-result.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidRegex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidRegex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidRegex-stderr.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidRegex-stderr.txt new file mode 100644 index 0000000..334c96e --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidRegex-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TRANSFORM-REPLACE-InvalidRegex.cmake:2 \(list\): + list sub-command TRANSFORM, action REPLACE: Failed to compile regex + "\^\(alpha\$". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidRegex.cmake b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidRegex.cmake new file mode 100644 index 0000000..f440c35 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidRegex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist REPLACE "^(alpha$" "zulu") diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace-result.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace1-result.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace1-stderr.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace1-stderr.txt new file mode 100644 index 0000000..7671c83 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace1-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TRANSFORM-REPLACE-InvalidReplace1.cmake:2 \(list\): + list sub-command TRANSFORM, action REPLACE: replace-expression ends in a + backslash. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace1.cmake b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace1.cmake new file mode 100644 index 0000000..35387f0 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace1.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist REPLACE "^alpha$" "zulu\\") diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace2-result.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace2-stderr.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace2-stderr.txt new file mode 100644 index 0000000..e0aabd7 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace2-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TRANSFORM-REPLACE-InvalidReplace2.cmake:2 \(list\): + list sub-command TRANSFORM, action REPLACE: Unknown escape "\\z" in + replace-expression. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace2.cmake b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace2.cmake new file mode 100644 index 0000000..2f1f2c7 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-InvalidReplace2.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist REPLACE "^alpha$" "\\zulu") diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-NoArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-NoArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoArguments-stderr.txt new file mode 100644 index 0000000..3d39e72 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-REPLACE-NoArguments.cmake:2 \(list\): + list sub-command TRANSFORM, action REPLACE expects 2 argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-NoArguments.cmake b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoArguments.cmake new file mode 100644 index 0000000..b7b1e9d --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist REPLACE) diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-NoEnoughArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoEnoughArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoEnoughArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-NoEnoughArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoEnoughArguments-stderr.txt new file mode 100644 index 0000000..dc80f33 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoEnoughArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-REPLACE-NoEnoughArguments.cmake:2 \(list\): + list sub-command TRANSFORM, action REPLACE expects 2 argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-NoEnoughArguments.cmake b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoEnoughArguments.cmake new file mode 100644 index 0000000..1d418c0 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-NoEnoughArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist REPLACE "^alpha$") diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-TooManyArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-TooManyArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-REPLACE-TooManyArguments-stderr.txt new file mode 100644 index 0000000..3d4e15a --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-REPLACE-TooManyArguments.cmake:2 \(list\): + list sub-command TRANSFORM, 'one_too_many': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE-TooManyArguments.cmake b/Tests/RunCMake/list/TRANSFORM-REPLACE-TooManyArguments.cmake new file mode 100644 index 0000000..baed0af --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist REPLACE "^alpha$" "zulu" "one_too_many") diff --git a/Tests/RunCMake/list/TRANSFORM-REPLACE.cmake b/Tests/RunCMake/list/TRANSFORM-REPLACE.cmake new file mode 100644 index 0000000..256b1b8 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-REPLACE.cmake @@ -0,0 +1,48 @@ +set(mylist alpha bravo charlie delta) + +list(TRANSFORM mylist REPLACE "(.+a)$" "\\1_\\1" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha_alpha;bravo;charlie;delta_delta") + message (FATAL_ERROR "TRANSFORM(REPLACE) is \"${output}\", expected is \"alpha_alpha;bravo;charlie;delta_delta\"") +endif() + +unset(output) +list(TRANSFORM mylist REPLACE "(.+a)$" "\\1_\\1" AT 1 3 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo;charlie;delta_delta") + message (FATAL_ERROR "TRANSFORM(REPLACE) is \"${output}\", expected is \"alpha;bravo;charlie;delta_delta\"") +endif() + +unset(output) +list(TRANSFORM mylist REPLACE "(.+e)$" "\\1_\\1" AT 1 -2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo;charlie_charlie;delta") + message (FATAL_ERROR "TRANSFORM(REPLACE) is \"${output}\", expected is \"alpha;bravo;charlie_charlie;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist REPLACE "(.+e)$" "\\1_\\1" FOR 1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo;charlie_charlie;delta") + message (FATAL_ERROR "TRANSFORM(REPLACE) is \"${output}\", expected is \"alpha;bravo;charlie_charlie;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist REPLACE "(.+a)$" "\\1_\\1" FOR 1 -1 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo;charlie;delta_delta") + message (FATAL_ERROR "TRANSFORM(REPLACE) is \"${output}\", expected is \"alpha;bravo;charlie_A;delta_delta\"") +endif() + +unset(output) +list(TRANSFORM mylist REPLACE "(.+a)$" "\\1_\\1" FOR 0 -1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha_alpha;bravo;charlie;delta") + message (FATAL_ERROR "TRANSFORM(REPLACE) is \"${output}\", expected is \"alpha_alpha;bravo;charlie;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist REPLACE "(.+a)$" "\\1_\\1" REGEX "(r|t)a" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo;charlie;delta_delta") + message (FATAL_ERROR "TRANSFORM(REPLACE) is \"${output}\", expected is \"alpha;bravo;charlie;delta_delta\"") +endif() + +unset(output) +list(TRANSFORM mylist REPLACE "(.+a)$" "\\1_\\1" REGEX "(r|t)a") +if (NOT mylist STREQUAL "alpha;bravo;charlie;delta_delta") + message (FATAL_ERROR "TRANSFORM(REPLACE) is \"${mylist}\", expected is \"alpha;bravo;charlie;delta_delta\"") +endif() diff --git a/Tests/RunCMake/list/TRANSFORM-STRIP-TooManyArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-STRIP-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-STRIP-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-STRIP-TooManyArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-STRIP-TooManyArguments-stderr.txt new file mode 100644 index 0000000..534f940 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-STRIP-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-STRIP-TooManyArguments.cmake:2 \(list\): + list sub-command TRANSFORM, 'one_too_many': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-STRIP-TooManyArguments.cmake b/Tests/RunCMake/list/TRANSFORM-STRIP-TooManyArguments.cmake new file mode 100644 index 0000000..c6a8213 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-STRIP-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist STRIP one_too_many) diff --git a/Tests/RunCMake/list/TRANSFORM-STRIP.cmake b/Tests/RunCMake/list/TRANSFORM-STRIP.cmake new file mode 100644 index 0000000..366c63a --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-STRIP.cmake @@ -0,0 +1,49 @@ +set(mylist " alpha" "bravo " " charlie " delta) + +list(TRANSFORM mylist STRIP OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo;charlie;delta") + message (FATAL_ERROR "TRANSFORM(STRIP) is \"${output}\", expected is \"alpha;bravo;charlie;delta\"") +endif() + +set(mylist " alpha" "bravo " " charlie " "delta ") +unset(output) +list(TRANSFORM mylist STRIP AT 1 3 OUTPUT_VARIABLE output) +if (NOT output STREQUAL " alpha;bravo; charlie ;delta") + message (FATAL_ERROR "TRANSFORM(STRIP) is \"${output}\", expected is \" alpha;bravo; charlie ;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist STRIP AT 1 -2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL " alpha;bravo;charlie;delta ") + message (FATAL_ERROR "TRANSFORM(STRIP) is \"${output}\", expected is \" alpha;bravo;charlie;delta \"") +endif() + +unset(output) +list(TRANSFORM mylist STRIP FOR 1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL " alpha;bravo;charlie;delta ") + message (FATAL_ERROR "TRANSFORM(STRIP) is \"${output}\", expected is \" alpha;bravo;charlie;delta \"") +endif() + +unset(output) +list(TRANSFORM mylist STRIP FOR 1 -1 OUTPUT_VARIABLE output) +if (NOT output STREQUAL " alpha;bravo;charlie;delta") + message (FATAL_ERROR "TRANSFORM(STRIP) is \"${output}\", expected is \" alpha;bravo;charlie;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist STRIP FOR 0 -1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo ;charlie;delta ") + message (FATAL_ERROR "TRANSFORM(STRIP) is \"${output}\", expected is \"alpha;bravo ;charlie;delta \"") +endif() + +unset(output) +list(TRANSFORM mylist STRIP REGEX "(r|t)a" OUTPUT_VARIABLE output) +if (NOT output STREQUAL " alpha;bravo; charlie ;delta") + message (FATAL_ERROR "TRANSFORM(STRIP) is \"${output}\", expected is \" alpha;bravo; charlie ;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist STRIP REGEX "(r|t)a") +if (NOT mylist STREQUAL " alpha;bravo; charlie ;delta") + message (FATAL_ERROR "TRANSFORM(STRIP) is \"${mylist}\", expected is \" alpha;bravo; charlie ;delta\"") +endif() diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-AT-BadArgument-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-AT-BadArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-AT-BadArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-AT-BadArgument-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-AT-BadArgument-stderr.txt new file mode 100644 index 0000000..cec520f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-AT-BadArgument-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-Selector-AT-BadArgument.cmake:2 \(list\): + list sub-command TRANSFORM, '1x 2': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-AT-BadArgument.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-AT-BadArgument.cmake new file mode 100644 index 0000000..f61b86b --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-AT-BadArgument.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER AT 0 1x 2) diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-AT-InvalidIndex-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-AT-InvalidIndex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-AT-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-AT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-AT-InvalidIndex-stderr.txt new file mode 100644 index 0000000..7e2898b --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-AT-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-Selector-AT-InvalidIndex.cmake:2 \(list\): + list sub-command TRANSFORM, selector AT, index: 3 out of range \(-3, 2\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-AT-InvalidIndex.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-AT-InvalidIndex.cmake new file mode 100644 index 0000000..d33586c --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-AT-InvalidIndex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER AT 0 3 2) diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-AT-NoArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-AT-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-AT-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-AT-NoArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-AT-NoArguments-stderr.txt new file mode 100644 index 0000000..eaf5281 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-AT-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-Selector-AT-NoArguments.cmake:2 \(list\): + list sub-command TRANSFORM, selector AT expects at least one numeric value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-AT-NoArguments.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-AT-NoArguments.cmake new file mode 100644 index 0000000..052b79b --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-AT-NoArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER AT) diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BadArgument-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BadArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BadArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BadArgument-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BadArgument-stderr.txt new file mode 100644 index 0000000..a0f701f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BadArgument-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TRANSFORM-Selector-FOR-BadArgument.cmake:2 \(list\): + list sub-command TRANSFORM, selector FOR expects, at least, two numeric + values. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BadArgument.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BadArgument.cmake new file mode 100644 index 0000000..55527be --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-BadArgument.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER FOR 0 1x 2) diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-InvalidIndex-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-InvalidIndex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-InvalidIndex-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-InvalidIndex-stderr.txt new file mode 100644 index 0000000..c50cc0a --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-Selector-FOR-InvalidIndex.cmake:2 \(list\): + list sub-command TRANSFORM, selector FOR, index: 6 out of range \(-3, 2\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-InvalidIndex.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-InvalidIndex.cmake new file mode 100644 index 0000000..6e2374e --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-InvalidIndex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER FOR 0 6 2) diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoArguments-stderr.txt new file mode 100644 index 0000000..5881b67 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-Selector-FOR-NoArguments.cmake:2 \(list\): + list sub-command TRANSFORM, selector FOR expects, at least, two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoArguments.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoArguments.cmake new file mode 100644 index 0000000..4902cc9 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER FOR) diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoEnoughArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoEnoughArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoEnoughArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoEnoughArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoEnoughArguments-stderr.txt new file mode 100644 index 0000000..b1081d9 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoEnoughArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-Selector-FOR-NoEnoughArguments.cmake:2 \(list\): + list sub-command TRANSFORM, selector FOR expects, at least, two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoEnoughArguments.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoEnoughArguments.cmake new file mode 100644 index 0000000..81417de --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-NoEnoughArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER FOR 1) diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-TooManyArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-TooManyArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-TooManyArguments-stderr.txt new file mode 100644 index 0000000..2221cb3 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-Selector-FOR-TooManyArguments.cmake:2 \(list\): + list sub-command TRANSFORM, '3': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-FOR-TooManyArguments.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-TooManyArguments.cmake new file mode 100644 index 0000000..80917d6 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-FOR-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER FOR 0 1 2 3) diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-InvalidRegex-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-InvalidRegex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-InvalidRegex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-InvalidRegex-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-InvalidRegex-stderr.txt new file mode 100644 index 0000000..31ba939 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-InvalidRegex-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TRANSFORM-Selector-REGEX-InvalidRegex.cmake:2 \(list\): + list sub-command TRANSFORM, selector REGEX failed to compile regex + "\^\(alpha\$". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-InvalidRegex.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-InvalidRegex.cmake new file mode 100644 index 0000000..56e202b --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-InvalidRegex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER REGEX "^(alpha$") diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-NoArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-NoArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-NoArguments-stderr.txt new file mode 100644 index 0000000..2784785 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-NoArguments-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TRANSFORM-Selector-REGEX-NoArguments.cmake:2 \(list\): + list sub-command TRANSFORM, selector REGEX expects 'regular expression' + argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-NoArguments.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-NoArguments.cmake new file mode 100644 index 0000000..f199d0e --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-NoArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER REGEX) diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-TooManyArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-TooManyArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-TooManyArguments-stderr.txt new file mode 100644 index 0000000..db5b1ff --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-Selector-REGEX-TooManyArguments.cmake:2 \(list\): + list sub-command TRANSFORM, 'one_too_many': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-TooManyArguments.cmake b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-TooManyArguments.cmake new file mode 100644 index 0000000..4aa1619 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-Selector-REGEX-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER REGEX "^alpha$" "one_too_many") diff --git a/Tests/RunCMake/list/TRANSFORM-TOLOWER-TooManyArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-TOLOWER-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-TOLOWER-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-TOLOWER-TooManyArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-TOLOWER-TooManyArguments-stderr.txt new file mode 100644 index 0000000..90248ae --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-TOLOWER-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-TOLOWER-TooManyArguments.cmake:2 \(list\): + list sub-command TRANSFORM, 'one_too_many': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-TOLOWER-TooManyArguments.cmake b/Tests/RunCMake/list/TRANSFORM-TOLOWER-TooManyArguments.cmake new file mode 100644 index 0000000..1758e19 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-TOLOWER-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOLOWER one_too_many) diff --git a/Tests/RunCMake/list/TRANSFORM-TOLOWER.cmake b/Tests/RunCMake/list/TRANSFORM-TOLOWER.cmake new file mode 100644 index 0000000..a2d7348 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-TOLOWER.cmake @@ -0,0 +1,48 @@ +set(mylist ALPHA BRAVO CHARLIE DELTA) + +list(TRANSFORM mylist TOLOWER OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo;charlie;delta") + message (FATAL_ERROR "TRANSFORM(TOLOWER) is \"${output}\", expected is \"alpha;bravo;charlie;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist TOLOWER AT 1 3 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "ALPHA;bravo;CHARLIE;delta") + message (FATAL_ERROR "TRANSFORM(TOLOWER) is \"${output}\", expected is \"ALPHA;bravo;CHARLIE;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist TOLOWER AT 1 -2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "ALPHA;bravo;charlie;DELTA") + message (FATAL_ERROR "TRANSFORM(TOLOWER) is \"${output}\", expected is \"ALPHA;bravo;charlie;DELTA\"") +endif() + +unset(output) +list(TRANSFORM mylist TOLOWER FOR 1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "ALPHA;bravo;charlie;DELTA") + message (FATAL_ERROR "TRANSFORM(TOLOWER) is \"${output}\", expected is \"ALPHA;bravo;charlie;DELTA\"") +endif() + +unset(output) +list(TRANSFORM mylist TOLOWER FOR 1 -1 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "ALPHA;bravo;charlie;delta") + message (FATAL_ERROR "TRANSFORM(TOLOWER) is \"${output}\", expected is \"ALPHA;bravo;charlie;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist TOLOWER FOR 0 -1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;BRAVO;charlie;DELTA") + message (FATAL_ERROR "TRANSFORM(TOLOWER) is \"${output}\", expected is \"alpha;BRAVO;charlie;DELTA\"") +endif() + +unset(output) +list(TRANSFORM mylist TOLOWER REGEX "(R|T)A" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "ALPHA;bravo;CHARLIE;delta") + message (FATAL_ERROR "TRANSFORM(TOLOWER) is \"${output}\", expected is \"ALPHA;bravo;CHARLIE;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist TOLOWER REGEX "(R|T)A") +if (NOT mylist STREQUAL "ALPHA;bravo;CHARLIE;delta") + message (FATAL_ERROR "TRANSFORM(TOLOWER) is \"${mylist}\", expected is \"ALPHA;bravo;CHARLIE;delta\"") +endif() diff --git a/Tests/RunCMake/list/TRANSFORM-TOUPPER-TooManyArguments-result.txt b/Tests/RunCMake/list/TRANSFORM-TOUPPER-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-TOUPPER-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/TRANSFORM-TOUPPER-TooManyArguments-stderr.txt b/Tests/RunCMake/list/TRANSFORM-TOUPPER-TooManyArguments-stderr.txt new file mode 100644 index 0000000..9da241b --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-TOUPPER-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TRANSFORM-TOUPPER-TooManyArguments.cmake:2 \(list\): + list sub-command TRANSFORM, 'one_too_many': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/TRANSFORM-TOUPPER-TooManyArguments.cmake b/Tests/RunCMake/list/TRANSFORM-TOUPPER-TooManyArguments.cmake new file mode 100644 index 0000000..58d6a8c --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-TOUPPER-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(TRANSFORM mylist TOUPPER one_too_many) diff --git a/Tests/RunCMake/list/TRANSFORM-TOUPPER.cmake b/Tests/RunCMake/list/TRANSFORM-TOUPPER.cmake new file mode 100644 index 0000000..5b1fcb6 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-TOUPPER.cmake @@ -0,0 +1,48 @@ +set(mylist alpha bravo charlie delta) + +list(TRANSFORM mylist TOUPPER OUTPUT_VARIABLE output) +if (NOT output STREQUAL "ALPHA;BRAVO;CHARLIE;DELTA") + message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"ALPHA;BRAVO;CHARLIE;DELTA\"") +endif() + +unset(output) +list(TRANSFORM mylist TOUPPER AT 1 3 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;BRAVO;charlie;DELTA") + message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"alpha;BRAVO;charlie;DELTA\"") +endif() + +unset(output) +list(TRANSFORM mylist TOUPPER AT 1 -2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;BRAVO;CHARLIE;delta") + message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"alpha;BRAVO;CHARLIE;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist TOUPPER FOR 1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;BRAVO;CHARLIE;delta") + message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"alpha;BRAVO;CHARLIE;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist TOUPPER FOR 1 -1 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;BRAVO;CHARLIE;DELTA") + message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"alpha;BRAVO;CHARLIE;DELTA\"") +endif() + +unset(output) +list(TRANSFORM mylist TOUPPER FOR 0 -1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "ALPHA;bravo;CHARLIE;delta") + message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"ALPHA;bravo;CHARLIE;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist TOUPPER REGEX "(r|t)a" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;BRAVO;charlie;DELTA") + message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"alpha;BRAVO;charlie;DELTA\"") +endif() + +unset(output) +list(TRANSFORM mylist TOUPPER REGEX "(r|t)a") +if (NOT mylist STREQUAL "alpha;BRAVO;charlie;DELTA") + message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${mylist}\", expected is \"alpha;BRAVO;charlie;DELTA\"") +endif() diff --git a/Tests/RunCMake/project/LanguagesUnordered-stderr.txt b/Tests/RunCMake/project/LanguagesUnordered-stderr.txt new file mode 100644 index 0000000..5108670 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUnordered-stderr.txt @@ -0,0 +1 @@ + the following parameters must be specified after LANGUAGES keyword: C. diff --git a/Tests/RunCMake/project/LanguagesUnordered.cmake b/Tests/RunCMake/project/LanguagesUnordered.cmake new file mode 100644 index 0000000..cd3ba28 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUnordered.cmake @@ -0,0 +1 @@ +project(ProjectA C LANGUAGES CXX) diff --git a/Tests/RunCMake/project/ProjectDescriptionNoArg-stderr.txt b/Tests/RunCMake/project/ProjectDescriptionNoArg-stderr.txt new file mode 100644 index 0000000..910106f --- /dev/null +++ b/Tests/RunCMake/project/ProjectDescriptionNoArg-stderr.txt @@ -0,0 +1,2 @@ + DESCRIPTION keyword not followed by a value or was followed by a value that + expanded to nothing. diff --git a/Tests/RunCMake/project/ProjectDescriptionNoArg.cmake b/Tests/RunCMake/project/ProjectDescriptionNoArg.cmake new file mode 100644 index 0000000..25acff8 --- /dev/null +++ b/Tests/RunCMake/project/ProjectDescriptionNoArg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectDescriptionTest VERSION 1.0.0 LANGUAGES NONE DESCRIPTION) diff --git a/Tests/RunCMake/project/ProjectDescriptionNoArg2-stderr.txt b/Tests/RunCMake/project/ProjectDescriptionNoArg2-stderr.txt new file mode 100644 index 0000000..910106f --- /dev/null +++ b/Tests/RunCMake/project/ProjectDescriptionNoArg2-stderr.txt @@ -0,0 +1,2 @@ + DESCRIPTION keyword not followed by a value or was followed by a value that + expanded to nothing. diff --git a/Tests/RunCMake/project/ProjectDescriptionNoArg2.cmake b/Tests/RunCMake/project/ProjectDescriptionNoArg2.cmake new file mode 100644 index 0000000..f50a2f6 --- /dev/null +++ b/Tests/RunCMake/project/ProjectDescriptionNoArg2.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectDescriptionTest VERSION 1.0.0 DESCRIPTION LANGUAGES NONE) diff --git a/Tests/RunCMake/project/ProjectHomepage-stdout.txt b/Tests/RunCMake/project/ProjectHomepage-stdout.txt new file mode 100644 index 0000000..253990f --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepage-stdout.txt @@ -0,0 +1,3 @@ +-- PROJECT_HOMEPAGE_URL=http://example.com +-- CMAKE_PROJECT_HOMEPAGE_URL=http://example.com +-- ProjectHomepageTest_HOMEPAGE_URL=http://example.com diff --git a/Tests/RunCMake/project/ProjectHomepage.cmake b/Tests/RunCMake/project/ProjectHomepage.cmake new file mode 100644 index 0000000..3307f1f --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepage.cmake @@ -0,0 +1,14 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectHomepageTest VERSION 1.0.0 HOMEPAGE_URL "http://example.com" LANGUAGES) +if(NOT PROJECT_HOMEPAGE_URL) + message(FATAL_ERROR "PROJECT_HOMEPAGE_URL expected to be set") +endif() +if(NOT CMAKE_PROJECT_HOMEPAGE_URL) + message(FATAL_ERROR "CMAKE_PROJECT_HOMEPAGE_URL expected to be set") +endif() +if(NOT ProjectHomepageTest_HOMEPAGE_URL) + message(FATAL_ERROR "ProjectHomepageTest_HOMEPAGE_URL expected to be set") +endif() +message(STATUS "PROJECT_HOMEPAGE_URL=${PROJECT_HOMEPAGE_URL}") +message(STATUS "CMAKE_PROJECT_HOMEPAGE_URL=${CMAKE_PROJECT_HOMEPAGE_URL}") +message(STATUS "ProjectHomepageTest_HOMEPAGE_URL=${ProjectHomepageTest_HOMEPAGE_URL}") diff --git a/Tests/RunCMake/project/ProjectHomepage2-result.txt b/Tests/RunCMake/project/ProjectHomepage2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepage2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/project/ProjectHomepage2-stderr.txt b/Tests/RunCMake/project/ProjectHomepage2-stderr.txt new file mode 100644 index 0000000..4a0adc2 --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepage2-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at ProjectHomepage2.cmake:2 \(project\): + HOMEPAGE_URL may be specified at most once. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/ProjectHomepage2.cmake b/Tests/RunCMake/project/ProjectHomepage2.cmake new file mode 100644 index 0000000..184c392 --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepage2.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectDescriptionTest VERSION 1.0.0 HOMEPAGE_URL "http://example.com" HOMEPAGE_URL "http://example.com" LANGUAGES) diff --git a/Tests/RunCMake/project/ProjectHomepageNoArg-stderr.txt b/Tests/RunCMake/project/ProjectHomepageNoArg-stderr.txt new file mode 100644 index 0000000..c9503b7 --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepageNoArg-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning at ProjectHomepageNoArg.cmake:2 \(project\): + HOMEPAGE_URL keyword not followed by a value or was followed by a value + that expanded to nothing. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/ProjectHomepageNoArg.cmake b/Tests/RunCMake/project/ProjectHomepageNoArg.cmake new file mode 100644 index 0000000..4605541 --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepageNoArg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectDescriptionTest VERSION 1.0.0 LANGUAGES NONE HOMEPAGE_URL) diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 3d13e2e..e9fb929 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -7,8 +7,14 @@ run_cmake(LanguagesImplicit) run_cmake(LanguagesEmpty) run_cmake(LanguagesNONE) run_cmake(LanguagesTwice) +run_cmake(LanguagesUnordered) run_cmake(ProjectDescription) run_cmake(ProjectDescription2) +run_cmake(ProjectDescriptionNoArg) +run_cmake(ProjectDescriptionNoArg2) +run_cmake(ProjectHomepage) +run_cmake(ProjectHomepage2) +run_cmake(ProjectHomepageNoArg) run_cmake(VersionAndLanguagesEmpty) run_cmake(VersionEmpty) run_cmake(VersionInvalid) diff --git a/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt b/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt index 52433bc..576ac69 100644 --- a/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt +++ b/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt @@ -1,4 +1,5 @@ CMake Error at VersionMissingLanguages.cmake:2 \(project\): - project with VERSION must use LANGUAGES before language names. + project with VERSION, DESCRIPTION or HOMEPAGE_URL must use LANGUAGES before + language names. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/project/VersionMissingValueOkay-stderr.txt b/Tests/RunCMake/project/VersionMissingValueOkay-stderr.txt new file mode 100644 index 0000000..3228df7 --- /dev/null +++ b/Tests/RunCMake/project/VersionMissingValueOkay-stderr.txt @@ -0,0 +1,2 @@ + VERSION keyword not followed by a value or was followed by a value that + expanded to nothing. diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index 5b5327d..b966e89 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -9,3 +9,4 @@ run_cmake(LINK_LIBRARIES) run_cmake(SOURCES) run_cmake(TYPE) run_cmake(USER_PROP) +run_cmake(USER_PROP_INHERITED) diff --git a/Tests/RunCMake/set_property/USER_PROP_INHERITED-stdout.txt b/Tests/RunCMake/set_property/USER_PROP_INHERITED-stdout.txt new file mode 100644 index 0000000..dcb0f87 --- /dev/null +++ b/Tests/RunCMake/set_property/USER_PROP_INHERITED-stdout.txt @@ -0,0 +1,29 @@ +-- TopDir-to-nothing chaining: '' +-- TopDir-to-global chaining: 'vGlobal' +-- TopDir no chaining required: 'vTopDir' +-- TopDir unset append chaining: 'aTopDir' +-- TopDir preset append chaining: 'vTopDir;aTopDir' +-- Subdir-to-parent chaining: 'vTopDir' +-- Subdir-to-global chaining: 'vGlobal' +-- Subdir no chaining required: 'vSubdir' +-- Subdir preset append chaining: 'vSubdir;aSubdir' +-- Subdir unset append chaining: 'aSubdir' +-- Subdir undefined append chaining: 'aSubdir' +-- Target-to-directory chaining: 'vTopDir' +-- Target unset append chaining: 'aTarget' +-- Target no chaining required: 'vTarget' +-- Target preset append chaining: 'vTarget;aTarget' +-- Target undefined get chaining: '' +-- Target undefined append chaining: 'aTarget' +-- Source-to-directory chaining: 'vTopDir' +-- Source unset append chaining: 'aSource' +-- Source no chaining required: 'vSource' +-- Source preset append chaining: 'vSource;aSource' +-- Source undefined get chaining: '' +-- Source undefined append chaining: 'aSource' +-- Test-to-directory chaining: 'vTopDir' +-- Test unset append chaining: 'aTest' +-- Test no chaining required: 'vTest' +-- Test preset append chaining: 'vTest;aTest' +-- Test undefined get chaining: '' +-- Test undefined append chaining: 'aTest' diff --git a/Tests/RunCMake/set_property/USER_PROP_INHERITED.cmake b/Tests/RunCMake/set_property/USER_PROP_INHERITED.cmake new file mode 100644 index 0000000..2429866 --- /dev/null +++ b/Tests/RunCMake/set_property/USER_PROP_INHERITED.cmake @@ -0,0 +1,83 @@ +# Needed for source property tests +enable_language(C) + +#================================================= +# Directory property chaining +#================================================= + +foreach(i RANGE 1 5) + foreach(propType DIRECTORY TARGET SOURCE TEST) + define_property(${propType} PROPERTY USER_PROP${i} INHERITED + BRIEF_DOCS "Brief" FULL_DOCS "Full" + ) + endforeach() +endforeach() + +get_property(val DIRECTORY PROPERTY USER_PROP1) +message(STATUS "TopDir-to-nothing chaining: '${val}'") + +set_property(GLOBAL PROPERTY USER_PROP1 vGlobal) +set_property(GLOBAL PROPERTY USER_PROP2 vGlobal) +set_property(DIRECTORY PROPERTY USER_PROP2 vTopDir) +set_property(GLOBAL PROPERTY USER_PROP3 vGlobal) +set_property(DIRECTORY PROPERTY USER_PROP4 vTopDir) + +get_property(val DIRECTORY PROPERTY USER_PROP1) +message(STATUS "TopDir-to-global chaining: '${val}'") + +get_property(val DIRECTORY PROPERTY USER_PROP2) +message(STATUS "TopDir no chaining required: '${val}'") + +set_property(DIRECTORY APPEND PROPERTY USER_PROP3 aTopDir) +get_property(val DIRECTORY PROPERTY USER_PROP3) +message(STATUS "TopDir unset append chaining: '${val}'") + +set_property(DIRECTORY APPEND PROPERTY USER_PROP4 aTopDir) +get_property(val DIRECTORY PROPERTY USER_PROP4) +message(STATUS "TopDir preset append chaining: '${val}'") + +add_subdirectory(USER_PROP_INHERITED) + +#================================================= +# The other property types all chain the same way +#================================================= +macro(__chainToDirTests propType) + string(TOUPPER ${propType} propTypeUpper) + + get_property(val ${propTypeUpper} ${propType}1 PROPERTY USER_PROP2) + message(STATUS "${propType}-to-directory chaining: '${val}'") + + set_property(${propTypeUpper} ${propType}1 APPEND PROPERTY USER_PROP2 a${propType}) + get_property(val ${propTypeUpper} ${propType}1 PROPERTY USER_PROP2) + message(STATUS "${propType} unset append chaining: '${val}'") + + set_property(${propTypeUpper} ${propType}1 PROPERTY USER_PROP1 v${propType}) + get_property(val ${propTypeUpper} ${propType}1 PROPERTY USER_PROP1) + message(STATUS "${propType} no chaining required: '${val}'") + + set_property(${propTypeUpper} ${propType}1 APPEND PROPERTY USER_PROP1 a${propType}) + get_property(val ${propTypeUpper} ${propType}1 PROPERTY USER_PROP1) + message(STATUS "${propType} preset append chaining: '${val}'") + + get_property(val ${propTypeUpper} ${propType}2 PROPERTY USER_PROP5) + message(STATUS "${propType} undefined get chaining: '${val}'") + + set_property(${propTypeUpper} ${propType}2 APPEND PROPERTY USER_PROP5 a${propType}) + get_property(val ${propTypeUpper} ${propType}2 PROPERTY USER_PROP5) + message(STATUS "${propType} undefined append chaining: '${val}'") +endmacro() + +add_custom_target(Target1) +add_custom_target(Target2) +__chainToDirTests(Target) + +foreach(i RANGE 1 2) + set(Source${i} "${CMAKE_CURRENT_BINARY_DIR}/src${i}.c") + file(WRITE ${Source${i}} "int foo${i}() { return ${i}; }") +endforeach() +add_library(srcProps OBJECT ${Source1} ${Source2}) +__chainToDirTests(Source) + +add_test(NAME Test1 COMMAND ${CMAKE_COMMAND} -E touch_nocreate iDoNotExist) +add_test(NAME Test2 COMMAND ${CMAKE_COMMAND} -E touch_nocreate iDoNotExist) +__chainToDirTests(Test) diff --git a/Tests/RunCMake/set_property/USER_PROP_INHERITED/CMakeLists.txt b/Tests/RunCMake/set_property/USER_PROP_INHERITED/CMakeLists.txt new file mode 100644 index 0000000..234f4ee --- /dev/null +++ b/Tests/RunCMake/set_property/USER_PROP_INHERITED/CMakeLists.txt @@ -0,0 +1,21 @@ +get_property(val DIRECTORY PROPERTY USER_PROP2) +message(STATUS "Subdir-to-parent chaining: '${val}'") + +get_property(val DIRECTORY PROPERTY USER_PROP1) +message(STATUS "Subdir-to-global chaining: '${val}'") + +set_property(DIRECTORY PROPERTY USER_PROP1 vSubdir) +get_property(val DIRECTORY PROPERTY USER_PROP1) +message(STATUS "Subdir no chaining required: '${val}'") + +set_property(DIRECTORY APPEND PROPERTY USER_PROP1 aSubdir) +get_property(val DIRECTORY PROPERTY USER_PROP1) +message(STATUS "Subdir preset append chaining: '${val}'") + +set_property(DIRECTORY APPEND PROPERTY USER_PROP2 aSubdir) +get_property(val DIRECTORY PROPERTY USER_PROP2) +message(STATUS "Subdir unset append chaining: '${val}'") + +set_property(DIRECTORY APPEND PROPERTY USER_PROP5 aSubdir) +get_property(val DIRECTORY PROPERTY USER_PROP5) +message(STATUS "Subdir undefined append chaining: '${val}'") diff --git a/Tests/RunCMake/string/Join.cmake b/Tests/RunCMake/string/Join.cmake new file mode 100644 index 0000000..081f1e4 --- /dev/null +++ b/Tests/RunCMake/string/Join.cmake @@ -0,0 +1,16 @@ +string(JOIN % out) +if(NOT out STREQUAL "") + message(FATAL_ERROR "\"string(JOIN % out)\" set out to \"${out}\"") +endif() +string(JOIN % out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(JOIN % out a)\" set out to \"${out}\"") +endif() +string(JOIN % out a "b") +if(NOT out STREQUAL "a%b") + message(FATAL_ERROR "\"string(JOIN % out a \"b\")\" set out to \"${out}\"") +endif() +string(JOIN :: out a "b") +if(NOT out STREQUAL "a::b") + message(FATAL_ERROR "\"string(JOIN :: out a \"b\")\" set out to \"${out}\"") +endif() diff --git a/Tests/RunCMake/string/JoinNoArgs-result.txt b/Tests/RunCMake/string/JoinNoArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/JoinNoArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/JoinNoArgs-stderr.txt b/Tests/RunCMake/string/JoinNoArgs-stderr.txt new file mode 100644 index 0000000..d9dcec3 --- /dev/null +++ b/Tests/RunCMake/string/JoinNoArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at JoinNoArgs.cmake:1 \(string\): + string sub-command JOIN requires at least two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/JoinNoArgs.cmake b/Tests/RunCMake/string/JoinNoArgs.cmake new file mode 100644 index 0000000..35ba4d9 --- /dev/null +++ b/Tests/RunCMake/string/JoinNoArgs.cmake @@ -0,0 +1 @@ +string(JOIN) diff --git a/Tests/RunCMake/string/JoinNoVar-result.txt b/Tests/RunCMake/string/JoinNoVar-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/JoinNoVar-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/JoinNoVar-stderr.txt b/Tests/RunCMake/string/JoinNoVar-stderr.txt new file mode 100644 index 0000000..90701a9 --- /dev/null +++ b/Tests/RunCMake/string/JoinNoVar-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at JoinNoVar.cmake:1 \(string\): + string sub-command JOIN requires at least two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/JoinNoVar.cmake b/Tests/RunCMake/string/JoinNoVar.cmake new file mode 100644 index 0000000..35f7b92 --- /dev/null +++ b/Tests/RunCMake/string/JoinNoVar.cmake @@ -0,0 +1 @@ +string(JOIN ";") diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake index 513d1e3..211337a 100644 --- a/Tests/RunCMake/string/RunCMakeTest.cmake +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -9,6 +9,10 @@ run_cmake(PrependNoArgs) run_cmake(Concat) run_cmake(ConcatNoArgs) +run_cmake(Join) +run_cmake(JoinNoArgs) +run_cmake(JoinNoVar) + run_cmake(Timestamp) run_cmake(TimestampEmpty) run_cmake(TimestampInvalid) diff --git a/Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt b/Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt new file mode 100644 index 0000000..51db19c --- /dev/null +++ b/Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt @@ -0,0 +1,2 @@ +var MODIFIED_ACCESS a +var MODIFIED_ACCESS b diff --git a/Tests/RunCMake/variable_watch/RaiseInParentScope.cmake b/Tests/RunCMake/variable_watch/RaiseInParentScope.cmake new file mode 100644 index 0000000..207798e --- /dev/null +++ b/Tests/RunCMake/variable_watch/RaiseInParentScope.cmake @@ -0,0 +1,15 @@ + +function(watch variable access value) + message("${variable} ${access} ${value}") +endfunction () + +# -------------- + +variable_watch(var watch) +set(var "a") + +function(f) + set(var "b" PARENT_SCOPE) +endfunction(f) + +f() diff --git a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake index 2fa6275..3883999 100644 --- a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake +++ b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake @@ -4,3 +4,4 @@ run_cmake(ModifiedAccess) run_cmake(NoWatcher) run_cmake(WatchTwice) run_cmake(ModifyWatchInCallback) +run_cmake(RaiseInParentScope) diff --git a/Tests/Server/CMakeLists.txt b/Tests/Server/CMakeLists.txt index 41d1131..8321edb 100644 --- a/Tests/Server/CMakeLists.txt +++ b/Tests/Server/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.4) project(Server CXX) -find_package(PythonInterp REQUIRED) +find_package(Python REQUIRED) macro(do_test bsname file type) - execute_process(COMMAND ${PYTHON_EXECUTABLE} + execute_process(COMMAND ${Python_EXECUTABLE} -B # no .pyc files "${CMAKE_SOURCE_DIR}/${type}-test.py" "${CMAKE_COMMAND}" diff --git a/Tests/SwigTest/runme.py b/Tests/SwigTest/runme.py deleted file mode 100644 index ed3909e..0000000 --- a/Tests/SwigTest/runme.py +++ /dev/null @@ -1,51 +0,0 @@ -# file: runme.py - -# This file illustrates the shadow-class C++ interface generated -# by SWIG. - -import example - -# ----- Object creation ----- - -print "Creating some objects:" -c = example.Circle(10) -print " Created circle", c -s = example.Square(10) -print " Created square", s - -# ----- Access a static member ----- - -print "\nA total of", example.cvar.Shape_nshapes,"shapes were created" - -# ----- Member data access ----- - -# Set the location of the object - -c.x = 20 -c.y = 30 - -s.x = -10 -s.y = 5 - -print "\nHere is their current position:" -print " Circle = (%f, %f)" % (c.x,c.y) -print " Square = (%f, %f)" % (s.x,s.y) - -# ----- Call some methods ----- - -print "\nHere are some properties of the shapes:" -for o in [c,s]: - print " ", o - print " area = ", o.area() - print " perimeter = ", o.perimeter() - -print "\nGuess I'll clean up now" - -# Note: this invokes the virtual destructor -del c -del s - -s = 3 -print example.cvar.Shape_nshapes,"shapes remain" -print "Goodbye" - diff --git a/Tests/Tutorial/Step7/build2.cmake b/Tests/Tutorial/Step7/build2.cmake deleted file mode 100644 index c2f2e2e..0000000 --- a/Tests/Tutorial/Step7/build2.cmake +++ /dev/null @@ -1,9 +0,0 @@ -set(CTEST_SOURCE_DIRECTORY "$ENV{HOME}/Dashboards/My Tests/CMake/Tests/Tutorial/Step7") -set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}-build2") -set(CTEST_CMAKE_GENERATOR "Visual Studio 8 2005") - -CTEST_START("Experimental") -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}") -CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}") -CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}") -CTEST_SUBMIT() diff --git a/Tests/UseSWIG/BasicConfiguration.cmake b/Tests/UseSWIG/BasicConfiguration.cmake new file mode 100644 index 0000000..d025d2a --- /dev/null +++ b/Tests/UseSWIG/BasicConfiguration.cmake @@ -0,0 +1,79 @@ + +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +# Path separator +if (WIN32) + set (PS "$<SEMICOLON>") +else() + set (PS ":") +endif() + +unset(SWIG_LANG_TYPE) +unset(SWIG_LANG_INCLUDE_DIRECTORIES) +unset(SWIG_LANG_DEFINITIONS) +unset(SWIG_LANG_OPTIONS) +unset(SWIG_LANG_LIBRARIES) + +if(${language} MATCHES python) + find_package(Python REQUIRED COMPONENTS Interpreter Development) + set(SWIG_LANG_INCLUDE_DIRECTORIES ${Python_INCLUDE_DIRS}) + set(SWIG_LANG_LIBRARIES ${Python_LIBRARIES}) +endif() +if(${language} MATCHES perl) + find_package(Perl REQUIRED) + find_package(PerlLibs REQUIRED) + set(SWIG_LANG_INCLUDE_DIRECTORIES ${PERL_INCLUDE_PATH}) + separate_arguments(c_flags UNIX_COMMAND "${PERL_EXTRA_C_FLAGS}") + set(SWIG_LANG_OPTIONS ${c_flags}) + set(SWIG_LANG_LIBRARIES ${PERL_LIBRARY}) +endif() +if(${language} MATCHES tcl) + find_package(TCL REQUIRED) + set(SWIG_LANG_INCLUDE_DIRECTORIES ${TCL_INCLUDE_PATH}) + set(SWIG_LANG_LIBRARIES ${TCL_LIBRARY}) +endif() +if(${language} MATCHES ruby) + find_package(Ruby REQUIRED) + set(SWIG_LANG_INCLUDE_DIRECTORIES ${RUBY_INCLUDE_PATH}) + set(SWIG_LANG_LIBRARIES ${RUBY_LIBRARY}) +endif() +if(${language} MATCHES php4) + find_package(PHP4 REQUIRED) + set(SWIG_LANG_INCLUDE_DIRECTORIES ${PHP4_INCLUDE_PATH}) + set(SWIG_LANG_LIBRARIES ${PHP4_LIBRARY}) +endif() +if(${language} MATCHES pike) + find_package(Pike REQUIRED) + set(SWIG_LANG_INCLUDE_DIRECTORIES ${PIKE_INCLUDE_PATH}) + set(SWIG_LANG_LIBRARIES ${PIKE_LIBRARY}) +endif() +if(${language} MATCHES lua) + find_package(Lua REQUIRED) + set(SWIG_LANG_INCLUDE_DIRECTORIES ${LUA_INCLUDE_DIR}) + set(SWIG_LANG_TYPE TYPE SHARED) + set(SWIG_LANG_LIBRARIES ${LUA_LIBRARIES}) +endif() + +unset(CMAKE_SWIG_FLAGS) + +set (CMAKE_INCLUDE_CURRENT_DIR ON) + +set_property(SOURCE "${CMAKE_CURRENT_LIST_DIR}/example.i" PROPERTY CPLUSPLUS ON) +set_property(SOURCE "${CMAKE_CURRENT_LIST_DIR}/example.i" PROPERTY COMPILE_OPTIONS -includeall) + +set_property(SOURCE "${CMAKE_CURRENT_LIST_DIR}/example.i" + PROPERTY GENERATED_INCLUDE_DIRECTORIES ${SWIG_LANG_INCLUDE_DIRECTORIES} + "${CMAKE_CURRENT_LIST_DIR}") +set_property(SOURCE "${CMAKE_CURRENT_LIST_DIR}/example.i" + PROPERTY GENERATED_COMPILE_DEFINITIONS ${SWIG_LANG_DEFINITIONS}) +set_property(SOURCE "${CMAKE_CURRENT_LIST_DIR}/example.i" + PROPERTY GENERATED_COMPILE_OPTIONS ${SWIG_LANG_OPTIONS}) + + +SWIG_ADD_LIBRARY(example + LANGUAGE "${language}" + ${SWIG_LANG_TYPE} + SOURCES "${CMAKE_CURRENT_LIST_DIR}/example.i" + "${CMAKE_CURRENT_LIST_DIR}/example.cxx") +TARGET_LINK_LIBRARIES(example PRIVATE ${SWIG_LANG_LIBRARIES}) diff --git a/Tests/UseSWIG/BasicPerl/CMakeLists.txt b/Tests/UseSWIG/BasicPerl/CMakeLists.txt new file mode 100644 index 0000000..476ef0e --- /dev/null +++ b/Tests/UseSWIG/BasicPerl/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestBasicPerl CXX) + +include(CTest) + +set(language "perl") + +include (../BasicConfiguration.cmake) + +add_test (NAME BasicPerl + COMMAND "${PERL_EXECUTABLE}" "-I${CMAKE_CURRENT_BINARY_DIR}" + "-I$<TARGET_FILE_DIR:example>" + "${CMAKE_CURRENT_SOURCE_DIR}/../runme.pl") diff --git a/Tests/UseSWIG/BasicPython/CMakeLists.txt b/Tests/UseSWIG/BasicPython/CMakeLists.txt new file mode 100644 index 0000000..cf1d821 --- /dev/null +++ b/Tests/UseSWIG/BasicPython/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestBasicPython CXX) + +include(CTest) + +set(language "python") + +include (../BasicConfiguration.cmake) + +add_test (NAME BasicPython + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}${PS}$<TARGET_FILE_DIR:example>" + "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt new file mode 100644 index 0000000..0c4ec8a --- /dev/null +++ b/Tests/UseSWIG/CMakeLists.txt @@ -0,0 +1,76 @@ +add_test(NAME UseSWIG.LegacyPython COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/LegacyPython" + "${CMake_BINARY_DIR}/Tests/UseSWIG/LegacyPython" + ${build_generator_args} + --build-project TestLegacyPython + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +add_test(NAME UseSWIG.LegacyPerl COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/LegacyPerl" + "${CMake_BINARY_DIR}/Tests/UseSWIG/LegacyPerl" + ${build_generator_args} + --build-project TestLegacyPerl + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + +add_test(NAME UseSWIG.BasicPython COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/BasicPython" + "${CMake_BINARY_DIR}/Tests/UseSWIG/BasicPython" + ${build_generator_args} + --build-project TestBasicPython + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +add_test(NAME UseSWIG.BasicPerl COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/BasicPerl" + "${CMake_BINARY_DIR}/Tests/UseSWIG/BasicPerl" + ${build_generator_args} + --build-project TestBasicPerl + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + +add_test(NAME UseSWIG.MultipleModules COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultipleModules" + "${CMake_BINARY_DIR}/Tests/UseSWIG/MultipleModules" + ${build_generator_args} + --build-project TestMultipleModules + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +add_test(NAME UseSWIG.MultiplePython COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultiplePython" + "${CMake_BINARY_DIR}/Tests/UseSWIG/MultiplePython" + ${build_generator_args} + --build-project TestMultiplePython + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + +add_test(NAME UseSWIG.ModuleVersion2 COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/ModuleVersion2" + "${CMake_BINARY_DIR}/Tests/UseSWIG/ModuleVersion2" + ${build_generator_args} + --build-project TestModuleVersion2 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/SwigTest/CMakeLists.txt b/Tests/UseSWIG/LegacyConfiguration.cmake index 65f5c93..1acc05a 100644 --- a/Tests/SwigTest/CMakeLists.txt +++ b/Tests/UseSWIG/LegacyConfiguration.cmake @@ -1,59 +1,68 @@ -set(language "python") -cmake_minimum_required (VERSION 2.6) - -project(example_${language}_class) +# Prevent deprecated warnings from new UseSWIG module +set (CMAKE_WARN_DEPRECATED FALSE) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) +# Path separator +if (WIN32) + set (PS "$<SEMICOLON>") +else() + set (PS ":") +endif() + unset(SWIG_LANG_TYPE) if(${language} MATCHES python) - find_package(PythonLibs) + find_package(PythonInterp REQUIRED) + find_package(PythonLibs REQUIRED) include_directories(${PYTHON_INCLUDE_PATH}) set(SWIG_LANG_LIBRARIES ${PYTHON_LIBRARIES}) endif() if(${language} MATCHES perl) - find_package(PerlLibs) + find_package(Perl REQUIRED) + find_package(PerlLibs REQUIRED) include_directories(${PERL_INCLUDE_PATH}) - add_definitions(${PERL_EXTRA_C_FLAGS}) + separate_arguments(c_flags UNIX_COMMAND "${PERL_EXTRA_C_FLAGS}") + add_compile_options(${c_flags}) set(SWIG_LANG_LIBRARIES ${PERL_LIBRARY}) endif() if(${language} MATCHES tcl) - find_package(TCL) + find_package(TCL REQUIRED) include_directories(${TCL_INCLUDE_PATH}) set(SWIG_LANG_LIBRARIES ${TCL_LIBRARY}) endif() if(${language} MATCHES ruby) - find_package(Ruby) + find_package(Ruby REQUIRED) include_directories(${RUBY_INCLUDE_PATH}) set(SWIG_LANG_LIBRARIES ${RUBY_LIBRARY}) endif() if(${language} MATCHES php4) - find_package(PHP4) + find_package(PHP4 REQUIRED) include_directories(${PHP4_INCLUDE_PATH}) set(SWIG_LANG_LIBRARIES ${PHP4_LIBRARY}) endif() if(${language} MATCHES pike) - find_package(Pike) + find_package(Pike REQUIRED) include_directories(${PIKE_INCLUDE_PATH}) set(SWIG_LANG_LIBRARIES ${PIKE_LIBRARY}) endif() if(${language} MATCHES lua) - find_package(Lua) + find_package(Lua REQUIRED) include_directories(${LUA_INCLUDE_DIR}) set(SWIG_LANG_TYPE TYPE SHARED) set(SWIG_LANG_LIBRARIES ${LUA_LIBRARIES}) endif() -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +unset(CMAKE_SWIG_FLAGS) -set(CMAKE_SWIG_FLAGS "") +include_directories(${CMAKE_CURRENT_LIST_DIR}) -set_source_files_properties(example.i PROPERTIES CPLUSPLUS ON) -set_source_files_properties(example.i PROPERTIES SWIG_FLAGS "-includeall") +set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/example.i" PROPERTIES CPLUSPLUS ON) +set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/example.i" PROPERTIES SWIG_FLAGS "-includeall") SWIG_ADD_LIBRARY(example LANGUAGE "${language}" ${SWIG_LANG_TYPE} - SOURCES example.i example.cxx) + SOURCES "${CMAKE_CURRENT_LIST_DIR}/example.i" + "${CMAKE_CURRENT_LIST_DIR}/example.cxx") SWIG_LINK_LIBRARIES(example ${SWIG_LANG_LIBRARIES}) diff --git a/Tests/UseSWIG/LegacyPerl/CMakeLists.txt b/Tests/UseSWIG/LegacyPerl/CMakeLists.txt new file mode 100644 index 0000000..90d92f4 --- /dev/null +++ b/Tests/UseSWIG/LegacyPerl/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestLegacyPerl CXX) + +include(CTest) + +set(language "perl") + +include (../LegacyConfiguration.cmake) + +add_test (NAME LegacyPerl + COMMAND "${PERL_EXECUTABLE}" "-I${CMAKE_CURRENT_BINARY_DIR}" + "-I$<TARGET_FILE_DIR:${SWIG_MODULE_example_REAL_NAME}>" + "${CMAKE_CURRENT_SOURCE_DIR}/../runme.pl") diff --git a/Tests/UseSWIG/LegacyPython/CMakeLists.txt b/Tests/UseSWIG/LegacyPython/CMakeLists.txt new file mode 100644 index 0000000..03facb1 --- /dev/null +++ b/Tests/UseSWIG/LegacyPython/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestLegacyPython CXX) + +include(CTest) + +set(language "python") + +include (../LegacyConfiguration.cmake) + +add_test (NAME LegacyPython + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}${PS}$<TARGET_FILE_DIR:${SWIG_MODULE_example_REAL_NAME}>" + "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") diff --git a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt new file mode 100644 index 0000000..3f9d363 --- /dev/null +++ b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestModuleVersion2 CXX) + +include(CTest) + +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +find_package(Python2 REQUIRED COMPONENTS Interpreter Development) +find_package(Python3 REQUIRED COMPONENTS Interpreter Development) + +if (WIN32) + set (PS $<SEMICOLON>) +else() + set (PS ":") +endif() + +set (UseSWIG_MODULE_VERSION 2) +unset(CMAKE_SWIG_FLAGS) + +set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON) +set_property(SOURCE "../example.i" PROPERTY COMPILE_OPTIONS -includeall) + +set_property(SOURCE "../example.i" + PROPERTY GENERATED_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/..") + +swig_add_library(example1 + LANGUAGE python + SOURCES ../example.i ../example.cxx) +set_target_properties (example1 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2") +target_link_libraries(example1 PRIVATE Python2::Python) + +# re-use sample interface file for another plugin +swig_add_library(example2 + LANGUAGE python + SOURCES ../example.i ../example.cxx) +set_target_properties (example2 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3") +target_link_libraries(example2 PRIVATE Python3::Python) + + +add_test (NAME ModuleVersion2.example1 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example1,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example1>" + "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") + +add_test (NAME ModuleVersion2.example2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example2,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example2>" + "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") diff --git a/Tests/UseSWIG/MultipleModules/CMakeLists.txt b/Tests/UseSWIG/MultipleModules/CMakeLists.txt new file mode 100644 index 0000000..578825f --- /dev/null +++ b/Tests/UseSWIG/MultipleModules/CMakeLists.txt @@ -0,0 +1,68 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestMultipleModules CXX) + +include(CTest) + +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +find_package(Python REQUIRED COMPONENTS Interpreter Development) + +find_package(Perl REQUIRED) +find_package(PerlLibs REQUIRED) + +# Path separator +if (WIN32) + set (PS "$<SEMICOLON>") +else() + set (PS ":") +endif() + +unset(CMAKE_SWIG_FLAGS) + +set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON) +set_property(SOURCE "../example.i" PROPERTY COMPILE_OPTIONS -includeall) + +set_property(SOURCE "../example.i" + PROPERTY GENERATED_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/..") + +swig_add_library(example1 + LANGUAGE python + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Python" + SOURCES ../example.i ../example.cxx) +set_target_properties (example1 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python") +target_link_libraries(example1 PRIVATE Python::Python) + +# re-use sample interface file for another plugin +set_property(SOURCE "../example.i" APPEND PROPERTY + GENERATED_INCLUDE_DIRECTORIES ${PERL_INCLUDE_PATH}) +separate_arguments(c_flags UNIX_COMMAND "${PERL_EXTRA_C_FLAGS}") +set_property(SOURCE "../example.i" PROPERTY GENERATED_COMPILE_OPTIONS ${c_flags}) + +swig_add_library(example2 + LANGUAGE perl + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Perl" + SOURCES ../example.i ../example.cxx) +set_target_properties (example2 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Perl" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Perl" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Perl") +target_link_libraries(example2 PRIVATE ${PERL_LIBRARY}) + + + +add_test (NAME MultipleModules.Python + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Python${PS}$<TARGET_FILE_DIR:example1>" + "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") + + +add_test (NAME MultipleModules.Perl + COMMAND "${PERL_EXECUTABLE}" "-I${CMAKE_CURRENT_BINARY_DIR}/Perl" + "-I$<TARGET_FILE_DIR:example2>" + "${CMAKE_CURRENT_SOURCE_DIR}/../runme.pl") diff --git a/Tests/UseSWIG/MultiplePython/CMakeLists.txt b/Tests/UseSWIG/MultiplePython/CMakeLists.txt new file mode 100644 index 0000000..a5e3eed --- /dev/null +++ b/Tests/UseSWIG/MultiplePython/CMakeLists.txt @@ -0,0 +1,59 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestMultiplePython CXX) + +include(CTest) + +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +find_package(Python2 REQUIRED COMPONENTS Interpreter Development) +find_package(Python3 REQUIRED COMPONENTS Interpreter Development) + +# Path separator +if (WIN32) + set (PS "$<SEMICOLON>") +else() + set (PS ":") +endif() + +unset(CMAKE_SWIG_FLAGS) + +set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON) +set_property(SOURCE "../example.i" PROPERTY COMPILE_OPTIONS -includeall) + +set_property(SOURCE "../example.i" + PROPERTY GENERATED_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/..") + +swig_add_library(example1 + LANGUAGE python + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Python2" + SOURCES ../example.i ../example.cxx) +set_target_properties (example1 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2") +target_link_libraries(example1 PRIVATE Python2::Python) + +# re-use sample interface file for another plugin +swig_add_library(example2 + LANGUAGE python + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Python3" + SOURCES ../example.i ../example.cxx) +set_target_properties (example2 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3") +target_link_libraries(example2 PRIVATE Python3::Python) + + + +add_test (NAME MultiplePython.example1 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Python2${PS}$<TARGET_FILE_DIR:example1>" + "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") + +add_test (NAME MultiplePython.example2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Python3${PS}$<TARGET_FILE_DIR:example2>" + "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") diff --git a/Tests/SwigTest/example.cxx b/Tests/UseSWIG/example.cxx index 961d6dd..961d6dd 100644 --- a/Tests/SwigTest/example.cxx +++ b/Tests/UseSWIG/example.cxx diff --git a/Tests/SwigTest/example.h b/Tests/UseSWIG/example.h index 366deb0..366deb0 100644 --- a/Tests/SwigTest/example.h +++ b/Tests/UseSWIG/example.h diff --git a/Tests/SwigTest/example.i b/Tests/UseSWIG/example.i index 75700b3..fbdf724 100644 --- a/Tests/SwigTest/example.i +++ b/Tests/UseSWIG/example.i @@ -7,4 +7,3 @@ /* Let's just grab the original header file here */ %include "example.h" - diff --git a/Tests/SwigTest/runme.php4 b/Tests/UseSWIG/runme.php4 index 653ced2..653ced2 100644 --- a/Tests/SwigTest/runme.php4 +++ b/Tests/UseSWIG/runme.php4 diff --git a/Tests/SwigTest/runme.pike b/Tests/UseSWIG/runme.pike index ec28dd7..ec28dd7 100755..100644 --- a/Tests/SwigTest/runme.pike +++ b/Tests/UseSWIG/runme.pike diff --git a/Tests/SwigTest/runme.pl b/Tests/UseSWIG/runme.pl index 5bfb3d8..965e063 100644 --- a/Tests/SwigTest/runme.pl +++ b/Tests/UseSWIG/runme.pl @@ -54,4 +54,3 @@ examplec::delete_Shape($s); print $examplec::Shape_nshapes," shapes remain\n"; print "Goodbye\n"; - diff --git a/Tests/UseSWIG/runme.py b/Tests/UseSWIG/runme.py new file mode 100644 index 0000000..af5e07d --- /dev/null +++ b/Tests/UseSWIG/runme.py @@ -0,0 +1,52 @@ +# file: runme.py + +# This file illustrates the shadow-class C++ interface generated +# by SWIG. + +from __future__ import print_function + +import example + +# ----- Object creation ----- + +print ("Creating some objects:") +c = example.Circle(10) +print (" Created circle", c) +s = example.Square(10) +print (" Created square", s) + +# ----- Access a static member ----- + +print ("\nA total of", example.cvar.Shape_nshapes,"shapes were created") + +# ----- Member data access ----- + +# Set the location of the object + +c.x = 20 +c.y = 30 + +s.x = -10 +s.y = 5 + +print ("\nHere is their current position:") +print (" Circle = (%f, %f)" % (c.x,c.y)) +print (" Square = (%f, %f)" % (s.x,s.y)) + +# ----- Call some methods ----- + +print ("\nHere are some properties of the shapes:") +for o in [c,s]: + print (" ", o) + print (" area = ", o.area()) + print (" perimeter = ", o.perimeter()) + +print ("\nGuess I'll clean up now") + +# Note: this invokes the virtual destructor +del c +del s + +s = 3 +print (example.cvar.Shape_nshapes,"shapes remain") +print ("Goodbye") diff --git a/Tests/SwigTest/runme.rb b/Tests/UseSWIG/runme.rb index de73bcd..de73bcd 100644 --- a/Tests/SwigTest/runme.rb +++ b/Tests/UseSWIG/runme.rb diff --git a/Tests/SwigTest/runme.tcl b/Tests/UseSWIG/runme.tcl index c7f4725..6055cf6 100644 --- a/Tests/SwigTest/runme.tcl +++ b/Tests/UseSWIG/runme.tcl @@ -47,4 +47,3 @@ rename s "" puts "$Shape_nshapes shapes remain" puts "Goodbye" - diff --git a/Tests/SwigTest/runme2.tcl b/Tests/UseSWIG/runme2.tcl index 88ec2f6..d0b5c21 100644 --- a/Tests/SwigTest/runme2.tcl +++ b/Tests/UseSWIG/runme2.tcl @@ -67,4 +67,3 @@ delete_Shape $s puts "$Shape_nshapes shapes remain" puts "Goodbye" - |