diff options
Diffstat (limited to 'Tests')
224 files changed, 1745 insertions, 173 deletions
diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index 71a1764..61a77cf 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -8,7 +8,7 @@ #include <cm/memory> -#include "cm_uv.h" +#include <cm3p/uv.h> #include "cmGetPipes.h" #include "cmUVHandlePtr.h" diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx index cb05ace..0607f44 100644 --- a/Tests/CMakeLib/testUVRAII.cxx +++ b/Tests/CMakeLib/testUVRAII.cxx @@ -3,7 +3,7 @@ #include <thread> #include <utility> -#include "cm_uv.h" +#include <cm3p/uv.h> #include "cmUVHandlePtr.h" diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx index cd9c9d4..b86ed76 100644 --- a/Tests/CMakeLib/testUVStreambuf.cxx +++ b/Tests/CMakeLib/testUVStreambuf.cxx @@ -3,10 +3,9 @@ #include <string> #include <vector> +#include <cm3p/uv.h> #include <stdint.h> -#include "cm_uv.h" - #include "cmGetPipes.h" #include "cmUVHandlePtr.h" #include "cmUVStreambuf.h" diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 32e6582..0c8a639 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -790,13 +790,8 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH endif() endmacro() if(CMake_BUILD_NIGHTLY_RELEASES) - ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWin32 - win32_release.cmake) - ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWin64 - win64_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyOSX osx_release.cmake) - set_property(TEST CMakeNightlyWin64 PROPERTY DEPENDS CMakeNightlyWin32) endif() # add tests with more complex invocations diff --git a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt index 90aa921..1570c37 100644 --- a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt @@ -18,16 +18,16 @@ if(APPLE) list(APPEND LANGUAGES OBJC OBJCXX) endif() -foreach(lang ${LANGUAGES}) - check_language(${lang}) - if(NOT DEFINED CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) did not set result") +foreach(test_lang ${LANGUAGES}) + check_language(${test_lang}) + if(NOT DEFINED CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) did not set result") endif() - if(DEFINED expect_${lang}) - if(expect_${lang} AND NOT CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) should not fail!") - elseif(NOT expect_${lang} AND CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) should not succeed!") + if(DEFINED expect_${test_lang}) + if(expect_${test_lang} AND NOT CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) should not fail!") + elseif(NOT expect_${test_lang} AND CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) should not succeed!") endif() endif() endforeach() diff --git a/Tests/CPackWiXGenerator/myotherapp.cpp b/Tests/CPackWiXGenerator/myotherapp.cpp index 0eefc1c..5047a34 100644 --- a/Tests/CPackWiXGenerator/myotherapp.cpp +++ b/Tests/CPackWiXGenerator/myotherapp.cpp @@ -1,3 +1,3 @@ int main() { -}
\ No newline at end of file +} diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt index f5dd276..6e69e8b 100644 --- a/Tests/ConfigSources/CMakeLists.txt +++ b/Tests/ConfigSources/CMakeLists.txt @@ -1,6 +1,17 @@ cmake_minimum_required(VERSION 3.0) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build") +endif() project(ConfigSources CXX) +# Source file(s) named with the configuration(s). +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config_$<CONFIG>.cpp" + CONTENT "void config_$<CONFIG>() {}\n" + ) + +# Per-config sources via INTERFACE_SOURCES. add_library(iface INTERFACE) target_sources(iface INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp" @@ -12,10 +23,56 @@ target_compile_definitions(iface INTERFACE "$<$<CONFIG:Debug>:CFG_DEBUG>" "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>" ) - add_executable(ConfigSources $<$<CONFIG:Debug>:main_debug.cpp> $<$<NOT:$<CONFIG:Debug>>:main_other.cpp> $<$<CONFIG:NotAConfig>:does_not_exist.cpp> + ${CMAKE_CURRENT_BINARY_DIR}/config_$<CONFIG>.cpp ) target_link_libraries(ConfigSources iface) + +# Per-config sources via LINK_LIBRARIES. +add_library(iface_debug INTERFACE) +target_sources(iface_debug INTERFACE + "${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/iface_debug_src.cpp" + ) +add_library(iface_other INTERFACE) +target_sources(iface_other INTERFACE + "${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/iface_other_src.cpp" + ) +add_executable(ConfigSourcesLink main.cpp) +target_compile_definitions(ConfigSourcesLink PRIVATE + "$<$<CONFIG:Debug>:CFG_DEBUG>" + "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>" + ) +target_link_libraries(ConfigSourcesLink PRIVATE + "$<$<CONFIG:Debug>:iface_debug>" + "$<$<NOT:$<CONFIG:Debug>>:iface_other>" + "$<$<CONFIG:NotAConfig>:iface_does_not_exist>" + ) + +# Per-config sources via INTERFACE_LINK_LIBRARIES. +add_library(ConfigSourcesIface INTERFACE) +target_link_libraries(ConfigSourcesIface INTERFACE + "$<$<CONFIG:Debug>:iface_debug>" + "$<$<NOT:$<CONFIG:Debug>>:iface_other>" + "$<$<CONFIG:NotAConfig>:iface_does_not_exist>" + ) +add_executable(ConfigSourcesLinkIface main.cpp) +target_compile_definitions(ConfigSourcesLinkIface PRIVATE + "$<$<CONFIG:Debug>:CFG_DEBUG>" + "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>" + ) +target_link_libraries(ConfigSourcesLinkIface ConfigSourcesIface) + +# A target with sources in only one configuration that is not the +# first in CMAKE_CONFIGURATION_TYPES. +if(CMAKE_CONFIGURATION_TYPES MATCHES ";([^;]+)") + set(one_config "${CMAKE_MATCH_1}") +else() + set(one_config "${CMAKE_BUILD_TYPE}") +endif() +add_library(OneConfigOnly OBJECT "$<$<CONFIG:${one_config}>:${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp>") +set_property(TARGET OneConfigOnly PROPERTY LINKER_LANGUAGE CXX) diff --git a/Tests/ConfigSources/main.cpp b/Tests/ConfigSources/main.cpp new file mode 100644 index 0000000..c1cd3b2 --- /dev/null +++ b/Tests/ConfigSources/main.cpp @@ -0,0 +1,9 @@ +#if !defined(CFG_DEBUG) && !defined(CFG_OTHER) +# error "Neither CFG_DEBUG or CFG_OTHER is defined." +#endif +#ifdef CFG_DEBUG +# include "main_debug.cpp" +#endif +#ifdef CFG_OTHER +# include "main_other.cpp" +#endif diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt index 58b9b03..630cea2 100644 --- a/Tests/Cuda/CMakeLists.txt +++ b/Tests/Cuda/CMakeLists.txt @@ -1,5 +1,4 @@ -ADD_TEST_MACRO(Cuda.Complex CudaComplex) ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures) ADD_TEST_MACRO(Cuda.CXXStandardSetTwice CXXStandardSetTwice) ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary) @@ -12,10 +11,16 @@ ADD_TEST_MACRO(Cuda.NotEnabled CudaNotEnabled) ADD_TEST_MACRO(Cuda.SeparableCompCXXOnly SeparableCompCXXOnly) ADD_TEST_MACRO(Cuda.Toolkit Toolkit) ADD_TEST_MACRO(Cuda.IncludePathNoToolkit IncludePathNoToolkit) -ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries) -ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags) ADD_TEST_MACRO(Cuda.SharedRuntimePlusToolkit SharedRuntimePlusToolkit) +# Separable compilation is currently only supported on NVCC. Disable tests +# using it for other compilers. +if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") + ADD_TEST_MACRO(Cuda.Complex CudaComplex) + ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries) + ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags) +endif() + # The CUDA only ships the shared version of the toolkit libraries # on windows if(NOT WIN32) diff --git a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt index b6e0e39..d38da6d 100644 --- a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt +++ b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt @@ -9,11 +9,17 @@ project (ProperLinkFlags CUDA CXX) #Specify a set of valid CUDA flags and an invalid set of CXX flags ( for CUDA ) #to make sure we don't use the CXX flags when linking CUDA executables -string(APPEND CMAKE_CUDA_FLAGS " -arch=sm_35 --use_fast_math") +if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") + string(APPEND CMAKE_CUDA_FLAGS "--use_fast_math") +elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") + string(APPEND CMAKE_CUDA_FLAGS "-ffast-math") +endif() + set(CMAKE_CXX_FLAGS "-Wall") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 35) add_executable(ProperLinkFlags file1.cu main.cxx) set_target_properties( ProperLinkFlags diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index d74e810..8244b91 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -1,17 +1,37 @@ ADD_TEST_MACRO(CudaOnly.Architecture Architecture) -ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine) ADD_TEST_MACRO(CudaOnly.CompileFlags CudaOnlyCompileFlags) ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard) ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX) -ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) -ADD_TEST_MACRO(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols) -ADD_TEST_MACRO(CudaOnly.SeparateCompilation CudaOnlySeparateCompilation) ADD_TEST_MACRO(CudaOnly.SharedRuntimePlusToolkit CudaOnlySharedRuntimePlusToolkit) ADD_TEST_MACRO(CudaOnly.Standard98 CudaOnlyStandard98) ADD_TEST_MACRO(CudaOnly.Toolkit CudaOnlyToolkit) ADD_TEST_MACRO(CudaOnly.WithDefs CudaOnlyWithDefs) +if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") + ADD_TEST_MACRO(CudaOnly.SharedRuntimeViaCUDAFlags CudaOnlySharedRuntimeViaCUDAFlags) + + # Separable compilation is currently only supported on NVCC. Disable tests + # using it for other compilers. + ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine) + ADD_TEST_MACRO(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols) + ADD_TEST_MACRO(CudaOnly.SeparateCompilation CudaOnlySeparateCompilation) + + add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMAKE_CURRENT_SOURCE_DIR}/DontResolveDeviceSymbols/" + "${CMAKE_CURRENT_BINARY_DIR}/DontResolveDeviceSymbols/" + ${build_generator_args} + --build-project DontResolveDeviceSymbols + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + # Only NVCC defines __CUDACC_DEBUG__ when compiling in debug mode. + ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) +endif() + # The CUDA only ships the shared version of the toolkit libraries # on windows if(NOT WIN32) @@ -22,17 +42,6 @@ if(MSVC) ADD_TEST_MACRO(CudaOnly.PDB CudaOnlyPDB) endif() -add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMAKE_CURRENT_SOURCE_DIR}/DontResolveDeviceSymbols/" - "${CMAKE_CURRENT_BINARY_DIR}/DontResolveDeviceSymbols/" - ${build_generator_args} - --build-project DontResolveDeviceSymbols - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) - add_test(NAME CudaOnly.RuntimeControls COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test diff --git a/Tests/CudaOnly/CompileFlags/CMakeLists.txt b/Tests/CudaOnly/CompileFlags/CMakeLists.txt index cbce7d6..5e8a8e4 100644 --- a/Tests/CudaOnly/CompileFlags/CMakeLists.txt +++ b/Tests/CudaOnly/CompileFlags/CMakeLists.txt @@ -1,16 +1,15 @@ cmake_minimum_required(VERSION 3.17) -cmake_policy(SET CMP0104 OLD) project(CompileFlags CUDA) -# Clear defaults. -set(CMAKE_CUDA_ARCHITECTURES) - add_executable(CudaOnlyCompileFlags main.cu) # Try passing CUDA architecture flags explicitly. if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") target_compile_options(CudaOnlyCompileFlags PRIVATE -gencode arch=compute_50,code=compute_50 - --compiler-options=-DHOST_DEFINE ) +else() + set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES 50-real) endif() + +target_compile_options(CudaOnlyCompileFlags PRIVATE -DALWAYS_DEFINE) diff --git a/Tests/CudaOnly/CompileFlags/main.cu b/Tests/CudaOnly/CompileFlags/main.cu index 573d230..999c056 100644 --- a/Tests/CudaOnly/CompileFlags/main.cu +++ b/Tests/CudaOnly/CompileFlags/main.cu @@ -4,11 +4,8 @@ # endif #endif -// Check HOST_DEFINE only for nvcc -#ifndef __CUDA__ -# ifndef HOST_DEFINE -# error "HOST_DEFINE not defined!" -# endif +#ifndef ALWAYS_DEFINE +# error "ALWAYS_DEFINE not defined!" #endif int main() diff --git a/Tests/CudaOnly/ExportPTX/CMakeLists.txt b/Tests/CudaOnly/ExportPTX/CMakeLists.txt index ff6e77c..ee5f54d 100644 --- a/Tests/CudaOnly/ExportPTX/CMakeLists.txt +++ b/Tests/CudaOnly/ExportPTX/CMakeLists.txt @@ -34,16 +34,15 @@ static std::string ptx_paths = "$<TARGET_OBJECTS:CudaPTX>"; # need to also pass the --name option set(output_file ${CMAKE_CURRENT_BINARY_DIR}/embedded_objs.h) -get_filename_component(cuda_compiler_bin "${CMAKE_CUDA_COMPILER}" DIRECTORY) +find_package(CUDAToolkit REQUIRED) find_program(bin_to_c NAMES bin2c - PATHS ${cuda_compiler_bin} + PATHS ${CUDAToolkit_BIN_DIR} ) if(NOT bin_to_c) message(FATAL_ERROR "bin2c not found:\n" - " CMAKE_CUDA_COMPILER='${CMAKE_CUDA_COMPILER}'\n" - " cuda_compiler_bin='${cuda_compiler_bin}'\n" + " CUDAToolkit_BIN_DIR='${CUDAToolkit_BIN_DIR}'\n" ) endif() diff --git a/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt b/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt index fbef15f..6675655 100644 --- a/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt +++ b/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt @@ -2,18 +2,19 @@ cmake_minimum_required(VERSION 3.7) project (GPUDebugFlag CUDA) -#Goal for this example: -#verify that -G enables gpu debug flags -string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_30,code=compute_30") -string(APPEND CMAKE_CUDA_FLAGS " -G") set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30) + +# Goal for this example: +# Verify that enabling device debug works. +string(APPEND CMAKE_CUDA_FLAGS " -G") add_executable(CudaOnlyGPUDebugFlag main.cu) +#CUDA's __CUDACC_DEBUG__ define was added in NVCC 9.0 +#so if we are below 9.0.0 we will manually add the define so that the test +#passes if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0.0) - #CUDA's __CUDACC_DEBUG__ define was added in 9.0 - #so if we are below 9.0.0 we will manually add the define so that the test - #passes target_compile_definitions(CudaOnlyGPUDebugFlag PRIVATE "__CUDACC_DEBUG__") endif() diff --git a/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt b/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt new file mode 100644 index 0000000..24ff478 --- /dev/null +++ b/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.17) +project(SharedRuntimeViaCUDAFlags NONE) + +set(CMAKE_CUDA_FLAGS "") +string(APPEND CMAKE_CUDA_FLAGS "-cudart shared") + +enable_language(CUDA) + +add_executable(CudaOnlySharedRuntimeViaCUDAFlags main.cu) + +if(UNIX) + # Help the shared cuda runtime find libcudart as it is not located + # in a default system searched location + set_property(TARGET CudaOnlySharedRuntimeViaCUDAFlags PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) +endif() diff --git a/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/main.cu b/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/main.cu new file mode 100644 index 0000000..766b775 --- /dev/null +++ b/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/main.cu @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index add8131..0ed81d8 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -18,7 +18,7 @@ target_compile_options(CudaOnlyWithDefs PRIVATE -DFLAG_COMPILE_LANG_$<COMPILE_LANGUAGE> -DFLAG_LANG_IS_CUDA=$<COMPILE_LANGUAGE:CUDA> - --compiler-options=-DHOST_DEFINE + $<$<CUDA_COMPILER_ID:NVIDIA>:--compiler-options=-DHOST_DEFINE> # Host-only defines are possible only on NVCC. ) target_compile_definitions(CudaOnlyWithDefs diff --git a/Tests/CudaOnly/WithDefs/main.notcu b/Tests/CudaOnly/WithDefs/main.notcu index a5f4ed6..9119eba 100644 --- a/Tests/CudaOnly/WithDefs/main.notcu +++ b/Tests/CudaOnly/WithDefs/main.notcu @@ -7,8 +7,10 @@ # error "INC_CUDA not defined!" #endif -#ifndef HOST_DEFINE -# error "HOST_DEFINE not defined!" +#ifdef __NVCC__ +# ifndef HOST_DEFINE +# error "HOST_DEFINE not defined!" +# endif #endif #ifndef PACKED_DEFINE diff --git a/Tests/FindDoxygen/SimpleTest/CMakeLists.txt b/Tests/FindDoxygen/SimpleTest/CMakeLists.txt index 332cecc..deec4fd 100644 --- a/Tests/FindDoxygen/SimpleTest/CMakeLists.txt +++ b/Tests/FindDoxygen/SimpleTest/CMakeLists.txt @@ -22,6 +22,7 @@ else() message(FATAL_ERROR "Import target Doxygen::doxygen not defined") endif() +set(DOXYGEN_OUTPUT_DIRECTORY noArgs) doxygen_add_docs(docsNoArgs) if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsNoArgs") message(FATAL_ERROR "Missing generated file: Doxyfile.docsNoArgs") @@ -30,6 +31,7 @@ if(NOT TARGET docsNoArgs) message(FATAL_ERROR "Target docsNoArgs not created") endif() +set(DOXYGEN_OUTPUT_DIRECTORY withArgs) configure_file(spaces_in_name.cpp.in "spaces in name.cpp" COPYONLY) doxygen_add_docs(docsWithArgs "${CMAKE_CURRENT_BINARY_DIR}/spaces in name.cpp" diff --git a/Tests/FindDoxygen/StampFile/CMakeLists.txt b/Tests/FindDoxygen/StampFile/CMakeLists.txt index 2d06540..ed2bfbb 100644 --- a/Tests/FindDoxygen/StampFile/CMakeLists.txt +++ b/Tests/FindDoxygen/StampFile/CMakeLists.txt @@ -3,22 +3,41 @@ project(TestFindDoxygen VERSION 1.0 LANGUAGES NONE) find_package(Doxygen REQUIRED) +set(DOXYGEN_OUTPUT_DIRECTORY noFiles) doxygen_add_docs(docsWithoutFilesWithStamp USE_STAMP_FILE) if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsWithoutFilesWithStamp") - message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithoutFilesWithStamp") + message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithoutFilesWithStamp") endif() if(NOT TARGET docsWithoutFilesWithStamp) - message(FATAL_ERROR "Target docsWithoutFilesWithStamp not created") + message(FATAL_ERROR "Target docsWithoutFilesWithStamp not created") endif() +set(DOXYGEN_OUTPUT_DIRECTORY withFiles) doxygen_add_docs(docsWithFilesWithStamp main.cpp main2.cpp USE_STAMP_FILE) if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsWithFilesWithStamp") - message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithFilesWithStamp") + message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithFilesWithStamp") endif() if(NOT TARGET docsWithFilesWithStamp) - message(FATAL_ERROR "Target docsWithFilesWithStamp not created") + message(FATAL_ERROR "Target docsWithFilesWithStamp not created") endif() +# Confirm that doxygen_add_docs() doesn't cause a fatal error if given a +# source file that is generated at build time +file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/genDox.cpp) +add_custom_command(OUTPUT genDox.cpp + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main2.cpp genDox.cpp + DEPENDS main2.cpp +) +set(DOXYGEN_OUTPUT_DIRECTORY withGenFiles) +doxygen_add_docs(docsWithGenFilesWithStamp + main.cpp + ${CMAKE_CURRENT_BINARY_DIR}/genDox.cpp + USE_STAMP_FILE +) add_custom_target(allDocTargets) -add_dependencies(allDocTargets docsWithoutFilesWithStamp docsWithFilesWithStamp) +add_dependencies(allDocTargets + docsWithoutFilesWithStamp + docsWithFilesWithStamp + docsWithGenFilesWithStamp +) diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index 2cec030..fdfa36e 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -150,6 +150,99 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + add_test(NAME FindPython.Python2.ExactVersion.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.LOCATION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_MAJOR_VERSION=2 + -DPython_REQUESTED_VERSION=2.1.2 + -DPython2_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python2.ExactVersion.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.VERSION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_MAJOR_VERSION=2 + -DPython_REQUESTED_VERSION=2.1.2 + -DPython2_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python3.ExactVersion.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3.ExactVersion.LOCATION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_MAJOR_VERSION=3 + -DPython_REQUESTED_VERSION=3.1.2 + -DPython3_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python3.ExactVersion.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3.ExactVersion.VERSION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_MAJOR_VERSION=3 + -DPython_REQUESTED_VERSION=3.1.2 + -DPython3_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python.V2.ExactVersion.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.LOCATION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2 + -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python.V2.ExactVersion.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.VERSION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2 + -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python.V3.ExactVersion.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V3.ExactVersion.LOCATION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_REQUESTED_VERSION=3.1.2 + -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python.V3.ExactVersion.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V3.ExactVersion.VERSION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_REQUESTED_VERSION=3.1.2 + -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.MultiplePackages COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test diff --git a/Tests/FindPython/ExactVersion/CMakeLists.txt b/Tests/FindPython/ExactVersion/CMakeLists.txt new file mode 100644 index 0000000..e09f73a --- /dev/null +++ b/Tests/FindPython/ExactVersion/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestExactVersion C) + +find_package(Python${Python_MAJOR_VERSION} ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development) +if (NOT Python${Python_MAJOR_VERSION}_FOUND) + message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") +endif() +if (NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Interpreter") +endif() +if (NOT Python${Python_MAJOR_VERSION}_Development_FOUND) + message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Development") +endif() + +if(NOT TARGET Python${Python_MAJOR_VERSION}::Interpreter) + message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Interpreter not found") +endif() + +if(NOT TARGET Python${Python_MAJOR_VERSION}::Python) + message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Python not found") +endif() +if(NOT TARGET Python${Python_MAJOR_VERSION}::Module) + message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Module not found") +endif() + + +# reset artifacts and second search with exact version already founded +unset (Python${Python_MAJOR_VERSION}_EXECUTABLE) +unset (_Python${Python_MAJOR_VERSION}_EXECUTABLE CACHE) + +unset (_Python${Python_MAJOR_VERSION}_LIBRARY_RELEASE CACHE) +unset (_Python${Python_MAJOR_VERSION}_INCLUDE_DIR CACHE) + +set (Python_REQUESTED_VERSION ${Python${Python_MAJOR_VERSION}_VERSION}) +find_package(Python${Python_MAJOR_VERSION} ${Python_REQUESTED_VERSION} EXACT COMPONENTS Interpreter Development) +if (NOT Python${Python_MAJOR_VERSION}_FOUND) + message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") +endif() +if (NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Interpreter") +endif() +if (NOT Python${Python_MAJOR_VERSION}_Development_FOUND) + message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Development") +endif() + +if(NOT TARGET Python${Python_MAJOR_VERSION}::Interpreter) + message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Interpreter not found") +endif() + +if(NOT TARGET Python${Python_MAJOR_VERSION}::Python) + message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Python not found") +endif() +if(NOT TARGET Python${Python_MAJOR_VERSION}::Module) + message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Module not found") +endif() diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt index a263061..f93f553 100644 --- a/Tests/Properties/CMakeLists.txt +++ b/Tests/Properties/CMakeLists.txt @@ -144,4 +144,143 @@ set_property(CACHE SOME_ENTRY PROPERTY ADVANCED "${expect_ADVANCED}") set_property(CACHE SOME_ENTRY PROPERTY STRINGS "${expect_STRINGS}") check_cache_props() +function(generate_file_for_set_property_test i target_name) + set(src_path "${CMAKE_CURRENT_BINARY_DIR}/src${i}.cpp") + file(GENERATE OUTPUT "${src_path}" CONTENT + "#ifndef def${i}\n\ + #error Expected def${i}\n\ + #endif\n\ + #ifdef _WIN32\n\ + __declspec(dllexport)\n\ + #endif\n\ + void dummy_symbol${i}() {}\n") + target_sources(${target_name} PRIVATE "${src_path}") +endfunction() + +add_library(maindirtest SHARED) add_subdirectory(SubDir2) + +set(src_prefix "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/") + +# Set property + target directory +set_property(SOURCE "${src_prefix}/src1.cpp" + TARGET_DIRECTORY set_prop_lib_1 + PROPERTY COMPILE_DEFINITIONS def1) + +# Append property + target directory +set_property(SOURCE "${src_prefix}/src2.cpp" + TARGET_DIRECTORY set_prop_lib_1 + APPEND PROPERTY COMPILE_DEFINITIONS def2) + +# Set property + relative directory path +set_property(SOURCE "${src_prefix}/src3.cpp" + DIRECTORY SubDir2 + PROPERTY COMPILE_DEFINITIONS def3) + +# Set property + absolute directory path +set_property(SOURCE "${src_prefix}/src4.cpp" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2" + PROPERTY COMPILE_DEFINITIONS def4) + +# Append property + relative directory path +set_property(SOURCE "${src_prefix}/src5.cpp" + DIRECTORY SubDir2 + APPEND PROPERTY COMPILE_DEFINITIONS def5) + +# Append property + absolute directory path +set_property(SOURCE "${src_prefix}/src6.cpp" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2" + APPEND PROPERTY COMPILE_DEFINITIONS def6) + + +# Target directory +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src10.cpp" + TARGET_DIRECTORY set_prop_lib_1 + PROPERTIES COMPILE_DEFINITIONS def10) + +# Relative directory path +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src11.cpp" + DIRECTORY SubDir2 + PROPERTIES COMPILE_DEFINITIONS def11) + +# Absolute directory path +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src12.cpp" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2" + PROPERTIES COMPILE_DEFINITIONS def12) + + +# Multiple files + absolute directory path +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src20.cpp" + "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src21.cpp" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2" + PROPERTIES COMPILE_DEFINITIONS "def20;def21") + +# Multiple files + multiple target directories +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src22.cpp" + "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src23.cpp" + TARGET_DIRECTORY set_prop_lib_2 set_prop_lib_3 + PROPERTIES COMPILE_DEFINITIONS "def22;def23") + + +# Multiple files in multiple relative directories +generate_file_for_set_property_test(30 maindirtest) +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src30.cpp" + "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src31.cpp" + DIRECTORY . SubDir2 + PROPERTIES COMPILE_DEFINITIONS "def30;def31") + +# Check that specifying files without any properties doesn't crash. +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src30.cpp" + "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src31.cpp") + +function(check_get_property_value expected) + if(NOT actual STREQUAL expected) + message(SEND_ERROR "Error: get_property returned unexpected value\n" + "actual: ${actual}\n" + "expected: ${expected}") + endif() +endfunction() + +# Get property + target directory +get_property(actual + SOURCE "${src_prefix}/src1.cpp" + TARGET_DIRECTORY set_prop_lib_1 + PROPERTY COMPILE_DEFINITIONS) +check_get_property_value("def1") + +# Get property + relative directory path +get_property(actual + SOURCE "${src_prefix}/src3.cpp" + DIRECTORY SubDir2 + PROPERTY COMPILE_DEFINITIONS) +check_get_property_value("def3") + +# Get property + absolute directory path +get_property(actual + SOURCE "${src_prefix}/src4.cpp" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2" + PROPERTY COMPILE_DEFINITIONS) +check_get_property_value("def4") + + +# Get property + target directory +unset(actual) +get_source_file_property(actual + "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src10.cpp" + TARGET_DIRECTORY set_prop_lib_1 + COMPILE_DEFINITIONS) +check_get_property_value("def10") + +# Get property + relative directory path +get_source_file_property(actual + "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src11.cpp" + DIRECTORY SubDir2 + COMPILE_DEFINITIONS) +check_get_property_value("def11") + +# Get property + absolute directory path +get_source_file_property(actual + "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src12.cpp" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2" + COMPILE_DEFINITIONS) +check_get_property_value("def12") diff --git a/Tests/Properties/SubDir2/CMakeLists.txt b/Tests/Properties/SubDir2/CMakeLists.txt index 377dc83..9b2c79e 100644 --- a/Tests/Properties/SubDir2/CMakeLists.txt +++ b/Tests/Properties/SubDir2/CMakeLists.txt @@ -3,3 +3,28 @@ set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/../subdirtest.cxx" PROPERTIES COMPILE_DEFINITIONS SUBDIR_TEST) add_executable(subdirtest "${CMAKE_CURRENT_SOURCE_DIR}/../subdirtest.cxx") + +# For set_property +add_library(set_prop_lib_1 SHARED) +foreach(i RANGE 1 6) + generate_file_for_set_property_test(${i} set_prop_lib_1) +endforeach() + +# For set_source_files_properties +foreach(i RANGE 10 12) + generate_file_for_set_property_test(${i} set_prop_lib_1) +endforeach() + +# For set_source_files_properties + multiple files + absolute directory path +add_library(set_prop_lib_2 SHARED) +foreach(i RANGE 20 21) + generate_file_for_set_property_test(${i} set_prop_lib_1) +endforeach() + +# For set_source_files_properties + multiple files + multiple target directories +add_library(set_prop_lib_3 SHARED) +generate_file_for_set_property_test(22 set_prop_lib_2) +generate_file_for_set_property_test(23 set_prop_lib_3) + +# For set_source_files_properties + multiple files in multiple directories +generate_file_for_set_property_test(31 set_prop_lib_3) diff --git a/Tests/QtAutogen/Complex/codeeditor.cpp b/Tests/QtAutogen/Complex/codeeditor.cpp index bb6f405..80d6a55 100644 --- a/Tests/QtAutogen/Complex/codeeditor.cpp +++ b/Tests/QtAutogen/Complex/codeeditor.cpp @@ -40,7 +40,10 @@ #include "codeeditor.h" -#include <QtGui> +#include <QPainter> +#include <QSize> +#include <QTextBlock> +#include <QWidget> CodeEditor::CodeEditor(QWidget* parent) : QPlainTextEdit(parent) diff --git a/Tests/RunCMake/AndroidTestUtilities/check.cmake b/Tests/RunCMake/AndroidTestUtilities/check.cmake index ccd4d74..c24a3cd 100644 --- a/Tests/RunCMake/AndroidTestUtilities/check.cmake +++ b/Tests/RunCMake/AndroidTestUtilities/check.cmake @@ -13,7 +13,7 @@ function(compare_build_to_expected) endfunction() function(check_for_setup_test) - file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" output_var REGEX "add_test\\(setup_test.*") + file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" output_var REGEX "add_test\\(\"setup_test\".*") if(NOT output_var) set(RunCMake_TEST_FAILED "Could not find the test: setup_test" PARENT_SCOPE) endif() diff --git a/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt b/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt new file mode 100644 index 0000000..57a0f6e --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.12) +project(External NONE) + +if (DEFINED cache_arg) + message("configured with: ${cache_arg}") +else () + message("cache_arg is undefined") +endif () + +if (DEFINED second_cache_arg) + message("configured again with: ${second_cache_arg}") +else () + message("second_cache_arg is undefined") +endif () diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt new file mode 100644 index 0000000..fea7fd9 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt @@ -0,0 +1,2 @@ +.*configured with: first +.*second_cache_arg is undefined diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt new file mode 100644 index 0000000..e19e743 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt @@ -0,0 +1,2 @@ +.*configured with: first +.*configured again with: second diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake new file mode 100644 index 0000000..fe69426 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake @@ -0,0 +1,19 @@ +include("${CMAKE_CURRENT_BINARY_DIR}/data.cmake") + +include(ExternalProject) +ExternalProject_add(external + SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/ExternalProject" + CMAKE_CACHE_ARGS + ${cache_args} + BUILD_COMMAND "" + INSTALL_COMMAND "") + +set(cache_args_path "<TMP_DIR>/external-cache-$<CONFIG>.cmake") +set(cmake_cache_path "<BINARY_DIR>/CMakeCache.txt") +_ep_replace_location_tags(external cache_args_path cmake_cache_path) + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake" CONTENT " +set(check_pairs + \"${cmake_cache_path}|${cache_args_path}\" +) +") diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake new file mode 100644 index 0000000..57c7ab7 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/data.cmake" + "set(cache_args -Dcache_arg:STRING=first) +") diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake new file mode 100644 index 0000000..cbb79e1 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/data.cmake" + "set(cache_args -Dsecond_cache_arg:STRING=second) +") diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 753417d..7a68c4b 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -46,6 +46,11 @@ endif() run_BuildDepends(Custom-Symbolic-and-Byproduct) run_BuildDepends(Custom-Always) +set(RunCMake_TEST_OUTPUT_MERGE_save "${RunCMake_TEST_OUTPUT_MERGE}") +set(RunCMake_TEST_OUTPUT_MERGE 1) +run_BuildDepends(ExternalProjectCacheArgs) +set(RunCMake_TEST_OUTPUT_MERGE "${RunCMake_TEST_OUTPUT_MERGE_save}") + # Test header dependencies with a build tree underneath a source tree. set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource/build") diff --git a/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake b/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake index 841d0a8..2b4a8f5 100644 --- a/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake +++ b/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake @@ -1 +1,2 @@ include(CMP0104-Common.cmake) +set_property(TARGET cuda PROPERTY CUDA_ARCHITECTURES) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index cc88868..0f94e4e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -197,6 +197,9 @@ endif() add_RunCMake_test(CompilerNotFound) add_RunCMake_test(Configure -DMSVC_IDE=${MSVC_IDE}) add_RunCMake_test(DisallowedCommands) +if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") + add_RunCMake_test(ExportCompileCommands) +endif() add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) @@ -269,6 +272,7 @@ add_RunCMake_test(add_dependencies) add_RunCMake_test(add_executable) add_RunCMake_test(add_library) add_RunCMake_test(add_subdirectory) +add_RunCMake_test(add_test) add_RunCMake_test(build_command) add_executable(exit_code exit_code.c) set(execute_process_ARGS -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>) @@ -277,6 +281,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) endif() add_RunCMake_test(execute_process) add_RunCMake_test(export) +add_RunCMake_test(cmake_language) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(cmake_parse_arguments) add_RunCMake_test(continue) @@ -672,5 +677,3 @@ add_RunCMake_test("CTestCommandExpandLists") add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) add_RunCMake_test("UnityBuild") - -add_RunCMake_test(cmake_command) diff --git a/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake b/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake index 777f192..e9aa3a4 100644 --- a/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake @@ -38,6 +38,13 @@ function(run_ctresalloc_verify name tests) run_cmake_command(${name} "${CTRESALLOC_COMMAND}" verify "${RunCMake_SOURCE_DIR}/${name}.log" "${CMAKE_CURRENT_LIST_DIR}/resspec.json" "${tests}") endfunction() +function(read_testing_file filename variable) + file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/TAG" _tag) + string(REGEX REPLACE "^([^\n]*)\n.*$" "\\1" _date "${_tag}") + file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/${_date}/${filename}" _contents) + set("${variable}" "${_contents}" PARENT_SCOPE) +endfunction() + unset(ENV{CTEST_RESOURCE_GROUP_COUNT}) set(RunCMake_TEST_NO_CLEAN 1) file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/ctresalloc-write-proc-good1-build") diff --git a/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-nores-check.cmake b/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-nores-check.cmake new file mode 100644 index 0000000..c6e72bd --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-nores-check.cmake @@ -0,0 +1,4 @@ +read_testing_file("Test.xml" _test_contents) +if(NOT _test_contents MATCHES "#CTEST_RESOURCE_GROUP_COUNT=") + string(APPEND RunCMake_TEST_FAILED "Could not find unset variable CTEST_RESOURCE_GROUP_COUNT in test measurements\n") +endif() diff --git a/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake b/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake index ceda72e..585c36b 100644 --- a/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake +++ b/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake @@ -1 +1,9 @@ verify_ctest_resources() + +read_testing_file("Test.xml" _test_contents) +if(NOT _test_contents MATCHES "\nCTEST_RESOURCE_GROUP_0=widgets") + string(APPEND RunCMake_TEST_FAILED "Could not find variable CTEST_RESOURCE_GROUP_0 in test measurements\n") +endif() +if(NOT _test_contents MATCHES "\nCTEST_RESOURCE_GROUP_0_WIDGETS=id:") + string(APPEND RunCMake_TEST_FAILED "Could not find variable CTEST_RESOURCE_GROUP_0_WIDGETS in test measurements\n") +endif() diff --git a/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake new file mode 100644 index 0000000..29faae3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake @@ -0,0 +1,3 @@ +if(NOT ("${CMAKE_ARGV3}" STREQUAL "--" AND "${CMAKE_ARGV4}" STREQUAL "-DFOO")) + message(FATAL_ERROR "`-DFOO` shouldn't trigger an error after `--`") +endif() diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 0f806bc..973391d 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -46,6 +46,7 @@ run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G) run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) +run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO) run_cmake_command(build-no-dir ${CMAKE_COMMAND} --build) diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h b/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h Binary files differindex bf56ec6..2d39178 100644 --- a/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h +++ b/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake index 588b77b..3cbbc07 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake @@ -7,22 +7,22 @@ endif() set(error_details "There is a problem with generated test file: ${testfile}") -if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n") +if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulator[\"] [^\n]+pseudo_emulator[^\n]+\n") message(SEND_ERROR "Used emulator when it should not be used. ${error_details}") endif() -if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n") +if(NOT testfile_contents MATCHES "add_test[(][\"]UsesEmulator[\"] [^\n]+pseudo_emulator[^\n]+\n") message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}") endif() -if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n") +if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulatorWithGenex[\"] [^\n]+pseudo_emulator[^\n]+\n") message(SEND_ERROR "Used emulator when it should not be used. ${error_details}") endif() -if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n") +if(NOT testfile_contents MATCHES "add_test[(][\"]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex[\"] [^\n]+pseudo_emulator[^\n]+\n") message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}") endif() -if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n") +if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex[\"] [^\n]+pseudo_emulator[^\n]+\n") message(SEND_ERROR "Used emulator when it should not be used. ${error_details}") endif() diff --git a/Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake b/Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake new file mode 100644 index 0000000..87058e2 --- /dev/null +++ b/Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake @@ -0,0 +1,4 @@ +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json") + set(RunCMake_TEST_FAILED "compile_commands.json not generated") + return() +endif() diff --git a/Tests/RunCMake/ExportCompileCommands/BeforeProject.cmake b/Tests/RunCMake/ExportCompileCommands/BeforeProject.cmake new file mode 100644 index 0000000..b8cbdef --- /dev/null +++ b/Tests/RunCMake/ExportCompileCommands/BeforeProject.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_library(empty STATIC empty.c) +message(STATUS "CMAKE_EXPORT_COMPILE_COMMANDS='${CMAKE_EXPORT_COMPILE_COMMANDS}'") diff --git a/Tests/RunCMake/ExportCompileCommands/BeforeProjectBEFORE.cmake b/Tests/RunCMake/ExportCompileCommands/BeforeProjectBEFORE.cmake new file mode 100644 index 0000000..87f9c87 --- /dev/null +++ b/Tests/RunCMake/ExportCompileCommands/BeforeProjectBEFORE.cmake @@ -0,0 +1 @@ +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/Tests/RunCMake/ExportCompileCommands/CMakeLists.txt b/Tests/RunCMake/ExportCompileCommands/CMakeLists.txt new file mode 100644 index 0000000..b7117bd --- /dev/null +++ b/Tests/RunCMake/ExportCompileCommands/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.17) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake new file mode 100644 index 0000000..b540a04 --- /dev/null +++ b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake_with_options(BeforeProject -DCMAKE_PROJECT_INCLUDE_BEFORE=BeforeProjectBEFORE.cmake) diff --git a/Tests/RunCMake/ExportCompileCommands/empty.c b/Tests/RunCMake/ExportCompileCommands/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/ExportCompileCommands/empty.c diff --git a/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt b/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt index 6e6c730..711de6b 100644 --- a/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt +++ b/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt @@ -1,2 +1,3 @@ Confirmation project has been added +.*Confirmation subproject has been added .*Confirmation script has been called diff --git a/Tests/RunCMake/FetchContent/MakeAvailable.cmake b/Tests/RunCMake/FetchContent/MakeAvailable.cmake index a93f1f7..d7fc55c 100644 --- a/Tests/RunCMake/FetchContent/MakeAvailable.cmake +++ b/Tests/RunCMake/FetchContent/MakeAvailable.cmake @@ -8,13 +8,22 @@ FetchContent_Declare( WithoutProject SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithoutProject ) +FetchContent_Declare( + ProjectSubdir + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithoutProject + SOURCE_SUBDIR ProjectSubdir +) # Order is important and will be verified by test output -FetchContent_MakeAvailable(WithProject WithoutProject) +FetchContent_MakeAvailable(WithProject WithoutProject ProjectSubdir) get_property(addedWith GLOBAL PROPERTY FetchWithProject SET) if(NOT addedWith) - message(SEND_ERROR "Subdir with CMakeLists.txt not added") + message(SEND_ERROR "Project with top level CMakeLists.txt not added") +endif() +get_property(addedSubdir GLOBAL PROPERTY FetchWithSubProject SET) +if(NOT addedSubdir) + message(SEND_ERROR "Project with CMakeLists.txt in subdir not added") endif() include(${withoutproject_SOURCE_DIR}/confirmMessage.cmake) diff --git a/Tests/RunCMake/FetchContent/WithoutProject/ProjectSubdir/CMakeLists.txt b/Tests/RunCMake/FetchContent/WithoutProject/ProjectSubdir/CMakeLists.txt new file mode 100644 index 0000000..216eeb1 --- /dev/null +++ b/Tests/RunCMake/FetchContent/WithoutProject/ProjectSubdir/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.13) +project(ProjectSubdir LANGUAGES NONE) + +set_property(GLOBAL PROPERTY FetchWithSubProject YES) +message(STATUS "Confirmation subproject has been added") diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake index 62bb5de..d697fc6 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake @@ -99,6 +99,7 @@ file(WRITE ${fakePkgDir}/lib/pkgconfig/${pname}.pc Description: Dummy package for FindPkgConfig IMPORTED_TARGET INTERFACE_LINK_OPTIONS test Version: 1.2.3 Libs: -e dummy_main +Cflags: -I/special -isystem /other -isystem/more -DA-isystem/foo ") set(expected_link_options -e dummy_main) @@ -109,7 +110,26 @@ endif() get_target_property(link_options PkgConfig::FakeLinkOptionsPackage INTERFACE_LINK_OPTIONS) if (NOT link_options STREQUAL expected_link_options) message(FATAL_ERROR - "Additional link options not present in INTERFACE_LINK_OPTIONS property" + "Additional link options not present in INTERFACE_LINK_OPTIONS property\n" "expected: \"${expected_link_options}\", but got \"${link_options}\"" ) endif() + +get_target_property(inc_dirs PkgConfig::FakeLinkOptionsPackage INTERFACE_INCLUDE_DIRECTORIES) +set(expected_inc_dirs "/special" "/other" "/more") + +if (NOT inc_dirs STREQUAL expected_inc_dirs) + message(FATAL_ERROR + "Additional include directories not correctly present in INTERFACE_INCLUDE_DIRECTORIES property\n" + "expected: \"${expected_inc_dirs}\", got \"${inc_dirs}\"" + ) +endif () + +get_target_property(c_opts PkgConfig::FakeLinkOptionsPackage INTERFACE_COMPILE_OPTIONS) +set(expected_c_opts "-DA-isystem/foo") # this is an invalid option, but a good testcase +if (NOT c_opts STREQUAL expected_c_opts) + message(FATAL_ERROR + "Additional compile options not present in INTERFACE_COMPILE_OPTIONS property\n" + "expected: \"${expected_c_opts}\", got \"${c_opts}\"" + ) +endif () diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index 18c3340..b3977f1 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -26,4 +26,12 @@ function(run_GEH) endforeach() endfunction() +# remove these flags from the enviornment if they have been set +# so the tests run the correct env +set(env_cxx_flags $ENV{CXXFLAGS}) +if(env_cxx_flags) + string(REPLACE "-fvisibility=hidden" "" env_cxx_flags "${env_cxx_flags}") + string(REPLACE "-fvisibility-inlines-hidden" "" env_cxx_flags "${env_cxx_flags}") + set(ENV{CXXFLAGS} "${env_cxx_flags}") +endif() run_GEH() diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt index 5f7753d..7fb3919 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt @@ -1,22 +1,28 @@ Test project .* - Start 1: TEST:basic\.case_foo!1 -1/8 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec - Start 2: TEST:basic\.case_bar!1 -2/8 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec - Start 3: TEST:basic\.disabled_case!1 -3/8 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 4: TEST:disabled\.case!1 -4/8 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 5: TEST:typed/short\.case!1 -5/8 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec - Start 6: TEST:typed/float\.case!1 -6/8 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec - Start 7: TEST:value/test\.case/1!1 -7/8 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec - Start 8: TEST:value/test\.case/"foo"!1 -8/8 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + Start 1: TEST:basic\.case_foo!1 + 1/11 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec + Start 2: TEST:basic\.case_bar!1 + 2/11 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec + Start 3: TEST:basic\.disabled_case!1 + 3/11 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 4: TEST:disabled\.case!1 + 4/11 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 5: TEST:typed/short\.case!1 + 5/11 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec + Start 6: TEST:typed/float\.case!1 + 6/11 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec + Start 7: TEST:value/test\.case/1!1 + 7/11 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec + Start 8: TEST:value/test\.case/"foo"!1 + 8/11 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + Start 9: TEST:param/special\.case/"semicolon;"!1 + 9/11 Test #9: TEST:param/special\.case/"semicolon;"!1 \.+ +Passed +[0-9.]+ sec + Start 10: TEST:param/special\.case/"backslash\\"!1 +10/11 Test #10: TEST:param/special\.case/"backslash\\"!1 \.+ +Passed +[0-9.]+ sec + Start 11: TEST:param/special\.case/"\$\{var\}"!1 +11/11 Test #11: TEST:param/special\.case/"\$\{var\}"!1 \.+ +Passed +[0-9.]+ sec -100% tests passed, 0 tests failed out of 6 +100% tests passed, 0 tests failed out of 9 Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt index 960c0b9..58c4d10 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -1,25 +1,31 @@ Test project .* - Start 9: TEST:basic\.case_foo!2 -1/8 Test #9: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec - Start 10: TEST:basic\.case_bar!2 -2/8 Test #10: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec - Start 11: TEST:basic\.disabled_case!2 -3/8 Test #11: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 12: TEST:disabled\.case!2 -4/8 Test #12: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 13: TEST:typed/short\.case!2 -5/8 Test #13: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec - Start 14: TEST:typed/float\.case!2 -6/8 Test #14: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec - Start 15: TEST:value/test\.case/1!2 -7/8 Test #15: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec - Start 16: TEST:value/test\.case/"foo"!2 -8/8 Test #16: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + Start 12: TEST:basic\.case_foo!2 + 1/11 Test #12: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec + Start 13: TEST:basic\.case_bar!2 + 2/11 Test #13: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec + Start 14: TEST:basic\.disabled_case!2 + 3/11 Test #14: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 15: TEST:disabled\.case!2 + 4/11 Test #15: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 16: TEST:typed/short\.case!2 + 5/11 Test #16: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec + Start 17: TEST:typed/float\.case!2 + 6/11 Test #17: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec + Start 18: TEST:value/test\.case/1!2 + 7/11 Test #18: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec + Start 19: TEST:value/test\.case/"foo"!2 + 8/11 Test #19: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + Start 20: TEST:param/special\.case/"semicolon;"!2 + 9/11 Test #20: TEST:param/special\.case/"semicolon;"!2 \.+ +Passed +[0-9.]+ sec + Start 21: TEST:param/special\.case/"backslash\\"!2 +10/11 Test #21: TEST:param/special\.case/"backslash\\"!2 \.+ +Passed +[0-9.]+ sec + Start 22: TEST:param/special\.case/"\$\{var\}"!2 +11/11 Test #22: TEST:param/special\.case/"\$\{var\}"!2 \.+ +Passed +[0-9.]+ sec -100% tests passed, 0 tests failed out of 6 +100% tests passed, 0 tests failed out of 9 Total Test time \(real\) = +[0-9.]+ sec The following tests did not run: -.*11 - TEST:basic\.disabled_case!2 \(Disabled\) -.*12 - TEST:disabled\.case!2 \(Disabled\) +.*14 - TEST:basic\.disabled_case!2 \(Disabled\) +.*15 - TEST:disabled\.case!2 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp index f1bd7ef..a8127bf 100644 --- a/Tests/RunCMake/GoogleTest/fake_gtest.cpp +++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp @@ -21,6 +21,10 @@ int main(int argc, char** argv) std::cout << "value/test." << std::endl; std::cout << " case/0 # GetParam() = 1" << std::endl; std::cout << " case/1 # GetParam() = \"foo\"" << std::endl; + std::cout << "param/special." << std::endl; + std::cout << " case/0 # GetParam() = \"semicolon;\"" << std::endl; + std::cout << " case/1 # GetParam() = \"backslash\\\"" << std::endl; + std::cout << " case/2 # GetParam() = \"${var}\"" << std::endl; return 0; } diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 6472f46..23b89d3 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -285,7 +285,8 @@ run_cmake_command(NoUnusedVariables ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR} "-DCMAKE_DEFAULT_CONFIGS=all" ) -if(CMake_TEST_CUDA) +# CudaSimple uses separable compilation, which is currently only supported on NVCC. +if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CudaSimple-build) run_cmake_configure(CudaSimple) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) diff --git a/Tests/RunCMake/ObjectLibrary/b.c b/Tests/RunCMake/ObjectLibrary/b.c index 220ce03..2c65a2b 100644 --- a/Tests/RunCMake/ObjectLibrary/b.c +++ b/Tests/RunCMake/ObjectLibrary/b.c @@ -5,7 +5,7 @@ #endif extern int a(void); -EXPORT int b() +EXPORT int b(void) { return a(); } diff --git a/Tests/RunCMake/ObjectLibrary/requires.c b/Tests/RunCMake/ObjectLibrary/requires.c index 685632b..a5b429a 100644 --- a/Tests/RunCMake/ObjectLibrary/requires.c +++ b/Tests/RunCMake/ObjectLibrary/requires.c @@ -1,5 +1,5 @@ #ifdef REQUIRED -int required() +int required(void) { return 0; } diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake index a1e0792..aab20d8 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake @@ -9,6 +9,9 @@ target_precompile_headers(foo PUBLIC <stdio.h> \"string.h\" ) +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + set_property(SOURCE foo.c APPEND PROPERTY COMPILE_OPTIONS "-WX-") +endif() add_library(bar INTERFACE) target_include_directories(bar INTERFACE include) diff --git a/Tests/RunCMake/PrecompileHeaders/empty.c b/Tests/RunCMake/PrecompileHeaders/empty.c index 30ae1c4..2a51ebc 100644 --- a/Tests/RunCMake/PrecompileHeaders/empty.c +++ b/Tests/RunCMake/PrecompileHeaders/empty.c @@ -1,3 +1,3 @@ -void nothing() +void nothing(void) { } diff --git a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake index 24daa64..9ba3c85 100644 --- a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake +++ b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake @@ -1,14 +1,20 @@ include(RunCMake) run_cmake(unitybuild_c) +run_cmake(unitybuild_c_batch) +run_cmake(unitybuild_c_group) run_cmake(unitybuild_cxx) +run_cmake(unitybuild_cxx_group) run_cmake(unitybuild_c_and_cxx) +run_cmake(unitybuild_c_and_cxx_group) run_cmake(unitybuild_batchsize) run_cmake(unitybuild_default_batchsize) run_cmake(unitybuild_skip) run_cmake(unitybuild_code_before_and_after_include) run_cmake(unitybuild_c_no_unity_build) +run_cmake(unitybuild_c_no_unity_build_group) run_cmake(unitybuild_order) +run_cmake(unitybuild_invalid_mode) function(run_test name) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) diff --git a/Tests/RunCMake/UnityBuild/f.c b/Tests/RunCMake/UnityBuild/f.c new file mode 100644 index 0000000..d5813c6 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/f.c @@ -0,0 +1,5 @@ +int f(int x) +{ + (void)x; + return 0; +} diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group-check.cmake new file mode 100644 index 0000000..b027682 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group-check.cmake @@ -0,0 +1,42 @@ +set(unitybuild_a_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_a_c.c") +if(NOT EXISTS "${unitybuild_a_c}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_a_c} does not exist.") + return() +else() + #verify that the 4 c file is part of this grouping and therefore UNITY_BUILD_BATCH_SIZE + #was ignored + file(STRINGS ${unitybuild_a_c} unitybuild_a_c_strings) + string(REGEX MATCH ".*#include.*s1.c.*#include.*s2.c.*#include.*s3.c.*#include.*s4.c.*" matched_code ${unitybuild_a_c_strings}) + if(NOT matched_code) + set(RunCMake_TEST_FAILED "Generated unity file doesn't include expected source files") + return() + endif() +endif() + +set(unitybuild_b_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_b_c.c") +if(NOT EXISTS "${unitybuild_b_c}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_b_c} does not exist.") + return() +endif() + + +set(unitybuild_a_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_a_cxx.cxx") +if(NOT EXISTS "${unitybuild_a_cxx}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_a_cxx} does not exist.") + return() +else() + #verify that the 4 cxx file are part of this grouping and therefore UNITY_BUILD_BATCH_SIZE + #was ignored + file(STRINGS ${unitybuild_a_cxx} unitybuild_a_cxx_strings) + string(REGEX MATCH ".*#include.*s1.cxx.*#include.*s2.cxx.*#include.*s3.cxx.*#include.*s4.cxx.*" matched_code ${unitybuild_a_cxx_strings}) + if(NOT matched_code) + set(RunCMake_TEST_FAILED "Generated unity file doesn't include expected source files") + return() + endif() +endif() + +set(unitybuild_b_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_b_cxx.cxx") +if(NOT EXISTS "${unitybuild_b_cxx}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_b_cxx} does not exist.") + return() +endif() diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group.cmake new file mode 100644 index 0000000..7bf3f4b --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group.cmake @@ -0,0 +1,39 @@ +project(unitybuild_c_and_cxx C CXX) + +set(srcs f.c) +foreach(s RANGE 1 8) + set(src_c "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c") + file(WRITE "${src_c}" " +int f(int);\n +int s${s}(void) { return f(${s}); }\n" + ) + + set(src_cxx "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cxx") + file(WRITE "${src_cxx}" " +extern \"C\" { \n + int f(int); \n +}\n + int s${s}(void) { return f(${s}); }\n" + ) + + list(APPEND srcs "${src_c}") + list(APPEND srcs "${src_cxx}") +endforeach() + + + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD ON + UNITY_BUILD_MODE GROUP + #UNITY_BUILD_BATCH_SIZE will be ignored + UNITY_BUILD_BATCH_SIZE 2) + +set_source_files_properties(s1.c s2.c s3.c s4.c + s1.cxx s2.cxx s3.cxx s4.cxx + PROPERTIES UNITY_GROUP "a" + ) +set_source_files_properties(s5.c s6.c s7.c s8.c + s5.cxx s6.cxx s7.cxx s8.cxx + PROPERTIES UNITY_GROUP "b" + ) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_batch-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_batch-check.cmake new file mode 100644 index 0000000..024286d --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_c_batch-check.cmake @@ -0,0 +1,5 @@ +set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_c.c") +if(NOT EXISTS "${unitybuild_c}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c} does not exist.") + return() +endif() diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_batch.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_batch.cmake new file mode 100644 index 0000000..33873b6 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_c_batch.cmake @@ -0,0 +1,15 @@ +project(unitybuild_c C) + +set(srcs "") +foreach(s RANGE 1 8) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c") + file(WRITE "${src}" "int s${s}(void) { return 0; }\n") + list(APPEND srcs "${src}") +endforeach() + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES + UNITY_BUILD ON + UNITY_BUILD_MODE BATCH + ) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_group-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_group-check.cmake new file mode 100644 index 0000000..0b9ea15 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_c_group-check.cmake @@ -0,0 +1,11 @@ +set(unitybuild_a_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_a_c.c") +if(NOT EXISTS "${unitybuild_a_c}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_a_c} does not exist.") + return() +endif() + +set(unitybuild_b_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_b_c.c") +if(NOT EXISTS "${unitybuild_b_c}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_b_c} does not exist.") + return() +endif() diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_group.cmake new file mode 100644 index 0000000..1fa17f3 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_c_group.cmake @@ -0,0 +1,17 @@ +project(unitybuild_c C) + +set(srcs "") +foreach(s RANGE 1 8) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c") + file(WRITE "${src}" "int s${s}(void) { return 0; }\n") + list(APPEND srcs "${src}") +endforeach() + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD ON + UNITY_BUILD_MODE GROUP) + +set_source_files_properties(s1.c PROPERTIES UNITY_GROUP "a") +set_source_files_properties(s2.c PROPERTIES UNITY_GROUP "a") +set_source_files_properties(s3.c s4.c PROPERTIES UNITY_GROUP "b") diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group-check.cmake new file mode 100644 index 0000000..e344627 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group-check.cmake @@ -0,0 +1,5 @@ +set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_a_c.c") +if(EXISTS "${unitybuild_c}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c} should not exist.") + return() +endif() diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group.cmake new file mode 100644 index 0000000..7b26dc1 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group.cmake @@ -0,0 +1,16 @@ +project(unitybuild_c_no_unity_build C) + +set(srcs "") +foreach(s RANGE 1 8) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c") + file(WRITE "${src}" "int s${s}(void) { return 0; }\n") + list(APPEND srcs "${src}") +endforeach() + +add_library(tgt SHARED ${srcs}) + +#These should be ignored as UNITY_BUILD is off +set_target_properties(tgt PROPERTIES UNITY_BUILD_MODE GROUP) +set_source_files_properties(s1.c s2.c s3.c s4.c s5.c s6.c s7.c s8.c + PROPERTIES UNITY_GROUP "a" + ) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_cxx_group-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_cxx_group-check.cmake new file mode 100644 index 0000000..ecef3a3 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_cxx_group-check.cmake @@ -0,0 +1,27 @@ +set(unitybuild_a_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_a_cxx.cxx") +if(NOT EXISTS "${unitybuild_a_cxx}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_a_cxx} does not exist.") + return() +else() + #verify that odr2 is not part of this source set + file(STRINGS ${unitybuild_a_cxx} unitybuild_a_cxx_strings) + string(REGEX MATCH ".*#include.*odr2.cxx" matched_code ${unitybuild_a_cxx_strings}) + if(matched_code) + set(RunCMake_TEST_FAILED "Generated unity file includes un-expected ord2.cxx source file") + return() + endif() +endif() + +set(unitybuild_b_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_b_cxx.cxx") +if(NOT EXISTS "${unitybuild_b_cxx}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_b_cxx} does not exist.") + return() +else() + #verify that odr1 is not part of this source set + file(STRINGS ${unitybuild_b_cxx} unitybuild_b_cxx_strings) + string(REGEX MATCH ".*#include.*odr1.cxx" matched_code ${unitybuild_b_cxx_strings}) + if(matched_code) + set(RunCMake_TEST_FAILED "Generated unity file includes un-expected ord1.cxx source file") + return() + endif() +endif() diff --git a/Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake new file mode 100644 index 0000000..9804289 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake @@ -0,0 +1,27 @@ +project(unitybuild_cxx CXX) + +set(srcs "") +foreach(s RANGE 1 4) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cxx") + file(WRITE "${src}" "int s${s}(void) { return 0; }\n") + list(APPEND srcs "${src}") +endforeach() + +foreach(s RANGE 1 2) + set(src "${CMAKE_CURRENT_BINARY_DIR}/odr${s}.cxx") + file(WRITE "${src}" "namespace odr { int s${s}(void) { return 0; } }\n") + list(APPEND srcs "${src}") +endforeach() + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD ON + UNITY_BUILD_MODE GROUP + ) + +set_source_files_properties(s1.cxx s2.cxx odr1.cxx + PROPERTIES UNITY_GROUP "a" + ) +set_source_files_properties(s3.cxx s4.cxx odr2.cxx + PROPERTIES UNITY_GROUP "b" + ) diff --git a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-result.txt b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-result.txt +++ b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-result.txt diff --git a/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-stderr.txt b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-stderr.txt new file mode 100644 index 0000000..b1b17a0 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error in CMakeLists.txt: + Invalid UNITY_BUILD_MODE value of INVALID assigned to target tgt\. + Acceptable values are BATCH and GROUP\. +.* +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode.cmake b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode.cmake new file mode 100644 index 0000000..0212200 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode.cmake @@ -0,0 +1,12 @@ +project(unitybuild_c C) + +set(srcs "") +foreach(s RANGE 1 8) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c") + file(WRITE "${src}" "int s${s}(void) { return 0; }\n") + list(APPEND srcs "${src}") +endforeach() + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD ON UNITY_BUILD_MODE INVALID) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 06ccaae..93ef603 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -56,6 +56,7 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio 1[0-4] 201[0-5]" OR run_cmake(UnityBuildPre2017) else() run_cmake(UnityBuildNative) + run_cmake(UnityBuildNativeGrouped) endif() run_cmake(VsDotnetTargetFramework) diff --git a/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped-check.cmake b/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped-check.cmake new file mode 100644 index 0000000..d6380da --- /dev/null +++ b/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped-check.cmake @@ -0,0 +1,56 @@ +set(unitybuild_c0 "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_poolA_c.c") +if(NOT EXISTS "${unitybuild_c0}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c0} does not exist.") + return() +endif() + +set(unitybuild_c1 "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_poolB_c.c") +if(NOT EXISTS "${unitybuild_c1}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c1} does not exist.") + return() +endif() + +set(tgt_project "${RunCMake_TEST_BINARY_DIR}/tgt.vcxproj") +if (NOT EXISTS "${tgt_project}") + set(RunCMake_TEST_FAILED "Generated project file ${tgt_project} doesn't exist.") + return() +endif() + +file(STRINGS ${tgt_project} tgt_projects_strings) + +foreach(line IN LISTS tgt_projects_strings) + if (line MATCHES "<EnableUnitySupport>true</EnableUnitySupport>") + set(have_unity_support ON) + endif() + + if (line MATCHES "<ClCompile Include=.*IncludeInUnityFile=\"false\" CustomUnityFile=\"true\"") + list(APPEND unity_source_lines ${line}) + endif() + + if (line MATCHES "<ClCompile Include=.*IncludeInUnityFile=\"true\" CustomUnityFile=\"true\"") + list(APPEND sources_list ${line}) + endif() +endforeach() + +if (NOT have_unity_support) + set(RunCMake_TEST_FAILED "Generated project should include the <EnableUnitySupport> block.") + return() +endif() + +string(REPLACE "\\" "/" unity_source_lines "${unity_source_lines}") +string(FIND "${unity_source_lines}" "CMakeFiles/tgt.dir/Unity/unity_poolA_c.c" unity_source_file_position) +if (unity_source_file_position EQUAL "-1") + set(RunCMake_TEST_FAILED "Generated project should include the generated unity source file 'poolA'.") + return() +endif() +string(FIND "${unity_source_lines}" "CMakeFiles/tgt.dir/Unity/unity_poolB_c.c" unity_source_file_position) +if (unity_source_file_position EQUAL "-1") + set(RunCMake_TEST_FAILED "Generated project should include the generated unity source file 'poolB'.") + return() +endif() + +list(LENGTH sources_list number_of_sources) +if(NOT number_of_sources EQUAL 7) + set(RunCMake_TEST_FAILED "Generated project doesn't include the expect number of files.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped.cmake b/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped.cmake new file mode 100644 index 0000000..b740e3b --- /dev/null +++ b/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped.cmake @@ -0,0 +1,20 @@ +project(unitybuild_c C) + +set(srcs "") +foreach(s RANGE 1 8) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c") + file(WRITE "${src}" "int s${s}(void) { return 0; }\n") + list(APPEND srcs "${src}") +endforeach() + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD ON UNITY_BUILD_MODE GROUP) + +set_source_files_properties(s1.c s2.c s3.c s4.c + PROPERTIES UNITY_GROUP "poolA" + ) + +set_source_files_properties(s5.c s6.c s7.c + PROPERTIES UNITY_GROUP "poolB" + ) diff --git a/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped-check.cmake b/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped-check.cmake new file mode 100644 index 0000000..d9b8c01 --- /dev/null +++ b/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped-check.cmake @@ -0,0 +1,59 @@ +set(unitybuild_c0 "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_poolA.c") +if(NOT EXISTS "${unitybuild_c0}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c0} does not exist.") + return() +endif() + +set(unitybuild_c1 "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_poolB.c") +if(NOT EXISTS "${unitybuild_c1}") + set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c1} does not exist.") + return() +endif() + +set(tgt_project "${RunCMake_TEST_BINARY_DIR}/tgt.vcxproj") +if (NOT EXISTS "${tgt_project}") + set(RunCMake_TEST_FAILED "Generated project file ${tgt_project} doesn't exist.") + return() +endif() + +file(STRINGS ${tgt_project} tgt_projects_strings) + +foreach(line IN LISTS tgt_projects_strings) + if (line MATCHES "<ClCompile Include=.*/>") + set(unity_source_line ${line}) + endif() + + if (line MATCHES "<ClCompile Include=\"[^\"]*\">") + string(REGEX MATCH "<ClCompile Include=\"([^\"]*)\">" source_file ${line}) + list(APPEND sources_list ${source_file}) + endif() + + if (line MATCHES "<ExcludedFromBuild.*</ExcludedFromBuild>") + list(APPEND excluded_sources_list ${source_file}) + endif() +endforeach() + +string(REPLACE "\\" "/" unity_source_line ${unity_source_line}) +string(FIND "${unity_source_line}" "CMakeFiles/tgt.dir/Unity/unity_poolA.c" unity_source_file_position) +if (unity_source_file_position EQUAL "-1") + set(RunCMake_TEST_FAILED "Generated project should include the generated unity source file.") + return() +endif() +string(FIND "${unity_source_line}" "CMakeFiles/tgt.dir/Unity/unity_poolB.c" unity_source_file_position) +if (unity_source_file_position EQUAL "-1") + set(RunCMake_TEST_FAILED "Generated project should include the generated unity source file.") + return() +endif() + +list(LENGTH sources_list number_of_sources) +if(NOT number_of_sources EQUAL 7) + set(RunCMake_TEST_FAILED "Generated project doesn't include the expect number of files.") + return() +endif() + +# Exclusions for Debug|Release|MinSizeRel|RelWithDebInfo +list(LENGTH excluded_sources_list number_of_excluded_sources) +if(NOT number_of_excluded_sources EQUAL 28) + set(RunCMake_TEST_FAILED "Generated project doesn't exclude the source files for all configurations.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped.cmake b/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped.cmake new file mode 100644 index 0000000..b740e3b --- /dev/null +++ b/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped.cmake @@ -0,0 +1,20 @@ +project(unitybuild_c C) + +set(srcs "") +foreach(s RANGE 1 8) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c") + file(WRITE "${src}" "int s${s}(void) { return 0; }\n") + list(APPEND srcs "${src}") +endforeach() + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD ON UNITY_BUILD_MODE GROUP) + +set_source_files_properties(s1.c s2.c s3.c s4.c + PROPERTIES UNITY_GROUP "poolA" + ) + +set_source_files_properties(s5.c s6.c s7.c + PROPERTIES UNITY_GROUP "poolB" + ) diff --git a/Tests/RunCMake/add_test/CMakeLists.txt.in b/Tests/RunCMake/add_test/CMakeLists.txt.in new file mode 100644 index 0000000..495240d --- /dev/null +++ b/Tests/RunCMake/add_test/CMakeLists.txt.in @@ -0,0 +1,27 @@ +if (NOT DEFINED RUN_AS_SCRIPT) + + cmake_minimum_required(VERSION 3.7) + project(@CASE_NAME@ NONE) + include(CTest) + + # Two fallback tests for set_tests_properties. + add_test(NAME PrefixTest COMMAND "${CMAKE_COMMAND}" --version) + add_test(NAME SuffixTest COMMAND "${CMAKE_COMMAND}" --version) + + add_test( + NAME @CASE_CMAKELISTS_NAME_1@ + COMMAND "${CMAKE_COMMAND}" -D RUN_AS_SCRIPT=1 -P "${CMAKE_CURRENT_LIST_FILE}" + ) + set_tests_properties( + @CASE_CMAKELISTS_NAME_2@ + PROPERTIES + ENVIRONMENT CMAKE_add_test_ENVVAR=1 + ) + +else() + + if(NOT DEFINED ENV{CMAKE_add_test_ENVVAR}) + message(FATAL_ERROR "Setting property on test did not succeed!") + endif() + +endif() diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument1-stdout.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument1-stdout.txt new file mode 100644 index 0000000..00865d0 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsBracketArgument1-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \[=\[BracketArgument;SuffixTest\]=\] \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument2-stdout.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument2-stdout.txt new file mode 100644 index 0000000..a744beb --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsBracketArgument2-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BracketArgument;SuffixTest \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument3-result.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument3-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsBracketArgument3-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument3-stderr.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument3-stderr.txt new file mode 100644 index 0000000..32c2112 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsBracketArgument3-stderr.txt @@ -0,0 +1,2 @@ +Error\(s\) when configuring the project +No tests were found!!! diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument4-result.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument4-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsBracketArgument4-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument4-stderr.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument4-stderr.txt new file mode 100644 index 0000000..32c2112 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsBracketArgument4-stderr.txt @@ -0,0 +1,2 @@ +Error\(s\) when configuring the project +No tests were found!!! diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote1-result.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stderr.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stderr.txt new file mode 100644 index 0000000..0661945 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: SuffixTest diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stdout.txt new file mode 100644 index 0000000..4875409 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote2-result.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stderr.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stderr.txt new file mode 100644 index 0000000..0661945 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: SuffixTest diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stdout.txt new file mode 100644 index 0000000..4875409 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote3-result.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stderr.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stderr.txt new file mode 100644 index 0000000..0661945 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: SuffixTest diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stdout.txt new file mode 100644 index 0000000..4875409 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote4-result.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stderr.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stderr.txt new file mode 100644 index 0000000..0661945 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: SuffixTest diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stdout.txt new file mode 100644 index 0000000..4875409 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars1-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars1-stdout.txt new file mode 100644 index 0000000..80435b6 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars1-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \(\) # \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars2-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars2-stdout.txt new file mode 100644 index 0000000..80435b6 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars2-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \(\) # \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars3-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars3-stdout.txt new file mode 100644 index 0000000..80435b6 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars3-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \(\) # \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars4-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars4-stdout.txt new file mode 100644 index 0000000..80435b6 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars4-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \(\) # \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax1-stdout.txt b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax1-stdout.txt new file mode 100644 index 0000000..172ff99 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax1-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax2-stdout.txt b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax2-stdout.txt new file mode 100644 index 0000000..172ff99 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax2-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax3-stdout.txt b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax3-stdout.txt new file mode 100644 index 0000000..172ff99 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax3-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax4-stdout.txt b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax4-stdout.txt new file mode 100644 index 0000000..172ff99 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax4-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsOtherSpecialChars1-stdout.txt b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars1-stdout.txt new file mode 100644 index 0000000..83e3f86 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars1-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsOtherSpecialChars2-stdout.txt b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars2-stdout.txt new file mode 100644 index 0000000..83e3f86 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars2-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsOtherSpecialChars3-stdout.txt b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars3-stdout.txt new file mode 100644 index 0000000..83e3f86 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars3-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsOtherSpecialChars4-stdout.txt b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars4-stdout.txt new file mode 100644 index 0000000..83e3f86 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars4-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon1-stdout.txt b/Tests/RunCMake/add_test/NameContainsSemicolon1-stdout.txt new file mode 100644 index 0000000..0fbf486 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSemicolon1-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: PrefixTest;SuffixTest \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon2-result.txt b/Tests/RunCMake/add_test/NameContainsSemicolon2-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSemicolon2-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon2-stderr.txt b/Tests/RunCMake/add_test/NameContainsSemicolon2-stderr.txt new file mode 100644 index 0000000..32c2112 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSemicolon2-stderr.txt @@ -0,0 +1,2 @@ +Error\(s\) when configuring the project +No tests were found!!! diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon3-stdout.txt b/Tests/RunCMake/add_test/NameContainsSemicolon3-stdout.txt new file mode 100644 index 0000000..c5ab1d8 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSemicolon3-stdout.txt @@ -0,0 +1,3 @@ +3/3 Test #3: PrefixTest;SuffixTest \.+\*\*\*Failed.* +CMake Error at .+/CMakeLists.txt:[0-9]+ \(message\): +[ ]*Setting property on test did not succeed! diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon4-result.txt b/Tests/RunCMake/add_test/NameContainsSemicolon4-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSemicolon4-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon4-stderr.txt b/Tests/RunCMake/add_test/NameContainsSemicolon4-stderr.txt new file mode 100644 index 0000000..32c2112 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSemicolon4-stderr.txt @@ -0,0 +1,2 @@ +Error\(s\) when configuring the project +No tests were found!!! diff --git a/Tests/RunCMake/add_test/NameContainsSpaces1-stdout.txt b/Tests/RunCMake/add_test/NameContainsSpaces1-stdout.txt new file mode 100644 index 0000000..a255fb1 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSpaces1-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: PrefixTest SuffixTest \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsSpaces2-result.txt b/Tests/RunCMake/add_test/NameContainsSpaces2-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSpaces2-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/add_test/NameContainsSpaces2-stderr.txt b/Tests/RunCMake/add_test/NameContainsSpaces2-stderr.txt new file mode 100644 index 0000000..32c2112 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSpaces2-stderr.txt @@ -0,0 +1,2 @@ +Error\(s\) when configuring the project +No tests were found!!! diff --git a/Tests/RunCMake/add_test/NameContainsSpaces3-stdout.txt b/Tests/RunCMake/add_test/NameContainsSpaces3-stdout.txt new file mode 100644 index 0000000..3d42b0b --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSpaces3-stdout.txt @@ -0,0 +1,3 @@ +3/3 Test #3: PrefixTest SuffixTest \.+\*\*\*Failed.* +CMake Error at .+/CMakeLists.txt:[0-9]+ \(message\): +[ ]*Setting property on test did not succeed! diff --git a/Tests/RunCMake/add_test/NameContainsSpaces4-result.txt b/Tests/RunCMake/add_test/NameContainsSpaces4-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSpaces4-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/add_test/NameContainsSpaces4-stderr.txt b/Tests/RunCMake/add_test/NameContainsSpaces4-stderr.txt new file mode 100644 index 0000000..32c2112 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsSpaces4-stderr.txt @@ -0,0 +1,2 @@ +Error\(s\) when configuring the project +No tests were found!!! diff --git a/Tests/RunCMake/add_test/NameContainsValidSpecialChars1-stdout.txt b/Tests/RunCMake/add_test/NameContainsValidSpecialChars1-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsValidSpecialChars1-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsValidSpecialChars2-stdout.txt b/Tests/RunCMake/add_test/NameContainsValidSpecialChars2-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsValidSpecialChars2-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsValidSpecialChars3-stdout.txt b/Tests/RunCMake/add_test/NameContainsValidSpecialChars3-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsValidSpecialChars3-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameContainsValidSpecialChars4-stdout.txt b/Tests/RunCMake/add_test/NameContainsValidSpecialChars4-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/NameContainsValidSpecialChars4-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameIsAlphaNumeric1-stdout.txt b/Tests/RunCMake/add_test/NameIsAlphaNumeric1-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/NameIsAlphaNumeric1-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameIsAlphaNumeric2-stdout.txt b/Tests/RunCMake/add_test/NameIsAlphaNumeric2-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/NameIsAlphaNumeric2-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameIsAlphaNumeric3-stdout.txt b/Tests/RunCMake/add_test/NameIsAlphaNumeric3-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/NameIsAlphaNumeric3-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/NameIsAlphaNumeric4-stdout.txt b/Tests/RunCMake/add_test/NameIsAlphaNumeric4-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/NameIsAlphaNumeric4-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/RunCMakeTest.cmake b/Tests/RunCMake/add_test/RunCMakeTest.cmake new file mode 100644 index 0000000..6e9edda --- /dev/null +++ b/Tests/RunCMake/add_test/RunCMakeTest.cmake @@ -0,0 +1,263 @@ +include(RunCTest) + +set(ENV{CTEST_OUTPUT_ON_FAILURE} 1) + +function(run_NameIsAlphaNumeric1_test) + set(CASE_CMAKELISTS_NAME_1 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==]) + run_ctest(NameIsAlphaNumeric1) +endfunction() +run_NameIsAlphaNumeric1_test() + +function(run_NameIsAlphaNumeric2_test) + set(CASE_CMAKELISTS_NAME_1 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==]) + set(CASE_CMAKELISTS_NAME_2 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==]) + run_ctest(NameIsAlphaNumeric2) +endfunction() +run_NameIsAlphaNumeric2_test() + +function(run_NameIsAlphaNumeric3_test) + set(CASE_CMAKELISTS_NAME_1 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==]) + run_ctest(NameIsAlphaNumeric3) +endfunction() +run_NameIsAlphaNumeric3_test() + +function(run_NameIsAlphaNumeric4_test) + set(CASE_CMAKELISTS_NAME_1 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==]) + set(CASE_CMAKELISTS_NAME_2 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==]) + run_ctest(NameIsAlphaNumeric4) +endfunction() +run_NameIsAlphaNumeric4_test() + + +function(run_NameContainsValidSpecialChars1_test) + set(CASE_CMAKELISTS_NAME_1 [==[ abc_.+-012 ]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ abc_.+-012 ]==]) + run_ctest(NameContainsValidSpecialChars1) +endfunction() +run_NameContainsValidSpecialChars1_test() + +function(run_NameContainsValidSpecialChars2_test) + set(CASE_CMAKELISTS_NAME_1 [==["abc_.+-012"]==]) + set(CASE_CMAKELISTS_NAME_2 [==["abc_.+-012"]==]) + run_ctest(NameContainsValidSpecialChars2) +endfunction() +run_NameContainsValidSpecialChars2_test() + +function(run_NameContainsValidSpecialChars3_test) + set(CASE_CMAKELISTS_NAME_1 [==["abc_.+-012"]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ abc_.+-012 ]==]) + run_ctest(NameContainsValidSpecialChars3) +endfunction() +run_NameContainsValidSpecialChars3_test() + +function(run_NameContainsValidSpecialChars4_test) + set(CASE_CMAKELISTS_NAME_1 [==[ abc_.+-012 ]==]) + set(CASE_CMAKELISTS_NAME_2 [==["abc_.+-012"]==]) + run_ctest(NameContainsValidSpecialChars4) +endfunction() +run_NameContainsValidSpecialChars4_test() + + +function(run_NameContainsOtherSpecialChars1_test) + set(CASE_CMAKELISTS_NAME_1 [==[ !§$%&/ü:*😤~ ]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ !§$%&/ü:*😤~ ]==]) + run_ctest(NameContainsOtherSpecialChars1) +endfunction() +run_NameContainsOtherSpecialChars1_test() + +function(run_NameContainsOtherSpecialChars2_test) + set(CASE_CMAKELISTS_NAME_1 [==["!§$%&/ü:*😤~"]==]) + set(CASE_CMAKELISTS_NAME_2 [==["!§$%&/ü:*😤~"]==]) + run_ctest(NameContainsOtherSpecialChars2) +endfunction() +run_NameContainsOtherSpecialChars2_test() + +function(run_NameContainsOtherSpecialChars3_test) + set(CASE_CMAKELISTS_NAME_1 [==["!§$%&/ü:*😤~"]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ !§$%&/ü:*😤~ ]==]) + run_ctest(NameContainsOtherSpecialChars3) +endfunction() +run_NameContainsOtherSpecialChars3_test() + +function(run_NameContainsOtherSpecialChars4_test) + set(CASE_CMAKELISTS_NAME_1 [==[ !§$%&/ü:*😤~ ]==]) + set(CASE_CMAKELISTS_NAME_2 [==["!§$%&/ü:*😤~"]==]) + run_ctest(NameContainsOtherSpecialChars4) +endfunction() +run_NameContainsOtherSpecialChars4_test() + + +function(run_NameContainsEscapedSpecialChars1_test) + set(CASE_CMAKELISTS_NAME_1 [==[ \(\)\ \# ]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ \(\)\ \# ]==]) + run_ctest(NameContainsEscapedSpecialChars1) +endfunction() +run_NameContainsEscapedSpecialChars1_test() + +function(run_NameContainsEscapedSpecialChars2_test) + set(CASE_CMAKELISTS_NAME_1 [==["\(\)\ \#"]==]) + set(CASE_CMAKELISTS_NAME_2 [==["\(\)\ \#"]==]) + run_ctest(NameContainsEscapedSpecialChars2) +endfunction() +run_NameContainsEscapedSpecialChars2_test() + +function(run_NameContainsEscapedSpecialChars3_test) + set(CASE_CMAKELISTS_NAME_1 [==["\(\)\ \#"]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ \(\)\ \# ]==]) + run_ctest(NameContainsEscapedSpecialChars3) +endfunction() +run_NameContainsEscapedSpecialChars3_test() + +function(run_NameContainsEscapedSpecialChars4_test) + set(CASE_CMAKELISTS_NAME_1 [==[ \(\)\ \# ]==]) + set(CASE_CMAKELISTS_NAME_2 [==["\(\)\ \#"]==]) + run_ctest(NameContainsEscapedSpecialChars4) +endfunction() +run_NameContainsEscapedSpecialChars4_test() + + +function(run_NameContainsGeneratorExpressionSyntax1_test) + set(CASE_CMAKELISTS_NAME_1 [==[ $<BOOL:0> ]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ $<BOOL:0> ]==]) + run_ctest(NameContainsGeneratorExpressionSyntax1) +endfunction() +run_NameContainsGeneratorExpressionSyntax1_test() + +function(run_NameContainsGeneratorExpressionSyntax2_test) + set(CASE_CMAKELISTS_NAME_1 [==["$<BOOL:0>"]==]) + set(CASE_CMAKELISTS_NAME_2 [==["$<BOOL:0>"]==]) + run_ctest(NameContainsGeneratorExpressionSyntax2) +endfunction() +run_NameContainsGeneratorExpressionSyntax2_test() + +function(run_NameContainsGeneratorExpressionSyntax3_test) + set(CASE_CMAKELISTS_NAME_1 [==["$<BOOL:0>"]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ $<BOOL:0> ]==]) + run_ctest(NameContainsGeneratorExpressionSyntax3) +endfunction() +run_NameContainsGeneratorExpressionSyntax3_test() + +function(run_NameContainsGeneratorExpressionSyntax4_test) + set(CASE_CMAKELISTS_NAME_1 [==[ $<BOOL:0> ]==]) + set(CASE_CMAKELISTS_NAME_2 [==["$<BOOL:0>"]==]) + run_ctest(NameContainsGeneratorExpressionSyntax4) +endfunction() +run_NameContainsGeneratorExpressionSyntax4_test() + + +function(run_NameContainsSpaces1_test) + set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest SuffixTest"]==]) + set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest SuffixTest"]==]) + run_ctest(NameContainsSpaces1) +endfunction() +run_NameContainsSpaces1_test() + +function(run_NameContainsSpaces2_test) + set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest SuffixTest ]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest SuffixTest ]==]) + run_ctest(NameContainsSpaces2) +endfunction() +run_NameContainsSpaces2_test() + +function(run_NameContainsSpaces3_test) + set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest SuffixTest"]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest SuffixTest ]==]) + run_ctest(NameContainsSpaces3) +endfunction() +run_NameContainsSpaces3_test() + +function(run_NameContainsSpaces4_test) + set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest SuffixTest ]==]) + set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest SuffixTest"]==]) + run_ctest(NameContainsSpaces4) +endfunction() +run_NameContainsSpaces4_test() + + +function(run_NameContainsSemicolon1_test) + set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest;SuffixTest"]==]) + set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest;SuffixTest"]==]) + run_ctest(NameContainsSemicolon1) +endfunction() +run_NameContainsSemicolon1_test() + +function(run_NameContainsSemicolon2_test) + set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest;SuffixTest ]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest;SuffixTest ]==]) + run_ctest(NameContainsSemicolon2) +endfunction() +run_NameContainsSemicolon2_test() + +function(run_NameContainsSemicolon3_test) + set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest;SuffixTest"]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest;SuffixTest ]==]) + run_ctest(NameContainsSemicolon3) +endfunction() +run_NameContainsSemicolon3_test() + +function(run_NameContainsSemicolon4_test) + set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest;SuffixTest ]==]) + set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest;SuffixTest"]==]) + run_ctest(NameContainsSemicolon4) +endfunction() +run_NameContainsSemicolon4_test() + + +function(run_NameContainsEscapedQuote1_test) + set(CASE_CMAKELISTS_NAME_1 [==["EscapedQuote\"\"SuffixTest"]==]) + set(CASE_CMAKELISTS_NAME_2 [==["EscapedQuote\"\"SuffixTest"]==]) + run_ctest(NameContainsEscapedQuote1) +endfunction() +run_NameContainsEscapedQuote1_test() + +function(run_NameContainsEscapedQuote2_test) + set(CASE_CMAKELISTS_NAME_1 [==[ EscapedQuote\"\"SuffixTest ]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ EscapedQuote\"\"SuffixTest ]==]) + run_ctest(NameContainsEscapedQuote2) +endfunction() +run_NameContainsEscapedQuote2_test() + +function(run_NameContainsEscapedQuote3_test) + set(CASE_CMAKELISTS_NAME_1 [==["EscapedQuote\"\"SuffixTest"]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ EscapedQuote\"\"SuffixTest ]==]) + run_ctest(NameContainsEscapedQuote3) +endfunction() +run_NameContainsEscapedQuote3_test() + +function(run_NameContainsEscapedQuote4_test) + set(CASE_CMAKELISTS_NAME_1 [==[ EscapedQuote\"\"SuffixTest ]==]) + set(CASE_CMAKELISTS_NAME_2 [==["EscapedQuote\"\"SuffixTest"]==]) + run_ctest(NameContainsEscapedQuote4) +endfunction() +run_NameContainsEscapedQuote4_test() + + +function(run_NameContainsBracketArgument1_test) + set(CASE_CMAKELISTS_NAME_1 [==["[=[BracketArgument;SuffixTest]=]"]==]) + set(CASE_CMAKELISTS_NAME_2 [==["[=[BracketArgument;SuffixTest]=]"]==]) + run_ctest(NameContainsBracketArgument1) +endfunction() +run_NameContainsBracketArgument1_test() + +function(run_NameContainsBracketArgument2_test) + set(CASE_CMAKELISTS_NAME_1 [==[ [=[BracketArgument;SuffixTest]=] ]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ [=[BracketArgument;SuffixTest]=] ]==]) + run_ctest(NameContainsBracketArgument2) +endfunction() +run_NameContainsBracketArgument2_test() + +function(run_NameContainsBracketArgument3_test) + set(CASE_CMAKELISTS_NAME_1 [==["[=[BracketArgument;SuffixTest]=]"]==]) + set(CASE_CMAKELISTS_NAME_2 [==[ [=[BracketArgument;SuffixTest]=] ]==]) + run_ctest(NameContainsBracketArgument3) +endfunction() +run_NameContainsBracketArgument3_test() + +function(run_NameContainsBracketArgument4_test) + set(CASE_CMAKELISTS_NAME_1 [==[ [=[BracketArgument;SuffixTest]=] ]==]) + set(CASE_CMAKELISTS_NAME_2 [==["[=[BracketArgument;SuffixTest]=]"]==]) + run_ctest(NameContainsBracketArgument4) +endfunction() +run_NameContainsBracketArgument4_test() diff --git a/Tests/RunCMake/add_test/test.cmake.in b/Tests/RunCMake/add_test/test.cmake.in new file mode 100644 index 0000000..9821c1c --- /dev/null +++ b/Tests/RunCMake/add_test/test.cmake.in @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.17) + +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}") + +set(ctest_test_args "@CASE_CTEST_TEST_ARGS@") +ctest_start(Experimental) +ctest_configure() +#ctest_build() +ctest_test(${ctest_test_args}) diff --git a/Tests/RunCMake/cmake_command/RunCMakeTest.cmake b/Tests/RunCMake/cmake_command/RunCMakeTest.cmake deleted file mode 100644 index 2b6e7a2..0000000 --- a/Tests/RunCMake/cmake_command/RunCMakeTest.cmake +++ /dev/null @@ -1,13 +0,0 @@ -include(RunCMake) - -run_cmake(cmake_command_no_parameters) -run_cmake(cmake_command_unknown_meta_operation) -run_cmake(cmake_command_invoke_message) -run_cmake(cmake_command_invoke_message_fatal_error) -run_cmake(cmake_command_invoke_no_parameters) -run_cmake(cmake_command_invoke_unknown_function) -run_cmake(cmake_command_eval_message) -run_cmake(cmake_command_eval_message_fatal_error) -run_cmake(cmake_command_eval_no_code) -run_cmake(cmake_command_eval_no_parameters) -run_cmake(cmake_command_eval_variable_outside_message) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake deleted file mode 100644 index 9ef5e25..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(EVAL CODE message(WORKS!)) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt deleted file mode 100644 index 6a8a124..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at cmake_command_eval_message_fatal_error.cmake:1:EVAL:2 \(message\): - error! -Call Stack \(most recent call first\): - cmake_command_eval_message_fatal_error.cmake:1 \(cmake_command\) - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt deleted file mode 100644 index ee53312..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_eval_no_code.cmake:1 \(cmake_command\): - cmake_command called without CODE argument diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake deleted file mode 100644 index 22e1667..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(EVAL message "too many parameters") diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt deleted file mode 100644 index e9fc317..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_eval_no_parameters.cmake:1 \(cmake_command\): - cmake_command called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake deleted file mode 100644 index a5ba2c7..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(EVAL) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake deleted file mode 100644 index b7a06a5..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake +++ /dev/null @@ -1,2 +0,0 @@ -cmake_command(EVAL CODE "set(phrase \"WORKS!\")") -message(${phrase}) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake deleted file mode 100644 index 336d78a..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(INVOKE message WORKS!) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt deleted file mode 100644 index 2c9dab5..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at cmake_command_invoke_message_fatal_error.cmake:1 \(message\): - error! -Call Stack \(most recent call first\): - cmake_command_invoke_message_fatal_error.cmake:1 \(cmake_command\) - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake deleted file mode 100644 index 6b42764..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(INVOKE message FATAL_ERROR error!) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt deleted file mode 100644 index 7741b41..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_invoke_no_parameters.cmake:1 \(cmake_command\): - cmake_command called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake deleted file mode 100644 index b9c5e14..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(INVOKE) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt deleted file mode 100644 index 50a81a3..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_invoke_unknown_function.cmake:1 \(unknown\): - Unknown CMake command "unknown". diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake deleted file mode 100644 index f19a04b..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(INVOKE unknown) diff --git a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt deleted file mode 100644 index 772b604..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_no_parameters.cmake:1 \(cmake_command\): - cmake_command called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake b/Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake deleted file mode 100644 index b9c5e14..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(INVOKE) diff --git a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt deleted file mode 100644 index 7b9b915..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at cmake_command_unknown_meta_operation.cmake:1 \(cmake_command\): - cmake_command called with unknown meta-operation diff --git a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake b/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake deleted file mode 100644 index f7c77e5..0000000 --- a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake +++ /dev/null @@ -1 +0,0 @@ -cmake_command(UNKNOWN) diff --git a/Tests/RunCMake/cmake_command/CMakeLists.txt b/Tests/RunCMake/cmake_language/CMakeLists.txt index 2632ffa..2632ffa 100644 --- a/Tests/RunCMake/cmake_command/CMakeLists.txt +++ b/Tests/RunCMake/cmake_language/CMakeLists.txt diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake new file mode 100644 index 0000000..c556e42 --- /dev/null +++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake @@ -0,0 +1,23 @@ +include(RunCMake) + +run_cmake(no_parameters) +run_cmake(unknown_meta_operation) +run_cmake(call_double_evaluation) +run_cmake(call_expanded_command) +run_cmake(call_expanded_command_and_arguments) +run_cmake(call_expanded_command_with_explicit_argument) +run_cmake(call_expand_command_name) +run_cmake(call_expand_function_name) +run_cmake(call_message) +run_cmake(call_message_fatal_error) +run_cmake(call_no_parameters) +run_cmake(call_preserve_arguments) +run_cmake(call_unknown_function) +run_cmake(eval_expand_command_name) +run_cmake(eval_expanded_command_and_arguments) +run_cmake(eval_extra_parameters_between_eval_and_code) +run_cmake(eval_message) +run_cmake(eval_message_fatal_error) +run_cmake(eval_no_code) +run_cmake(eval_no_parameters) +run_cmake(eval_variable_outside_message) diff --git a/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt b/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt new file mode 100644 index 0000000..59a70bd --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt @@ -0,0 +1 @@ +var='\${foo}' diff --git a/Tests/RunCMake/cmake_language/call_double_evaluation.cmake b/Tests/RunCMake/cmake_language/call_double_evaluation.cmake new file mode 100644 index 0000000..cf8fc91 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_double_evaluation.cmake @@ -0,0 +1,2 @@ +set(var [[${foo}]]) +cmake_language(CALL cmake_language CALL message "var='${var}'") diff --git a/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt b/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/call_expand_command_name.cmake b/Tests/RunCMake/cmake_language/call_expand_command_name.cmake new file mode 100644 index 0000000..e03bb1f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_command_name.cmake @@ -0,0 +1,2 @@ +set (my_call "CALL") +cmake_language (${my_call} message "OK!") diff --git a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-result.txt b/Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-result.txt +++ b/Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt diff --git a/Tests/RunCMake/cmake_language/call_expand_function_name.cmake b/Tests/RunCMake/cmake_language/call_expand_function_name.cmake new file mode 100644 index 0000000..565a7df --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expand_function_name.cmake @@ -0,0 +1,11 @@ +function(some_function_1) + message(1) +endfunction() + +function(some_function_2) + message(2) +endfunction() + +set(function_version 1) + +cmake_language(CALL some_function_${function_version}) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/call_expanded_command.cmake b/Tests/RunCMake/cmake_language/call_expanded_command.cmake new file mode 100644 index 0000000..e76e612 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command.cmake @@ -0,0 +1,6 @@ +function (itsok) + message(OK!) +endfunction() + +set (cmd CALL itsok) +cmake_language (${cmd}) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-result.txt b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-result.txt +++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt new file mode 100644 index 0000000..e87e9bc --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at call_expanded_command_and_arguments.cmake:2 \(cmake_language\): + cmake_language called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake new file mode 100644 index 0000000..4ce6b34 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake @@ -0,0 +1,2 @@ +set(call_message CALL message a b) +cmake_language(${call_message}) diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake new file mode 100644 index 0000000..0563400 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake @@ -0,0 +1,2 @@ +set (cmd CALL message) +cmake_language (${cmd} "OK!") diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message-stderr.txt b/Tests/RunCMake/cmake_language/call_message-stderr.txt index cfc8694..cfc8694 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message-stderr.txt +++ b/Tests/RunCMake/cmake_language/call_message-stderr.txt diff --git a/Tests/RunCMake/cmake_language/call_message.cmake b/Tests/RunCMake/cmake_language/call_message.cmake new file mode 100644 index 0000000..31aefdf --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message.cmake @@ -0,0 +1 @@ +cmake_language(CALL message WORKS!) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-result.txt b/Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-result.txt +++ b/Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt diff --git a/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt new file mode 100644 index 0000000..83eb3d8 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at call_message_fatal_error.cmake:1 \(message\): + error! +Call Stack \(most recent call first\): + call_message_fatal_error.cmake:1 \(cmake_language\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake b/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake new file mode 100644 index 0000000..935b437 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake @@ -0,0 +1 @@ +cmake_language(CALL message FATAL_ERROR error!) diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-result.txt b/Tests/RunCMake/cmake_language/call_no_parameters-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-result.txt +++ b/Tests/RunCMake/cmake_language/call_no_parameters-result.txt diff --git a/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt new file mode 100644 index 0000000..9e2c08f --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at call_no_parameters.cmake:1 \(cmake_language\): + cmake_language called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_language/call_no_parameters.cmake b/Tests/RunCMake/cmake_language/call_no_parameters.cmake new file mode 100644 index 0000000..8353e08 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_no_parameters.cmake @@ -0,0 +1 @@ +cmake_language(CALL) diff --git a/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt b/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt new file mode 100644 index 0000000..8ec5483 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt @@ -0,0 +1,6 @@ +foo\(...\) +\[a;b\] +\[c;d\] +cmake_language\(CALL foo ...\) +\[a;b\] +\[c;d\] diff --git a/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake b/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake new file mode 100644 index 0000000..bfef0fd --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake @@ -0,0 +1,12 @@ +function(foo arg1 arg2) + math(EXPR last "${ARGC} - 1") + foreach(i RANGE 0 ${last}) + message("[${ARGV${i}}]") + endforeach() +endfunction() + +message("foo(...)") +foo("a;b" "c;d") + +message("cmake_language(CALL foo ...)") +cmake_language(CALL foo "a;b" "c;d") diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt b/Tests/RunCMake/cmake_language/call_unknown_function-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt +++ b/Tests/RunCMake/cmake_language/call_unknown_function-result.txt diff --git a/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt b/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt new file mode 100644 index 0000000..d09e708 --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at call_unknown_function.cmake:1 \(unknown\): + Unknown CMake command "unknown". diff --git a/Tests/RunCMake/cmake_language/call_unknown_function.cmake b/Tests/RunCMake/cmake_language/call_unknown_function.cmake new file mode 100644 index 0000000..efd6baf --- /dev/null +++ b/Tests/RunCMake/cmake_language/call_unknown_function.cmake @@ -0,0 +1 @@ +cmake_language(CALL unknown) diff --git a/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt b/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake b/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake new file mode 100644 index 0000000..2397232 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake @@ -0,0 +1,2 @@ +set (my_eval "EVAL") +cmake_language (${my_eval} CODE message("OK!")) diff --git a/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt new file mode 100644 index 0000000..d640661 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt @@ -0,0 +1 @@ +OK! diff --git a/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake new file mode 100644 index 0000000..f7d2d51 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake @@ -0,0 +1,2 @@ +set(cmd EVAL CODE [[message("OK!")]]) +cmake_language(${cmd}) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt +++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt diff --git a/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt new file mode 100644 index 0000000..d32054f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at eval_extra_parameters_between_eval_and_code.cmake:1 \(cmake_language\): + cmake_language called with unsupported arguments between EVAL and CODE + arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake new file mode 100644 index 0000000..7c004d7 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake @@ -0,0 +1 @@ +cmake_language(EVAL BAD CODE "message(BAD CODE)") diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt b/Tests/RunCMake/cmake_language/eval_message-stderr.txt index cfc8694..cfc8694 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt +++ b/Tests/RunCMake/cmake_language/eval_message-stderr.txt diff --git a/Tests/RunCMake/cmake_language/eval_message.cmake b/Tests/RunCMake/cmake_language/eval_message.cmake new file mode 100644 index 0000000..91edcdd --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message.cmake @@ -0,0 +1 @@ +cmake_language(EVAL CODE message(WORKS!)) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt b/Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt +++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt diff --git a/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt new file mode 100644 index 0000000..5cf11e3 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at eval_message_fatal_error.cmake:1:EVAL:2 \(message\): + error! +Call Stack \(most recent call first\): + eval_message_fatal_error.cmake:1 \(cmake_language\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake b/Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake index 22913de..72e155d 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake +++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake @@ -1,4 +1,4 @@ -cmake_command(EVAL CODE +cmake_language(EVAL CODE " message(FATAL_ERROR error!) " diff --git a/Tests/RunCMake/cmake_language/eval_no_code-result.txt b/Tests/RunCMake/cmake_language/eval_no_code-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_code-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt b/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt new file mode 100644 index 0000000..608ba88 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at eval_no_code.cmake:1 \(cmake_language\): + cmake_language called without CODE argument diff --git a/Tests/RunCMake/cmake_language/eval_no_code.cmake b/Tests/RunCMake/cmake_language/eval_no_code.cmake new file mode 100644 index 0000000..7f5bc21 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_code.cmake @@ -0,0 +1 @@ +cmake_language(EVAL message "too many parameters") diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt b/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt new file mode 100644 index 0000000..6166898 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at eval_no_parameters.cmake:1 \(cmake_language\): + cmake_language called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters.cmake b/Tests/RunCMake/cmake_language/eval_no_parameters.cmake new file mode 100644 index 0000000..e7ae808 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_no_parameters.cmake @@ -0,0 +1 @@ +cmake_language(EVAL) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt b/Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt index cfc8694..cfc8694 100644 --- a/Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt +++ b/Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt diff --git a/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake b/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake new file mode 100644 index 0000000..71f0457 --- /dev/null +++ b/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake @@ -0,0 +1,2 @@ +cmake_language(EVAL CODE "set(phrase \"WORKS!\")") +message(${phrase}) diff --git a/Tests/RunCMake/cmake_language/no_parameters-result.txt b/Tests/RunCMake/cmake_language/no_parameters-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/no_parameters-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/no_parameters-stderr.txt new file mode 100644 index 0000000..194bbe3 --- /dev/null +++ b/Tests/RunCMake/cmake_language/no_parameters-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at no_parameters.cmake:1 \(cmake_language\): + cmake_language called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_language/no_parameters.cmake b/Tests/RunCMake/cmake_language/no_parameters.cmake new file mode 100644 index 0000000..8353e08 --- /dev/null +++ b/Tests/RunCMake/cmake_language/no_parameters.cmake @@ -0,0 +1 @@ +cmake_language(CALL) diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt b/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt b/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt new file mode 100644 index 0000000..6a1d4fd --- /dev/null +++ b/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at unknown_meta_operation.cmake:1 \(cmake_language\): + cmake_language called with unknown meta-operation diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake b/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake new file mode 100644 index 0000000..699f36f --- /dev/null +++ b/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake @@ -0,0 +1 @@ +cmake_language(UNKNOWN) diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 34d4020..18ae793 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -107,3 +107,14 @@ add_test(NAME NotRunTest COMMAND ${CMAKE_COMMAND} -E true) run_ctest_test(stop-on-failure STOP_ON_FAILURE) endfunction() run_stop_on_failure() + +# Make sure environment gets logged +function(run_environment) + set(ENV{BAD_ENVIRONMENT_VARIABLE} "Bad environment variable") + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +set_property(TEST RunCMakeVersion PROPERTY ENVIRONMENT "ENV1=env1;ENV2=env2") + ]]) + + run_ctest(TestEnvironment) +endfunction() +run_environment() diff --git a/Tests/RunCMake/ctest_test/TestEnvironment-check.cmake b/Tests/RunCMake/ctest_test/TestEnvironment-check.cmake new file mode 100644 index 0000000..91c9731 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestEnvironment-check.cmake @@ -0,0 +1,10 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/TAG" _tag) +string(REGEX REPLACE "^([^\n]*)\n.*$" "\\1" _date "${_tag}") +file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/${_date}/Test.xml" _test_contents) + +if(NOT _test_contents MATCHES "<Value>ENV1=env1\nENV2=env2\n#CTEST_RESOURCE_GROUP_COUNT=</Value>") + string(APPEND RunCMake_TEST_FAILED "Could not find expected environment variables in Test.xml") +endif() +if(_test_contents MATCHES "BAD_ENVIRONMENT_VARIABLE") + string(APPEND RunCMake_TEST_FAILED "Found BAD_ENVIRONMENT_VARIABLE in Test.xml") +endif() diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake index 6e36473..c4ee53d 100644 --- a/Tests/RunCMake/get_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake @@ -5,6 +5,7 @@ run_cmake(directory_properties) run_cmake(global_properties) run_cmake(install_properties) run_cmake(source_properties) +run_cmake(source_properties_failures) run_cmake(target_properties) run_cmake(test_properties) run_cmake(DebugConfigurations) diff --git a/Tests/RunCMake/get_property/source_properties_failures-result.txt b/Tests/RunCMake/get_property/source_properties_failures-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/source_properties_failures-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/source_properties_failures-stderr.txt b/Tests/RunCMake/get_property/source_properties_failures-stderr.txt new file mode 100644 index 0000000..a500e2e --- /dev/null +++ b/Tests/RunCMake/get_property/source_properties_failures-stderr.txt @@ -0,0 +1,66 @@ +^CMake Error at source_properties_failures.cmake:1 \(set_source_files_properties\): + set_source_files_properties called with incorrect number of arguments no + value provided to the DIRECTORY option +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:2 \(set_source_files_properties\): + set_source_files_properties given non-existent DIRECTORY non_existing_dir +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:3 \(set_source_files_properties\): + set_source_files_properties called with incorrect number of arguments no + value provided to the TARGET_DIRECTORY option +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:4 \(set_source_files_properties\): + set_source_files_properties given non-existent target for DIRECTORY_TARGET + non_existing_target +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:6 \(get_property\): + get_property called with incorrect number of arguments no value provided to + the DIRECTORY option +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:7 \(get_property\): + get_property given non-existent DIRECTORY non_existing_dir +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:8 \(get_property\): + get_property called with incorrect number of arguments no value provided to + the TARGET_DIRECTORY option +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:9 \(get_property\): + get_property given non-existent target for DIRECTORY_TARGET + non_existing_dir +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:11 \(get_source_file_property\): + get_source_file_property given non-existent DIRECTORY PROPERTY +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:12 \(get_source_file_property\): + get_source_file_property called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:13 \(get_source_file_property\): + get_source_file_property given non-existent target for DIRECTORY_TARGET + PROPERTY +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at source_properties_failures.cmake:14 \(get_source_file_property\): + get_source_file_property called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/get_property/source_properties_failures.cmake b/Tests/RunCMake/get_property/source_properties_failures.cmake new file mode 100644 index 0000000..f4b87f9 --- /dev/null +++ b/Tests/RunCMake/get_property/source_properties_failures.cmake @@ -0,0 +1,14 @@ +set_source_files_properties(a.txt DIRECTORY PROPERTIES COMPILE_DEFINITIONS "def") +set_source_files_properties(a.txt DIRECTORY non_existing_dir PROPERTIES COMPILE_DEFINITIONS "def") +set_source_files_properties(a.txt TARGET_DIRECTORY PROPERTIES COMPILE_DEFINITIONS "def") +set_source_files_properties(a.txt TARGET_DIRECTORY non_existing_target PROPERTIES COMPILE_DEFINITIONS "def") + +get_property(in_var SOURCE a.txt DIRECTORY PROPERTY COMPILE_DEFINITIONS) +get_property(in_var SOURCE a.txt DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS) +get_property(in_var SOURCE a.txt TARGET_DIRECTORY PROPERTY COMPILE_DEFINITIONS) +get_property(in_var SOURCE a.txt TARGET_DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS) + +get_source_file_property(in_var a.txt DIRECTORY PROPERTY COMPILE_DEFINITIONS) +get_source_file_property(in_var a.txt DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS) +get_source_file_property(in_var a.txt TARGET_DIRECTORY PROPERTY COMPILE_DEFINITIONS) +get_source_file_property(in_var a.txt TARGET_DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index bd0bbe3..a681c7e 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -174,6 +174,13 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs1) run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs2) elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") + if(DEFINED ENV{LDFLAGS}) + # Some setups prebake disable-new-dtags into LDFLAGS + set(new_ldflags $ENV{LDFLAGS}}) + string(REPLACE "-Wl,--disable-new-dtags" "" new_ldflags "${new_ldflags}") + set(ENV{LDFLAGS} "${new_ldflags}") + endif() + if(NOT CMAKE_C_COMPILER_ID MATCHES "^XL") run_install_test(file-GET_RUNTIME_DEPENDENCIES-linux) endif() diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index 8d4614c..692c6b9 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -9,6 +9,7 @@ run_cmake(LINK_OPTIONS) run_cmake(LINK_DIRECTORIES) run_cmake(LINK_LIBRARIES) run_cmake(SOURCES) +run_cmake(SOURCE_FILE) run_cmake(TYPE) run_cmake(USER_PROP) run_cmake(USER_PROP_INHERITED) diff --git a/Tests/RunCMake/set_property/SOURCE_FILE-result.txt b/Tests/RunCMake/set_property/SOURCE_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/set_property/SOURCE_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt b/Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt new file mode 100644 index 0000000..2e0b238 --- /dev/null +++ b/Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt @@ -0,0 +1,22 @@ +^CMake Error at SOURCE_FILE.cmake:1 \(set_property\): + set_property called with incorrect number of arguments no value provided to + the DIRECTORY option +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at SOURCE_FILE.cmake:2 \(set_property\): + set_property given non-existent DIRECTORY non_existing_dir +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at SOURCE_FILE.cmake:3 \(set_property\): + set_property called with incorrect number of arguments no value provided to + the TARGET_DIRECTORY option +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at SOURCE_FILE.cmake:4 \(set_property\): + set_property given non-existent target for DIRECTORY_TARGET + non_existing_target +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/set_property/SOURCE_FILE.cmake b/Tests/RunCMake/set_property/SOURCE_FILE.cmake new file mode 100644 index 0000000..b1d78bd --- /dev/null +++ b/Tests/RunCMake/set_property/SOURCE_FILE.cmake @@ -0,0 +1,4 @@ +set_property(SOURCE a.txt DIRECTORY PROPERTY COMPILE_DEFINITIONS "def") +set_property(SOURCE a.txt DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS "def") +set_property(SOURCE a.txt TARGET_DIRECTORY PROPERTY COMPILE_DEFINITIONS "def") +set_property(SOURCE a.txt TARGET_DIRECTORY non_existing_target PROPERTY COMPILE_DEFINITIONS "def") diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake index b919f48..8ef13f9 100644 --- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake @@ -50,10 +50,14 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") run_cmake_target(genex_DEVICE_LINK interface LinkOptions_shared_interface --config Release) run_cmake_target(genex_DEVICE_LINK private LinkOptions_private --config Release) if (CMake_TEST_CUDA) - run_cmake_target(genex_DEVICE_LINK CMP0105_UNSET LinkOptions_CMP0105_UNSET --config Release) - run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release) - run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release) - run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release) + # Separable compilation is only supported on NVCC. + if(NOT CMake_TEST_CUDA STREQUAL "Clang") + run_cmake_target(genex_DEVICE_LINK CMP0105_UNSET LinkOptions_CMP0105_UNSET --config Release) + run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release) + run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release) + run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release) + endif() + run_cmake_target(genex_DEVICE_LINK no_device LinkOptions_no_device --config Release) endif() diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt index a5740bb..d726395 100644 --- a/Tests/SourceGroups/CMakeLists.txt +++ b/Tests/SourceGroups/CMakeLists.txt @@ -30,6 +30,9 @@ source_group(Base\\Sub1\\Base FILES bar.c) # a group without files, is currently not created source_group(EmptyGroup) +# Forward slashes can be delimiters too +source_group(Base/Nested FILES nested.c) + set(root ${CMAKE_CURRENT_SOURCE_DIR}) set(tree_files_without_prefix ${root}/sub1/tree_bar.c @@ -58,4 +61,5 @@ source_group(PREFIX "" FILES ${tree_files_with_empty_prefix} TREE ${root}) add_executable(SourceGroups main.c bar.c foo.c sub1/foo.c sub1/foobar.c baz.c ${tree_files_with_prefix} ${tree_files_without_prefix} - ${tree_files_with_empty_prefix} README.txt) + ${tree_files_with_empty_prefix} README.txt + nested.c) diff --git a/Tests/SourceGroups/main.c b/Tests/SourceGroups/main.c index 87225f5..f646b49 100644 --- a/Tests/SourceGroups/main.c +++ b/Tests/SourceGroups/main.c @@ -12,6 +12,7 @@ extern int tree_empty_prefix_bar(void); extern int tree_bar(void); extern int tree_foobar(void); extern int tree_baz(void); +extern int nested(void); int main() { @@ -23,5 +24,8 @@ int main() "tree_empty_prefix_bar: %d\n", tree_prefix_foo(), tree_prefix_bar(), tree_bar(), tree_foobar(), tree_baz(), tree_empty_prefix_foo(), tree_empty_prefix_bar()); + + printf("nested: %d\n", nested()); + return 0; } diff --git a/Tests/SourceGroups/nested.c b/Tests/SourceGroups/nested.c new file mode 100644 index 0000000..4e31480 --- /dev/null +++ b/Tests/SourceGroups/nested.c @@ -0,0 +1,4 @@ +int nested(void) +{ + return 123; +} diff --git a/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.cpp b/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.cpp index 154e268..0c37370 100644 --- a/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.cpp +++ b/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.cpp @@ -1 +1 @@ -#include "MyForm.h"
\ No newline at end of file +#include "MyForm.h" |