diff options
Diffstat (limited to 'Tests')
160 files changed, 1394 insertions, 84 deletions
diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt index 1db00cc..5513af8 100644 --- a/Tests/ConfigSources/CMakeLists.txt +++ b/Tests/ConfigSources/CMakeLists.txt @@ -16,6 +16,72 @@ void config_$<CONFIG>() {} ]] ) +# Custom command outputs named with the configuration(s). +add_custom_command( + OUTPUT "custom1_$<CONFIG>.cpp" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/custom1.cpp.in" "custom1_$<CONFIG>.cpp" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/custom1.cpp.in + VERBATIM + ) +# Output path starts in a generator expression. +add_custom_command( + OUTPUT "$<1:custom2_$<CONFIG>.cpp>" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/custom2.cpp.in" "custom2_$<CONFIG>.cpp" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/custom2.cpp.in + VERBATIM + ) +# Source file generated as a custom command's byproduct. +add_custom_command( + OUTPUT custom3.txt + BYPRODUCTS "$<1:custom3_$<CONFIG>.cpp>" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/custom3.cpp.in" "custom3_$<CONFIG>.cpp" + COMMAND ${CMAKE_COMMAND} -E touch custom3.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/custom3.cpp.in + VERBATIM + ) +# Source file generated as a custom target's byproduct. +add_custom_target(custom4 + BYPRODUCTS "custom4_$<CONFIG>.cpp" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/custom4.cpp.in" "custom4_$<CONFIG>.cpp" + VERBATIM + ) +# Source file generated by appended custom command. +add_custom_command( + OUTPUT "custom5_$<CONFIG>.cpp" + COMMAND ${CMAKE_COMMAND} -E echo custom5_$<CONFIG>.cpp + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/custom5.cpp.in + VERBATIM + ) +add_custom_command(APPEND + OUTPUT "custom5_$<CONFIG>.cpp" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/custom5.cpp.in" "custom5_$<CONFIG>.cpp.in" + VERBATIM + ) +# Appending through any configuration's output affects all configurations. +if(CMAKE_CONFIGURATION_TYPES MATCHES ";([^;]+)$") + set(last_config "${CMAKE_MATCH_1}") +else() + set(last_config ${CMAKE_BUILD_TYPE}) +endif() +add_custom_command(APPEND + OUTPUT "custom5_${last_config}.cpp" + COMMAND ${CMAKE_COMMAND} -E copy "custom5_$<CONFIG>.cpp.in" "custom5_$<CONFIG>.cpp" + VERBATIM + ) +foreach(n RANGE 1 5) + set_property(SOURCE custom${n}_Debug.cpp PROPERTY COMPILE_DEFINITIONS CUSTOM_CFG_DEBUG) + foreach(other Release RelWithDebInfo MinSizeRel) + set_property(SOURCE custom${n}_${other}.cpp PROPERTY COMPILE_DEFINITIONS CUSTOM_CFG_OTHER) + endforeach() +endforeach() +add_library(Custom STATIC + custom1_$<CONFIG>.cpp + custom2_$<CONFIG>.cpp + custom3_$<CONFIG>.cpp custom3.txt + custom4_$<CONFIG>.cpp + custom5_$<CONFIG>.cpp + ) + # Per-config sources via INTERFACE_SOURCES. add_library(iface INTERFACE) target_sources(iface INTERFACE @@ -34,7 +100,7 @@ add_executable(ConfigSources $<$<CONFIG:NotAConfig>:does_not_exist.cpp> ${CMAKE_CURRENT_BINARY_DIR}/config_$<CONFIG>.cpp ) -target_link_libraries(ConfigSources iface) +target_link_libraries(ConfigSources Custom iface) # Per-config sources via LINK_LIBRARIES. add_library(iface_debug INTERFACE) @@ -53,6 +119,7 @@ target_compile_definitions(ConfigSourcesLink PRIVATE "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>" ) target_link_libraries(ConfigSourcesLink PRIVATE + Custom "$<$<CONFIG:Debug>:iface_debug>" "$<$<NOT:$<CONFIG:Debug>>:iface_other>" "$<$<CONFIG:NotAConfig>:iface_does_not_exist>" @@ -70,7 +137,7 @@ target_compile_definitions(ConfigSourcesLinkIface PRIVATE "$<$<CONFIG:Debug>:CFG_DEBUG>" "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>" ) -target_link_libraries(ConfigSourcesLinkIface ConfigSourcesIface) +target_link_libraries(ConfigSourcesLinkIface Custom ConfigSourcesIface) # A target with sources in only one configuration that is not the # first in CMAKE_CONFIGURATION_TYPES. diff --git a/Tests/ConfigSources/custom1.cpp.in b/Tests/ConfigSources/custom1.cpp.in new file mode 100644 index 0000000..e5f21c7 --- /dev/null +++ b/Tests/ConfigSources/custom1.cpp.in @@ -0,0 +1,13 @@ +#ifdef CUSTOM_CFG_DEBUG +int custom1_debug() +{ + return 0; +} +#endif + +#ifdef CUSTOM_CFG_OTHER +int custom1_other() +{ + return 0; +} +#endif diff --git a/Tests/ConfigSources/custom2.cpp.in b/Tests/ConfigSources/custom2.cpp.in new file mode 100644 index 0000000..438c1fd --- /dev/null +++ b/Tests/ConfigSources/custom2.cpp.in @@ -0,0 +1,13 @@ +#ifdef CUSTOM_CFG_DEBUG +int custom2_debug() +{ + return 0; +} +#endif + +#ifdef CUSTOM_CFG_OTHER +int custom2_other() +{ + return 0; +} +#endif diff --git a/Tests/ConfigSources/custom3.cpp.in b/Tests/ConfigSources/custom3.cpp.in new file mode 100644 index 0000000..4545b69 --- /dev/null +++ b/Tests/ConfigSources/custom3.cpp.in @@ -0,0 +1,13 @@ +#ifdef CUSTOM_CFG_DEBUG +int custom3_debug() +{ + return 0; +} +#endif + +#ifdef CUSTOM_CFG_OTHER +int custom3_other() +{ + return 0; +} +#endif diff --git a/Tests/ConfigSources/custom4.cpp.in b/Tests/ConfigSources/custom4.cpp.in new file mode 100644 index 0000000..8a8b2a8 --- /dev/null +++ b/Tests/ConfigSources/custom4.cpp.in @@ -0,0 +1,13 @@ +#ifdef CUSTOM_CFG_DEBUG +int custom4_debug() +{ + return 0; +} +#endif + +#ifdef CUSTOM_CFG_OTHER +int custom4_other() +{ + return 0; +} +#endif diff --git a/Tests/ConfigSources/custom5.cpp.in b/Tests/ConfigSources/custom5.cpp.in new file mode 100644 index 0000000..51f40ae --- /dev/null +++ b/Tests/ConfigSources/custom5.cpp.in @@ -0,0 +1,13 @@ +#ifdef CUSTOM_CFG_DEBUG +int custom5_debug() +{ + return 0; +} +#endif + +#ifdef CUSTOM_CFG_OTHER +int custom5_other() +{ + return 0; +} +#endif diff --git a/Tests/ConfigSources/main_debug.cpp b/Tests/ConfigSources/main_debug.cpp index 9b1e68a..ef776f8 100644 --- a/Tests/ConfigSources/main_debug.cpp +++ b/Tests/ConfigSources/main_debug.cpp @@ -7,7 +7,14 @@ #include "iface.h" +extern int custom1_debug(); +extern int custom2_debug(); +extern int custom3_debug(); +extern int custom4_debug(); +extern int custom5_debug(); + int main(int argc, char** argv) { - return iface_src() + iface_debug(); + return iface_src() + iface_debug() + custom1_debug() + custom2_debug() + + custom3_debug() + custom4_debug() + custom5_debug(); } diff --git a/Tests/ConfigSources/main_other.cpp b/Tests/ConfigSources/main_other.cpp index 3184a19..74f2156 100644 --- a/Tests/ConfigSources/main_other.cpp +++ b/Tests/ConfigSources/main_other.cpp @@ -7,7 +7,14 @@ #include "iface.h" +extern int custom1_other(); +extern int custom2_other(); +extern int custom3_other(); +extern int custom4_other(); +extern int custom5_other(); + int main(int argc, char** argv) { - return iface_src() + iface_other(); + return iface_src() + iface_other() + custom1_other() + custom2_other() + + custom3_other() + custom4_other() + custom5_other(); } diff --git a/Tests/ISPC/CMakeLists.txt b/Tests/ISPC/CMakeLists.txt index 2c3651d..c993275 100644 --- a/Tests/ISPC/CMakeLists.txt +++ b/Tests/ISPC/CMakeLists.txt @@ -7,6 +7,7 @@ macro (add_ispc_test_macro name) endmacro () add_ispc_test_macro(ISPC.ChainedStaticLibraries ISPCChainedStaticLibraries) +add_ispc_test_macro(ISPC.CustomHeaderSuffix ISPCCustomHeaderSuffix) add_ispc_test_macro(ISPC.Defines ISPCDefines) add_ispc_test_macro(ISPC.DynamicLibrary ISPCDynamicLibrary) add_ispc_test_macro(ISPC.ObjectGenex ISPCObjectGenex) diff --git a/Tests/ISPC/ChainedStaticLibraries/extra.cxx b/Tests/ISPC/ChainedStaticLibraries/extra.cxx index 88ef3a7..9f50df4 100644 --- a/Tests/ISPC/ChainedStaticLibraries/extra.cxx +++ b/Tests/ISPC/ChainedStaticLibraries/extra.cxx @@ -1,6 +1,6 @@ #include <stdio.h> -#include "extra.ispc.h" +#include "extra_ispc.h" int extra() { diff --git a/Tests/ISPC/ChainedStaticLibraries/main.cxx b/Tests/ISPC/ChainedStaticLibraries/main.cxx index 4f1c9be..a6b91a6 100644 --- a/Tests/ISPC/ChainedStaticLibraries/main.cxx +++ b/Tests/ISPC/ChainedStaticLibraries/main.cxx @@ -1,6 +1,6 @@ #include <stdio.h> -#include "simple.ispc.h" +#include "simple_ispc.h" int main() { diff --git a/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt b/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt new file mode 100644 index 0000000..d20f88e --- /dev/null +++ b/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt @@ -0,0 +1,23 @@ + +cmake_minimum_required(VERSION 3.18) +project(ISPCCustomHeaderSuffix CXX ISPC) + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_ISPC_FLAGS "--arch=x86") +endif() + +set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16") + +set(CMAKE_ISPC_HEADER_SUFFIX ".ispc.h") + +add_library(ispc_suffix_1 OBJECT simple.ispc) +add_library(ispc_suffix_2 OBJECT extra.ispc) + +set_target_properties(ispc_suffix_2 PROPERTIES ISPC_HEADER_SUFFIX "___ispc.h") + +set_target_properties(ispc_suffix_1 ispc_suffix_2 + PROPERTIES POSITION_INDEPENDENT_CODE ON +) + +add_executable(ISPCCustomHeaderSuffix main.cxx extra.cxx) +target_link_libraries(ISPCCustomHeaderSuffix PRIVATE ispc_suffix_1 ispc_suffix_2) diff --git a/Tests/ISPC/CustomHeaderSuffix/extra.cxx b/Tests/ISPC/CustomHeaderSuffix/extra.cxx new file mode 100644 index 0000000..0354e2d --- /dev/null +++ b/Tests/ISPC/CustomHeaderSuffix/extra.cxx @@ -0,0 +1,17 @@ +#include <stdio.h> + +#include "extra___ispc.h" + +int extra() +{ + float vin[16], vout[16]; + for (int i = 0; i < 16; ++i) + vin[i] = i; + + ispc::extra(vin, vout, 16); + + for (int i = 0; i < 16; ++i) + printf("%d: extra(%f) = %f\n", i, vin[i], vout[i]); + + return 0; +} diff --git a/Tests/ISPC/CustomHeaderSuffix/extra.ispc b/Tests/ISPC/CustomHeaderSuffix/extra.ispc new file mode 100644 index 0000000..5a4a442 --- /dev/null +++ b/Tests/ISPC/CustomHeaderSuffix/extra.ispc @@ -0,0 +1,12 @@ + +export void extra(uniform float vin[], uniform float vout[], + uniform int count) { + foreach (index = 0 ... count) { + float v = vin[index]; + if (v < 3.) + v = v * v; + else + v = sqrt(v); + vout[index] = v; + } +} diff --git a/Tests/ISPC/CustomHeaderSuffix/main.cxx b/Tests/ISPC/CustomHeaderSuffix/main.cxx new file mode 100644 index 0000000..4f1c9be --- /dev/null +++ b/Tests/ISPC/CustomHeaderSuffix/main.cxx @@ -0,0 +1,15 @@ +#include <stdio.h> + +#include "simple.ispc.h" + +int main() +{ + float vin[16], vout[16]; + for (int i = 0; i < 16; ++i) + vin[i] = i; + + ispc::simple(vin, vout, 16); + + for (int i = 0; i < 16; ++i) + printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]); +} diff --git a/Tests/ISPC/CustomHeaderSuffix/simple.ispc b/Tests/ISPC/CustomHeaderSuffix/simple.ispc new file mode 100644 index 0000000..70cb588 --- /dev/null +++ b/Tests/ISPC/CustomHeaderSuffix/simple.ispc @@ -0,0 +1,12 @@ + +export void simple(uniform float vin[], uniform float vout[], + uniform int count) { + foreach (index = 0 ... count) { + float v = vin[index]; + if (v < 3.) + v = v * v; + else + v = sqrt(v); + vout[index] = v; + } +} diff --git a/Tests/ISPC/Defines/main.cxx b/Tests/ISPC/Defines/main.cxx index 4f1c9be..a6b91a6 100644 --- a/Tests/ISPC/Defines/main.cxx +++ b/Tests/ISPC/Defines/main.cxx @@ -1,6 +1,6 @@ #include <stdio.h> -#include "simple.ispc.h" +#include "simple_ispc.h" int main() { diff --git a/Tests/ISPC/DynamicLibrary/extra.cxx b/Tests/ISPC/DynamicLibrary/extra.cxx index b3623d1..a3d89ed 100644 --- a/Tests/ISPC/DynamicLibrary/extra.cxx +++ b/Tests/ISPC/DynamicLibrary/extra.cxx @@ -1,6 +1,6 @@ #include <stdio.h> -#include "extra.ispc.h" +#include "extra_ispc.h" #ifdef _WIN32 # define EXPORT __declspec(dllexport) diff --git a/Tests/ISPC/DynamicLibrary/simple.cxx b/Tests/ISPC/DynamicLibrary/simple.cxx index cb5a779..bc78bda 100644 --- a/Tests/ISPC/DynamicLibrary/simple.cxx +++ b/Tests/ISPC/DynamicLibrary/simple.cxx @@ -1,6 +1,6 @@ #include <stdio.h> -#include "simple.ispc.h" +#include "simple_ispc.h" #ifdef _WIN32 # define EXPORT __declspec(dllexport) diff --git a/Tests/ISPC/ObjectLibrary/extra.cxx b/Tests/ISPC/ObjectLibrary/extra.cxx index 88ef3a7..9f50df4 100644 --- a/Tests/ISPC/ObjectLibrary/extra.cxx +++ b/Tests/ISPC/ObjectLibrary/extra.cxx @@ -1,6 +1,6 @@ #include <stdio.h> -#include "extra.ispc.h" +#include "extra_ispc.h" int extra() { diff --git a/Tests/ISPC/ObjectLibrary/main.cxx b/Tests/ISPC/ObjectLibrary/main.cxx index 4f1c9be..a6b91a6 100644 --- a/Tests/ISPC/ObjectLibrary/main.cxx +++ b/Tests/ISPC/ObjectLibrary/main.cxx @@ -1,6 +1,6 @@ #include <stdio.h> -#include "simple.ispc.h" +#include "simple_ispc.h" int main() { diff --git a/Tests/ISPC/ResponseAndDefine/main.cxx b/Tests/ISPC/ResponseAndDefine/main.cxx index 4f1c9be..a6b91a6 100644 --- a/Tests/ISPC/ResponseAndDefine/main.cxx +++ b/Tests/ISPC/ResponseAndDefine/main.cxx @@ -1,6 +1,6 @@ #include <stdio.h> -#include "simple.ispc.h" +#include "simple_ispc.h" int main() { diff --git a/Tests/ISPC/StaticLibrary/main.cxx b/Tests/ISPC/StaticLibrary/main.cxx index 4f1c9be..a6b91a6 100644 --- a/Tests/ISPC/StaticLibrary/main.cxx +++ b/Tests/ISPC/StaticLibrary/main.cxx @@ -1,6 +1,6 @@ #include <stdio.h> -#include "simple.ispc.h" +#include "simple_ispc.h" int main() { diff --git a/Tests/ISPC/SystemIncludes/CMakeLists.txt b/Tests/ISPC/SystemIncludes/CMakeLists.txt index 95959b2..d94e75e 100644 --- a/Tests/ISPC/SystemIncludes/CMakeLists.txt +++ b/Tests/ISPC/SystemIncludes/CMakeLists.txt @@ -4,8 +4,10 @@ project(ispc_spaces_in_path ISPC CXX) add_executable(ISPCSystemIncludes main.cxx simple.ispc) set_target_properties(ISPCSystemIncludes PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_target_properties(ISPCSystemIncludes PROPERTIES ISPC_HEADER_SUFFIX ".ispc.h") target_include_directories(ISPCSystemIncludes SYSTEM PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") + target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>") if(CMAKE_SIZEOF_VOID_P EQUAL 4) target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>") diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 0cab867..540a718 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -288,6 +288,7 @@ add_RunCMake_test(ToolchainFile) add_RunCMake_test(find_dependency) add_RunCMake_test(CompileDefinitions) add_RunCMake_test(CompileFeatures) +add_RunCMake_test(Policy) add_RunCMake_test(PolicyScope) add_RunCMake_test(WriteBasicConfigVersionFile) add_RunCMake_test(WriteCompilerDetectionHeader) @@ -316,7 +317,10 @@ 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>) +set(execute_process_ARGS + -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code> + -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} + ) if(NOT CMake_TEST_EXTERNAL_CMAKE) list(APPEND execute_process_ARGS -DTEST_ENCODING_EXE=$<TARGET_FILE:testEncoding>) endif() diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json index a7106fc..483ae79 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json @@ -7,7 +7,7 @@ "isGeneratorProvided": null, "sources": [ { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/custom_tgt$", + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/custom_tgt(-(Debug|Release|RelWithDebInfo|MinSizeRel))?$", "isGenerated": true, "sourceGroupName": "", "compileGroupLanguage": null, @@ -27,7 +27,7 @@ ] }, { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(custom/)?CMakeFiles/([0-9a-f]+/)?custom_tgt\\.rule$", + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(custom/)?CMakeFiles/([0-9a-f]+/)?custom_tgt(-\\(CONFIG\\))?\\.rule$", "isGenerated": true, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, @@ -45,13 +45,13 @@ { "name": "", "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/custom_tgt$" + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/custom_tgt(-(Debug|Release|RelWithDebInfo|MinSizeRel))?$" ] }, { "name": "CMake Rules", "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(custom/)?CMakeFiles/([0-9a-f]+/)?custom_tgt\\.rule$" + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(custom/)?CMakeFiles/([0-9a-f]+/)?custom_tgt(-\\(CONFIG\\))?\\.rule$" ] } ], diff --git a/Tests/RunCMake/File_Configure/AtOnly.cmake b/Tests/RunCMake/File_Configure/AtOnly.cmake new file mode 100644 index 0000000..cc5304a --- /dev/null +++ b/Tests/RunCMake/File_Configure/AtOnly.cmake @@ -0,0 +1,12 @@ +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/atonly.txt) +set(var_a "a") +set(var_b "b") +file(CONFIGURE + OUTPUT ${file_name} + CONTENT "-->@var_a@<-- -->${var_b}<--" + @ONLY +) +file(READ ${file_name} file_content) +if(NOT file_content STREQUAL "-->a<-- -->${var_b}<--") + message(FATAL_ERROR "@ONLY doesn't work") +endif() diff --git a/Tests/RunCMake/File_Configure/BadArg-stderr.txt b/Tests/RunCMake/File_Configure/BadArg-stderr.txt deleted file mode 100644 index 5423a28..0000000 --- a/Tests/RunCMake/File_Configure/BadArg-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at BadArg.cmake:[0-9]+ \(file\): - file Incorrect arguments to CONFIGURE subcommand. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Configure/BadArgContent-result.txt b/Tests/RunCMake/File_Configure/BadArgContent-result.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/File_Configure/BadArgContent-result.txt diff --git a/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt b/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt new file mode 100644 index 0000000..a6ea314 --- /dev/null +++ b/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at BadArgContent.cmake:[0-9]+ \(file\): + file CONFIGURE CONTENT option needs a value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Configure/BadArgContent.cmake b/Tests/RunCMake/File_Configure/BadArgContent.cmake new file mode 100644 index 0000000..282dc18 --- /dev/null +++ b/Tests/RunCMake/File_Configure/BadArgContent.cmake @@ -0,0 +1 @@ +file(CONFIGURE CONTENT) diff --git a/Tests/RunCMake/File_Configure/BadArg-result.txt b/Tests/RunCMake/File_Configure/BadArgOutput-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/File_Configure/BadArg-result.txt +++ b/Tests/RunCMake/File_Configure/BadArgOutput-result.txt diff --git a/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt b/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt new file mode 100644 index 0000000..b5a924c --- /dev/null +++ b/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at BadArgOutput.cmake:[0-9]+ \(file\): + file CONFIGURE OUTPUT option needs a value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Configure/BadArg.cmake b/Tests/RunCMake/File_Configure/BadArgOutput.cmake index 7c7fcda..7c7fcda 100644 --- a/Tests/RunCMake/File_Configure/BadArg.cmake +++ b/Tests/RunCMake/File_Configure/BadArgOutput.cmake diff --git a/Tests/RunCMake/File_Configure/EscapeQuotes.cmake b/Tests/RunCMake/File_Configure/EscapeQuotes.cmake new file mode 100644 index 0000000..1136c87 --- /dev/null +++ b/Tests/RunCMake/File_Configure/EscapeQuotes.cmake @@ -0,0 +1,12 @@ +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/escape_quotes.txt) +set(var "\t") +set(ref "${var}") +file(CONFIGURE + CONTENT "-->@ref@<--" + OUTPUT ${file_name} + ESCAPE_QUOTES +) +file(READ ${file_name} file_content) +if(NOT file_content MATCHES "^-->\t<--$") + message(FATAL_ERROR "ESCAPE_QUOTES doesn't work") +endif() diff --git a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake index e79de79..5022985 100644 --- a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake @@ -1,10 +1,14 @@ include(RunCMake) run_cmake(AngleBracketsContent) -run_cmake(BadArg) +run_cmake(BadArgOutput) +run_cmake(BadArgContent) run_cmake(BadArgGeneratorExpressionOutput) +run_cmake(UnrecognizedArgs) run_cmake(DirOutput) run_cmake(NewLineStyle-NoArg) run_cmake(NewLineStyle-ValidArg) run_cmake(NewLineStyle-WrongArg) run_cmake(SubDir) +run_cmake(AtOnly) +run_cmake(EscapeQuotes) diff --git a/Tests/RunCMake/File_Configure/UnrecognizedArgs-result.txt b/Tests/RunCMake/File_Configure/UnrecognizedArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Configure/UnrecognizedArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Configure/UnrecognizedArgs-stderr.txt b/Tests/RunCMake/File_Configure/UnrecognizedArgs-stderr.txt new file mode 100644 index 0000000..1dd1a20 --- /dev/null +++ b/Tests/RunCMake/File_Configure/UnrecognizedArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at UnrecognizedArgs.cmake:[0-9]+ \(file\): + file CONFIGURE Unrecognized argument: "INPUT" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/File_Configure/UnrecognizedArgs.cmake b/Tests/RunCMake/File_Configure/UnrecognizedArgs.cmake new file mode 100644 index 0000000..93ea7b5 --- /dev/null +++ b/Tests/RunCMake/File_Configure/UnrecognizedArgs.cmake @@ -0,0 +1 @@ +file(CONFIGURE INPUT) diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..cc2e49a --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating depend_echo_genex_Debug\.txt +depend_echo_genex_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex-debug-ninja-stdout.txt new file mode 100644 index 0000000..cc2e49a --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating depend_echo_genex_Debug\.txt +depend_echo_genex_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_cmd-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_cmd-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..214e747 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_cmd-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Release[\/]echo(\.exe)? +\[3/3\] Generating depend_echo_genex_cmd_Debug\.txt +depend_echo_genex_cmd_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_cmd-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_cmd-debug-ninja-stdout.txt new file mode 100644 index 0000000..842336d --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_cmd-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating depend_echo_genex_cmd_Debug\.txt +depend_echo_genex_cmd_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_out-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_out-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..eafe30b --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_out-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating depend_echo_genex_out_Debug\.txt +depend_echo_genex_out_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_out-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_out-debug-ninja-stdout.txt new file mode 100644 index 0000000..eafe30b --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_genex_out-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating depend_echo_genex_out_Debug\.txt +depend_echo_genex_out_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_raw-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_raw-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..e7b74b9 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_raw-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Release[\/]echo(\.exe)? +\[3/3\] Generating depend_echo_raw_Debug\.txt +depend_echo_raw_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_raw-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_raw-debug-ninja-stdout.txt new file mode 100644 index 0000000..2e01d6a --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-depend_echo_raw-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating depend_echo_raw_Debug\.txt +depend_echo_raw_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..7455c25 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Debug\.txt +depend_Debug\.txt +\[2/2\] Generating echo_depend_Debug\.txt +echo_depend_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend-debug-ninja-stdout.txt new file mode 100644 index 0000000..7455c25 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Debug\.txt +depend_Debug\.txt +\[2/2\] Generating echo_depend_Debug\.txt +echo_depend_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_cmd-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_cmd-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..6d5620d --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_cmd-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Release\.txt +depend_Release\.txt +\[2/2\] Generating echo_depend_cmd_Debug\.txt +echo_depend_cmd_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_cmd-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_cmd-debug-ninja-stdout.txt new file mode 100644 index 0000000..2f0f1f1 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_cmd-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Debug\.txt +depend_Debug\.txt +\[2/2\] Generating echo_depend_cmd_Debug\.txt +echo_depend_cmd_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_out-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_out-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..39f5471 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_out-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Debug\.txt +depend_Debug\.txt +\[2/2\] Generating echo_depend_out_Debug\.txt +echo_depend_out_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_out-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_out-debug-ninja-stdout.txt new file mode 100644 index 0000000..39f5471 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_out-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Debug\.txt +depend_Debug\.txt +\[2/2\] Generating echo_depend_out_Debug\.txt +echo_depend_out_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..cc43cda --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Release[\/]echo(\.exe)? +\[3/3\] Generating echo_genex_Debug\.txt +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release[\/]echo(\.exe)?' 'Release' 'echo_genex_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex-debug-ninja-stdout.txt new file mode 100644 index 0000000..11985c6 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating echo_genex_Debug\.txt +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_genex_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex_out-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex_out-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..68a8cd1 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex_out-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating echo_genex_out_Debug\.txt +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_genex_out_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex_out-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex_out-debug-ninja-stdout.txt new file mode 100644 index 0000000..76b409d --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_genex_out-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating echo_genex_out_Debug\.txt +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_genex_out_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct-debug-in-release-graph-ninja-result.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct-debug-in-release-graph-ninja-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct-debug-in-release-graph-ninja-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct-debug-in-release-graph-ninja-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct-debug-in-release-graph-ninja-stderr.txt new file mode 100644 index 0000000..86f7995 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct-debug-in-release-graph-ninja-stderr.txt @@ -0,0 +1 @@ +ninja: error: 'echo_no_cross_byproduct_Debug\.txt', needed by 'CMakeFiles/echo_no_cross_byproduct-Debug', missing and no known rule to make it diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct-debug-ninja-stdout.txt new file mode 100644 index 0000000..1c74b71 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating echo_no_cross_byproduct_Debug\.txt +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_no_cross_byproduct_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct_if-debug-in-release-graph-ninja-result.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct_if-debug-in-release-graph-ninja-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct_if-debug-in-release-graph-ninja-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct_if-debug-in-release-graph-ninja-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct_if-debug-in-release-graph-ninja-stderr.txt new file mode 100644 index 0000000..e41cb17 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct_if-debug-in-release-graph-ninja-stderr.txt @@ -0,0 +1 @@ +ninja: error: 'echo_no_cross_byproduct_if_Debug\.txt', needed by 'CMakeFiles/echo_no_cross_byproduct_if-Debug', missing and no known rule to make it diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct_if-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct_if-debug-ninja-stdout.txt new file mode 100644 index 0000000..294d48b --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_byproduct_if-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating echo_no_cross_byproduct_if_Debug\.txt +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_no_cross_byproduct_if_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output-debug-in-release-graph-ninja-result.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output-debug-in-release-graph-ninja-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output-debug-in-release-graph-ninja-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output-debug-in-release-graph-ninja-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output-debug-in-release-graph-ninja-stderr.txt new file mode 100644 index 0000000..2ea22fa --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output-debug-in-release-graph-ninja-stderr.txt @@ -0,0 +1 @@ +ninja: error: 'echo_no_cross_output_Debug\.txt', needed by 'CMakeFiles/echo_no_cross_output-Debug', missing and no known rule to make it diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output-debug-ninja-stdout.txt new file mode 100644 index 0000000..1f4cc41 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating echo_no_cross_output\.txt, echo_no_cross_output_Debug\.txt +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_no_cross_output_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output_if-debug-in-release-graph-ninja-result.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output_if-debug-in-release-graph-ninja-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output_if-debug-in-release-graph-ninja-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output_if-debug-in-release-graph-ninja-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output_if-debug-in-release-graph-ninja-stderr.txt new file mode 100644 index 0000000..fde66ea --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output_if-debug-in-release-graph-ninja-stderr.txt @@ -0,0 +1 @@ +ninja: error: 'echo_no_cross_output_if_Debug\.txt', needed by 'CMakeFiles/echo_no_cross_output_if-Debug', missing and no known rule to make it diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output_if-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output_if-debug-ninja-stdout.txt new file mode 100644 index 0000000..dc31f3b --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_no_cross_output_if-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating echo_no_cross_output_a\.txt, echo_no_cross_output_if_Debug\.txt +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_no_cross_output_if_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_raw-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_raw-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..01ebae3 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_raw-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Release[\/]echo(\.exe)? +\[3/3\] Generating echo_raw_Debug\.txt +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release[\/]echo(\.exe)?' 'Debug' 'echo_raw_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_raw-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_raw-debug-ninja-stdout.txt new file mode 100644 index 0000000..242c9b0 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_raw-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] Generating echo_raw_Debug\.txt +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_raw_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..e77ef1a --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Debug\.txt +depend_Debug\.txt +\[2/2\] echo_target_depend +echo_target_depend_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend-debug-ninja-stdout.txt new file mode 100644 index 0000000..e77ef1a --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Debug\.txt +depend_Debug\.txt +\[2/2\] echo_target_depend +echo_target_depend_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_cmd-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_cmd-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..8196fcb --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_cmd-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Release\.txt +depend_Release\.txt +\[2/2\] echo_target_depend_cmd +echo_target_depend_cmd_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_cmd-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_cmd-debug-ninja-stdout.txt new file mode 100644 index 0000000..d45dcc2 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_cmd-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Debug\.txt +depend_Debug\.txt +\[2/2\] echo_target_depend_cmd +echo_target_depend_cmd_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_out-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_out-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..45f2e57 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_out-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,5 @@ +^(Recompacting log\.\.\. +)?\[1/2\] Generating depend_Debug\.txt +depend_Debug\.txt +\[2/2\] echo_target_depend_out +echo_target_depend_out_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_out-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_out-debug-ninja-stdout.txt new file mode 100644 index 0000000..d90a2f3 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_out-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/2\] Generating depend_Debug\.txt +depend_Debug\.txt +\[2/2\] echo_target_depend_out +echo_target_depend_out_Debug\.txt$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..73b403f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Release[\/]echo(\.exe)? +\[3/3\] echo_target_genex +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release[\/]echo(\.exe)?' 'Release' 'echo_target_genex_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex-debug-ninja-stdout.txt new file mode 100644 index 0000000..c374ce8 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] echo_target_genex +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_target_genex_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex_out-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex_out-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..ad6d6e0 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex_out-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] echo_target_genex_out +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_target_genex_out_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex_out-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex_out-debug-ninja-stdout.txt new file mode 100644 index 0000000..e819fdf --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_genex_out-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] echo_target_genex_out +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_target_genex_out_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_raw-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_raw-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..34df645 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_raw-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Release[\/]echo(\.exe)? +\[3/3\] echo_target_raw +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release[\/]echo(\.exe)?' 'Debug' 'echo_target_raw_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_raw-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_raw-debug-ninja-stdout.txt new file mode 100644 index 0000000..3fa5488 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_raw-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] echo_target_raw +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_target_raw_Debug\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_no_cross_byproduct-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_no_cross_byproduct-debug-in-release-graph-ninja-stdout.txt new file mode 100644 index 0000000..f504d98 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_no_cross_byproduct-debug-in-release-graph-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Release[\/]echo(\.exe)? +\[3/3\] target_no_cross_byproduct +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release[\/]echo(\.exe)?' 'Release' 'target_no_cross_byproduct\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_no_cross_byproduct-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_no_cross_byproduct-debug-ninja-stdout.txt new file mode 100644 index 0000000..6e933b2 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_no_cross_byproduct-debug-ninja-stdout.txt @@ -0,0 +1,4 @@ +^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj) +\[2/3\] Linking C executable Debug[\/]echo(\.exe)? +\[3/3\] target_no_cross_byproduct +'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'target_no_cross_byproduct\.txt'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake new file mode 100644 index 0000000..5d6f421 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake @@ -0,0 +1,167 @@ +enable_language(C) + +add_executable(echo echo.c) + +add_custom_command( + OUTPUT echo_raw_$<CONFIG>.txt + COMMAND echo $<CONFIG> echo_raw_$<CONFIG>.txt + WORKING_DIRECTORY $<CONFIG> + ) + +add_custom_command( + OUTPUT echo_genex_$<IF:$<CONFIG:Debug>,Debug,$<IF:$<CONFIG:Release>,Release,$<IF:$<CONFIG:MinSizeRel>,MinSizeRel,RelWithDebInfo>>>.txt + COMMAND $<TARGET_FILE:echo> $<COMMAND_CONFIG:$<CONFIG>> echo_genex_$<OUTPUT_CONFIG:$<CONFIG>>.txt + WORKING_DIRECTORY $<OUTPUT_CONFIG:$<CONFIG>> + ) + +add_custom_command( + OUTPUT echo_genex_out_$<CONFIG>.txt + COMMAND $<OUTPUT_CONFIG:$<TARGET_FILE:echo>> $<CONFIG> echo_genex_out_$<CONFIG>.txt + WORKING_DIRECTORY $<COMMAND_CONFIG:$<CONFIG>> + ) + +add_custom_command( + OUTPUT depend_$<CONFIG>.txt + COMMAND ${CMAKE_COMMAND} -E echo depend_$<CONFIG>.txt + ) + +add_custom_command( + OUTPUT echo_depend_$<CONFIG>.txt + COMMAND ${CMAKE_COMMAND} -E echo echo_depend_$<CONFIG>.txt + DEPENDS depend_$<CONFIG>.txt + ) + +add_custom_command( + OUTPUT echo_depend_out_$<CONFIG>.txt + COMMAND ${CMAKE_COMMAND} -E echo echo_depend_out_$<CONFIG>.txt + DEPENDS $<OUTPUT_CONFIG:depend_$<CONFIG>.txt> + ) + +add_custom_command( + OUTPUT echo_depend_cmd_$<CONFIG>.txt + COMMAND ${CMAKE_COMMAND} -E echo echo_depend_cmd_$<CONFIG>.txt + DEPENDS $<COMMAND_CONFIG:depend_$<CONFIG>.txt> + ) + +add_custom_command( + OUTPUT depend_echo_raw_$<CONFIG>.txt + COMMAND ${CMAKE_COMMAND} -E echo depend_echo_raw_$<CONFIG>.txt + DEPENDS echo + ) + +add_custom_command( + OUTPUT depend_echo_genex_$<CONFIG>.txt + COMMAND ${CMAKE_COMMAND} -E echo depend_echo_genex_$<CONFIG>.txt + DEPENDS $<TARGET_FILE:echo> + ) + +add_custom_command( + OUTPUT depend_echo_genex_out_$<CONFIG>.txt + COMMAND ${CMAKE_COMMAND} -E echo depend_echo_genex_out_$<CONFIG>.txt + DEPENDS $<OUTPUT_CONFIG:$<TARGET_FILE:echo>> + ) + +add_custom_command( + OUTPUT depend_echo_genex_cmd_$<CONFIG>.txt + COMMAND ${CMAKE_COMMAND} -E echo depend_echo_genex_cmd_$<CONFIG>.txt + DEPENDS $<COMMAND_CONFIG:$<TARGET_FILE:echo>> + ) + +# An OUTPUT that is not per-config prevents cross-config generation. +add_custom_command( + OUTPUT echo_no_cross_output.txt echo_no_cross_output_$<CONFIG>.txt + COMMAND echo $<CONFIG> echo_no_cross_output_$<CONFIG>.txt + WORKING_DIRECTORY $<CONFIG> + ) +add_custom_command( + OUTPUT echo_no_cross_output_$<IF:$<CONFIG:Debug>,a,b>.txt echo_no_cross_output_if_$<CONFIG>.txt + COMMAND echo $<CONFIG> echo_no_cross_output_if_$<CONFIG>.txt + WORKING_DIRECTORY $<CONFIG> + ) + +# BYPRODUCTS that are not per-config prevent cross-config generation. +add_custom_command( + OUTPUT echo_no_cross_byproduct_$<CONFIG>.txt + BYPRODUCTS echo_no_cross_byproduct.txt + COMMAND echo $<CONFIG> echo_no_cross_byproduct_$<CONFIG>.txt + WORKING_DIRECTORY $<CONFIG> + ) +add_custom_command( + OUTPUT echo_no_cross_byproduct_if_$<CONFIG>.txt + BYPRODUCTS echo_no_cross_byproduct_$<IF:$<CONFIG:Debug>,a,b>.txt + COMMAND echo $<CONFIG> echo_no_cross_byproduct_if_$<CONFIG>.txt + WORKING_DIRECTORY $<CONFIG> + ) + +foreach(case + echo_raw + echo_genex + echo_genex_out + echo_depend + echo_depend_out + echo_depend_cmd + depend + depend_echo_raw + depend_echo_genex + depend_echo_genex_out + depend_echo_genex_cmd + echo_no_cross_output + echo_no_cross_output_if + echo_no_cross_byproduct + echo_no_cross_byproduct_if + ) + set_property(SOURCE + ${CMAKE_CURRENT_BINARY_DIR}/${case}_Debug.txt + ${CMAKE_CURRENT_BINARY_DIR}/${case}_Release.txt + ${CMAKE_CURRENT_BINARY_DIR}/${case}_MinSizeRel.txt + ${CMAKE_CURRENT_BINARY_DIR}/${case}_RelWithDebInfo.txt + PROPERTY SYMBOLIC 1) + add_custom_target(${case} DEPENDS ${case}_$<CONFIG>.txt) +endforeach() + +add_custom_target(echo_target_raw + BYPRODUCTS echo_target_raw_$<CONFIG>.txt + COMMENT echo_target_raw + COMMAND echo $<CONFIG> echo_target_raw_$<CONFIG>.txt + WORKING_DIRECTORY $<CONFIG> + ) + +add_custom_target(echo_target_genex + BYPRODUCTS echo_target_genex_$<CONFIG>.txt + COMMENT echo_target_genex + COMMAND $<TARGET_FILE:echo> $<COMMAND_CONFIG:$<CONFIG>> echo_target_genex_$<OUTPUT_CONFIG:$<CONFIG>>.txt + WORKING_DIRECTORY $<OUTPUT_CONFIG:$<CONFIG>> + ) + +add_custom_target(echo_target_genex_out + BYPRODUCTS echo_target_genex_out_$<CONFIG>.txt + COMMENT echo_target_genex_out + COMMAND $<OUTPUT_CONFIG:$<TARGET_FILE:echo>> $<CONFIG> echo_target_genex_out_$<CONFIG>.txt + WORKING_DIRECTORY $<COMMAND_CONFIG:$<CONFIG>> + ) + +add_custom_target(echo_target_depend + COMMAND ${CMAKE_COMMAND} -E echo echo_target_depend_$<CONFIG>.txt + DEPENDS depend_$<CONFIG>.txt + COMMENT echo_target_depend + ) + +add_custom_target(echo_target_depend_out + COMMAND ${CMAKE_COMMAND} -E echo echo_target_depend_out_$<CONFIG>.txt + DEPENDS $<OUTPUT_CONFIG:depend_$<CONFIG>.txt> + COMMENT echo_target_depend_out + ) + +add_custom_target(echo_target_depend_cmd + COMMAND ${CMAKE_COMMAND} -E echo echo_target_depend_cmd_$<CONFIG>.txt + DEPENDS $<COMMAND_CONFIG:depend_$<CONFIG>.txt> + COMMENT echo_target_depend_cmd + ) + +# BYPRODUCTS that are not per-config block cross-configs. +add_custom_target(target_no_cross_byproduct + BYPRODUCTS target_no_cross_byproduct.txt + COMMENT target_no_cross_byproduct + COMMAND echo $<CONFIG> target_no_cross_byproduct.txt + WORKING_DIRECTORY $<CONFIG> + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 2411114..dc2db57 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -242,6 +242,102 @@ run_ninja(CustomCommandsAndTargets release-leaf-exe build-Release.ninja LeafExe) run_cmake_build(CustomCommandsAndTargets release-clean Release clean:all) run_ninja(CustomCommandsAndTargets release-leaf-byproduct build-Release.ninja main.c) +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandOutputGenex-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_CROSS_CONFIGS=all") +run_cmake_configure(CustomCommandOutputGenex) +set(RunCMake_TEST_NO_CLEAN 1) +unset(RunCMake_TEST_OPTIONS) +# echo_raw +run_ninja(CustomCommandOutputGenex echo_raw-debug build-Debug.ninja echo_raw:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex echo_raw-debug-in-release-graph build-Release.ninja echo_raw:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# echo_genex +run_ninja(CustomCommandOutputGenex echo_genex-debug build-Debug.ninja echo_genex:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex echo_genex-debug-in-release-graph build-Release.ninja echo_genex:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# echo_genex_out +run_ninja(CustomCommandOutputGenex echo_genex_out-debug build-Debug.ninja echo_genex_out:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex echo_genex_out-debug-in-release-graph build-Release.ninja echo_genex_out:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# echo_depend* +run_ninja(CustomCommandOutputGenex echo_depend-debug build-Debug.ninja echo_depend:Debug) +run_ninja(CustomCommandOutputGenex echo_depend_out-debug build-Debug.ninja echo_depend_out_Debug.txt) +run_ninja(CustomCommandOutputGenex echo_depend_cmd-debug build-Debug.ninja echo_depend_cmd_Debug.txt) +run_ninja(CustomCommandOutputGenex echo_depend-debug-in-release-graph build-Release.ninja echo_depend:Debug) +run_ninja(CustomCommandOutputGenex echo_depend_out-debug-in-release-graph build-Release.ninja echo_depend_out_Debug.txt) +run_ninja(CustomCommandOutputGenex echo_depend_cmd-debug-in-release-graph build-Release.ninja echo_depend_cmd_Debug.txt) +# depend_echo_raw +run_ninja(CustomCommandOutputGenex depend_echo_raw-debug build-Debug.ninja depend_echo_raw:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex depend_echo_raw-debug-in-release-graph build-Release.ninja depend_echo_raw:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# depend_echo_genex +run_ninja(CustomCommandOutputGenex depend_echo_genex-debug build-Debug.ninja depend_echo_genex:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex depend_echo_genex-debug-in-release-graph build-Release.ninja depend_echo_genex:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# depend_echo_genex_out +run_ninja(CustomCommandOutputGenex depend_echo_genex_out-debug build-Debug.ninja depend_echo_genex_out:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex depend_echo_genex_out-debug-in-release-graph build-Release.ninja depend_echo_genex_out:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# depend_echo_genex_cmd +run_ninja(CustomCommandOutputGenex depend_echo_genex_cmd-debug build-Debug.ninja depend_echo_genex_cmd:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex depend_echo_genex_cmd-debug-in-release-graph build-Release.ninja depend_echo_genex_cmd:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# no_cross_output +run_ninja(CustomCommandOutputGenex echo_no_cross_output-debug build-Debug.ninja echo_no_cross_output:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex echo_no_cross_output-debug-in-release-graph build-Release.ninja echo_no_cross_output:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# no_cross_output_if +run_ninja(CustomCommandOutputGenex echo_no_cross_output_if-debug build-Debug.ninja echo_no_cross_output_if:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex echo_no_cross_output_if-debug-in-release-graph build-Release.ninja echo_no_cross_output_if:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# no_cross_byproduct +run_ninja(CustomCommandOutputGenex echo_no_cross_byproduct-debug build-Debug.ninja echo_no_cross_byproduct:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex echo_no_cross_byproduct-debug-in-release-graph build-Release.ninja echo_no_cross_byproduct:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# no_cross_byproduct_if +run_ninja(CustomCommandOutputGenex echo_no_cross_byproduct_if-debug build-Debug.ninja echo_no_cross_byproduct_if:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex echo_no_cross_byproduct_if-debug-in-release-graph build-Release.ninja echo_no_cross_byproduct_if:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# echo_target_raw +run_ninja(CustomCommandOutputGenex echo_target_raw-debug build-Debug.ninja echo_target_raw:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex echo_target_raw-debug-in-release-graph build-Release.ninja echo_target_raw:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# echo_target_genex +run_ninja(CustomCommandOutputGenex echo_target_genex-debug build-Debug.ninja echo_target_genex:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex echo_target_genex-debug-in-release-graph build-Release.ninja echo_target_genex:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# echo_target_genex_out +run_ninja(CustomCommandOutputGenex echo_target_genex_out-debug build-Debug.ninja echo_target_genex_out:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex echo_target_genex_out-debug-in-release-graph build-Release.ninja echo_target_genex_out:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +# echo_target_depend* +run_ninja(CustomCommandOutputGenex echo_target_depend-debug build-Debug.ninja echo_target_depend:Debug) +run_ninja(CustomCommandOutputGenex echo_target_depend_out-debug build-Debug.ninja echo_target_depend_out:Debug) +run_ninja(CustomCommandOutputGenex echo_target_depend_cmd-debug build-Debug.ninja CMakeFiles/echo_target_depend_cmd-Debug) # undocumented +run_ninja(CustomCommandOutputGenex echo_target_depend-debug-in-release-graph build-Release.ninja echo_target_depend:Debug) +run_ninja(CustomCommandOutputGenex echo_target_depend_out-debug-in-release-graph build-Release.ninja echo_target_depend_out:Debug) +run_ninja(CustomCommandOutputGenex echo_target_depend_cmd-debug-in-release-graph build-Release.ninja CMakeFiles/echo_target_depend_cmd-Debug) # undocumented +# target_no_cross_* +run_ninja(CustomCommandOutputGenex target_no_cross_byproduct-debug build-Debug.ninja target_no_cross_byproduct:Debug) +run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean) +run_ninja(CustomCommandOutputGenex target_no_cross_byproduct-debug-in-release-graph build-Release.ninja target_no_cross_byproduct:Debug) +run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean) +unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_BINARY_DIR) run_cmake(CustomCommandDepfile) diff --git a/Tests/RunCMake/NinjaMultiConfig/echo.c b/Tests/RunCMake/NinjaMultiConfig/echo.c new file mode 100644 index 0000000..48a187f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/echo.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#if defined(_WIN32) +# include <direct.h> +# define getcwd _getcwd +#else +# include <unistd.h> +#endif + +int main(int argc, char** argv) +{ + int i; + char cwd[1024]; + if (getcwd(cwd, sizeof(cwd)) != NULL) { + printf("'%s'$", cwd); + } + for (i = 0; i < argc; ++i) { + printf(" '%s'", argv[i]); + } + printf("\n"); + return 0; +} diff --git a/Tests/RunCMake/Policy/CMakeLists.txt b/Tests/RunCMake/Policy/CMakeLists.txt new file mode 100644 index 0000000..667561e --- /dev/null +++ b/Tests/RunCMake/Policy/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/Policy/InvalidMaxVersion-result.txt b/Tests/RunCMake/Policy/InvalidMaxVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidMaxVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Policy/InvalidMaxVersion-stderr.txt b/Tests/RunCMake/Policy/InvalidMaxVersion-stderr.txt new file mode 100644 index 0000000..25d22f5 --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidMaxVersion-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at InvalidMaxVersion.cmake:[0-9]+ \(cmake_policy\): + Invalid policy max version value "[A-Za-z0-9]+.[A-Za-z0-9]*.[A-Za-z0-9]*.[A-Za-z0-9]*"\. A numeric + major.minor\[\.patch\[\.tweak\]\] must be given\. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Policy/InvalidMaxVersion.cmake b/Tests/RunCMake/Policy/InvalidMaxVersion.cmake new file mode 100644 index 0000000..be3270f --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidMaxVersion.cmake @@ -0,0 +1,5 @@ +if(NOT version) + message(SEND_ERROR "Vesrion string is empty: ${version}") +endif() + +cmake_policy(VERSION 3.1...${version}) diff --git a/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-result.txt b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-result.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-result.txt diff --git a/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-stderr.txt b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-stderr.txt new file mode 100644 index 0000000..a48feb3 --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at InvalidRangeMaxVersionNotGiven.cmake:[0-9]+ \(cmake_policy\): + cmake_policy VERSION "3.15..." does not have a version on both sides of + "...". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven.cmake b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven.cmake new file mode 100644 index 0000000..e55803c --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven.cmake @@ -0,0 +1 @@ +cmake_policy(VERSION 3.15...) diff --git a/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-result.txt b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-stderr.txt b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-stderr.txt new file mode 100644 index 0000000..84e9b88 --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at InvalidRangeMinVersionNotGiven.cmake:[0-9]+ \(cmake_policy\): + cmake_policy VERSION "...3.15" does not have a version on both sides of + "...". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven.cmake b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven.cmake new file mode 100644 index 0000000..60e7e25 --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven.cmake @@ -0,0 +1 @@ +cmake_policy(VERSION ...3.15) diff --git a/Tests/RunCMake/Policy/InvalidVersion-result.txt b/Tests/RunCMake/Policy/InvalidVersion-result.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidVersion-result.txt diff --git a/Tests/RunCMake/Policy/InvalidVersion-stderr.txt b/Tests/RunCMake/Policy/InvalidVersion-stderr.txt new file mode 100644 index 0000000..783f4ed --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidVersion-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at InvalidVersion.cmake:[0-9]+ \(cmake_policy\): + Invalid policy version value "[A-Za-z0-9]+.[A-Za-z0-9]*.[A-Za-z0-9]*.[A-Za-z0-9]*"\. A numeric + major\.minor\[\.patch\[\.tweak\]\] must be given\. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Policy/InvalidVersion.cmake b/Tests/RunCMake/Policy/InvalidVersion.cmake new file mode 100644 index 0000000..b135ba6 --- /dev/null +++ b/Tests/RunCMake/Policy/InvalidVersion.cmake @@ -0,0 +1,5 @@ +if(NOT version) + message(SEND_ERROR "Vesrion string is empty: ${version}") +endif() + +cmake_policy(VERSION ${version}) diff --git a/Tests/RunCMake/Policy/MinVersionLargerThanMax-result.txt b/Tests/RunCMake/Policy/MinVersionLargerThanMax-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Policy/MinVersionLargerThanMax-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Policy/MinVersionLargerThanMax-stderr.txt b/Tests/RunCMake/Policy/MinVersionLargerThanMax-stderr.txt new file mode 100644 index 0000000..0b0308f --- /dev/null +++ b/Tests/RunCMake/Policy/MinVersionLargerThanMax-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at MinVersionLargerThanMax.cmake:[0-9]+ \(cmake_policy\): + Policy VERSION range "3.12...3.8" specifies a larger minimum than maximum. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Policy/MinVersionLargerThanMax.cmake b/Tests/RunCMake/Policy/MinVersionLargerThanMax.cmake new file mode 100644 index 0000000..67d5f85 --- /dev/null +++ b/Tests/RunCMake/Policy/MinVersionLargerThanMax.cmake @@ -0,0 +1 @@ +cmake_policy(VERSION 3.12...3.8) diff --git a/Tests/RunCMake/Policy/RunCMakeTest.cmake b/Tests/RunCMake/Policy/RunCMakeTest.cmake new file mode 100644 index 0000000..74c7d63 --- /dev/null +++ b/Tests/RunCMake/Policy/RunCMakeTest.cmake @@ -0,0 +1,19 @@ +include(RunCMake) + +run_cmake(VersionNotGiven) +run_cmake(TooManyVersionsGiven) +run_cmake(InvalidRangeMinVersionNotGiven) +run_cmake(InvalidRangeMaxVersionNotGiven) + +set(RunCMake_TEST_OPTIONS "-Dversion=three") +run_cmake(InvalidVersion) +run_cmake(InvalidMaxVersion) +unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS "-Dversion=3.one") +run_cmake(InvalidVersion) +run_cmake(InvalidMaxVersion) +unset(RunCMake_TEST_OPTIONS) + +run_cmake(VersionLowerThan2_4) +run_cmake(MinVersionLargerThanMax) +run_cmake(VeryHighVersion) diff --git a/Tests/RunCMake/Policy/TooManyVersionsGiven-result.txt b/Tests/RunCMake/Policy/TooManyVersionsGiven-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Policy/TooManyVersionsGiven-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Policy/TooManyVersionsGiven-stderr.txt b/Tests/RunCMake/Policy/TooManyVersionsGiven-stderr.txt new file mode 100644 index 0000000..7a4f8c7 --- /dev/null +++ b/Tests/RunCMake/Policy/TooManyVersionsGiven-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at TooManyVersionsGiven.cmake:[0-9]+ \(cmake_policy\): + cmake_policy VERSION given too many arguments +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Policy/TooManyVersionsGiven.cmake b/Tests/RunCMake/Policy/TooManyVersionsGiven.cmake new file mode 100644 index 0000000..6c99af2 --- /dev/null +++ b/Tests/RunCMake/Policy/TooManyVersionsGiven.cmake @@ -0,0 +1 @@ +cmake_policy(VERSION 1 2 3) diff --git a/Tests/RunCMake/Policy/VersionLowerThan2_4-result.txt b/Tests/RunCMake/Policy/VersionLowerThan2_4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Policy/VersionLowerThan2_4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Policy/VersionLowerThan2_4-stderr.txt b/Tests/RunCMake/Policy/VersionLowerThan2_4-stderr.txt new file mode 100644 index 0000000..3f19192 --- /dev/null +++ b/Tests/RunCMake/Policy/VersionLowerThan2_4-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at VersionLowerThan2_4.cmake:[0-9]+ \(cmake_policy\): + Compatibility with CMake < 2.4 is not supported by CMake >= 3.0. For + compatibility with older versions please use any CMake 2.8.x release or + lower. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Policy/VersionLowerThan2_4.cmake b/Tests/RunCMake/Policy/VersionLowerThan2_4.cmake new file mode 100644 index 0000000..f1a4fd9 --- /dev/null +++ b/Tests/RunCMake/Policy/VersionLowerThan2_4.cmake @@ -0,0 +1 @@ +cmake_policy(VERSION 2.2) diff --git a/Tests/RunCMake/Policy/VersionNotGiven-result.txt b/Tests/RunCMake/Policy/VersionNotGiven-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Policy/VersionNotGiven-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Policy/VersionNotGiven-stderr.txt b/Tests/RunCMake/Policy/VersionNotGiven-stderr.txt new file mode 100644 index 0000000..8eeb177 --- /dev/null +++ b/Tests/RunCMake/Policy/VersionNotGiven-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at VersionNotGiven.cmake:[0-9]+ \(cmake_policy\): + cmake_policy VERSION not given an argument +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Policy/VersionNotGiven.cmake b/Tests/RunCMake/Policy/VersionNotGiven.cmake new file mode 100644 index 0000000..53b3d7f --- /dev/null +++ b/Tests/RunCMake/Policy/VersionNotGiven.cmake @@ -0,0 +1 @@ +cmake_policy(VERSION) diff --git a/Tests/RunCMake/Policy/VeryHighVersion-result.txt b/Tests/RunCMake/Policy/VeryHighVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Policy/VeryHighVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Policy/VeryHighVersion-stderr.txt b/Tests/RunCMake/Policy/VeryHighVersion-stderr.txt new file mode 100644 index 0000000..7cca91b --- /dev/null +++ b/Tests/RunCMake/Policy/VeryHighVersion-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at VeryHighVersion.cmake:[0-9]+ \(cmake_policy\): + An attempt was made to set the policy version of CMake to "99.1" which is + greater than this version of CMake. This is not allowed because the + greater version may have new policies not known to this CMake. You may + need a newer CMake version to build this project. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Policy/VeryHighVersion.cmake b/Tests/RunCMake/Policy/VeryHighVersion.cmake new file mode 100644 index 0000000..3d4af8c --- /dev/null +++ b/Tests/RunCMake/Policy/VeryHighVersion.cmake @@ -0,0 +1 @@ +cmake_policy(VERSION 99.1) diff --git a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake index 9ba3c85..c00f78b 100644 --- a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake +++ b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake @@ -1,5 +1,14 @@ include(RunCMake) +function(run_build name) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake(${name}) + run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --config Debug) + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endfunction() + run_cmake(unitybuild_c) run_cmake(unitybuild_c_batch) run_cmake(unitybuild_c_group) @@ -15,6 +24,9 @@ run_cmake(unitybuild_c_no_unity_build) run_cmake(unitybuild_c_no_unity_build_group) run_cmake(unitybuild_order) run_cmake(unitybuild_invalid_mode) +run_build(unitybuild_anon_ns) +run_build(unitybuild_anon_ns_no_unity_build) +run_build(unitybuild_anon_ns_group_mode) function(run_test name) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_anon_ns.cmake b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns.cmake new file mode 100644 index 0000000..6f4878f --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns.cmake @@ -0,0 +1,11 @@ +project(unitybuild_anon_ns CXX) + +include(${CMAKE_CURRENT_SOURCE_DIR}/unitybuild_anon_ns_test_files.cmake) + +write_unity_build_anon_ns_test_files(srcs) + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD ON) + +set_target_properties(tgt PROPERTIES UNITY_BUILD_UNIQUE_ID MY_ANON_ID) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_anon_ns_group_mode.cmake b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns_group_mode.cmake new file mode 100644 index 0000000..a91fc74 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns_group_mode.cmake @@ -0,0 +1,19 @@ +project(unitybuild_anon_ns_group_mode CXX) + +include(${CMAKE_CURRENT_SOURCE_DIR}/unitybuild_anon_ns_test_files.cmake) + +write_unity_build_anon_ns_test_files(srcs) + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD ON + UNITY_BUILD_MODE GROUP) + +set_target_properties(tgt PROPERTIES UNITY_BUILD_UNIQUE_ID MY_ANON_ID) + +set_source_files_properties(s1.cpp s2.cpp s5.cpp s7.cpp s8.cpp + PROPERTIES UNITY_GROUP "a" + ) +set_source_files_properties(s3.cpp s4.cpp s6.cpp + PROPERTIES UNITY_GROUP "b" + ) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_anon_ns_no_unity_build.cmake b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns_no_unity_build.cmake new file mode 100644 index 0000000..9f0a9e1 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns_no_unity_build.cmake @@ -0,0 +1,11 @@ +project(unitybuild_anon_ns_no_unity_build CXX) + +include(${CMAKE_CURRENT_SOURCE_DIR}/unitybuild_anon_ns_test_files.cmake) + +write_unity_build_anon_ns_test_files(srcs) + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD OFF) + +set_target_properties(tgt PROPERTIES UNITY_BUILD_UNIQUE_ID MY_ANON_ID) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_anon_ns_test_files.cmake b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns_test_files.cmake new file mode 100644 index 0000000..06a600e --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_anon_ns_test_files.cmake @@ -0,0 +1,31 @@ + +function(write_unity_build_anon_ns_test_files OUTVAR) + set(srcs) + foreach(s RANGE 1 8) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cpp") + file(WRITE "${src}" " +#ifndef CONFIG_H +#define CONFIG_H +#define MY_ANON_NAMESPACE MY_ANON_ID +#define MY_ANON(Name) MY_ANON_NAMESPACE::Name +#define MY_ANON_USING_NAMESPACE using namespace MY_ANON_NAMESPACE +#endif + +namespace { namespace MY_ANON_NAMESPACE { + int i = ${s}; +}} +int use_plain_${s}() { + return MY_ANON_NAMESPACE::i; +} +int func_like_macro_${s}() { + return MY_ANON(i); +} +int using_macro_${s}() { + MY_ANON_USING_NAMESPACE; + return i; +} +") + list(APPEND srcs "${src}") + endforeach() + set(${OUTVAR} ${srcs} PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/VS10Project/CustomCommandGenex-check.cmake b/Tests/RunCMake/VS10Project/CustomCommandGenex-check.cmake new file mode 100644 index 0000000..a7047bc --- /dev/null +++ b/Tests/RunCMake/VS10Project/CustomCommandGenex-check.cmake @@ -0,0 +1,37 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_CustomBuild_out 0) +set(found_CustomBuild_out_CONFIG 0) +set(found_CustomBuild_out_CONFIG_CONFIG 0) +set(found_CustomBuild_out_HASH 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES [[<CustomBuild Include=".*\\out\.txt\.rule">]]) + set(found_CustomBuild_out 1) + endif() + if(line MATCHES [[<CustomBuild Include=".*\\out-\(CONFIG\)\.txt\.rule">]]) + set(found_CustomBuild_out_CONFIG 1) + endif() + if(line MATCHES [[<CustomBuild Include=".*\\out-\(CONFIG\)-\(CONFIG\)\.txt\.rule">]]) + set(found_CustomBuild_out_CONFIG_CONFIG 1) + endif() + if(line MATCHES [[<CustomBuild Include=".*\\[0-9A-Fa-f]+\.rule">]]) + set(found_CustomBuild_out_HASH 1) + endif() +endforeach() +if(NOT found_CustomBuild_out) + string(APPEND RunCMake_TEST_FAILED "CustomBuild for out.txt.rule not found in\n ${vcProjectFile}\n") +endif() +if(NOT found_CustomBuild_out_CONFIG) + string(APPEND RunCMake_TEST_FAILED "CustomBuild for out-(CONFIG).txt.rule not found in\n ${vcProjectFile}\n") +endif() +if(NOT found_CustomBuild_out_CONFIG_CONFIG) + string(APPEND RunCMake_TEST_FAILED "CustomBuild for out-(CONFIG)-(CONFIG).txt.rule not found in\n ${vcProjectFile}\n") +endif() +if(NOT found_CustomBuild_out_HASH) + string(APPEND RunCMake_TEST_FAILED "CustomBuild for <hash>.rule not found in\n ${vcProjectFile}\n") +endif() diff --git a/Tests/RunCMake/VS10Project/CustomCommandGenex.cmake b/Tests/RunCMake/VS10Project/CustomCommandGenex.cmake new file mode 100644 index 0000000..5b69dc2 --- /dev/null +++ b/Tests/RunCMake/VS10Project/CustomCommandGenex.cmake @@ -0,0 +1,21 @@ +add_custom_command( + OUTPUT "$<1:out.txt>" + COMMAND ${CMAKE_COMMAND} -E touch "out.txt" + VERBATIM + ) +add_custom_command( + OUTPUT "out-$<CONFIG>.txt" + COMMAND ${CMAKE_COMMAND} -E touch "out-$<CONFIG>.txt" + VERBATIM + ) +add_custom_command( + OUTPUT "out-$<CONFIG>-$<CONFIG>.txt" + COMMAND ${CMAKE_COMMAND} -E touch "out-$<CONFIG>-$<CONFIG>.txt" + VERBATIM + ) +add_custom_command( + OUTPUT "out-$<CONFIG>-$<CONFIG:Debug>.txt" + COMMAND ${CMAKE_COMMAND} -E touch "out-$<CONFIG>-$<CONFIG:Debug>.txt" + VERBATIM + ) +add_custom_target(foo DEPENDS "out.txt" "out-$<CONFIG>.txt" "out-$<CONFIG>-$<CONFIG>.txt" "out-$<CONFIG>-$<CONFIG:Debug>.txt") diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 133dacc..d5ed136 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -7,6 +7,7 @@ if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREA run_cmake(LanguageStandard) endif() +run_cmake(CustomCommandGenex) run_cmake(VsCsharpSourceGroup) run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) diff --git a/Tests/RunCMake/WriteBasicConfigVersionFile/All.cmake b/Tests/RunCMake/WriteBasicConfigVersionFile/All.cmake index 4253652..c32c92d 100644 --- a/Tests/RunCMake/WriteBasicConfigVersionFile/All.cmake +++ b/Tests/RunCMake/WriteBasicConfigVersionFile/All.cmake @@ -3,16 +3,16 @@ set(CMAKE_SIZEOF_VOID_P 4) include(WriteBasicConfigVersionFile) -set(_compatibilities AnyNewerVersion - SameMajorVersion - SameMinorVersion - ExactVersion) +set(COMPATIBILITIES AnyNewerVersion + SameMajorVersion + SameMinorVersion + ExactVersion) function(TEST_WRITE_BASIC_CONFIG_VERSION_FILE_PREPARE _version_installed) set(_same_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) set(_no_CMAKE_SIZEOF_VOID_P "") math(EXPR _diff_CMAKE_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P} + 1") - foreach(_compat ${_compatibilities}) + foreach(_compat ${COMPATIBILITIES}) set(_pkg ${_compat}${_version_installed}) string(REPLACE "." "" _pkg ${_pkg}) set(_filename "${CMAKE_CURRENT_BINARY_DIR}/${_pkg}ConfigVersion.cmake") @@ -71,20 +71,58 @@ function(TEST_WRITE_BASIC_CONFIG_VERSION_FILE _version_installed _expected_compatible_SameMajorVersion _expected_compatible_SameMinorVersion _expected_compatible_ExactVersion) - set(PACKAGE_FIND_VERSION ${_version_requested}) - if("${PACKAGE_FIND_VERSION}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]]) - set(PACKAGE_FIND_VERSION_MAJOR "${CMAKE_MATCH_2}") - set(PACKAGE_FIND_VERSION_MINOR "${CMAKE_MATCH_4}") - set(PACKAGE_FIND_VERSION_PATCH "${CMAKE_MATCH_6}") - set(PACKAGE_FIND_VERSION_TWEAK "${CMAKE_MATCH_8}") - else() - message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version number") - endif() - - if ("${_version_installed}" STREQUAL "${_version_requested}") - set(_expected_exact 1) - else() + if("${_version_requested}" MATCHES [[^([0-9]+(\.[0-9]+)*)\.\.\.(<)?([0-9]+(\.[0-9]+)*)$]]) + set (_compatibilities ${COMPATIBILITIES}) + # ExactVersion must not be tested + list(POP_BACK _compatibilities) + set(PACKAGE_FIND_VERSION_RANGE TRUE) + set(PACKAGE_FIND_VERSION_RANGE_MIN INCLUDE) + if ("${CMAKE_MATCH_3}" STREQUAL "<") + set(PACKAGE_FIND_VERSION_RANGE_MAX EXCLUDE) + else() + set(PACKAGE_FIND_VERSION_RANGE_MAX INCLUDE) + endif() + set(PACKAGE_FIND_VERSION_MIN "${CMAKE_MATCH_1}") + set(PACKAGE_FIND_VERSION_MAX "${CMAKE_MATCH_4}") + if("${PACKAGE_FIND_VERSION_MIN}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]]) + set(PACKAGE_FIND_VERSION_MIN_MAJOR "${CMAKE_MATCH_2}") + set(PACKAGE_FIND_VERSION_MIN_MINOR "${CMAKE_MATCH_4}") + set(PACKAGE_FIND_VERSION_MIN_PATCH "${CMAKE_MATCH_6}") + set(PACKAGE_FIND_VERSION_MIN_TWEAK "${CMAKE_MATCH_8}") + else() + message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version range") + endif() + set(PACKAGE_FIND_VERSION "${PACKAGE_FIND_VERSION_MIN}") + set(PACKAGE_FIND_VERSION_MAJOR "${PACKAGE_FIND_VERSION_MIN_MAJOR}") + set(PACKAGE_FIND_VERSION_MINOR "${PACKAGE_FIND_VERSION_MIN_MINOR}") + set(PACKAGE_FIND_VERSION_PATCH "${PACKAGE_FIND_VERSION_MIN_PATCH}") + set(PACKAGE_FIND_VERSION_TWEAK "${PACKAGE_FIND_VERSION_MIN_TWEAK}") + if("${PACKAGE_FIND_VERSION_MAX}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]]) + set(PACKAGE_FIND_VERSION_MAX_MAJOR "${CMAKE_MATCH_2}") + set(PACKAGE_FIND_VERSION_MAX_MINOR "${CMAKE_MATCH_4}") + set(PACKAGE_FIND_VERSION_MAX_PATCH "${CMAKE_MATCH_6}") + set(PACKAGE_FIND_VERSION_MAX_TWEAK "${CMAKE_MATCH_8}") + else() + message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version range") + endif() set(_expected_exact 0) + else() + set (_compatibilities ${COMPATIBILITIES}) + set(PACKAGE_FIND_VERSION ${_version_requested}) + if("${PACKAGE_FIND_VERSION}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]]) + set(PACKAGE_FIND_VERSION_MAJOR "${CMAKE_MATCH_2}") + set(PACKAGE_FIND_VERSION_MINOR "${CMAKE_MATCH_4}") + set(PACKAGE_FIND_VERSION_PATCH "${CMAKE_MATCH_6}") + set(PACKAGE_FIND_VERSION_TWEAK "${CMAKE_MATCH_8}") + else() + message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version number") + endif() + + if ("${_version_installed}" STREQUAL "${_version_requested}") + set(_expected_exact 1) + else() + set(_expected_exact 0) + endif() endif() unset(PACKAGE_VERSION_COMPATIBLE) @@ -882,3 +920,54 @@ test_write_basic_config_version_file(4.5.6.7 9.9.9.0 0 0 0 0) # Request [ne test_write_basic_config_version_file(4.5.6.7 9.9.9.2 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[older tweak] test_write_basic_config_version_file(4.5.6.7 9.9.9.7 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[same tweak] test_write_basic_config_version_file(4.5.6.7 9.9.9.9 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[newer tweak] + +test_write_basic_config_version_file(4 0...5 1 0 0 0) +test_write_basic_config_version_file(4 2...5 1 0 0 0) +test_write_basic_config_version_file(4 2...4 1 0 0 0) +test_write_basic_config_version_file(4 4...<5 1 1 0 0) +test_write_basic_config_version_file(4 9...10 0 0 0 0) + +test_write_basic_config_version_file(4 0.1...5 1 0 0 0) +test_write_basic_config_version_file(4 2.1...5 1 0 0 0) +test_write_basic_config_version_file(4 2.8...5 1 0 0 0) +test_write_basic_config_version_file(4 2.1...4 1 0 0 0) +test_write_basic_config_version_file(4 2.8...4 1 0 0 0) +test_write_basic_config_version_file(4 4.0...<5 1 1 0 0) +test_write_basic_config_version_file(4 4.8...<5 0 0 0 0) +test_write_basic_config_version_file(4 4.1...5 0 0 0 0) +test_write_basic_config_version_file(4 4.8...5 0 0 0 0) +test_write_basic_config_version_file(4 9.1...10 0 0 0 0) +test_write_basic_config_version_file(4 9.8...10 0 0 0 0) + + +test_write_basic_config_version_file(4.5 0.1...5 1 0 0 0) +test_write_basic_config_version_file(4.5 2.1...5 1 0 0 0) +test_write_basic_config_version_file(4.5 2.8...5 1 0 0 0) +test_write_basic_config_version_file(4.5 2.1...4 0 0 0 0) +test_write_basic_config_version_file(4.5 2.8...4 0 0 0 0) +test_write_basic_config_version_file(4.5 2.8...4.8 1 0 0 0) +test_write_basic_config_version_file(4.5 4.1...<5 1 1 0 0) +test_write_basic_config_version_file(4.5 4.8...<5 0 0 0 0) +test_write_basic_config_version_file(4.5 4.5...4.5.8 1 1 1 0) +test_write_basic_config_version_file(4.5 4.5...<4.6 1 1 1 0) +test_write_basic_config_version_file(4.5 4.1...5 1 0 0 0) +test_write_basic_config_version_file(4.5 4.8...5 0 0 0 0) +test_write_basic_config_version_file(4.5 9.1...10 0 0 0 0) +test_write_basic_config_version_file(4.5 9.8...10 0 0 0 0) + + +test_write_basic_config_version_file(4.5.6 0.1...5 1 0 0 0) +test_write_basic_config_version_file(4.5.6 2.1...5 1 0 0 0) +test_write_basic_config_version_file(4.5.6 2.8...5 1 0 0 0) +test_write_basic_config_version_file(4.5.6 2.1...4 0 0 0 0) +test_write_basic_config_version_file(4.5.6 2.8...4 0 0 0 0) +test_write_basic_config_version_file(4.5.6 2.8...4.8 1 0 0 0) +test_write_basic_config_version_file(4.5.6 4.1...<5 1 1 0 0) +test_write_basic_config_version_file(4.5.6 4.8...<5 0 0 0 0) +test_write_basic_config_version_file(4.5.6 4.5...4.5.4 0 0 0 0) +test_write_basic_config_version_file(4.5.6 4.5...4.5.8 1 1 1 0) +test_write_basic_config_version_file(4.5.6 4.5...<4.6 1 1 1 0) +test_write_basic_config_version_file(4.5.6 4.1...5 1 0 0 0) +test_write_basic_config_version_file(4.5.6 4.8...5 0 0 0 0) +test_write_basic_config_version_file(4.5.6 9.1...10 0 0 0 0) +test_write_basic_config_version_file(4.5.6 9.8...10 0 0 0 0) diff --git a/Tests/RunCMake/add_custom_command/BadByproduct-stderr.txt b/Tests/RunCMake/add_custom_command/BadByproduct-stderr.txt index 086e397..547fb1c 100644 --- a/Tests/RunCMake/add_custom_command/BadByproduct-stderr.txt +++ b/Tests/RunCMake/add_custom_command/BadByproduct-stderr.txt @@ -1,36 +1,67 @@ CMake Error at BadByproduct.cmake:2 \(add_custom_command\): - add_custom_command called with BYPRODUCTS containing a "#". This character - is not allowed. + BYPRODUCTS containing a "#" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) CMake Error at BadByproduct.cmake:3 \(add_custom_command\): - add_custom_command called with BYPRODUCTS containing a "<". This character - is not allowed. + BYPRODUCTS containing a "<" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) CMake Error at BadByproduct.cmake:4 \(add_custom_command\): - add_custom_command called with BYPRODUCTS containing a ">". This character - is not allowed. + BYPRODUCTS containing a ">" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) - +( CMake Error at BadByproduct.cmake:5 \(add_custom_command\): - add_custom_command called with BYPRODUCTS containing a "<". This character - is not allowed. + BYPRODUCTS containing a "#" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) - +)+ CMake Error at BadByproduct.cmake:6 \(add_custom_command\): - add_custom_command attempted to have a file + BYPRODUCTS path .*RunCMake/add_custom_command/f in a source directory as an output of custom command. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + +( +CMake Error at BadByproduct.cmake:7 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:prop> + + \$<TARGET_PROPERTY:prop> may only be used with binary targets. It may not + be used with add_custom_command or add_custom_target. Specify the target + to read a property from using the \$<TARGET_PROPERTY:tgt,prop> signature + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + +)+( +CMake Error at BadByproduct.cmake:8 \(add_custom_command\): + Error evaluating generator expression: + + \$<OUTPUT_CONFIG:h> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + +)+( +CMake Error at BadByproduct.cmake:9 \(add_custom_command\): + Error evaluating generator expression: + + \$<COMMAND_CONFIG:i> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + +)+ diff --git a/Tests/RunCMake/add_custom_command/BadByproduct.cmake b/Tests/RunCMake/add_custom_command/BadByproduct.cmake index 91bca52..cf00f5b 100644 --- a/Tests/RunCMake/add_custom_command/BadByproduct.cmake +++ b/Tests/RunCMake/add_custom_command/BadByproduct.cmake @@ -4,3 +4,6 @@ add_custom_command(OUTPUT b BYPRODUCTS "a<") add_custom_command(OUTPUT c BYPRODUCTS "a>") add_custom_command(OUTPUT d BYPRODUCTS "$<CONFIG>/#") add_custom_command(OUTPUT e BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/f) +add_custom_command(OUTPUT f BYPRODUCTS "$<TARGET_PROPERTY:prop>") +add_custom_command(OUTPUT h BYPRODUCTS "$<OUTPUT_CONFIG:h>") +add_custom_command(OUTPUT i BYPRODUCTS "$<COMMAND_CONFIG:i>") diff --git a/Tests/RunCMake/add_custom_command/BadCommand-result.txt b/Tests/RunCMake/add_custom_command/BadCommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/BadCommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/BadCommand-stderr.txt b/Tests/RunCMake/add_custom_command/BadCommand-stderr.txt new file mode 100644 index 0000000..470afd6 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/BadCommand-stderr.txt @@ -0,0 +1,21 @@ +(CMake Error at BadCommand.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$<OUTPUT_CONFIG:a> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +)+(CMake Error at BadCommand.cmake:2 \(add_custom_command\): + Error evaluating generator expression: + + \$<COMMAND_CONFIG:b> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +)+ diff --git a/Tests/RunCMake/add_custom_command/BadCommand.cmake b/Tests/RunCMake/add_custom_command/BadCommand.cmake new file mode 100644 index 0000000..8c9c3f9 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/BadCommand.cmake @@ -0,0 +1,3 @@ +add_custom_command(OUTPUT "a" COMMAND "$<1:$<OUTPUT_CONFIG:a>>") +add_custom_command(OUTPUT "b" COMMAND "$<1:$<COMMAND_CONFIG:b>>") +add_custom_target(drive DEPENDS "a" "b") diff --git a/Tests/RunCMake/add_custom_command/BadOutput-stderr.txt b/Tests/RunCMake/add_custom_command/BadOutput-stderr.txt index 731e58d..2e43568 100644 --- a/Tests/RunCMake/add_custom_command/BadOutput-stderr.txt +++ b/Tests/RunCMake/add_custom_command/BadOutput-stderr.txt @@ -1,36 +1,67 @@ CMake Error at BadOutput.cmake:2 \(add_custom_command\): - add_custom_command called with OUTPUT containing a "#". This character is - not allowed. + OUTPUT containing a "#" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) CMake Error at BadOutput.cmake:3 \(add_custom_command\): - add_custom_command called with OUTPUT containing a "<". This character is - not allowed. + OUTPUT containing a "<" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) CMake Error at BadOutput.cmake:4 \(add_custom_command\): - add_custom_command called with OUTPUT containing a ">". This character is - not allowed. + OUTPUT containing a ">" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) - +( CMake Error at BadOutput.cmake:5 \(add_custom_command\): - add_custom_command called with OUTPUT containing a "<". This character is - not allowed. + OUTPUT containing a "#" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) - +)+ CMake Error at BadOutput.cmake:6 \(add_custom_command\): - add_custom_command attempted to have a file + OUTPUT path .*RunCMake/add_custom_command/e in a source directory as an output of custom command. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + +( +CMake Error at BadOutput.cmake:7 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:prop> + + \$<TARGET_PROPERTY:prop> may only be used with binary targets. It may not + be used with add_custom_command or add_custom_target. Specify the target + to read a property from using the \$<TARGET_PROPERTY:tgt,prop> signature + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + +)+( +CMake Error at BadOutput.cmake:8 \(add_custom_command\): + Error evaluating generator expression: + + \$<OUTPUT_CONFIG:h> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + +)+( +CMake Error at BadOutput.cmake:9 \(add_custom_command\): + Error evaluating generator expression: + + \$<COMMAND_CONFIG:i> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + +)+ diff --git a/Tests/RunCMake/add_custom_command/BadOutput.cmake b/Tests/RunCMake/add_custom_command/BadOutput.cmake index 6875fe9..f04bdd1 100644 --- a/Tests/RunCMake/add_custom_command/BadOutput.cmake +++ b/Tests/RunCMake/add_custom_command/BadOutput.cmake @@ -4,3 +4,6 @@ add_custom_command(OUTPUT "a<" COMMAND b) add_custom_command(OUTPUT "a>" COMMAND c) add_custom_command(OUTPUT "$<CONFIG>/#" COMMAND d) add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/e COMMAND f) +add_custom_command(OUTPUT "$<TARGET_PROPERTY:prop>" COMMAND g) +add_custom_command(OUTPUT "$<OUTPUT_CONFIG:h>" COMMAND h) +add_custom_command(OUTPUT "$<COMMAND_CONFIG:i>" COMMAND i) diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake index aac085d..9c59b4b 100644 --- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(AppendNotOutput) run_cmake(BadArgument) run_cmake(BadByproduct) run_cmake(BadOutput) +run_cmake(BadCommand) run_cmake(GeneratedProperty) run_cmake(LiteralQuotes) run_cmake(NoArguments) diff --git a/Tests/RunCMake/add_custom_target/BadByproduct-stderr.txt b/Tests/RunCMake/add_custom_target/BadByproduct-stderr.txt index 0f58550..da9af49 100644 --- a/Tests/RunCMake/add_custom_target/BadByproduct-stderr.txt +++ b/Tests/RunCMake/add_custom_target/BadByproduct-stderr.txt @@ -1,36 +1,67 @@ CMake Error at BadByproduct.cmake:2 \(add_custom_target\): - add_custom_target called with BYPRODUCTS containing a "#". This character - is not allowed. + BYPRODUCTS containing a "#" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) CMake Error at BadByproduct.cmake:3 \(add_custom_target\): - add_custom_target called with BYPRODUCTS containing a "<". This character - is not allowed. + BYPRODUCTS containing a "<" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) CMake Error at BadByproduct.cmake:4 \(add_custom_target\): - add_custom_target called with BYPRODUCTS containing a ">". This character - is not allowed. + BYPRODUCTS containing a ">" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) - +( CMake Error at BadByproduct.cmake:5 \(add_custom_target\): - add_custom_target called with BYPRODUCTS containing a "<". This character - is not allowed. + BYPRODUCTS containing a "#" is not allowed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) - +)+ CMake Error at BadByproduct.cmake:6 \(add_custom_target\): - add_custom_target attempted to have a file + BYPRODUCTS path .*RunCMake/add_custom_target/j in a source directory as an output of custom command. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + +( +CMake Error at BadByproduct.cmake:7 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:prop> + + \$<TARGET_PROPERTY:prop> may only be used with binary targets. It may not + be used with add_custom_command or add_custom_target. Specify the target + to read a property from using the \$<TARGET_PROPERTY:tgt,prop> signature + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + +)+( +CMake Error at BadByproduct.cmake:8 \(add_custom_target\): + Error evaluating generator expression: + + \$<OUTPUT_CONFIG:n> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + +)+( +CMake Error at BadByproduct.cmake:9 \(add_custom_target\): + Error evaluating generator expression: + + \$<COMMAND_CONFIG:p> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + +)+ diff --git a/Tests/RunCMake/add_custom_target/BadByproduct.cmake b/Tests/RunCMake/add_custom_target/BadByproduct.cmake index 963d641..c317b83 100644 --- a/Tests/RunCMake/add_custom_target/BadByproduct.cmake +++ b/Tests/RunCMake/add_custom_target/BadByproduct.cmake @@ -4,3 +4,6 @@ add_custom_target(c BYPRODUCTS "a<" COMMAND d) add_custom_target(e BYPRODUCTS "a>" COMMAND f) add_custom_target(g BYPRODUCTS "$<CONFIG>/#" COMMAND h) add_custom_target(i BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/j COMMAND k) +add_custom_target(l BYPRODUCTS "$<TARGET_PROPERTY:prop>" COMMAND m) +add_custom_target(n BYPRODUCTS "$<OUTPUT_CONFIG:n>" COMMAND o) +add_custom_target(p BYPRODUCTS "$<COMMAND_CONFIG:p>" COMMAND q) diff --git a/Tests/RunCMake/add_custom_target/BadCommand-result.txt b/Tests/RunCMake/add_custom_target/BadCommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_target/BadCommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_target/BadCommand-stderr.txt b/Tests/RunCMake/add_custom_target/BadCommand-stderr.txt new file mode 100644 index 0000000..dfdf8f8 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/BadCommand-stderr.txt @@ -0,0 +1,21 @@ +(CMake Error at BadCommand.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OUTPUT_CONFIG:a> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +)+(CMake Error at BadCommand.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<COMMAND_CONFIG:b> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +)+ diff --git a/Tests/RunCMake/add_custom_target/BadCommand.cmake b/Tests/RunCMake/add_custom_target/BadCommand.cmake new file mode 100644 index 0000000..dadf038 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/BadCommand.cmake @@ -0,0 +1,4 @@ +add_custom_target(drive + COMMAND "$<1:$<OUTPUT_CONFIG:a>>" + COMMAND "$<1:$<COMMAND_CONFIG:b>>" + ) diff --git a/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake index f5d5dd2..22a9ed4 100644 --- a/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) run_cmake(BadByproduct) +run_cmake(BadCommand) run_cmake(BadTargetName) run_cmake(ByproductsNoCommand) run_cmake(CommandExpandsEmpty) diff --git a/Tests/RunCMake/execute_process/AnyCommandAbnormalExit-result.txt b/Tests/RunCMake/execute_process/AnyCommandAbnormalExit-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/execute_process/AnyCommandAbnormalExit-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/execute_process/AnyCommandAbnormalExit-stderr.txt b/Tests/RunCMake/execute_process/AnyCommandAbnormalExit-stderr.txt new file mode 100644 index 0000000..9627872 --- /dev/null +++ b/Tests/RunCMake/execute_process/AnyCommandAbnormalExit-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at .*AnyCommandAbnormalExit.cmake:[0-9]+ \(execute_process\): + execute_process failed command indexes: + + 1: "Abnormal exit with child return code: Segmentation fault diff --git a/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake b/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake new file mode 100644 index 0000000..5ac0c21 --- /dev/null +++ b/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake @@ -0,0 +1,5 @@ +execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c + "import os; os.kill(os.getpid(),11)" + COMMAND ${CMAKE_COMMAND} -E true + COMMAND_ERROR_IS_FATAL ANY + ) diff --git a/Tests/RunCMake/execute_process/AnyCommandError-stderr.txt b/Tests/RunCMake/execute_process/AnyCommandError-stderr.txt index 0380562..bf36391 100644 --- a/Tests/RunCMake/execute_process/AnyCommandError-stderr.txt +++ b/Tests/RunCMake/execute_process/AnyCommandError-stderr.txt @@ -1,2 +1,5 @@ CMake Error at .*AnyCommandError.cmake:1 \(execute_process\): - execute_process failed command indexes: 2, 3, 4 + execute_process failed command indexes: + + 2: "Child return code: 1" + 3: "Child return code: 1" diff --git a/Tests/RunCMake/execute_process/AnyCommandError.cmake b/Tests/RunCMake/execute_process/AnyCommandError.cmake index f8ec385..c9348cd 100644 --- a/Tests/RunCMake/execute_process/AnyCommandError.cmake +++ b/Tests/RunCMake/execute_process/AnyCommandError.cmake @@ -1,8 +1,6 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E true - COMMAND ${CMAKE_COMMAND} -E false - COMMAND ${CMAKE_COMMAND} -E false - COMMAND ${CMAKE_COMMAND} -E false - COMMAND ${CMAKE_COMMAND} -E true - COMMAND ${CMAKE_COMMAND} -E true - COMMAND_ERROR_IS_FATAL ANY + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E true + COMMAND_ERROR_IS_FATAL ANY ) diff --git a/Tests/RunCMake/execute_process/AnyCommandGood.cmake b/Tests/RunCMake/execute_process/AnyCommandGood.cmake new file mode 100644 index 0000000..27f0996 --- /dev/null +++ b/Tests/RunCMake/execute_process/AnyCommandGood.cmake @@ -0,0 +1,4 @@ +execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E true + COMMAND_ERROR_IS_FATAL ANY + ) diff --git a/Tests/RunCMake/execute_process/AnyCommandTimeout-result.txt b/Tests/RunCMake/execute_process/AnyCommandTimeout-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/execute_process/AnyCommandTimeout-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/execute_process/AnyCommandTimeout-stderr.txt b/Tests/RunCMake/execute_process/AnyCommandTimeout-stderr.txt new file mode 100644 index 0000000..10cc5f4 --- /dev/null +++ b/Tests/RunCMake/execute_process/AnyCommandTimeout-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*AnyCommandTimeout.cmake:9 \(execute_process\): + execute_process Process terminated due to timeout diff --git a/Tests/RunCMake/execute_process/AnyCommandTimeout.cmake b/Tests/RunCMake/execute_process/AnyCommandTimeout.cmake new file mode 100644 index 0000000..a5a53fd --- /dev/null +++ b/Tests/RunCMake/execute_process/AnyCommandTimeout.cmake @@ -0,0 +1,15 @@ +execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E sleep 10 + COMMAND ${CMAKE_COMMAND} -E true + TIMEOUT 1 + RESULT_VARIABLE result +) + +if(NOT result EQUAL "0") + execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E sleep 10 + COMMAND ${CMAKE_COMMAND} -E true + TIMEOUT 1 + COMMAND_ERROR_IS_FATAL ANY + ) +endif() diff --git a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake new file mode 100644 index 0000000..5a4574c --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake @@ -0,0 +1,13 @@ +execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c + "import os; os.kill(os.getpid(),11)" + COMMAND ${CMAKE_COMMAND} -E true + RESULT_VARIABLE result + ) + +if(result EQUAL "0") + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c + "import os; os.kill(os.getpid(),11)" + COMMAND ${CMAKE_COMMAND} -E true + COMMAND_ERROR_IS_FATAL LAST + ) +endif() diff --git a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2-result.txt b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2-stderr.txt b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2-stderr.txt new file mode 100644 index 0000000..c915e58 --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*LastCommandAbnormalExit-2.cmake:[0-9]+ \(execute_process\): + execute_process Abnormal exit: Segmentation fault diff --git a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake new file mode 100644 index 0000000..b87e0f7 --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake @@ -0,0 +1,13 @@ +execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND "${PYTHON_EXECUTABLE}" -c + "import os; os.kill(os.getpid(),11)" + RESULT_VARIABLE result + ) + +if(NOT result EQUAL "0") + execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND "${PYTHON_EXECUTABLE}" -c + "import os; os.kill(os.getpid(),11)" + COMMAND_ERROR_IS_FATAL LAST + ) +endif() diff --git a/Tests/RunCMake/execute_process/LastCommandError-stderr.txt b/Tests/RunCMake/execute_process/LastCommandError-stderr.txt index ff191b3..335a771 100644 --- a/Tests/RunCMake/execute_process/LastCommandError-stderr.txt +++ b/Tests/RunCMake/execute_process/LastCommandError-stderr.txt @@ -1,2 +1,2 @@ -CMake Error at .*LastCommandError.cmake:1 \(execute_process\): +CMake Error at .*LastCommandError.cmake:11 \(execute_process\): execute_process last command failed diff --git a/Tests/RunCMake/execute_process/LastCommandError.cmake b/Tests/RunCMake/execute_process/LastCommandError.cmake index 6116a5c..9a925fe 100644 --- a/Tests/RunCMake/execute_process/LastCommandError.cmake +++ b/Tests/RunCMake/execute_process/LastCommandError.cmake @@ -1,8 +1,19 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E false + RESULT_VARIABLE result +) + +if(NOT result EQUAL "0") + execute_process(COMMAND ${CMAKE_COMMAND} -E true COMMAND ${CMAKE_COMMAND} -E false COMMAND ${CMAKE_COMMAND} -E false COMMAND ${CMAKE_COMMAND} -E false COMMAND ${CMAKE_COMMAND} -E true COMMAND ${CMAKE_COMMAND} -E false COMMAND_ERROR_IS_FATAL LAST -) + ) +endif() diff --git a/Tests/RunCMake/execute_process/LastCommandGood.cmake b/Tests/RunCMake/execute_process/LastCommandGood.cmake new file mode 100644 index 0000000..c22b49d --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandGood.cmake @@ -0,0 +1,15 @@ +execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E true + RESULT_VARIABLE result + ) + +if(result EQUAL "0") + execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E false + COMMAND ${CMAKE_COMMAND} -E true + COMMAND_ERROR_IS_FATAL LAST + ) +endif() diff --git a/Tests/RunCMake/execute_process/LastCommandTimeout-result.txt b/Tests/RunCMake/execute_process/LastCommandTimeout-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandTimeout-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/execute_process/LastCommandTimeout-stderr.txt b/Tests/RunCMake/execute_process/LastCommandTimeout-stderr.txt new file mode 100644 index 0000000..1cd1546 --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandTimeout-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*LastCommandTimeout.cmake:9 \(execute_process\): + execute_process Process terminated due to timeout diff --git a/Tests/RunCMake/execute_process/LastCommandTimeout.cmake b/Tests/RunCMake/execute_process/LastCommandTimeout.cmake new file mode 100644 index 0000000..9c1f444 --- /dev/null +++ b/Tests/RunCMake/execute_process/LastCommandTimeout.cmake @@ -0,0 +1,15 @@ +execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E sleep 10 + COMMAND ${CMAKE_COMMAND} -E true + TIMEOUT 1 + RESULT_VARIABLE result +) + +if(NOT result EQUAL "0") + execute_process(COMMAND ${CMAKE_COMMAND} -E true + COMMAND ${CMAKE_COMMAND} -E sleep 10 + COMMAND ${CMAKE_COMMAND} -E true + TIMEOUT 1 + COMMAND_ERROR_IS_FATAL LAST + ) +endif() diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake index f4c3d19..35712f6 100644 --- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake +++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake @@ -27,6 +27,16 @@ run_cmake_command(EchoCommand3 ${CMAKE_COMMAND} run_cmake_command(EchoVariable ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/EchoVariable.cmake) +run_cmake_command(CommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/CommandError.cmake) run_cmake_command(AnyCommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/AnyCommandError.cmake) +run_cmake_command(AnyCommandTimeout ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/AnyCommandTimeout.cmake) +run_cmake_command(AnyCommandGood ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/AnyCommandGood.cmake) run_cmake_command(LastCommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandError.cmake) -run_cmake_command(CommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/CommandError.cmake) +run_cmake_command(LastCommandTimeout ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandTimeout.cmake) +run_cmake_command(LastCommandGood ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandGood.cmake) + +if(UNIX AND PYTHON_EXECUTABLE) + run_cmake_command(AnyCommandAbnormalExit ${CMAKE_COMMAND} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/AnyCommandAbnormalExit.cmake) + run_cmake_command(LastCommandAbnormalExit-1 ${CMAKE_COMMAND} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-1.cmake) + run_cmake_command(LastCommandAbnormalExit-2 ${CMAKE_COMMAND} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-2.cmake) +endif() |