diff options
Diffstat (limited to 'Tests')
119 files changed, 801 insertions, 62 deletions
diff --git a/Tests/BootstrapTest.cmake b/Tests/BootstrapTest.cmake index 9c9fe09..07a65bf 100644 --- a/Tests/BootstrapTest.cmake +++ b/Tests/BootstrapTest.cmake @@ -1,7 +1,12 @@ file(MAKE_DIRECTORY "${bin_dir}") -message(STATUS "running bootstrap: ${bootstrap}") +include(ProcessorCount) +ProcessorCount(nproc) +if(NOT nproc EQUAL 0) + set(parallel_arg --parallel=${nproc}) +endif() +message(STATUS "running bootstrap: ${bootstrap} ${parallel_arg}") execute_process( - COMMAND ${bootstrap} + COMMAND ${bootstrap} ${parallel_arg} WORKING_DIRECTORY "${bin_dir}" RESULT_VARIABLE result ) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7df9403..e914d00 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1377,6 +1377,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindJsonCpp) endif() + if(CMake_TEST_FindLibRHash) + add_subdirectory(FindLibRHash) + endif() + if(CMake_TEST_FindLibUV) add_subdirectory(FindLibUV) endif() @@ -3081,8 +3085,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release -P ${CMAKE_CURRENT_SOURCE_DIR}/BootstrapTest.cmake ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest") - # Make this test run early during parallel execution - set_tests_properties(BootstrapTest PROPERTIES COST 5000) + # This test will use all processors. + set_tests_properties(BootstrapTest PROPERTIES RUN_SERIAL 1) # provide more time for the bootstrap test get_test_property(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT) @@ -3346,20 +3350,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --test-command InterfaceLinkLibraries) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceLinkLibraries") - if(CMAKE_USE_KWSTYLE AND KWSTYLE_EXECUTABLE) - # The "make StyleCheck" command line as a test. If the test fails, look - # for lines like "Error #0 (624) Line length exceed 88 (max=79)" in the - # output to find where the style errors are... - add_test(KWStyle ${KWSTYLE_EXECUTABLE} - -xml ${CMake_BINARY_DIR}/CMake.kws.xml - -o ${CMake_SOURCE_DIR}/Utilities/KWStyle/CMakeOverwrite.txt - -v - -D ${CMake_BINARY_DIR}/CMakeKWSFiles.txt - ) - set_tests_properties(KWStyle PROPERTIES - WORKING_DIRECTORY ${CMake_BINARY_DIR}/Utilities/KWStyle) - endif() - if(NOT CMake_TEST_EXTERNAL_CMAKE) add_subdirectory(CMakeTests) endif() diff --git a/Tests/CMakeTests/File-SHA3_224-Works.cmake b/Tests/CMakeTests/File-SHA3_224-Works.cmake new file mode 100644 index 0000000..e4f4e85 --- /dev/null +++ b/Tests/CMakeTests/File-SHA3_224-Works.cmake @@ -0,0 +1,2 @@ +file(SHA3_224 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt sha3_224) +message("${sha3_224}") diff --git a/Tests/CMakeTests/File-SHA3_256-Works.cmake b/Tests/CMakeTests/File-SHA3_256-Works.cmake new file mode 100644 index 0000000..189c8a2 --- /dev/null +++ b/Tests/CMakeTests/File-SHA3_256-Works.cmake @@ -0,0 +1,2 @@ +file(SHA3_256 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt sha3_256) +message("${sha3_256}") diff --git a/Tests/CMakeTests/File-SHA3_384-Works.cmake b/Tests/CMakeTests/File-SHA3_384-Works.cmake new file mode 100644 index 0000000..08f9f5b --- /dev/null +++ b/Tests/CMakeTests/File-SHA3_384-Works.cmake @@ -0,0 +1,2 @@ +file(SHA3_384 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt sha3_384) +message("${sha3_384}") diff --git a/Tests/CMakeTests/File-SHA3_512-Works.cmake b/Tests/CMakeTests/File-SHA3_512-Works.cmake new file mode 100644 index 0000000..4182196 --- /dev/null +++ b/Tests/CMakeTests/File-SHA3_512-Works.cmake @@ -0,0 +1,2 @@ +file(SHA3_512 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt sha3_512) +message("${sha3_512}") diff --git a/Tests/CMakeTests/FileTest.cmake.in b/Tests/CMakeTests/FileTest.cmake.in index 61523e6..71cb3db 100644 --- a/Tests/CMakeTests/FileTest.cmake.in +++ b/Tests/CMakeTests/FileTest.cmake.in @@ -36,6 +36,14 @@ set(SHA384-Works-RESULT 0) set(SHA384-Works-STDERR "1de9560b4e030e02051ea408200ffc55d70c97ac64ebf822461a5c786f495c36df43259b14483bc8d364f0106f4971ee") set(SHA512-Works-RESULT 0) set(SHA512-Works-STDERR "3982a1b4e651768bec70ab1fb97045cb7a659f4ba7203d501c52ab2e803071f9d5fd272022df15f27727fc67f8cd022e710e29010b2a9c0b467c111e2f6abf51") +set(SHA3_224-Works-RESULT 0) +set(SHA3_224-Works-STDERR "4272868085f4f25080681a7712509fd12e16dcda79bd356836dd2100") +set(SHA3_256-Works-RESULT 0) +set(SHA3_256-Works-STDERR "be0df472b6bd474417a166d12f2774f2ef5095e86f0a88ef4c78c703800cfc8a") +set(SHA3_384-Works-RESULT 0) +set(SHA3_384-Works-STDERR "935a17cc708443c1369549483656a4521af03a52e4f3b314566272017ccae03a2c5db838f6d4c156b1dc5c366182481b") +set(SHA3_512-Works-RESULT 0) +set(SHA3_512-Works-STDERR "471a85ed537e8f77f31412a089f22d836054ffa179599f87a5d7568927d8fa236b6793ded8a387d1de92398c967177bcc6361672a722bf736cb0f63a0956d5cf") set(TIMESTAMP-NoFile-RESULT 0) set(TIMESTAMP-NoFile-STDERR "~~") set(TIMESTAMP-BadArg1-RESULT 1) @@ -66,6 +74,10 @@ check_cmake_test(File SHA256-Works SHA384-Works SHA512-Works + SHA3_224-Works + SHA3_256-Works + SHA3_384-Works + SHA3_512-Works TIMESTAMP-NoFile TIMESTAMP-BadArg1 TIMESTAMP-NotBogus diff --git a/Tests/CMakeTests/String-SHA3_224-Works.cmake b/Tests/CMakeTests/String-SHA3_224-Works.cmake new file mode 100644 index 0000000..6aeb91d --- /dev/null +++ b/Tests/CMakeTests/String-SHA3_224-Works.cmake @@ -0,0 +1,2 @@ +string(SHA3_224 sha3_224 "sample input string\n") +message("${sha3_224}") diff --git a/Tests/CMakeTests/String-SHA3_256-Works.cmake b/Tests/CMakeTests/String-SHA3_256-Works.cmake new file mode 100644 index 0000000..cc7ea1a --- /dev/null +++ b/Tests/CMakeTests/String-SHA3_256-Works.cmake @@ -0,0 +1,2 @@ +string(SHA3_256 sha3_256 "sample input string\n") +message("${sha3_256}") diff --git a/Tests/CMakeTests/String-SHA3_384-Works.cmake b/Tests/CMakeTests/String-SHA3_384-Works.cmake new file mode 100644 index 0000000..9341c3f --- /dev/null +++ b/Tests/CMakeTests/String-SHA3_384-Works.cmake @@ -0,0 +1,2 @@ +string(SHA3_384 sha3_384 "sample input string\n") +message("${sha3_384}") diff --git a/Tests/CMakeTests/String-SHA3_512-Works.cmake b/Tests/CMakeTests/String-SHA3_512-Works.cmake new file mode 100644 index 0000000..cf4eddd --- /dev/null +++ b/Tests/CMakeTests/String-SHA3_512-Works.cmake @@ -0,0 +1,2 @@ +string(SHA3_512 sha3_512 "sample input string\n") +message("${sha3_512}") diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index a45b205..83655da 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -16,6 +16,14 @@ set(SHA384-Works-RESULT 0) set(SHA384-Works-STDERR "1de9560b4e030e02051ea408200ffc55d70c97ac64ebf822461a5c786f495c36df43259b14483bc8d364f0106f4971ee") set(SHA512-Works-RESULT 0) set(SHA512-Works-STDERR "3982a1b4e651768bec70ab1fb97045cb7a659f4ba7203d501c52ab2e803071f9d5fd272022df15f27727fc67f8cd022e710e29010b2a9c0b467c111e2f6abf51") +set(SHA3_224-Works-RESULT 0) +set(SHA3_224-Works-STDERR "4272868085f4f25080681a7712509fd12e16dcda79bd356836dd2100") +set(SHA3_256-Works-RESULT 0) +set(SHA3_256-Works-STDERR "be0df472b6bd474417a166d12f2774f2ef5095e86f0a88ef4c78c703800cfc8a") +set(SHA3_384-Works-RESULT 0) +set(SHA3_384-Works-STDERR "935a17cc708443c1369549483656a4521af03a52e4f3b314566272017ccae03a2c5db838f6d4c156b1dc5c366182481b") +set(SHA3_512-Works-RESULT 0) +set(SHA3_512-Works-STDERR "471a85ed537e8f77f31412a089f22d836054ffa179599f87a5d7568927d8fa236b6793ded8a387d1de92398c967177bcc6361672a722bf736cb0f63a0956d5cf") set(TIMESTAMP-BadArg1-RESULT 1) set(TIMESTAMP-BadArg1-STDERR "string sub-command TIMESTAMP requires at least one argument") set(TIMESTAMP-BadArg2-RESULT 1) @@ -52,6 +60,10 @@ check_cmake_test(String SHA256-Works SHA384-Works SHA512-Works + SHA3_224-Works + SHA3_256-Works + SHA3_384-Works + SHA3_512-Works TIMESTAMP-BadArg1 TIMESTAMP-BadArg2 TIMESTAMP-BadArg3 diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 9f08523..8acdd93 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -23,10 +23,12 @@ macro(run_test feature lang) endmacro() get_property(c_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES) +list(REMOVE_ITEM c_features c_std_90 c_std_99 c_std_11) foreach(feature ${c_features}) run_test(${feature} C) endforeach() get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) +list(REMOVE_ITEM cxx_features cxx_std_98 cxx_std_11 cxx_std_14) foreach(feature ${cxx_features}) run_test(${feature} CXX) endforeach() @@ -168,6 +170,15 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") endif() endif() +if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + if (CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.2) + # This works on some pre-15.0.2 versions and not others. + list(REMOVE_ITEM C_non_features + c_static_assert + ) + endif() +endif() + set(C_ext c) set(C_standard_flag 11) set(CXX_ext cpp) @@ -396,7 +407,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) ) add_executable(CompileFeaturesGenex2 genex_test.cpp) - target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_static_assert) + target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_std_11) target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override> HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type> @@ -405,10 +416,10 @@ if (CMAKE_CXX_COMPILE_FEATURES) HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$<COMPILE_FEATURES:cxx_inheriting_constructors,cxx_final> ) - add_library(static_assert_iface INTERFACE) - target_compile_features(static_assert_iface INTERFACE cxx_static_assert) + add_library(std_11_iface INTERFACE) + target_compile_features(std_11_iface INTERFACE cxx_std_11) add_executable(CompileFeaturesGenex3 genex_test.cpp) - target_link_libraries(CompileFeaturesGenex3 PRIVATE static_assert_iface) + target_link_libraries(CompileFeaturesGenex3 PRIVATE std_11_iface) target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override> HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type> diff --git a/Tests/CompileFeatures/cxx_right_angle_brackets.cpp b/Tests/CompileFeatures/cxx_right_angle_brackets.cpp index 8f1b0ee..4d494b5 100644 --- a/Tests/CompileFeatures/cxx_right_angle_brackets.cpp +++ b/Tests/CompileFeatures/cxx_right_angle_brackets.cpp @@ -7,6 +7,8 @@ struct A void someFunc() { - A<A<int> > object; + /* clang-format off */ + A<A<int>> object; + /* clang-format on */ (void)object; } diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index ca6462d..72c20eb 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -363,6 +363,23 @@ if(do_git_tests) ) set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + # Live git / master (no GIT_TAG), but git config flags + # + # The `git clone --config` parameter has been introduced in Git 1.7.7 + if(NOT git_version VERSION_LESS 1.7.7) + set(proj TutorialStep1-GIT-config) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_CONFIG core.eol=lf core.autocrlf=input + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + LOG_UPDATE 1 + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + endif() + # git by explicit branch/tag with empty submodule list # set(proj TutorialStep1-GIT-bytag-withsubmodules) diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt index 17f1630..5b94163 100644 --- a/Tests/ExternalProjectLocal/CMakeLists.txt +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -131,6 +131,7 @@ ExternalProject_Add(${proj} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> INSTALL_COMMAND "" LOG_BUILD 1 + UPDATE_DISCONNECTED 1 ) set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") diff --git a/Tests/FindLibRHash/CMakeLists.txt b/Tests/FindLibRHash/CMakeLists.txt new file mode 100644 index 0000000..4d3954d --- /dev/null +++ b/Tests/FindLibRHash/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindLibRHash.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindLibRHash/Test" + "${CMake_BINARY_DIR}/Tests/FindLibRHash/Test" + ${build_generator_args} + --build-project TestFindLibRHash + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindLibRHash/Test/CMakeLists.txt b/Tests/FindLibRHash/Test/CMakeLists.txt new file mode 100644 index 0000000..37e062a --- /dev/null +++ b/Tests/FindLibRHash/Test/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.7) +project(TestFindLibRHash C) +include(CTest) + +# CMake does not actually provide FindLibRHash publicly. +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules) + +find_package(LibRHash REQUIRED) + +add_executable(test_librhash_tgt main.c) +target_link_libraries(test_librhash_tgt LibRHash::LibRHash) +add_test(NAME test_librhash_tgt COMMAND test_librhash_tgt) + +add_executable(test_librhash_var main.c) +target_include_directories(test_librhash_var PRIVATE ${LibRHash_INCLUDE_DIRS}) +target_link_libraries(test_librhash_var PRIVATE ${LibRHash_LIBRARIES}) +add_test(NAME test_librhash_var COMMAND test_librhash_var) diff --git a/Tests/FindLibRHash/Test/main.c b/Tests/FindLibRHash/Test/main.c new file mode 100644 index 0000000..201dced --- /dev/null +++ b/Tests/FindLibRHash/Test/main.c @@ -0,0 +1,7 @@ +#include <rhash.h> + +int main() +{ + rhash_library_init(); + return 0; +} diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt index 56fcc5d..23832da 100644 --- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -20,16 +20,9 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile" AND configure_file(FindFoo.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindFoo.cmake @ONLY) # now set up the test: - if (NOT CMAKE_VERSION VERSION_LESS 2.8.12) - file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk" - CONTENT "CMAKE = \"$<TARGET_FILE:cmake>\"\n" - ) - else() - get_target_property(cmakeLocation cmake LOCATION) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk" - "CMAKE = \"${cmakeLocation}\"\n" - ) - endif() + file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk" + CONTENT "CMAKE = \"$<TARGET_FILE:cmake>\"\n" + ) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Makefile.in ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp COPYONLY) diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 27f33a2..f0d6abf 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -171,6 +171,13 @@ add_executable(Alias::SomeExe ALIAS someexe) add_library(Alias::SomeLib ALIAS empty1) +add_library(importedFallback STATIC IMPORTED) +set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) +set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION_RELEASE release_loc) +set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION fallback_loc) +set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_DEBUG "" DEBUG) +set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_RELEASE "") + add_custom_target(check-part3 ALL COMMAND ${CMAKE_COMMAND} -Dtest_version_greater_1=$<VERSION_GREATER:1.0,1.1.1> @@ -184,6 +191,7 @@ add_custom_target(check-part3 ALL -Dtest_imported_release=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> -Dtest_imported_relwithdebinfo=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> -Dtest_imported_minsizerel=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> + -Dtest_imported_fallback=$<STREQUAL:$<TARGET_FILE_NAME:importedFallback>,fallback_loc> -Dtest_alias_file_exe=$<STREQUAL:$<TARGET_FILE:Alias::SomeExe>,$<TARGET_FILE:someexe>> -Dtest_alias_file_lib=$<STREQUAL:$<TARGET_FILE:Alias::SomeLib>,$<TARGET_FILE:empty1>> -Dtest_alias_target_name=$<STREQUAL:$<TARGET_PROPERTY:Alias::SomeLib,NAME>,$<TARGET_PROPERTY:empty1,NAME>> @@ -249,6 +257,7 @@ add_custom_target(check-part4 ALL # Cover test properties with generator expressions. add_executable(echo echo.c) add_executable(pwd pwd.c) +set_property(SOURCE echo.c PROPERTY COMPILE_FLAGS $<1:-DSRC_GENEX_WORKS>) add_test(NAME echo-configuration COMMAND echo $<CONFIGURATION>) set_property(TEST echo-configuration PROPERTY diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 70ccfe1..e12d8c6 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -21,6 +21,8 @@ foreach(c debug release relwithdebinfo minsizerel) endif() endforeach() +check(test_imported_fallback "1") + check(test_alias_file_exe "1") check(test_alias_file_lib "1") check(test_alias_target_name "1") diff --git a/Tests/GeneratorExpression/echo.c b/Tests/GeneratorExpression/echo.c index 06b0844..41596a2 100644 --- a/Tests/GeneratorExpression/echo.c +++ b/Tests/GeneratorExpression/echo.c @@ -3,6 +3,9 @@ int main(int argc, char* argv[]) { +#ifndef SRC_GENEX_WORKS +#error SRC_GENEX_WORKS not defined +#endif printf("%s\n", argv[1]); return EXIT_SUCCESS; } diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index ee81419..3db210a 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -25,8 +25,25 @@ target_sources(iface_objlib INTERFACE $<TARGET_OBJECTS:objlib>) add_library(intermediate INTERFACE) target_link_libraries(intermediate INTERFACE iface_objlib) +add_library(item_fake_tgt STATIC item_fake.cpp) +set_property(TARGET item_fake_tgt PROPERTY OUTPUT_NAME item_fake) +add_library(item_real STATIC item.cpp) +add_library(item_iface INTERFACE IMPORTED) +set_property(TARGET item_iface PROPERTY IMPORTED_LIBNAME item_real) +add_dependencies(item_iface item_real) +link_directories(${CMAKE_CURRENT_BINARY_DIR}) + add_executable(InterfaceLibrary definetestexe.cpp) -target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface intermediate) +target_link_libraries(InterfaceLibrary + iface_nodepends + headeriface + subiface + intermediate + + item_iface + item_fake # ensure that 'item_real' is ordered in place of item_iface + ) +add_dependencies(InterfaceLibrary item_fake_tgt) add_subdirectory(libsdir) diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp index a6b5592..098502c 100644 --- a/Tests/InterfaceLibrary/definetestexe.cpp +++ b/Tests/InterfaceLibrary/definetestexe.cpp @@ -17,8 +17,9 @@ extern int obj(); extern int sub(); +extern int item(); int main(int, char**) { - return obj() + sub(); + return obj() + sub() + item(); } diff --git a/Tests/InterfaceLibrary/item.cpp b/Tests/InterfaceLibrary/item.cpp new file mode 100644 index 0000000..85cda1b --- /dev/null +++ b/Tests/InterfaceLibrary/item.cpp @@ -0,0 +1,4 @@ +int item() +{ + return 0; +} diff --git a/Tests/InterfaceLibrary/item_fake.cpp b/Tests/InterfaceLibrary/item_fake.cpp new file mode 100644 index 0000000..b4bd829 --- /dev/null +++ b/Tests/InterfaceLibrary/item_fake.cpp @@ -0,0 +1,5 @@ +extern int item_undefined(); +int item() +{ + return item_undefined(); +} diff --git a/Tests/MacRuntimePath/A/CMakeLists.txt b/Tests/MacRuntimePath/A/CMakeLists.txt index ade0a3c..bf937e6 100644 --- a/Tests/MacRuntimePath/A/CMakeLists.txt +++ b/Tests/MacRuntimePath/A/CMakeLists.txt @@ -40,21 +40,30 @@ target_link_libraries(test3 framework) add_executable(test4 test1.cpp) target_link_libraries(test4 shared2) +# executable to test a shared library dependency with build rpath +add_executable(test5 test1.cpp) + +# avoid linking by 'target_link_libraries' so CMake +# will not be able to set correct RPATH automatically +add_dependencies(test5 shared) +target_link_libraries(test5 "$<TARGET_FILE:shared>") +set_target_properties(test5 PROPERTIES BUILD_RPATH "@loader_path/../lib") + set_target_properties(shared shared2 framework PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") -set_target_properties(test1 test2 test3 test4 PROPERTIES +set_target_properties(test1 test2 test3 test4 test5 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") foreach(config ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${config} CONFIG) set_target_properties(shared shared2 framework PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${CONFIG} "${CMAKE_CURRENT_BINARY_DIR}/${config}/lib") - set_target_properties(test1 test2 test3 test4 PROPERTIES + set_target_properties(test1 test2 test3 test4 test5 PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${CONFIG} "${CMAKE_CURRENT_BINARY_DIR}/${config}/bin") endforeach() -foreach(test test1 test2 test3 test4) +foreach(test test1 test2 test3 test4 test5) add_custom_target(${test}_run ALL COMMAND ${test} DEPENDS ${test} diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt index ed2c7d4..f764b3a 100644 --- a/Tests/MathTest/CMakeLists.txt +++ b/Tests/MathTest/CMakeLists.txt @@ -10,6 +10,9 @@ set(expressions "1 +(3*4) + 10 >> 2" "10000 / 20 / 4" "10000 / (20 / 4)" + "-1 + +1" + "+1 - -1" + "+1 - - + + -(-3 + - - +1)" ) set(FILE_EXPRESSIONS "") diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt index 1018dd8..737e17a 100644 --- a/Tests/Module/ExternalData/CMakeLists.txt +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -45,6 +45,8 @@ ExternalData_Add_Test(Data1 -D Meta=DATA{MetaTop.dat,REGEX:Meta[ABC].dat} -D Directory=DATA{Directory/,A.dat,REGEX:[BC].dat} -D DirRecurse=DATA{DirRecurse/,RECURSE:,A.dat,REGEX:[BC].dat} + -D MultipleAlgorithmNoSHA1=DATA{MultipleAlgorithmNoSHA1.dat} + -D MultipleAlgorithmNoMD5=DATA{MultipleAlgorithmNoMD5.dat} -D "Semicolons=DATA{Data.dat}\\;DATA{Data.dat}" -P ${CMAKE_CURRENT_SOURCE_DIR}/Data1Check.cmake ) diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.md5 b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.md5 new file mode 100644 index 0000000..a956f36 --- /dev/null +++ b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.md5 @@ -0,0 +1 @@ +29848e54a4d0343f138ab14419b863de diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.sha1 b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.sha1 new file mode 100644 index 0000000..43a3540 --- /dev/null +++ b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.sha1 @@ -0,0 +1 @@ +2af59a7022024974f3b8521b7ed8137c996a79f1 diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.md5 b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.md5 new file mode 100644 index 0000000..1906cbf --- /dev/null +++ b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.md5 @@ -0,0 +1 @@ +08cfcf221f76ace7b906b312284e73d7 diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.sha1 b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.sha1 new file mode 100644 index 0000000..65781b2 --- /dev/null +++ b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.sha1 @@ -0,0 +1 @@ +223b134e6e3a9bf34aa7531c009d97cff6b0d8a3 diff --git a/Tests/Module/ExternalData/SHA3_256/.gitattributes b/Tests/Module/ExternalData/SHA3_256/.gitattributes new file mode 100644 index 0000000..3e51d39 --- /dev/null +++ b/Tests/Module/ExternalData/SHA3_256/.gitattributes @@ -0,0 +1 @@ +* -crlf diff --git a/Tests/Module/ExternalData/SHA3_256/c01b0bfd51ece4295c7b45493750a3612ecc483095eb1366f9f46b179550e231 b/Tests/Module/ExternalData/SHA3_256/c01b0bfd51ece4295c7b45493750a3612ecc483095eb1366f9f46b179550e231 new file mode 100644 index 0000000..0377f5d --- /dev/null +++ b/Tests/Module/ExternalData/SHA3_256/c01b0bfd51ece4295c7b45493750a3612ecc483095eb1366f9f46b179550e231 @@ -0,0 +1 @@ +SeriesMixed.5 diff --git a/Tests/Module/ExternalData/SeriesMixed.5.dat.sha3-256 b/Tests/Module/ExternalData/SeriesMixed.5.dat.sha3-256 new file mode 100644 index 0000000..1a5db39 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesMixed.5.dat.sha3-256 @@ -0,0 +1 @@ +c01b0bfd51ece4295c7b45493750a3612ecc483095eb1366f9f46b179550e231 diff --git a/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake b/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake new file mode 100644 index 0000000..99c6cae --- /dev/null +++ b/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake @@ -0,0 +1,14 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT applications) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) +install(FILES CMakeLists.txt DESTINATION bas COMPONENT libs) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") + set(CPACK_RPM_MAIN_COMPONENT "") +else() + set(CPACK_RPM_MAIN_COMPONENT "applications") + set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") +endif() + +set(CPACK_PACKAGE_NAME "main_component") diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake new file mode 100644 index 0000000..69603dd --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake @@ -0,0 +1,13 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "0") + +if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") + set(EXPECTED_FILES_COUNT "3") + set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm") + set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") + set(EXPECTED_FILE_2 "main_component*-headers.rpm") + set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$") + set(EXPECTED_FILE_3 "main_component*-libs.rpm") + set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/CMakeLists.txt$") +endif() diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt new file mode 100644 index 0000000..dff163d --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt @@ -0,0 +1,3 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-headers.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-libs.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component.spec$ diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt new file mode 100644 index 0000000..4d8ac6e --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt @@ -0,0 +1 @@ +CPACK_RPM_MAIN_COMPONENT set to non existing component. diff --git a/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-ExpectedFiles.cmake new file mode 100644 index 0000000..02ebb44 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "rpm_suggests*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-VerifyResult.cmake b/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-VerifyResult.cmake new file mode 100644 index 0000000..32cc6d1 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-VerifyResult.cmake @@ -0,0 +1,31 @@ +execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --querytags + OUTPUT_VARIABLE RPMBUILD_CAPS + RESULT_VARIABLE RPMBUILD_CAPS_RESULT) + +if(NOT RPMBUILD_CAPS_RESULT) + string(REPLACE "\n" ";" RPMBUILD_CAPS "${RPMBUILD_CAPS}") + cmake_policy(PUSH) + cmake_policy(SET CMP0057 NEW) + if(SUGGESTS IN_LIST RPMBUILD_CAPS) + set(should_contain_suggests_tag_ true) + endif() + cmake_policy(POP) +endif() + +# Only verify that suggests tag is present only if that tag is supported. +# If it is not supported the rpm package was corretly generated by ignoring +# that tag and that was already checked by expected files test. +if(should_contain_suggests_tag_) + execute_process(COMMAND ${RPM_EXECUTABLE} -q --suggests -p "${FOUND_FILE_1}" + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + RESULT_VARIABLE rpm_result_ + OUTPUT_VARIABLE rpm_output_ + ERROR_VARIABLE error_variable_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(rpm_result_ OR NOT rpm_output_ STREQUAL "libsuggested") + message(FATAL_ERROR "RPM_SUGGESTED package error: no suggested packages" + " (result: '${rpm_result_}'; output: '${rpm_output_}';" + " error: '${error_variable_}')") + endif() +endif() diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake new file mode 100644 index 0000000..dc49343 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake @@ -0,0 +1,30 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "0") + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") + set(EXPECTED_FILES_COUNT "4") + set(EXPECTED_FILE_1 "single_debuginfo-0.1.1-1.*.rpm") + set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$") + set(EXPECTED_FILE_2 "single_debuginfo*-headers.rpm") + set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$") + set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm") + set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$") + + set(EXPECTED_FILE_4 "single_debuginfo-debuginfo*.rpm") + set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") + set(EXPECTED_FILES_COUNT "2") + set(EXPECTED_FILE_1 "single_debuginfo-0*-applications.rpm") + set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$") + + set(EXPECTED_FILE_2 "single_debuginfo-applications-debuginfo*.rpm") + set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") + set(EXPECTED_FILES_COUNT "2") + set(EXPECTED_FILE_1 "single_debuginfo-0*.rpm") + set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$") + + set(EXPECTED_FILE_2 "single_debuginfo-debuginfo*.rpm") + set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") +endif() diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt new file mode 100644 index 0000000..d80939f --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_components-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$ diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt new file mode 100644 index 0000000..86396db --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt @@ -0,0 +1,3 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-headers.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-libs.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$ diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt new file mode 100644 index 0000000..454283c --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt @@ -0,0 +1 @@ +CPack Error: CPACK_RPM_MAIN_COMPONENT not set but it is mandatory with CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE being set. diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt new file mode 100644 index 0000000..080c4ff --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-applications.spec$ diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt new file mode 100644 index 0000000..665597c --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component_main-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$ diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt new file mode 100644 index 0000000..b64b1f5 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component_no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-applications.spec$ diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt new file mode 100644 index 0000000..f4c1bef --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt @@ -0,0 +1,3 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-headers.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-libs.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$ diff --git a/Tests/RunCMake/CPack/RPM_SUGGESTS.cmake b/Tests/RunCMake/CPack/RPM_SUGGESTS.cmake new file mode 100644 index 0000000..e6e0c1f --- /dev/null +++ b/Tests/RunCMake/CPack/RPM_SUGGESTS.cmake @@ -0,0 +1,4 @@ +install(FILES CMakeLists.txt DESTINATION foo) + +set(CPACK_RPM_PACKAGE_SUGGESTS "libsuggested") +set(CPACK_PACKAGE_NAME "rpm_suggests") diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 60d42ac..61d4332 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -12,11 +12,14 @@ run_cpack_test(DEPENDENCIES "RPM;DEB" true) run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(CUSTOM_NAMES "RPM;DEB" true) +run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false) run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false) run_cpack_test(RPM_DIST "RPM" false) +run_cpack_test(RPM_SUGGESTS "RPM" false) run_cpack_test(INSTALL_SCRIPTS "RPM" false) run_cpack_test(DEB_GENERATE_SHLIBS "DEB" true) run_cpack_test(DEB_GENERATE_SHLIBS_LDCONFIG "DEB" true) run_cpack_test(DEBUGINFO "RPM" true) +run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM" true) run_cpack_test(LONG_FILENAMES "DEB" false) -run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false) +run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512;SHA3_224;SHA3_256;SHA3_384;SHA3_512" "TGZ" false) diff --git a/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake b/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake new file mode 100644 index 0000000..ae4995e --- /dev/null +++ b/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake @@ -0,0 +1,56 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +# PGI compiler doesn't add build id to binaries by default +if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") + string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") + string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") +endif() + +if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") + set(CPACK_RPM_COMPONENT_INSTALL "ON") +endif() + +set(CMAKE_BUILD_TYPE Debug) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" + "int test_lib();\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" + "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") +add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") +add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +target_link_libraries(test_prog test_lib) + +install(TARGETS test_prog DESTINATION foo COMPONENT applications) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") + install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) + install(TARGETS test_lib DESTINATION bas COMPONENT libs) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") + set(CPACK_COMPONENTS_ALL applications) +endif() + +set(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE ON) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") + set(CPACK_RPM_MAIN_COMPONENT "applications") + set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") +endif() + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component") + set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON) + set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON) +endif() + +set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src") + +set(CPACK_PACKAGE_NAME "single_debuginfo") diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 8bc2a58..ad2a651 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -27,10 +27,12 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) expected_content_list "${PACKAGE_CONTENT}") if(NOT expected_content_list) + string(REPLACE "\n" "\n actual> " msg_actual "\n${PACKAGE_CONTENT}") + string(REPLACE "\n" "\n expect> " msg_expected "\n${EXPECTED_FILE_CONTENT_${file_no_}}") message(FATAL_ERROR "Unexpected file content for file No. '${file_no_}'!\n" - " Content: '${PACKAGE_CONTENT}'\n\n" - " Expected: '${EXPECTED_FILE_CONTENT_${file_no_}}'" + "The content was:${msg_actual}\n" + "which does not match:${msg_expected}\n" "${output_error_message}") endif() else() diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 2bc3693..e936dab 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -135,6 +135,7 @@ function(run_TestOutputSize) ") run_cmake_command(TestOutputSize ${CMAKE_CTEST_COMMAND} -M Experimental -T Test + --no-compress-output --test-output-size-passed 10 --test-output-size-failed 12 ) diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake index 09594bd..2d14a9e 100644 --- a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake @@ -3,13 +3,13 @@ add_library(empty1 empty.cpp) add_library(empty2 INTERFACE) add_library(empty3 INTERFACE) -target_compile_features(empty3 INTERFACE cxx_static_assert) +target_compile_features(empty3 INTERFACE cxx_std_11) target_link_libraries(empty1 # When starting, $<COMPILE_FEATURES:cxx_auto_type> is '0', so 'freeze' the # CXX_STANDARD at 98 during computation. $<$<COMPILE_FEATURES:cxx_auto_type>:empty2> - # This would add cxx_static_assert, but that would require CXX_STANDARD = 11, + # This would add cxx_std_11, but that would require CXX_STANDARD = 11, # which is not allowed after freeze. Report an error. empty3 ) diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved.cmake index bbcf4e0..a04dcec 100644 --- a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved.cmake +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved.cmake @@ -3,7 +3,7 @@ add_library(empty1 empty.cpp) add_library(empty2 INTERFACE) add_library(empty3 INTERFACE) -target_compile_features(empty3 INTERFACE cxx_static_assert) +target_compile_features(empty3 INTERFACE cxx_std_11) target_link_libraries(empty1 $<$<COMPILE_FEATURES:cxx_nullptr>:empty2> diff --git a/Tests/RunCMake/Configure/RemoveCache-stdout.txt b/Tests/RunCMake/Configure/RemoveCache-stdout.txt new file mode 100644 index 0000000..73e7e5d --- /dev/null +++ b/Tests/RunCMake/Configure/RemoveCache-stdout.txt @@ -0,0 +1 @@ +-- The C compiler identification is diff --git a/Tests/RunCMake/Configure/RemoveCache.cmake b/Tests/RunCMake/Configure/RemoveCache.cmake new file mode 100644 index 0000000..304918f --- /dev/null +++ b/Tests/RunCMake/Configure/RemoveCache.cmake @@ -0,0 +1,17 @@ +enable_language(C) + +set(vars + CMAKE_EXECUTABLE_FORMAT + ) + +if(CMAKE_HOST_UNIX) + list(APPEND vars + CMAKE_UNAME + ) +endif() + +foreach(v IN LISTS vars) + if(NOT DEFINED ${v}) + message(SEND_ERROR "Variable '${v}' is not set!") + endif() +endforeach() diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake index 91adb4e..4a135be 100644 --- a/Tests/RunCMake/Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake @@ -24,3 +24,12 @@ file(WRITE "${depend}" "2") run_cmake_command(RerunCMake-build2 ${CMAKE_COMMAND} --build .) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) + +# Use a single build tree for a few tests without cleaning. +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RemoveCache-build) +set(RunCMake_TEST_NO_CLEAN 1) +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") +run_cmake(RemoveCache) +file(REMOVE "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt") +run_cmake(RemoveCache) diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake index 67fa30f..c4db11b 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake @@ -4,7 +4,15 @@ set(CMAKE_CROSSCOMPILING 1) add_executable(generated_exe_emulator_expected simple_src_exiterror.cxx) # Executable: Return error code equal to 0 -add_executable(generated_exe_emulator_unexpected simple_src_exitsuccess.cxx) +add_executable(generated_exe_emulator_unexpected generated_exe_emulator_unexpected.cxx) +# Place the executable in a predictable location. +set_property(TARGET generated_exe_emulator_unexpected PROPERTY RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR}>) + +# Executable: Imported version of above. Fake the imported target to use the above. +add_executable(generated_exe_emulator_unexpected_imported IMPORTED) +set_property(TARGET generated_exe_emulator_unexpected_imported PROPERTY IMPORTED_LOCATION + "${CMAKE_CURRENT_BINARY_DIR}/generated_exe_emulator_unexpected${CMAKE_EXECUTABLE_SUFFIX}") +add_dependencies(generated_exe_emulator_unexpected_imported generated_exe_emulator_unexpected) # DoesNotUseEmulator add_custom_command(OUTPUT output1 @@ -22,6 +30,12 @@ add_custom_command(OUTPUT output3 COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output3 DEPENDS generated_exe_emulator_unexpected) +# DoesNotUseEmulator: The command will fail if emulator is prepended +add_custom_command(OUTPUT outputImp + COMMAND generated_exe_emulator_unexpected_imported + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/outputImp + ) + # UsesEmulator: The command only succeeds if the emulator is prepended # to the command. add_custom_command(OUTPUT output4 @@ -34,5 +48,6 @@ add_custom_target(ensure_build ALL ${CMAKE_CURRENT_BINARY_DIR}/output1 ${CMAKE_CURRENT_BINARY_DIR}/output2 ${CMAKE_CURRENT_BINARY_DIR}/output3 + ${CMAKE_CURRENT_BINARY_DIR}/outputImp ${CMAKE_CURRENT_BINARY_DIR}/output4 ) diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake index ced569f..5b01abc 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake @@ -4,7 +4,15 @@ set(CMAKE_CROSSCOMPILING 1) add_executable(generated_exe_emulator_expected simple_src_exiterror.cxx) # Executable: Return error code equal to 0 -add_executable(generated_exe_emulator_unexpected simple_src_exitsuccess.cxx) +add_executable(generated_exe_emulator_unexpected generated_exe_emulator_unexpected.cxx) +# Place the executable in a predictable location. +set_property(TARGET generated_exe_emulator_unexpected PROPERTY RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR}>) + +# Executable: Imported version of above. Fake the imported target to use the above. +add_executable(generated_exe_emulator_unexpected_imported IMPORTED) +set_property(TARGET generated_exe_emulator_unexpected_imported PROPERTY IMPORTED_LOCATION + "${CMAKE_CURRENT_BINARY_DIR}/generated_exe_emulator_unexpected${CMAKE_EXECUTABLE_SUFFIX}") +add_dependencies(generated_exe_emulator_unexpected_imported generated_exe_emulator_unexpected) # DoesNotUseEmulator add_custom_target(generate_output1 ALL @@ -22,6 +30,12 @@ add_custom_target(generate_output3 ALL COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output3 DEPENDS generated_exe_emulator_unexpected) +# DoesNotUseEmulator: The command will fail if emulator is prepended +add_custom_target(generate_outputImp ALL + COMMAND generated_exe_emulator_unexpected_imported + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/outputImp + ) + # UsesEmulator: The command only succeeds if the emulator is prepended # to the command. add_custom_target(generate_output4 ALL diff --git a/Tests/RunCMake/CrosscompilingEmulator/generated_exe_emulator_unexpected.cxx b/Tests/RunCMake/CrosscompilingEmulator/generated_exe_emulator_unexpected.cxx new file mode 100644 index 0000000..233f432 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/generated_exe_emulator_unexpected.cxx @@ -0,0 +1,9 @@ +#include <stdio.h> + +int main(int argc, const char* argv[]) +{ + for (int i = 1; i < argc; ++i) { + fprintf(stderr, "unexpected argument: '%s'\n", argv[i]); + } + return argc == 1 ? 0 : 1; +} diff --git a/Tests/RunCMake/CrosscompilingEmulator/simple_src_exitsuccess.cxx b/Tests/RunCMake/CrosscompilingEmulator/simple_src_exitsuccess.cxx deleted file mode 100644 index a3dd891..0000000 --- a/Tests/RunCMake/CrosscompilingEmulator/simple_src_exitsuccess.cxx +++ /dev/null @@ -1,4 +0,0 @@ -int main(int, char**) -{ - return 0; -} diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt index e4dbb71..d4e5b29 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning \(dev\) in CMakeLists.txt: +CMake Warning \(dev\) at TARGET_PROPERTY-LOCATION.cmake:2 \(add_library\): Policy CMP0026 is not set: Disallow use of the LOCATION target property. Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy command to set the policy and suppress this warning. @@ -7,4 +7,6 @@ CMake Warning \(dev\) in CMakeLists.txt: name directly with add_custom_command, or use the generator expression \$<TARGET_FILE>, as appropriate. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-stderr.txt new file mode 100644 index 0000000..5737e95 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + does not recognize the toolset + + Test Toolset,host=x6[45] + + that was specified\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index 283a2a0..e8ce47d 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -6,6 +6,21 @@ run_cmake(NoToolset) if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode" AND NOT XCODE_BELOW_3) set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) + if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[245]") + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") + run_cmake(TestToolsetHostArchBoth) + set(RunCMake_GENERATOR_TOOLSET ",host=x64") + run_cmake(TestToolsetHostArchOnly) + set(RunCMake_GENERATOR_TOOLSET "host=x64") + run_cmake(TestToolsetHostArchOnly) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolsetHostArchNone) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x65") + run_cmake(BadToolsetHostArch) + else() + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") + run_cmake(BadToolsetHostArch) + endif() else() set(RunCMake_GENERATOR_TOOLSET "Bad Toolset") run_cmake(BadToolset) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth-stdout.txt new file mode 100644 index 0000000..f0b6d46 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_TOOLSET='Test Toolset' +-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='x64' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth.cmake new file mode 100644 index 0000000..26926f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth.cmake @@ -0,0 +1,2 @@ +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}'") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt new file mode 100644 index 0000000..576b40c --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_TOOLSET='Test Toolset' +-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake new file mode 100644 index 0000000..26926f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake @@ -0,0 +1,2 @@ +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}'") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt new file mode 100644 index 0000000..8271bd4 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_TOOLSET='v[0-9]+' +-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='x64' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake new file mode 100644 index 0000000..26926f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake @@ -0,0 +1,2 @@ +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}'") diff --git a/Tests/RunCMake/Ninja/NinjaToolMissing-result.txt b/Tests/RunCMake/Ninja/NinjaToolMissing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Ninja/NinjaToolMissing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Ninja/NinjaToolMissing-stderr.txt b/Tests/RunCMake/Ninja/NinjaToolMissing-stderr.txt new file mode 100644 index 0000000..1214288 --- /dev/null +++ b/Tests/RunCMake/Ninja/NinjaToolMissing-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Running + + 'ninja-tool-missing' '--version' + + failed with: diff --git a/Tests/RunCMake/Ninja/NinjaToolMissing.cmake b/Tests/RunCMake/Ninja/NinjaToolMissing.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Ninja/NinjaToolMissing.cmake diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 1d3639d..7b4e51e 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -15,6 +15,12 @@ else() message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}") endif() +function(run_NinjaToolMissing) + set(RunCMake_MAKE_PROGRAM ninja-tool-missing) + run_cmake(NinjaToolMissing) +endfunction() +run_NinjaToolMissing() + function(run_CMP0058 case) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build) diff --git a/Tests/RunCMake/RunCTest.cmake b/Tests/RunCMake/RunCTest.cmake index e94432b..89e16ee 100644 --- a/Tests/RunCMake/RunCTest.cmake +++ b/Tests/RunCMake/RunCTest.cmake @@ -12,6 +12,7 @@ function(run_ctest CASE_NAME) -S ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake -V --output-log ${RunCMake_BINARY_DIR}/${CASE_NAME}-build/testOutput.log + --no-compress-output ${ARGN} ) endfunction() diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index cc2cc2e..22d8164 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -1,2 +1,3 @@ include(RunCMake) run_cmake(VsConfigurationType) +run_cmake(VsTargetsFileReferences) diff --git a/Tests/RunCMake/VS10Project/VsTargetsFileReferences-check.cmake b/Tests/RunCMake/VS10Project/VsTargetsFileReferences-check.cmake new file mode 100644 index 0000000..3d01c2c --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsTargetsFileReferences-check.cmake @@ -0,0 +1,45 @@ +set(files foo.vcxproj bar.vcxproj baz.vcxproj) + +foreach(file ${files}) + set(vsProjectFile ${RunCMake_TEST_BINARY_DIR}/${file}) + + if(NOT EXISTS "${vsProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vsProjectFile} does not exist.") + return() + endif() + + set(waldoFound FALSE) + set(xyzzyFound FALSE) + file(STRINGS "${vsProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<Import Project=.*/>$") + if(line MATCHES "^.*waldo.targets.*$") + set(waldoFound TRUE) + message(STATUS "${file} is importing waldo.targets") + elseif(line MATCHES "^.*xyzzy.targets.*$") + set(xyzzyFound TRUE) + message(STATUS "${file} is importing xyzzy.targets") + endif() + endif() + endforeach() + + if("${file}" STREQUAL "foo.vcxproj") + if(NOT xyzzyFound) + set(RunCMake_TEST_FAILED "xyzzy.targets not imported from ${file}") + return() + endif() + if(waldoFound) + set(RunCMake_TEST_FAILED "waldo.targets imported from ${file}") + return() + endif() + else() + if(NOT xyzzyFound) + set(RunCMake_TEST_FAILED "xyzzy.targets not imported from ${file}") + return() + endif() + if(NOT waldoFound) + set(RunCMake_TEST_FAILED "waldo.targets not imported from ${file}") + return() + endif() + endif() +endforeach() diff --git a/Tests/RunCMake/VS10Project/VsTargetsFileReferences.cmake b/Tests/RunCMake/VS10Project/VsTargetsFileReferences.cmake new file mode 100644 index 0000000..5ca4f1f --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsTargetsFileReferences.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) +add_library(foo foo.cpp) +target_link_libraries(foo ${CMAKE_BINARY_DIR}/xyzzy.targets) + +add_library(bar bar.cpp) +target_link_libraries(bar foo ${CMAKE_BINARY_DIR}/waldo.targets) + +add_executable(baz baz.cpp) +target_link_libraries(baz bar) diff --git a/Tests/RunCMake/VS10Project/bar.cpp b/Tests/RunCMake/VS10Project/bar.cpp new file mode 100644 index 0000000..b72a1a5 --- /dev/null +++ b/Tests/RunCMake/VS10Project/bar.cpp @@ -0,0 +1,3 @@ +void bar() +{ +} diff --git a/Tests/RunCMake/VS10Project/baz.cpp b/Tests/RunCMake/VS10Project/baz.cpp new file mode 100644 index 0000000..d5d334a --- /dev/null +++ b/Tests/RunCMake/VS10Project/baz.cpp @@ -0,0 +1,3 @@ +void baz() +{ +} diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-result.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt new file mode 100644 index 0000000..6500649 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error in CMakeLists.txt: + Xcode does not support per-config per-source COMPILE_FLAGS: + + \$<\$<CONFIG:Debug>:-DMYDEBUG> + + specified for source: + + .*/Tests/RunCMake/XcodeProject/main.c$ diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags.cmake b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags.cmake new file mode 100644 index 0000000..99cec5b --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_executable(main main.c) +set_property(SOURCE main.c PROPERTY COMPILE_FLAGS "$<$<CONFIG:Debug>:-DMYDEBUG>") diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index d43c80d..60912c2 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -13,6 +13,8 @@ if (NOT XCODE_VERSION VERSION_LESS 6) run_cmake(XcodePlatformFrameworks) endif() +run_cmake(PerConfigPerSourceFlags) + # Use a single build tree for a few tests without cleaning. if(NOT XCODE_VERSION VERSION_LESS 5) diff --git a/Tests/RunCMake/ctest_build/CMakeLists.txt.in b/Tests/RunCMake/ctest_build/CMakeLists.txt.in index 82cb7c4..133ae36 100644 --- a/Tests/RunCMake/ctest_build/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_build/CMakeLists.txt.in @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.1) +@CASE_CMAKELISTS_PREFIX_CODE@ project(CTestBuild@CASE_NAME@ NONE) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index 324f25c..1092d2a 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -13,6 +13,11 @@ function(run_BuildFailure) set(CASE_CMAKELISTS_SUFFIX_CODE [[ add_custom_target(BuildFailure ALL COMMAND command-does-not-exist) ]]) + set(CASE_CMAKELISTS_PREFIX_CODE [[ +if(NOT CTEST_USE_LAUNCHERS) + message(FATAL_ERROR "CTEST_USE_LAUNCHERS not set") +endif() +]]) set(CASE_TEST_PREFIX_CODE [[ cmake_policy(SET CMP0061 NEW) ]]) diff --git a/Tests/RunCMake/ctest_build/test.cmake.in b/Tests/RunCMake/ctest_build/test.cmake.in index 768f1c6..6f15ec9 100644 --- a/Tests/RunCMake/ctest_build/test.cmake.in +++ b/Tests/RunCMake/ctest_build/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_USE_LAUNCHERS TRUE) set(ctest_build_args "@CASE_CTEST_BUILD_ARGS@") ctest_start(Experimental) diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-stderr.txt new file mode 100644 index 0000000..d4b71ae --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-stderr.txt @@ -0,0 +1 @@ +Defect count: 3 diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-stdout.txt new file mode 100644 index 0000000..97a8a9b --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-stdout.txt @@ -0,0 +1,3 @@ +Memory checking results: +Direct leak - 2 +Indirect leak - 1 diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurify-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyPurify-stdout.txt index dabb004..69ab584 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyPurify-stdout.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyPurify-stdout.txt @@ -2,5 +2,7 @@ 100% tests passed, 0 tests failed out of 1 .* --- Processing memory checking output:( ) +-- Processing memory checking output: +MemCheck log files can be found here:.*corresponds to test number. +.*MemoryChecker.*log Memory checking results: diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrind-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrind-stdout.txt index dabb004..69ab584 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrind-stdout.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrind-stdout.txt @@ -2,5 +2,7 @@ 100% tests passed, 0 tests failed out of 1 .* --- Processing memory checking output:( ) +-- Processing memory checking output: +MemCheck log files can be found here:.*corresponds to test number. +.*MemoryChecker.*log Memory checking results: diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stdout.txt index dabb004..69ab584 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stdout.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stdout.txt @@ -2,5 +2,7 @@ 100% tests passed, 0 tests failed out of 1 .* --- Processing memory checking output:( ) +-- Processing memory checking output: +MemCheck log files can be found here:.*corresponds to test number. +.*MemoryChecker.*log Memory checking results: diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stdout.txt index dabb004..69ab584 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stdout.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stdout.txt @@ -2,5 +2,7 @@ 100% tests passed, 0 tests failed out of 1 .* --- Processing memory checking output:( ) +-- Processing memory checking output: +MemCheck log files can be found here:.*corresponds to test number. +.*MemoryChecker.*log Memory checking results: diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stdout.txt index 5a5675c..88b4788 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stdout.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stdout.txt @@ -3,5 +3,7 @@ 100% tests passed, 0 tests failed out of 1 .* --- Processing memory checking output:( ) +-- Processing memory checking output: +MemCheck log files can be found here:.*corresponds to test number. +.*MemoryChecker.*log Memory checking results: diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoDefects-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoDefects-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoDefects-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoDefects-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoDefects-stderr.txt new file mode 100644 index 0000000..ad28645 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoDefects-stderr.txt @@ -0,0 +1 @@ +Defect count: 0 diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoDefects-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoDefects-stdout.txt new file mode 100644 index 0000000..69ab584 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoDefects-stdout.txt @@ -0,0 +1,8 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output: +MemCheck log files can be found here:.*corresponds to test number. +.*MemoryChecker.*log +Memory checking results: diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stdout.txt index dabb004..69ab584 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stdout.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stdout.txt @@ -2,5 +2,7 @@ 100% tests passed, 0 tests failed out of 1 .* --- Processing memory checking output:( ) +-- Processing memory checking output: +MemCheck log files can be found here:.*corresponds to test number. +.*MemoryChecker.*log Memory checking results: diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake index 5ad6511..212bfdb 100644 --- a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake @@ -12,6 +12,8 @@ endfunction() unset(CTEST_EXTRA_CONFIG) unset(CTEST_EXTRA_CODE) +unset(CTEST_SUFFIX_CODE) +unset(CTEST_MEMCHECK_ARGS) unset(CMAKELISTS_EXTRA_CODE) #----------------------------------------------------------------------------- @@ -132,4 +134,31 @@ run_mc_test(DummyValgrindNoLogFile "${PSEUDO_VALGRIND_NOLOG}") run_mc_test(DummyBCNoLogFile "${PSEUDO_BC_NOLOG}") run_mc_test(NotExist "\${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") run_mc_test(Unknown "\${CMAKE_COMMAND}") -run_mc_test(DummyQuiet "${PSEUDO_VALGRIND}" -DMEMCHECK_ARGS=QUIET) + +#---------------------------------------------------------------------------- +set(CTEST_MEMCHECK_ARGS QUIET) +run_mc_test(DummyQuiet "${PSEUDO_VALGRIND}") +unset(CTEST_MEMCHECK_ARGS) + +#----------------------------------------------------------------------------- +set(CTEST_SUFFIX_CODE "message(\"Defect count: \${defect_count}\")") +set(CTEST_MEMCHECK_ARGS "DEFECT_COUNT defect_count") +run_mc_test(DummyValgrindNoDefects "${PSEUDO_VALGRIND}") +unset(CTEST_MEMCHECK_ARGS) +unset(CTEST_SUFFIX_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_SUFFIX_CODE "message(\"Defect count: \${defect_count}\")") +set(CTEST_MEMCHECK_ARGS "DEFECT_COUNT defect_count") +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testLeakSanitizer.cmake\") +") +run_mc_test(DummyLeakSanitizerPrintDefects "" -DMEMCHECK_TYPE=AddressSanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) +unset(CTEST_MEMCHECK_ARGS) +unset(CTEST_SUFFIX_CODE) diff --git a/Tests/RunCMake/ctest_memcheck/test.cmake.in b/Tests/RunCMake/ctest_memcheck/test.cmake.in index 8431fa6..50b4b6a 100644 --- a/Tests/RunCMake/ctest_memcheck/test.cmake.in +++ b/Tests/RunCMake/ctest_memcheck/test.cmake.in @@ -21,4 +21,6 @@ set(CTEST_MEMORYCHECK_TYPE "${MEMCHECK_TYPE}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res ${MEMCHECK_ARGS}) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res @CTEST_MEMCHECK_ARGS@) + +@CTEST_SUFFIX_CODE@ diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-result.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-stderr.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-stderr.txt new file mode 100644 index 0000000..454c655 --- /dev/null +++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-stderr.txt @@ -0,0 +1,44 @@ +^CMake Error at IMPORTED_LIBNAME-bad-value.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property value + + -flag + + may not start with '-'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-bad-value.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property value + + item1;item2 + + may not contain ';'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-bad-value.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property value + + /path/to/item1 + + may not contain '/'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-bad-value.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property value + + \\path\\to\\item1 + + may not contain '\\'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-bad-value.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property value + + c:\\path\\to\\item1 + + may not contain ':'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value.cmake b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value.cmake new file mode 100644 index 0000000..1af65b4 --- /dev/null +++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value.cmake @@ -0,0 +1,6 @@ +add_library(MyTarget INTERFACE IMPORTED) +set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME -flag) +set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME item1 item2) +set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME /path/to/item1) +set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME \\path\\to\\item1) +set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME c:\\path\\to\\item1) diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-result.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-stderr.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-stderr.txt new file mode 100644 index 0000000..3a329d2 --- /dev/null +++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-stderr.txt @@ -0,0 +1,45 @@ +^CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property may be set only on imported INTERFACE library + targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property may not be APPENDed. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME_DEBUG property may be set only on imported INTERFACE + library targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME_DEBUG property may not be APPENDed. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property may be set only on imported INTERFACE library + targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property may be set only on imported INTERFACE library + targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property may be set only on imported INTERFACE library + targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property may be set only on imported INTERFACE library + targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface.cmake b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface.cmake new file mode 100644 index 0000000..fe6841a --- /dev/null +++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface.cmake @@ -0,0 +1,17 @@ +add_custom_target(MyCustom) +set_property(TARGET MyCustom PROPERTY IMPORTED_LIBNAME item1) +set_property(TARGET MyCustom APPEND PROPERTY IMPORTED_LIBNAME item2) +set_property(TARGET MyCustom PROPERTY IMPORTED_LIBNAME_DEBUG item1) +set_property(TARGET MyCustom APPEND PROPERTY IMPORTED_LIBNAME_DEBUG item2) + +add_library(MyStatic STATIC IMPORTED) +set_property(TARGET MyStatic PROPERTY IMPORTED_LIBNAME item1) + +add_library(MyShared SHARED IMPORTED) +set_property(TARGET MyShared PROPERTY IMPORTED_LIBNAME item1) + +add_library(MyModule MODULE IMPORTED) +set_property(TARGET MyModule PROPERTY IMPORTED_LIBNAME item1) + +add_executable(MyExe IMPORTED) +set_property(TARGET MyExe PROPERTY IMPORTED_LIBNAME item1) diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-result.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-stderr.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-stderr.txt new file mode 100644 index 0000000..e9d94cf --- /dev/null +++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-stderr.txt @@ -0,0 +1,21 @@ +^CMake Error at IMPORTED_LIBNAME-non-imported.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property may be set only on imported INTERFACE library + targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-non-imported.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME property may not be APPENDed. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-non-imported.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME_DEBUG property may be set only on imported INTERFACE + library targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at IMPORTED_LIBNAME-non-imported.cmake:[0-9]+ \(set_property\): + IMPORTED_LIBNAME_DEBUG property may not be APPENDed. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported.cmake b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported.cmake new file mode 100644 index 0000000..07a67d7 --- /dev/null +++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported.cmake @@ -0,0 +1,5 @@ +add_library(MyTarget INTERFACE) +set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME item1) +set_property(TARGET MyTarget APPEND PROPERTY IMPORTED_LIBNAME item2) +set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME_DEBUG item1) +set_property(TARGET MyTarget APPEND PROPERTY IMPORTED_LIBNAME_DEBUG item2) diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake index 201daa7..5a6af1d 100644 --- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake @@ -8,3 +8,6 @@ run_cmake(invalid_signature) run_cmake(global-interface) run_cmake(genex_link) run_cmake(add_custom_command-TARGET) +run_cmake(IMPORTED_LIBNAME-bad-value) +run_cmake(IMPORTED_LIBNAME-non-iface) +run_cmake(IMPORTED_LIBNAME-non-imported) diff --git a/Tests/RunCMake/pseudo_emulator_custom_command.c b/Tests/RunCMake/pseudo_emulator_custom_command.c index 760e83c..3a94795 100644 --- a/Tests/RunCMake/pseudo_emulator_custom_command.c +++ b/Tests/RunCMake/pseudo_emulator_custom_command.c @@ -14,7 +14,8 @@ int main(int argc, const char* argv[]) { const char* substring_failure = "generated_exe_emulator_unexpected"; - const char* substring_success = "generated_exe_emulator_expected"; + // Require a slash to make sure it is a path and not a target name. + const char* substring_success = "/generated_exe_emulator_expected"; const char* str = argv[1]; if (argc < 2) { return EXIT_FAILURE; diff --git a/Tests/SwigTest/CMakeLists.txt b/Tests/SwigTest/CMakeLists.txt index 17a502d..65f5c93 100644 --- a/Tests/SwigTest/CMakeLists.txt +++ b/Tests/SwigTest/CMakeLists.txt @@ -7,6 +7,7 @@ project(example_${language}_class) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) +unset(SWIG_LANG_TYPE) if(${language} MATCHES python) find_package(PythonLibs) include_directories(${PYTHON_INCLUDE_PATH}) @@ -38,6 +39,12 @@ if(${language} MATCHES pike) include_directories(${PIKE_INCLUDE_PATH}) set(SWIG_LANG_LIBRARIES ${PIKE_LIBRARY}) endif() +if(${language} MATCHES lua) + find_package(Lua) + include_directories(${LUA_INCLUDE_DIR}) + set(SWIG_LANG_TYPE TYPE SHARED) + set(SWIG_LANG_LIBRARIES ${LUA_LIBRARIES}) +endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}) @@ -45,6 +52,8 @@ set(CMAKE_SWIG_FLAGS "") set_source_files_properties(example.i PROPERTIES CPLUSPLUS ON) set_source_files_properties(example.i PROPERTIES SWIG_FLAGS "-includeall") -SWIG_ADD_MODULE(example "${language}" - example.i example.cxx) +SWIG_ADD_LIBRARY(example + LANGUAGE "${language}" + ${SWIG_LANG_TYPE} + SOURCES example.i example.cxx) SWIG_LINK_LIBRARIES(example ${SWIG_LANG_LIBRARIES}) |