diff options
Diffstat (limited to 'Tests')
203 files changed, 1288 insertions, 291 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 801d7e8..ae61bca 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -213,6 +213,29 @@ if(BUILD_TESTING) set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}") endif() endif() + if(CMAKE_OSX_SYSROOT) + execute_process( + COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version ProductName + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed + ) + if(NOT _failed) + set(CMAKE_OSX_SDKPRODUCT "${_stdout}") + endif() + + execute_process( + COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version SDKVersion + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed + ) + if(NOT _failed) + set(CMAKE_OSX_SDKVERSION "${_stdout}") + endif() + endif() endif() # Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value, @@ -253,15 +276,20 @@ if(BUILD_TESTING) if(TEST_RESOURCES) ADD_TEST_MACRO(VSResource VSResource) endif() + ADD_TEST_MACRO(MSManifest MSManifest) ADD_TEST_MACRO(Simple Simple) ADD_TEST_MACRO(PreOrder PreOrder) ADD_TEST_MACRO(MissingSourceFile MissingSourceFile) set_tests_properties(MissingSourceFile PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c") - if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1) - if(CMAKE_GENERATOR STREQUAL "Xcode") - ADD_TEST_MACRO(SwiftMix SwiftMix) - ADD_TEST_MACRO(SwiftOnly SwiftOnly) + if(CMake_TEST_XCODE_VERSION AND CMAKE_OSX_SDKVERSION AND CMAKE_OSX_SDKPRODUCT) + if((NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1) AND + ((NOT CMAKE_OSX_SDKPRODUCT STREQUAL "Mac OS X") OR + (NOT CMAKE_OSX_SDKVERSION VERSION_LESS 10.10))) + if(CMAKE_GENERATOR STREQUAL "Xcode") + ADD_TEST_MACRO(SwiftMix SwiftMix) + ADD_TEST_MACRO(SwiftOnly SwiftOnly) + endif() endif() endif() if(CMAKE_Fortran_COMPILER) @@ -659,12 +687,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CMAKE_BUILD_NIGHTLY_RELEASES) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWindows dash2win64_release.cmake) - ADD_NIGHTLY_BUILD_TEST(CMakeNightlyMac - dashmacmini2_release.cmake) - ADD_NIGHTLY_BUILD_TEST(CMakeNightlyMac64 + ADD_NIGHTLY_BUILD_TEST(CMakeNightlyOSX dashmacmini5_release.cmake) - ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux + ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux32 magrathea_release.cmake) + ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux64 + linux64_release.cmake) endif() # add tests with more complex invocations @@ -1337,6 +1365,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindOpenSSL) endif() + add_subdirectory(FindThreads) + # Matlab module if(CMake_TEST_FindMatlab) ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>) @@ -1925,13 +1955,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]") set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]") set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]") + set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]") set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]") set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]") + set(reg_ws10_0 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;srcPath]") set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]") set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]") select_wince_sdk(reg_wince wince_sdk) set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") - foreach(reg vs10 vs11 vs12 ws80 ws81 wp80 wp81 wince tegra) + foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra) get_filename_component(r "${reg_${reg}}" ABSOLUTE) if(IS_DIRECTORY "${r}") set(${reg} 1) @@ -1978,6 +2010,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release -DCMAKE_SYSTEM_VERSION=8.1 ) endif() + if(vs14 AND ws10_0) + add_test_VSWinStorePhone(vs14-store10_0-X86 "Visual Studio 14 2015" WindowsStore 10.0) + add_test_VSWinStorePhone(vs14-store10_0-ARM "Visual Studio 14 2015 ARM" WindowsStore 10.0) + add_test_VSWinStorePhone(vs14-store10_0-X64 "Visual Studio 14 2015 Win64" WindowsStore 10.0) + endif() if(vs11 AND wp80) add_test_VSWinStorePhone(vs11-phone80-X86 "Visual Studio 11 2012" WindowsPhone 8.0) add_test_VSWinStorePhone(vs11-phone80-ARM "Visual Studio 11 2012 ARM" WindowsPhone 8.0) @@ -2550,8 +2587,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "${CMake_BINARY_DIR}/Testing/DelphiCoverage/DartConfiguration.tcl") file(COPY "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/src" DESTINATION "${CMake_BINARY_DIR}/Testing/DelphiCoverage") - file(COPY "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html" - DESTINATION "${CMake_BINARY_DIR}/Testing/DelphiCoverage") + configure_file( + "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html.in" + "${CMake_BINARY_DIR}/Testing/DelphiCoverage/UTCovTest(UTCovTest.pas).html") add_test(NAME CTestDelphiCoverage COMMAND cmake -E chdir ${CMake_BINARY_DIR}/Testing/DelphiCoverage diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index 055b183..da614e9 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -105,6 +105,13 @@ set(linux64_test2_libs "c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a") set(linux64_test2_dirs "/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64") list(APPEND platforms linux64_test2) +# -specs=redhat-hardened-ld +set(linux64_test3_text "COLLECT_GCC_OPTIONS='-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' '-v' '-O2' '-g' '-pipe' '-Wall' '-Werror=format-security' '-fexceptions' '-fstack-protector-strong' '--param' 'ssp-buffer-size=4' '-grecord-gcc-switches' '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' '-m64' '-mtune=generic' '-I' '/usr/lib64/gfortran/modules' '-o' 'a.out' '-rdynamic' '-shared-libgcc' '-march=x86-64' '-pie' + /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccNzxFD8.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lquadmath -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z now -pie -o a.out /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/crtbeginS.o -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1 -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../.. -z relro dummy.o -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/5.1.1/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crtn.o") +set(linux64_test3_libs "gfortran;m;quadmath;m;c") +set(linux64_test3_dirs "/usr/lib/gcc/x86_64-redhat-linux/5.1.1;/usr/lib64;/lib64;/usr/lib") +list(APPEND platforms linux64_test3) + #----------------------------------------------------------------------------- # Mac diff --git a/Tests/CPackComponents/CMakeLists.txt b/Tests/CPackComponents/CMakeLists.txt index 1cb8669..3c8ae35 100644 --- a/Tests/CPackComponents/CMakeLists.txt +++ b/Tests/CPackComponents/CMakeLists.txt @@ -72,7 +72,7 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") set(CPACK_NSIS_MENU_LINKS "ftp://ftpserver" "Test Ftp Link" "ftps://ftpsserver" "Test Ftps Link" - "http://www.cmake.org" "CMake Web Site" + "https://cmake.org" "CMake Web Site" "https://github.com/" "Test Https Link" "mailto:kitware@kitware.com" "Test MailTo Link" "news://newsserver" "Test News Link" diff --git a/Tests/CPackComponentsDEB/CMakeLists.txt b/Tests/CPackComponentsDEB/CMakeLists.txt index 5c4eeab..093b23f 100644 --- a/Tests/CPackComponentsDEB/CMakeLists.txt +++ b/Tests/CPackComponentsDEB/CMakeLists.txt @@ -80,6 +80,43 @@ set(CPACK_COMPONENT_HEADERS_DESCRIPTION # depend on the libraries component. set(CPACK_COMPONENT_HEADERS_DEPENDS libraries) +# creates preinst/prerm scripts with specific permissions. Those permissions +# (especially executable) should be in the final archive +find_program(CHMOD_PROG chmod) +if(CHMOD_PROG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/preinst "echo default_preinst") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/prerm "echo default_prerm") + + # Those should have 755 permission normally. We mess it up to see if + # CPACK_DEBIAN_APPLICATIONS_PACKAGE_CONTROL_STRICT_PERMISSION is able to fix + # it. + execute_process(COMMAND ${CHMOD_PROG} 640 ${CMAKE_CURRENT_BINARY_DIR}/preinst) + execute_process(COMMAND ${CHMOD_PROG} 640 ${CMAKE_CURRENT_BINARY_DIR}/prerm) + + set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm") + + set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) +endif() + +# creates a symbolic link and a directory. Those should not be hashed. +# warning: relocation of the symlink is not supported (symlinks with relative +# paths) +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink mylibapp symtest) +install(FILES ${CPackComponentsDEB_BINARY_DIR}/symtest + DESTINATION bin + COMPONENT applications) + +if(EXISTS "./dirtest") + execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ./dirtest) +endif() +# NOTE: directory left empty on purpose +execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ./dirtest) +# NOTE: we should not add the trailing "/" to dirtest +install(DIRECTORY ${CPackComponentsDEB_BINARY_DIR}/dirtest + DESTINATION bin/ + COMPONENT applications) + # We may use the CPack specific config file in order # to tailor CPack behavior on a CPack generator specific way # (Behavior would be different for RPM or TGZ or DEB ...) diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake index 5460b1a..ff22f8f 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake @@ -36,7 +36,7 @@ find_program(LINTIAN_EXECUTABLE lintian) if(LINTIAN_EXECUTABLE) set(lintian_output_errors_all "") foreach(_f IN LISTS actual_output) - set(STRINGS_TO_AVOID "E:([^\r\n]*)control-file-has-bad-permissions") + set(STRINGS_TO_AVOID "E:([^\r\n]*)control-file-has-bad-permissions" "E:([^\r\n]*)md5sums-lists-nonexistent-file") lintian_check_specific_errors(lintian_output_errors FILENAME "${_f}" ERROR_REGEX_STRINGS "${STRINGS_TO_AVOID}") diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake index b96669e..bf9f81d 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake @@ -137,6 +137,8 @@ endfunction() # This function runs dpkg-deb on a .deb and returns its output +# the default behaviour it to run "--info" on the specified Debian package +# ACTION is one of the option accepted by dpkg-deb function(run_dpkgdeb dpkg_deb_output) set(${dpkg_deb_output} "" PARENT_SCOPE) @@ -144,7 +146,7 @@ function(run_dpkgdeb dpkg_deb_output) if(DPKGDEB_EXECUTABLE) set(options "") - set(oneValueArgs "FILENAME") + set(oneValueArgs "FILENAME" "ACTION") set(multiValueArgs "") cmake_parse_arguments(run_dpkgdeb_deb "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) @@ -153,8 +155,12 @@ function(run_dpkgdeb dpkg_deb_output) message(FATAL_ERROR "error: run_dpkgdeb needs FILENAME to be set") endif() - # run lintian - execute_process(COMMAND ${DPKGDEB_EXECUTABLE} -I ${run_dpkgdeb_deb_FILENAME} + if(NOT run_dpkgdeb_deb_ACTION) + set(run_dpkgdeb_deb_ACTION "--info") + endif() + + # run dpkg-deb + execute_process(COMMAND ${DPKGDEB_EXECUTABLE} ${run_dpkgdeb_deb_ACTION} ${run_dpkgdeb_deb_FILENAME} WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" OUTPUT_VARIABLE DPKGDEB_OUTPUT RESULT_VARIABLE DPKGDEB_RESULT diff --git a/Tests/CPackComponentsDEB/license.txt b/Tests/CPackComponentsDEB/license.txt index ba8ba48..d829d93 100644 --- a/Tests/CPackComponentsDEB/license.txt +++ b/Tests/CPackComponentsDEB/license.txt @@ -1,3 +1,3 @@ LICENSE ------- -This is an installer created using CPack (http://www.cmake.org). No license provided. +This is an installer created using CPack (https://cmake.org). No license provided. diff --git a/Tests/CPackComponentsForAll/license.txt b/Tests/CPackComponentsForAll/license.txt index ba8ba48..d829d93 100644 --- a/Tests/CPackComponentsForAll/license.txt +++ b/Tests/CPackComponentsForAll/license.txt @@ -1,3 +1,3 @@ LICENSE ------- -This is an installer created using CPack (http://www.cmake.org). No license provided. +This is an installer created using CPack (https://cmake.org). No license provided. diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt index 638e788..73eaf4f 100644 --- a/Tests/CPackWiXGenerator/CMakeLists.txt +++ b/Tests/CPackWiXGenerator/CMakeLists.txt @@ -64,7 +64,7 @@ set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/patch.xml") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt") set(CPACK_WIX_PROPERTY_ARPCOMMENTS "My Custom ARPCOMMENTS") -set(CPACK_WIX_PROPERTY_ARPHELPLINK "http://www.cmake.org") +set(CPACK_WIX_PROPERTY_ARPHELPLINK "https://cmake.org") include(CPack) diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in index 29f7e7f..b2e6d6d 100644 --- a/Tests/CTestCoverageCollectGCOV/test.cmake.in +++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in @@ -12,9 +12,9 @@ ctest_build() ctest_test() list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE - "/foo/something" - "/3rdparty/" - "/bar/somethingelse" + "/foo/something" + "/3rdparty/" + "/bar/somethingelse" ) include(CTestCoverageCollectGCOV) diff --git a/Tests/Contracts/Trilinos/CMakeLists.txt b/Tests/Contracts/Trilinos/CMakeLists.txt index f5757b5..8d74ca5 100644 --- a/Tests/Contracts/Trilinos/CMakeLists.txt +++ b/Tests/Contracts/Trilinos/CMakeLists.txt @@ -27,7 +27,7 @@ endif() message(STATUS "HOME='${HOME}'") if(NOT DEFINED url) - set(url "http://www.cmake.org/files/contracts/trilinos-11.4.1.tar.gz") + set(url "https://cmake.org/files/contracts/trilinos-11.4.1.tar.gz") endif() message(STATUS "url='${url}'") diff --git a/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html b/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html.in index 9caaea3..9caaea3 100644 --- a/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html +++ b/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html.in diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 2b9e844..aedc89b 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -29,14 +29,14 @@ add_custom_command(TARGET testLib1 POST_BUILD $<TARGET_FILE:testLib1>.genex ) install(FILES $<TARGET_FILE:testLib1>.genex - DESTINATION lib + DESTINATION $<1:lib>$<0:/wrong> ) set_property(TARGET testLib1 PROPERTY MY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/testLib1file1.txt ${CMAKE_CURRENT_SOURCE_DIR}/testLib1file2.txt ) install(FILES $<TARGET_PROPERTY:testLib1,MY_FILES> - DESTINATION doc + DESTINATION $<1:doc>$<0:/wrong> ) # Test library with empty link interface. Link it to an implementation @@ -136,7 +136,7 @@ add_library(testLibDepends testLibDepends.c) target_link_libraries(testLibDepends LINK_PUBLIC testLibRequired) macro(add_include_lib _libName) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c" "// no content\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c" "/* no content */\n") add_library(${_libName} "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_libName}") set_property(TARGET ${_libName} APPEND PROPERTY @@ -144,7 +144,7 @@ macro(add_include_lib _libName) "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${_libName}>" ) if (NOT "${ARGV1}" STREQUAL "NO_HEADER") - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}/${_libName}.h" "// no content\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}/${_libName}.h" "/* no content */\n") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${_libName}/${_libName}.h" DESTINATION include/${_libName} @@ -182,7 +182,7 @@ install(FILES ) add_include_lib(testLibIncludeRequired6) -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired7/testLibIncludeRequired7.h" "// No content\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired7/testLibIncludeRequired7.h" "/* No content */\n") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired7/testLibIncludeRequired7.h" DESTINATION include/testLibIncludeRequired7 @@ -391,22 +391,22 @@ install(TARGETS install(EXPORT RequiredExp NAMESPACE Req:: FILE testLibRequiredTargets.cmake DESTINATION lib/cmake/testLibRequired) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h" "// No content\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h" "/* No content */\n") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2/installIncludesTest2.h" "// No content\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2/installIncludesTest2.h" "/* No content */\n") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibRequired") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibRequired/installIncludesTest3.h" "// No content\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibRequired/installIncludesTest3.h" "/* No content */\n") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4/installIncludesTest4.h" "// No content\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4/installIncludesTest4.h" "/* No content */\n") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5/installIncludesTest5.h" "// No content\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5/installIncludesTest5.h" "/* No content */\n") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest6") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest6/installIncludesTest6.h" "// No content\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest6/installIncludesTest6.h" "/* No content */\n") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7/installIncludesTest7.h" "// No content\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7/installIncludesTest7.h" "/* No content */\n") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest8") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest8/installIncludesTest8.h" "// No content\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest8/installIncludesTest8.h" "/* No content */\n") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h" DESTINATION installIncludesTest @@ -551,5 +551,5 @@ install( ARCHIVE DESTINATION lib INCLUDES DESTINATION include/abs ) -install(DIRECTORY include/abs DESTINATION include) +install(DIRECTORY include/abs DESTINATION $<1:include>$<0:/wrong>) install(EXPORT expAbs NAMESPACE expAbs_ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/expAbs) diff --git a/Tests/ExternalProject/Example/CMakeLists.txt b/Tests/ExternalProject/Example/CMakeLists.txt index 69ebaaf..4c12895 100644 --- a/Tests/ExternalProject/Example/CMakeLists.txt +++ b/Tests/ExternalProject/Example/CMakeLists.txt @@ -5,7 +5,7 @@ include(ExternalProject) ExternalProject_Add( cmake281 - URL http://www.cmake.org/files/v2.8/cmake-2.8.1.tar.gz + URL https://cmake.org/files/v2.8/cmake-2.8.1.tar.gz CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> BUILD_COMMAND "" ) diff --git a/Tests/FindGTK2/CMakeLists.txt b/Tests/FindGTK2/CMakeLists.txt index 1c5987c..0105fae 100644 --- a/Tests/FindGTK2/CMakeLists.txt +++ b/Tests/FindGTK2/CMakeLists.txt @@ -9,6 +9,7 @@ if(GTK2_GTK_FOUND) "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtk" ${build_generator_args} --build-target gtk-all-libs + --build-project gtk --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtk" --force-new-ctest-process --test-command ${CMAKE_CTEST_COMMAND} -V @@ -22,6 +23,7 @@ if(GTK2_GTKMM_FOUND) "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtkmm" ${build_generator_args} --build-target gtkmm-all-libs + --build-project gtkmm --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtkmm" --force-new-ctest-process --test-command ${CMAKE_CTEST_COMMAND} -V @@ -310,6 +312,7 @@ if(TARGET GTK2::gtkmm) "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtkmm" ${build_generator_args} --build-target gtkmm-target + --build-project gtkmm --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtkmm" --force-new-ctest-process --test-command ${CMAKE_CTEST_COMMAND} -V diff --git a/Tests/FindPackageModeMakefileTest/Makefile.in b/Tests/FindPackageModeMakefileTest/Makefile.in index e4df9d6..8e7ff72 100644 --- a/Tests/FindPackageModeMakefileTest/Makefile.in +++ b/Tests/FindPackageModeMakefileTest/Makefile.in @@ -4,6 +4,7 @@ include cmakeExecutable.mk CMAKE_CURRENT_BINARY_DIR = "@CMAKE_CURRENT_BINARY_DIR@" CMAKE_CXX_COMPILER = "@CMAKE_CXX_COMPILER@" CMAKE_CXX_COMPILER_ID = "@CMAKE_CXX_COMPILER_ID@" +CMAKE_CXX_FLAGS = @CMAKE_CXX_FLAGS@ CMAKE_FOO = $(CMAKE) --find-package -DCMAKE_MODULE_PATH=$(CMAKE_CURRENT_BINARY_DIR) -DNAME=Foo -DLANGUAGE=CXX -DCOMPILER_ID=$(CMAKE_CXX_COMPILER_ID) @@ -14,7 +15,7 @@ all: pngtest main.o: clean main.cpp @$(CMAKE_FOO) -DMODE=COMPILE >$(tmp) @foo="`cat $(tmp)`"; \ - printf '"%s" %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CXXFLAGS)" "$$foo" >$(tmp) + printf '"%s" %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$$foo" >$(tmp) @cat $(tmp) @sh $(tmp) @rm -f $(tmp) @@ -22,7 +23,7 @@ main.o: clean main.cpp pngtest: main.o @$(CMAKE_FOO) -DMODE=LINK >$(tmp) @foo="`cat $(tmp)`"; \ - printf '"%s" %s %s -o pngtest main.o %s\n' $(CMAKE_CXX_COMPILER) "$(CXXFLAGS)" "$(LDFLAGS)" "$$foo" >$(tmp) + printf '"%s" %s %s -o pngtest main.o %s\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$(LDFLAGS)" "$$foo" >$(tmp) @cat $(tmp) @sh $(tmp) @rm -f $(tmp) diff --git a/Tests/FindThreads/C-only/CMakeLists.txt b/Tests/FindThreads/C-only/CMakeLists.txt new file mode 100644 index 0000000..ab4ca0d --- /dev/null +++ b/Tests/FindThreads/C-only/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +project(FindThreads_C-only C) + +set(CMAKE_THREAD_PREFER_PTHREAD On) +find_package(Threads REQUIRED) + +if (NOT WIN32) + add_executable(thr ${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/CheckForPthreads.c) + target_link_libraries(thr Threads::Threads) +endif () diff --git a/Tests/FindThreads/CMakeLists.txt b/Tests/FindThreads/CMakeLists.txt new file mode 100644 index 0000000..aa9499b --- /dev/null +++ b/Tests/FindThreads/CMakeLists.txt @@ -0,0 +1,11 @@ +foreach (_lang IN ITEMS C CXX) + add_test(NAME FindThreads.${_lang}-only COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindThreads/${_lang}-only" + "${CMake_BINARY_DIR}/Tests/FindThreads/${_lang}-only" + ${build_generator_args} + --build-project FindThreads_${_lang}-only + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endforeach () diff --git a/Tests/FindThreads/CXX-only/CMakeLists.txt b/Tests/FindThreads/CXX-only/CMakeLists.txt new file mode 100644 index 0000000..9993123 --- /dev/null +++ b/Tests/FindThreads/CXX-only/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +project(FindThreads_CXX-only CXX) + +set(CMAKE_THREAD_PREFER_PTHREAD On) +find_package(Threads REQUIRED) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/CheckForPthreads.c + ${CMAKE_CURRENT_BINARY_DIR}/CheckForPthreads.cxx) + +if (NOT WIN32) + add_executable(thr ${CMAKE_CURRENT_BINARY_DIR}/CheckForPthreads.cxx) + target_link_libraries(thr Threads::Threads) +endif () diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 758165c..27f33a2 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -66,7 +66,7 @@ add_custom_target(check-part1 ALL -Dtest_colons_4=$<1:C:\\CMake> -Dtest_colons_5=$<1:C:/CMake> -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part1.cmake - COMMAND ${CMAKE_COMMAND} -E echo "check done (part 1 of 3)" + COMMAND ${CMAKE_COMMAND} -E echo "check done (part 1 of 4)" VERBATIM ) @@ -137,7 +137,7 @@ add_custom_target(check-part2 ALL -Dtest_arbitrary_content_comma_9=$<1:a,,b,,> -Dtest_arbitrary_content_comma_10=$<1:,,a,,b,,> -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part2.cmake - COMMAND ${CMAKE_COMMAND} -E echo "check done (part 2 of 3)" + COMMAND ${CMAKE_COMMAND} -E echo "check done (part 2 of 4)" VERBATIM ) @@ -221,7 +221,27 @@ add_custom_target(check-part3 ALL -Dequal22=$<EQUAL:10,-012> -Dequal23=$<EQUAL:-10,-012> -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake - COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)" + COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 4)" + VERBATIM + ) + +if(WIN32) + set(test_shell_path c:/shell/path) +else() + set(test_shell_path /shell/path) +endif() +set(path_prefix BYPASS_FURTHER_CONVERSION) + +add_custom_target(check-part4 ALL + COMMAND ${CMAKE_COMMAND} + # Prefix path to bypass its further conversion when being processed by + # CMake as command-line argument + -Dtest_shell_path=${path_prefix}$<SHELL_PATH:${test_shell_path}> + -Dpath_prefix=${path_prefix} + -DWIN32=${WIN32} + -DCMAKE_GENERATOR=${CMAKE_GENERATOR} + -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part4.cmake + COMMAND ${CMAKE_COMMAND} -E echo "check done (part 4 of 4)" VERBATIM ) diff --git a/Tests/GeneratorExpression/check-common.cmake b/Tests/GeneratorExpression/check-common.cmake index 8ffebd7..faf5d4f 100644 --- a/Tests/GeneratorExpression/check-common.cmake +++ b/Tests/GeneratorExpression/check-common.cmake @@ -1,5 +1,5 @@ -macro(check var val) +function(check var val) if(NOT "${${var}}" STREQUAL "${val}") message(SEND_ERROR "${var} is \"${${var}}\", not \"${val}\"") endif() -endmacro() +endfunction() diff --git a/Tests/GeneratorExpression/check-part1.cmake b/Tests/GeneratorExpression/check-part1.cmake index 3207582..60b193f 100644 --- a/Tests/GeneratorExpression/check-part1.cmake +++ b/Tests/GeneratorExpression/check-part1.cmake @@ -55,5 +55,5 @@ check(test_semicolon ";") check(test_colons_1 ":") check(test_colons_2 "::") check(test_colons_3 "Qt5::Core") -check(test_colons_4 "C:\\\\CMake") +check(test_colons_4 [[C:\CMake]]) check(test_colons_5 "C:/CMake") diff --git a/Tests/GeneratorExpression/check-part4.cmake b/Tests/GeneratorExpression/check-part4.cmake new file mode 100644 index 0000000..9e516d5 --- /dev/null +++ b/Tests/GeneratorExpression/check-part4.cmake @@ -0,0 +1,15 @@ +include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake) + +string(REPLACE ${path_prefix} "" test_shell_path ${test_shell_path}) + +if(WIN32) + if(CMAKE_GENERATOR STREQUAL "MSYS Makefiles") + check(test_shell_path [[/c/shell/path]]) + elseif(CMAKE_GENERATOR STREQUAL "Unix Makefiles") + check(test_shell_path [[c:/shell/path]]) + else() + check(test_shell_path [[c:\shell\path]]) + endif() +else() + check(test_shell_path [[/shell/path]]) +endif() diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt index 8e2bd0a..5b99ea7 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt @@ -5,7 +5,7 @@ project(TargetIncludeDirectories) macro(create_header _name) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_name}") - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_name}/${_name}.h" "//${_name}.h\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_name}/${_name}.h" "/* ${_name}.h */\n") endmacro() create_header(bar) @@ -88,7 +88,7 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bad/common.h" "#error Should not be incl file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/good") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/good/common.h" "#include \"othergood.h\"\n") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/othergood") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/othergood/othergood.h" "// No error\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/othergood/othergood.h" "/* No error */\n") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libothergood.cpp" "// No content \n") add_library(libothergood "${CMAKE_CURRENT_BINARY_DIR}/libothergood.cpp") @@ -149,7 +149,7 @@ target_include_directories(lib5 ) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/prefix_foo/prefix_bar/prefix_bat") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/prefix_foo/prefix_bar/prefix_bat/prefix_foo_bar_bat.h" "// prefix_foo_bar_bat.h\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/prefix_foo/prefix_bar/prefix_bat/prefix_foo_bar_bat.h" "/* prefix_foo_bar_bat.h */\n") target_include_directories(TargetIncludeDirectories PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/prefix_$<JOIN:foo;bar;bat,/prefix_>") diff --git a/Tests/MSManifest/CMakeLists.txt b/Tests/MSManifest/CMakeLists.txt new file mode 100644 index 0000000..300cfa6 --- /dev/null +++ b/Tests/MSManifest/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.3) +project(MSManifest C) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_subdirectory(Subdir) diff --git a/Tests/MSManifest/Subdir/CMakeLists.txt b/Tests/MSManifest/Subdir/CMakeLists.txt new file mode 100644 index 0000000..a47cf00 --- /dev/null +++ b/Tests/MSManifest/Subdir/CMakeLists.txt @@ -0,0 +1,9 @@ +configure_file(test.manifest.in test.manifest) +add_executable(MSManifest main.c ${CMAKE_CURRENT_BINARY_DIR}/test.manifest) + +if(MSVC AND NOT MSVC_VERSION LESS 1400) + add_custom_command(TARGET MSManifest POST_BUILD VERBATIM + COMMAND ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSManifest> + -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake + ) +endif() diff --git a/Tests/MSManifest/Subdir/check.cmake b/Tests/MSManifest/Subdir/check.cmake new file mode 100644 index 0000000..b7b6841 --- /dev/null +++ b/Tests/MSManifest/Subdir/check.cmake @@ -0,0 +1,6 @@ +file(STRINGS "${exe}" content REGEX "name=\"Kitware.CMake.MSManifestTest\"") +if(content) + message(STATUS "Expected manifest content found:\n ${content}") +else() + message(FATAL_ERROR "Expected manifest content not found in\n ${exe}") +endif() diff --git a/Tests/MSManifest/Subdir/main.c b/Tests/MSManifest/Subdir/main.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/MSManifest/Subdir/main.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Tests/MSManifest/Subdir/test.manifest.in b/Tests/MSManifest/Subdir/test.manifest.in new file mode 100644 index 0000000..540961a --- /dev/null +++ b/Tests/MSManifest/Subdir/test.manifest.in @@ -0,0 +1,4 @@ +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity type="win32" version="1.0.0.0" + name="Kitware.CMake.MSManifestTest"/> +</assembly> diff --git a/Tests/OutOfBinary/CMakeLists.txt b/Tests/OutOfBinary/CMakeLists.txt index e327541..f50536e 100644 --- a/Tests/OutOfBinary/CMakeLists.txt +++ b/Tests/OutOfBinary/CMakeLists.txt @@ -1,2 +1,4 @@ add_library(outlib outlib.c) +add_executable(outexe outexe.c) +target_link_libraries(outexe subdir) diff --git a/Tests/OutOfBinary/outexe.c b/Tests/OutOfBinary/outexe.c new file mode 100644 index 0000000..6f14043 --- /dev/null +++ b/Tests/OutOfBinary/outexe.c @@ -0,0 +1,2 @@ +extern int subdir(void); +int main(void) { return subdir(); } diff --git a/Tests/OutOfSource/SubDir/CMakeLists.txt b/Tests/OutOfSource/SubDir/CMakeLists.txt index c5df36e..e18dbb9 100644 --- a/Tests/OutOfSource/SubDir/CMakeLists.txt +++ b/Tests/OutOfSource/SubDir/CMakeLists.txt @@ -6,3 +6,5 @@ add_subdirectory(${OutOfSource_SOURCE_DIR}/../OutOfBinary # subdir to a sibling dir add_subdirectory(${OutOfSource_SOURCE_DIR}/${KEN}OutOfSourceSubdir OutOfSourceSubdir ) + +add_library(subdir subdir.c) diff --git a/Tests/OutOfSource/SubDir/subdir.c b/Tests/OutOfSource/SubDir/subdir.c new file mode 100644 index 0000000..0d0d827 --- /dev/null +++ b/Tests/OutOfSource/SubDir/subdir.c @@ -0,0 +1 @@ +int subdir(void) { return 0; } diff --git a/Tests/Plugin/src/example_exe.cxx b/Tests/Plugin/src/example_exe.cxx index bc4b03e..12d9204 100644 --- a/Tests/Plugin/src/example_exe.cxx +++ b/Tests/Plugin/src/example_exe.cxx @@ -32,7 +32,7 @@ int main() if(!handle) { std::cerr << "Could not open plugin \"" - << libName << "\"!" << std::endl; + << libName.c_str() << "\"!" << std::endl; return 1; } kwsys::DynamicLoader::SymbolPointer sym = diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index ebcfc0f..d5aca55 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -101,7 +101,14 @@ add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.c ) set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h") -set_target_properties(QtAutogen codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE) +add_executable(targetObjectsTest targetObjectsTest.cpp $<TARGET_OBJECTS:privateSlot>) +target_link_libraries(targetObjectsTest ${QT_LIBRARIES}) + +set_target_properties( + QtAutogen codeeditorLib privateSlot targetObjectsTest + PROPERTIES + AUTOMOC TRUE +) include(GenerateExportHeader) # The order is relevant here. B depends on A, and B headers depend on A diff --git a/Tests/QtAutogen/targetObjectsTest.cpp b/Tests/QtAutogen/targetObjectsTest.cpp new file mode 100644 index 0000000..766b775 --- /dev/null +++ b/Tests/QtAutogen/targetObjectsTest.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake new file mode 100644 index 0000000..ef33012 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake @@ -0,0 +1,19 @@ +enable_language(C) + +add_executable(main main.c ${CMAKE_CURRENT_BINARY_DIR}/test.manifest) + +if(MSVC AND NOT MSVC_VERSION LESS 1400) + set(EXTRA_CHECK [[ +file(STRINGS "$<TARGET_FILE:main>" content REGEX "name=\"Kitware.CMake.C-Exe-Manifest-step[0-9]\"") +if(NOT "${content}" MATCHES "name=\"Kitware.CMake.C-Exe-Manifest-step${check_step}\"") + set(RunCMake_TEST_FAILED "Binary has no manifest with name=\"Kitware.CMake.C-Exe-Manifest-step${check_step}\":\n ${content}") +endif() +]]) +endif() + +file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +set(check_pairs + \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/test.manifest\" + ) +${EXTRA_CHECK} +") diff --git a/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step1.cmake b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step1.cmake new file mode 100644 index 0000000..c0b939d --- /dev/null +++ b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step1.cmake @@ -0,0 +1,6 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/test.manifest" [[ +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity type="win32" version="1.0.0.0" + name="Kitware.CMake.C-Exe-Manifest-step1"/> +</assembly> +]]) diff --git a/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step2.cmake b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step2.cmake new file mode 100644 index 0000000..a75bf21 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step2.cmake @@ -0,0 +1,6 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/test.manifest" [[ +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity type="win32" version="1.0.0.0" + name="Kitware.CMake.C-Exe-Manifest-step2"/> +</assembly> +]]) diff --git a/Tests/RunCMake/BuildDepends/C-Exe.cmake b/Tests/RunCMake/BuildDepends/C-Exe.cmake new file mode 100644 index 0000000..5057ca9 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/C-Exe.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +add_executable(main ${CMAKE_CURRENT_BINARY_DIR}/main.c) + +file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +set(check_pairs + \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.c\" + ) +set(check_exes + \"$<TARGET_FILE:main>\" + ) +") diff --git a/Tests/RunCMake/BuildDepends/C-Exe.step1.cmake b/Tests/RunCMake/BuildDepends/C-Exe.step1.cmake new file mode 100644 index 0000000..08e2949 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/C-Exe.step1.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.c" [[ +int main(void) { return 1; } +]]) diff --git a/Tests/RunCMake/BuildDepends/C-Exe.step2.cmake b/Tests/RunCMake/BuildDepends/C-Exe.step2.cmake new file mode 100644 index 0000000..ee4530c --- /dev/null +++ b/Tests/RunCMake/BuildDepends/C-Exe.step2.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.c" [[ +int main(void) { return 2; } +]]) diff --git a/Tests/RunCMake/BuildDepends/CMakeLists.txt b/Tests/RunCMake/BuildDepends/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake new file mode 100644 index 0000000..a578408 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -0,0 +1,40 @@ +include(RunCMake) + +if(RunCMake_GENERATOR STREQUAL "Borland Makefiles") + set(fs_delay 3) +else() + set(fs_delay 1.125) +endif() + +function(run_BuildDepends CASE) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build) + set(RunCMake_TEST_NO_CLEAN 1) + if(RunCMake_GENERATOR MATCHES "Make|Ninja") + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + include(${RunCMake_SOURCE_DIR}/${CASE}.step1.cmake OPTIONAL) + run_cmake(${CASE}) + set(RunCMake-check-file check.cmake) + set(check_step 1) + run_cmake_command(${CASE}-build1 ${CMAKE_COMMAND} --build . --config Debug) + if(run_BuildDepends_skip_step_2) + return() + endif() + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay}) # handle 1s resolution + include(${RunCMake_SOURCE_DIR}/${CASE}.step2.cmake OPTIONAL) + set(check_step 2) + run_cmake_command(${CASE}-build2 ${CMAKE_COMMAND} --build . --config Debug) +endfunction() + +run_BuildDepends(C-Exe) +if(NOT RunCMake_GENERATOR MATCHES "Visual Studio [67]|Xcode") + if(RunCMake_GENERATOR MATCHES "Visual Studio 10") + # VS 10 forgets to re-link when a manifest changes + set(run_BuildDepends_skip_step_2 1) + endif() + run_BuildDepends(C-Exe-Manifest) + unset(run_BuildDepends_skip_step_2) +endif() diff --git a/Tests/RunCMake/BuildDepends/check.cmake b/Tests/RunCMake/BuildDepends/check.cmake new file mode 100644 index 0000000..26a9eb6 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/check.cmake @@ -0,0 +1,37 @@ +if(EXISTS ${RunCMake_TEST_BINARY_DIR}/check-debug.cmake) + include(${RunCMake_TEST_BINARY_DIR}/check-debug.cmake) + if(RunCMake_TEST_FAILED) + return() + endif() + foreach(exe IN LISTS check_exes) + execute_process(COMMAND ${exe} RESULT_VARIABLE res) + if(NOT res EQUAL ${check_step}) + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED} + '${exe}' returned '${res}' but expected '${check_step}' +") + endif() + endforeach() + foreach(p IN LISTS check_pairs) + if("${p}" MATCHES "^(.*)\\|(.*)$") + set(lhs "${CMAKE_MATCH_1}") + set(rhs "${CMAKE_MATCH_2}") + if(NOT EXISTS "${lhs}") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED} + '${lhs}' missing +") + elseif(NOT EXISTS "${rhs}") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED} + '${rhs}' missing +") + elseif(NOT "${lhs}" IS_NEWER_THAN "${rhs}") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED} + '${lhs}' is not newer than '${rhs}' +") + endif() + endif() + endforeach() +else() + set(RunCMake_TEST_FAILED " + '${RunCMake_TEST_BINARY_DIR}/check-debug.cmake' missing +") +endif() diff --git a/Tests/RunCMake/BuildDepends/main.c b/Tests/RunCMake/BuildDepends/main.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/main.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake index fc58ea5..6331717 100644 --- a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake @@ -11,3 +11,4 @@ run_cmake(CMP0026-LOCATION-CONFIG-OLD) run_cmake(CMP0026-LOCATION-CONFIG-WARN) run_cmake(ObjlibNotDefined) run_cmake(LOCATION-and-TARGET_OBJECTS) +run_cmake(clear-cached-information) diff --git a/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt new file mode 100644 index 0000000..c51e883 --- /dev/null +++ b/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt @@ -0,0 +1,2 @@ + +add_executable(Hello ${CMAKE_CURRENT_BINARY_DIR}/main.c) diff --git a/Tests/RunCMake/CMP0026/clear-cached-information.cmake b/Tests/RunCMake/CMP0026/clear-cached-information.cmake new file mode 100644 index 0000000..dd2dd72 --- /dev/null +++ b/Tests/RunCMake/CMP0026/clear-cached-information.cmake @@ -0,0 +1,14 @@ + +enable_language(C) + +cmake_policy(SET CMP0026 OLD) + +add_subdirectory(clear-cached-information-dir) + +# Critical: this needs to happen in root CMakeLists.txt and not inside +# the subdir. +get_target_property(mypath Hello LOCATION) +# Now we create the file later, so you can see, ultimately no error should +# happen e.g. during generate phase: +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c) +set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c PROPERTIES GENERATED TRUE) diff --git a/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt index 3d875ae..3cfa5d2 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt @@ -9,3 +9,15 @@ CMake Warning \(dev\) at CMP0054-WARN.cmake:3 \(if\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0054-WARN.cmake:5 \(elseif\): + Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or + keywords when unquoted. Run "cmake --help-policy CMP0054" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + Quoted variables like "FOO" will no longer be dereferenced when the policy + is set to NEW. Since the policy is not set the OLD behavior will be used. +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/CMP0054/CMP0054-WARN.cmake b/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake index 37855fc..a608929 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake +++ b/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake @@ -2,4 +2,6 @@ set(FOO "BAR") if(NOT "FOO" STREQUAL "BAR") message(FATAL_ERROR "The given literals should match") +elseif("FOO" STREQUAL "BING") + message(FATAL_ERROR "The given literals should not match") endif() diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt index b1ebd49..5a8c263 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt @@ -10,3 +10,16 @@ CMake Warning \(dev\) at CMP0054-keywords-WARN.cmake:1 \(if\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0054-keywords-WARN.cmake:3 \(elseif\): + Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or + keywords when unquoted. Run "cmake --help-policy CMP0054" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + Quoted keywords like "DEFINED" will no longer be interpreted as keywords + when the policy is set to NEW. Since the policy is not set the OLD + behavior will be used. +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/CMP0054/CMP0054-keywords-WARN.cmake b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake index ee0a623..118ab3d 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake +++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake @@ -1,3 +1,5 @@ if("NOT" 1) message(FATAL_ERROR "[\"NOT\" 1] evaluated true") +elseif("DEFINED" NotDefined) + message(FATAL_ERROR "[\"DEFINED\" NotDefined] evaluated true") endif() diff --git a/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt b/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt new file mode 100644 index 0000000..71f1ab7 --- /dev/null +++ b/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at CMP0064-WARN.cmake:3 \(if\): + Policy CMP0064 is not set: Support new TEST if\(\) operator. Run "cmake + --help-policy CMP0064" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + TEST will be interpreted as an operator when the policy is set to NEW. + Since the policy is not set the OLD behavior will be used. +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/CMP0064/CMP0064-WARN.cmake b/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake index bffd3f3..8f26ec6 100644 --- a/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake +++ b/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake @@ -1,4 +1,4 @@ -cmake_policy(SET CMP0064 OLD) + if(TEST) message(FATAL_ERROR "TEST was not recognized to be undefined") diff --git a/Tests/RunCMake/CMP0065/BuildTargetInSubProject.cmake b/Tests/RunCMake/CMP0065/BuildTargetInSubProject.cmake new file mode 100644 index 0000000..9339e46 --- /dev/null +++ b/Tests/RunCMake/CMP0065/BuildTargetInSubProject.cmake @@ -0,0 +1,15 @@ +function(BuildTargetInSubProject P T E) + try_compile(RESULTVAR + ${CMAKE_CURRENT_BINARY_DIR}/subproject + ${CMAKE_CURRENT_SOURCE_DIR}/subproject + ${P} ${T} OUTPUT_VARIABLE O) + if(E AND RESULTVAR) + message(STATUS "${P} target ${T} succeeded as expected") + elseif(E AND NOT RESULTVAR) + message(FATAL_ERROR "${P} target ${T} failed but should have succeeded. Output:${O}") + elseif(NOT E AND NOT RESULTVAR) + message(STATUS "${P} target ${T} failed as expected") + elseif(NOT E AND RESULTVAR) + message(FATAL_ERROR "${P} target ${T} succeeded but should have failed. Output:${O}") + endif() +endfunction() diff --git a/Tests/RunCMake/CMP0065/CMakeLists.txt b/Tests/RunCMake/CMP0065/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/CMP0065/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0065/NEWBad.cmake b/Tests/RunCMake/CMP0065/NEWBad.cmake new file mode 100644 index 0000000..79d9adb --- /dev/null +++ b/Tests/RunCMake/CMP0065/NEWBad.cmake @@ -0,0 +1,4 @@ +enable_language(C) +include(BuildTargetInSubProject.cmake) + +BuildTargetInSubProject(TestPolicyCMP0065 FooNEWBad FALSE) diff --git a/Tests/RunCMake/CMP0065/NEWGood.cmake b/Tests/RunCMake/CMP0065/NEWGood.cmake new file mode 100644 index 0000000..a5b5d04 --- /dev/null +++ b/Tests/RunCMake/CMP0065/NEWGood.cmake @@ -0,0 +1,4 @@ +enable_language(C) +include(BuildTargetInSubProject.cmake) + +BuildTargetInSubProject(TestPolicyCMP0065 FooNEWGood TRUE) diff --git a/Tests/RunCMake/CMP0065/OLDBad1.cmake b/Tests/RunCMake/CMP0065/OLDBad1.cmake new file mode 100644 index 0000000..6d780b4 --- /dev/null +++ b/Tests/RunCMake/CMP0065/OLDBad1.cmake @@ -0,0 +1,4 @@ +enable_language(C) +include(BuildTargetInSubProject.cmake) + +BuildTargetInSubProject(TestPolicyCMP0065 FooOLDBad1 FALSE) diff --git a/Tests/RunCMake/CMP0065/OLDBad2.cmake b/Tests/RunCMake/CMP0065/OLDBad2.cmake new file mode 100644 index 0000000..7196473 --- /dev/null +++ b/Tests/RunCMake/CMP0065/OLDBad2.cmake @@ -0,0 +1,4 @@ +enable_language(C) +include(BuildTargetInSubProject.cmake) + +BuildTargetInSubProject(TestPolicyCMP0065 FooOLDBad2 FALSE) diff --git a/Tests/RunCMake/CMP0065/RunCMakeTest.cmake b/Tests/RunCMake/CMP0065/RunCMakeTest.cmake new file mode 100644 index 0000000..254a4ec --- /dev/null +++ b/Tests/RunCMake/CMP0065/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(OLDBad1) +run_cmake(OLDBad2) +run_cmake(NEWBad) +run_cmake(NEWGood) +run_cmake(WARN-OFF) +run_cmake(WARN-ON) diff --git a/Tests/RunCMake/CMP0065/WARN-OFF.cmake b/Tests/RunCMake/CMP0065/WARN-OFF.cmake new file mode 100644 index 0000000..dbc9562 --- /dev/null +++ b/Tests/RunCMake/CMP0065/WARN-OFF.cmake @@ -0,0 +1,3 @@ + +enable_language(C) +add_executable(main subproject/main.c) diff --git a/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt b/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt new file mode 100644 index 0000000..dda4fe5 --- /dev/null +++ b/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0065 is not set: Do not add flags to export symbols from + executables without the ENABLE_EXPORTS target property. Run "cmake + --help-policy CMP0065" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + For compatibility with older versions of CMake, additional flags may be + added to export symbols on all executables regardless of thier + ENABLE_EXPORTS property. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0065/WARN-ON.cmake b/Tests/RunCMake/CMP0065/WARN-ON.cmake new file mode 100644 index 0000000..6ed4a41 --- /dev/null +++ b/Tests/RunCMake/CMP0065/WARN-ON.cmake @@ -0,0 +1,3 @@ +set(CMAKE_POLICY_WARNING_CMP0065 1) +enable_language(C) +add_executable(main subproject/main.c) diff --git a/Tests/RunCMake/CMP0065/subproject/CMakeLists.txt b/Tests/RunCMake/CMP0065/subproject/CMakeLists.txt new file mode 100644 index 0000000..bed5960 --- /dev/null +++ b/Tests/RunCMake/CMP0065/subproject/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.3) + +project(TestPolicyCMP0065 C) +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS BADFLAGS) + +#---------------------------------------------------------------------- +cmake_policy(SET CMP0065 OLD) +add_executable(FooOLDBad1 main.c) + +#---------------------------------------------------------------------- +cmake_policy(SET CMP0065 OLD) +add_executable(FooOLDBad2 main.c) +set_target_properties(FooOLDBad2 PROPERTIES ENABLE_EXPORTS ON) + +#---------------------------------------------------------------------- +cmake_policy(SET CMP0065 NEW) +add_executable(FooNEWGood main.c) + +#---------------------------------------------------------------------- +cmake_policy(SET CMP0065 NEW) +add_executable(FooNEWBad main.c) +set_target_properties(FooNEWBad PROPERTIES ENABLE_EXPORTS ON) diff --git a/Tests/RunCMake/CMP0065/subproject/main.c b/Tests/RunCMake/CMP0065/subproject/main.c new file mode 100644 index 0000000..98725db --- /dev/null +++ b/Tests/RunCMake/CMP0065/subproject/main.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(int argc, char **argv) +{ + printf("Hello World\n"); + return 0; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5bc9af8..1a0019f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -104,6 +104,13 @@ add_RunCMake_test(CMP0057) add_RunCMake_test(CMP0059) add_RunCMake_test(CMP0060) add_RunCMake_test(CMP0064) + +# The test for Policy 65 requires the use of the +# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode +# generators ignore. The policy will have no effect on those generators. +if(NOT CMAKE_GENERATOR MATCHES "Visual Studio|Xcode") + add_RunCMake_test(CMP0065) +endif() if(CMAKE_GENERATOR MATCHES "Make") add_RunCMake_test(Make) endif() @@ -124,6 +131,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) ) endif() +add_RunCMake_test(BuildDepends) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() @@ -139,6 +147,7 @@ add_RunCMake_test(GeneratorToolset) add_RunCMake_test(GNUInstallDirs) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) +add_RunCMake_test(LinkStatic) add_RunCMake_test(ObjectLibrary) add_RunCMake_test(Swift) add_RunCMake_test(TargetObjects) @@ -281,7 +290,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(CompilerLauncher) endif() -add_RunCMake_test_group(CPack "DEB;RPM") +add_RunCMake_test_group(CPack "DEB;RPM;TGZ") # add a test to make sure symbols are exported from a shared library # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) diff --git a/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake b/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake new file mode 100644 index 0000000..7210e7d --- /dev/null +++ b/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake @@ -0,0 +1,5 @@ +set(CPACK_COMPONENTS_ALL test) +install(DIRECTORY DESTINATION empty + COMPONENT test) + +set(CPACK_PACKAGE_NAME "components_empty_dir") diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 7ea2a24..aef1086 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -10,47 +10,12 @@ function(run_cpack_test TEST_NAME types build) file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") # execute cmake - execute_process( - COMMAND "${CMAKE_COMMAND}" -DRunCMake_TEST=${TEST_NAME} - -DGENERATOR_TYPE=${TEST_TYPE} "${RunCMake_SOURCE_DIR}" - WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" - RESULT_VARIABLE res - OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" - ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" - ) - - if(res) - run_cmake_command( - ${TEST_TYPE}/${TEST_NAME} - "${CMAKE_COMMAND}" - -DRunCMake_TEST_STEP=configure - -Dreturn_code=${res} - "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" - -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake" - ) - return() - endif() + set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}") + run_cmake(${TEST_NAME}) # execute optional build step if(build) - execute_process( - COMMAND "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}" - RESULT_VARIABLE res - OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" - ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" - ) - endif() - - if(res) - run_cmake_command( - ${TEST_TYPE}/${TEST_NAME} - "${CMAKE_COMMAND}" - -DRunCMake_TEST_STEP=build - -Dreturn_code=${res} - "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" - -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake" - ) - return() + run_cmake_command(${TEST_NAME}-Build "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}") endif() # execute cpack diff --git a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 0000000..5adca68 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "components_empty_dir*.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$") diff --git a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake new file mode 100644 index 0000000..2720fe9 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake @@ -0,0 +1,2 @@ +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEB_COMPONENT_INSTALL "ON") diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake index 78b6114..5f929ff 100644 --- a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake +++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake @@ -1,11 +1,17 @@ set(foo_preinst "^echo default_preinst$") +set(foo_preinst_permissions_regex "-rwxr-xr-x .*") set(foo_prerm "^echo default_prerm$") +set(foo_prerm_permissions_regex "-rwxr-xr-x .*") verifyDebControl("${FOUND_FILE_1}" "foo" "preinst;prerm") set(bar_preinst "^echo bar_preinst$") +set(bar_prerm_permissions_regex "-rwx------ .*") set(bar_prerm "^echo bar_prerm$") +set(bar_prerm_permissions_regex "-rwx------ .*") verifyDebControl("${FOUND_FILE_2}" "bar" "preinst;prerm") set(bas_preinst "^echo default_preinst$") +set(bas_prerm_permissions_regex "-rwxr-xr-x .*") set(bas_prerm "^echo default_prerm$") +set(bas_prerm_permissions_regex "-rwxr-xr-x .*") verifyDebControl("${FOUND_FILE_3}" "bas" "preinst;prerm") diff --git a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake index 44c862d..ba39f2e 100644 --- a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake +++ b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake @@ -1,4 +1,4 @@ -function(checkDepends_ FILE REGEX) +function(checkDependencies_ FILE REGEX) set(whitespaces_ "[\t\n\r ]*") getPackageInfo("${FILE}" "FILE_INFO_") @@ -7,9 +7,28 @@ function(checkDepends_ FILE REGEX) endif() endfunction() -checkDepends_("${FOUND_FILE_1}" ".*Depends${whitespaces_}:${whitespaces_}depend-application, depend-application-b.*") -# use wildcard as we are using dependency auto detection -checkDepends_("${FOUND_FILE_2}" ".*Depends${whitespaces_}:${whitespaces_}.*depend-application, depend-application-b.*") -checkDepends_("${FOUND_FILE_3}" ".*Depends${whitespaces_}:${whitespaces_}depend-headers.*") -checkDepends_("${FOUND_FILE_4}" ".*Depends${whitespaces_}:${whitespaces_}depend-default, depend-default-b.*") -checkDepends_("${FOUND_FILE_5}" ".*Depends${whitespaces_}:${whitespaces_}depend-default, depend-default-b.*") +foreach(dependency_type_ DEPENDS CONFLICTS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS) + string(TOLOWER "${dependency_type_}" lower_dependency_type_) + string(SUBSTRING ${lower_dependency_type_} 1 -1 lower_dependency_type_tail_) + string(SUBSTRING ${dependency_type_} 0 1 dependency_type_head_) + set(dependency_type_name_ "${dependency_type_head_}${lower_dependency_type_tail_}") + + checkDependencies_("${FOUND_FILE_1}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b.*") + checkDependencies_("${FOUND_FILE_2}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}.*${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b.*") + checkDependencies_("${FOUND_FILE_3}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-headers.*") + checkDependencies_("${FOUND_FILE_4}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b.*") + checkDependencies_("${FOUND_FILE_5}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b.*") +endforeach() + +checkDependencies_("${FOUND_FILE_1}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b") +checkDependencies_("${FOUND_FILE_2}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b") +checkDependencies_("${FOUND_FILE_3}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b") +checkDependencies_("${FOUND_FILE_4}" ".*Provides${whitespaces_}:${whitespaces_}provided-lib.*") +checkDependencies_("${FOUND_FILE_5}" ".*Provides${whitespaces_}:${whitespaces_}provided-lib_auto.*, provided-lib_auto-b.*") + +# PREDEPENDS +checkDependencies_("${FOUND_FILE_1}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-application, predepends-application-b.*") +checkDependencies_("${FOUND_FILE_2}" ".*Pre-Depends${whitespaces_}:${whitespaces_}.*predepends-application, predepends-application-b.*") +checkDependencies_("${FOUND_FILE_3}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-headers.*") +checkDependencies_("${FOUND_FILE_4}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-default, predepends-default-b.*") +checkDependencies_("${FOUND_FILE_5}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-default, predepends-default-b.*") diff --git a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake index 9e09428..96a9f14 100644 --- a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake +++ b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake @@ -7,9 +7,15 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS FALSE) # to determine their dependencies and we can not be certain if there will be any set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_SHLIBDEPS TRUE) -set(CPACK_DEBIAN_PACKAGE_DEPENDS "depend-default, depend-default-b") -set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_DEPENDS "depend-application, depend-application-b") -set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_DEPENDS "depend-application, depend-application-b") -set(CPACK_DEBIAN_HEADERS_PACKAGE_DEPENDS "depend-headers") +foreach(dependency_type_ DEPENDS CONFLICTS PREDEPENDS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS) + string(TOLOWER "${dependency_type_}" lower_dependency_type_) -# TODO add other dependency tests once CPackDeb supports them + set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b") + set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b") + set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b") + set(CPACK_DEBIAN_HEADERS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-headers") +endforeach() + +set(CPACK_DEBIAN_PACKAGE_PROVIDES "provided-default, provided-default-b") +set(CPACK_DEBIAN_LIBS_PACKAGE_PROVIDES "provided-lib") +set(CPACK_DEBIAN_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b") diff --git a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 0000000..1552a36 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "empty_dir*.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$") diff --git a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake new file mode 100644 index 0000000..8821ab9 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake @@ -0,0 +1 @@ +set(CPACK_PACKAGE_CONTACT "someone") diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index a204a3c..f490130 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -14,7 +14,7 @@ function(verifyDebControl FILE PREFIX VERIFY_FILES) ERROR_VARIABLE err_) if(err_) - message(FATAL_ERROR "Debian controll verification failed for file: " + message(FATAL_ERROR "Debian control verification failed for file: " "'${FILE}'; error output: '${err_}'") endif() @@ -24,6 +24,19 @@ function(verifyDebControl FILE PREFIX VERIFY_FILES) message(FATAL_ERROR "Unexpected content in for '${PREFIX}_${FILE_}'!" " Content: '${content_}'") endif() + + execute_process(COMMAND ls -l "${CMAKE_CURRENT_BINARY_DIR}/control_${PREFIX}/${FILE_}" + OUTPUT_VARIABLE package_permissions_ + ERROR_VARIABLE package_permissions_error_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(NOT package_permissions_error_) + if(NOT package_permissions_ MATCHES "${${PREFIX}_${FILE_}_permissions_regex}") + message(FATAL_ERROR "Unexpected file permissions for ${PREFIX}_${FILE_}: '${package_permissions_}'!") + endif() + else() + message(FATAL_ERROR "Listing file permissions failed (${package_permissions_error_})!") + endif() endforeach() endfunction() diff --git a/Tests/RunCMake/CPack/DEB_EXTRA.cmake b/Tests/RunCMake/CPack/DEB_EXTRA.cmake index 46d848d..3c291d5 100644 --- a/Tests/RunCMake/CPack/DEB_EXTRA.cmake +++ b/Tests/RunCMake/CPack/DEB_EXTRA.cmake @@ -2,14 +2,32 @@ install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) install(FILES CMakeLists.txt DESTINATION bas COMPONENT bas) -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/preinst "echo default_preinst") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/prerm "echo default_prerm") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/preinst "echo default_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/prerm "echo default_prerm") + +foreach(file_ preinst prerm) + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tmp/${file_} + DESTINATION ${CMAKE_CURRENT_BINARY_DIR} + FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE) +endforeach() set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA - "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm") + "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm;${CMAKE_CURRENT_BINARY_DIR}/conffiles") + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/preinst "echo bar_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/prerm "echo bar_prerm") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar/preinst "echo bar_preinst") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar/prerm "echo bar_prerm") +foreach(file_ preinst prerm) + # not acceptable permissions for lintian but we need to check that + # permissions are preserved + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/${file_} + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bar + FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE) +endforeach() set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm") diff --git a/Tests/RunCMake/CPack/DEPENDENCIES.cmake b/Tests/RunCMake/CPack/DEPENDENCIES.cmake index 0aef925..4f6d65f 100644 --- a/Tests/RunCMake/CPack/DEPENDENCIES.cmake +++ b/Tests/RunCMake/CPack/DEPENDENCIES.cmake @@ -1,11 +1,13 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" - "int test_lib();") + "int test_lib();\n") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" - "#include \"test_lib.hpp\"\nint test_lib() {return 0;}") + "#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();}") + "#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) diff --git a/Tests/RunCMake/CPack/EMPTY_DIR.cmake b/Tests/RunCMake/CPack/EMPTY_DIR.cmake new file mode 100644 index 0000000..023ba17 --- /dev/null +++ b/Tests/RunCMake/CPack/EMPTY_DIR.cmake @@ -0,0 +1,4 @@ +install(DIRECTORY DESTINATION empty + COMPONENT test) + +set(CPACK_PACKAGE_NAME "empty_dir") diff --git a/Tests/RunCMake/CPack/PreTestError.cmake b/Tests/RunCMake/CPack/PreTestError.cmake deleted file mode 100644 index f88f2e8..0000000 --- a/Tests/RunCMake/CPack/PreTestError.cmake +++ /dev/null @@ -1,7 +0,0 @@ -file(READ "${bin_dir}/test_output.txt" output) -file(READ "${bin_dir}/test_error.txt" error) - -message(FATAL_ERROR "Error in pre-test phase '${RunCMake_TEST_STEP}'!\n" - "Return code: '${return_code}'\n" - "Info output: '${output}'\n" - "Error output: '${error}'") diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt index 365c737..ea68304 100644 --- a/Tests/RunCMake/CPack/README.txt +++ b/Tests/RunCMake/CPack/README.txt @@ -32,14 +32,14 @@ different types of packages. This script is placed into CPack test root directory even if it will be used for only one of the generators. If test will be used for multiple generators but some of them require some -generator speciffic commands then those commands should be added to a separate +generator specific commands then those commands should be added to a separate file that should be located in '<generator_name>/<test_name>-specifics.cmake' in CPack test root directory. CPack execution phase: ---------------------- -Only exececutes CPack for content that was generated during CMake execution +Only executes CPack for content that was generated during CMake execution phase. Verification of generated files: diff --git a/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 0000000..d396276 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "components_empty_dir*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/empty$") diff --git a/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt new file mode 100644 index 0000000..6ddca12 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/COMPONENTS_EMPTY_DIR-build/_CPack_Packages/.*/RPM/SPECS/components_empty_dir.spec$ diff --git a/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 0000000..0c2977f --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "empty_dir*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/empty$") diff --git a/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt new file mode 100644 index 0000000..1777aa0 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/EMPTY_DIR-build/_CPack_Packages/.*/RPM/SPECS/empty_dir.spec$ diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 3e5714d..b7295f4 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -4,7 +4,9 @@ include(RunCMake) include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") # args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP -run_cpack_test(MINIMAL "RPM;DEB" false) +run_cpack_test(MINIMAL "RPM;DEB;TGZ" false) run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false) run_cpack_test(DEB_EXTRA "DEB" false) 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) diff --git a/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 0000000..26e2ab0 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,3 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "components_empty_dir*.tar.gz") +set(EXPECTED_FILE_CONTENT_1 "^[^\n]*empty/$") diff --git a/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake new file mode 100644 index 0000000..81a5035 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake @@ -0,0 +1 @@ +set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") diff --git a/Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake new file mode 100644 index 0000000..a75514a --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake @@ -0,0 +1,3 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "empty_dir*.tar.gz") +set(EXPECTED_FILE_CONTENT_1 "^[^\n]*empty_dir-0.1.1-[^\n]*/empty/$") diff --git a/Tests/RunCMake/CPack/TGZ/Helpers.cmake b/Tests/RunCMake/CPack/TGZ/Helpers.cmake new file mode 100644 index 0000000..f14d532 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/Helpers.cmake @@ -0,0 +1,10 @@ +set(ALL_FILES_GLOB "*.tar.gz") + +function(getPackageContent FILE RESULT_VAR) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar -ztvf ${FILE} + OUTPUT_VARIABLE package_content_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake new file mode 100644 index 0000000..5c31f27 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "minimal*.tar.gz") +set(EXPECTED_FILE_CONTENT_1 "^[^\n]*minimal-0.1.1-[^\n]*/foo/\n[^\n]*minimal-0.1.1-[^\n]*/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/TGZ/Prerequirements.cmake b/Tests/RunCMake/CPack/TGZ/Prerequirements.cmake new file mode 100644 index 0000000..dbaf682 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/Prerequirements.cmake @@ -0,0 +1,4 @@ +function(get_test_prerequirements found_var config_file) + file(WRITE "${config_file}" "") + set(${found_var} true PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 96efa9e..6eab531 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -28,8 +28,9 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) if(NOT expected_content_list) message(FATAL_ERROR - "Unexpected file content for file No. '${file_no_}'!" - " Content: '${PACKAGE_CONTENT}'" + "Unexpected file content for file No. '${file_no_}'!\n" + " Content: '${PACKAGE_CONTENT}'\n\n" + " Expected: '${EXPECTED_FILE_CONTENT_${file_no_}}'" "${output_error_message}") endif() else() @@ -56,7 +57,7 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) "${output_error_message}") endif() - # sanity check that we didn't accidentaly list wrong files with our regular + # sanity check that we didn't accidentally list wrong files with our regular # expressions foreach(expected_ IN LISTS allFoundFiles_) list(FIND foundFiles_ "${expected_}" found_) diff --git a/Tests/RunCMake/CPackConfig/Default-check.cmake b/Tests/RunCMake/CPackConfig/Default-check.cmake new file mode 100644 index 0000000..b67fe81 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Default-check.cmake @@ -0,0 +1,7 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Foo\\Bar") +test_variable(CPACK_NSIS_PACKAGE_NAME "Bar\\Foo") + +test_variable(CPACK_SOURCE_IGNORE_FILES + "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#") diff --git a/Tests/RunCMake/CPackConfig/Default.cmake b/Tests/RunCMake/CPackConfig/Default.cmake new file mode 100644 index 0000000..3b3beb3 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Default.cmake @@ -0,0 +1,3 @@ +# two levels of escaping to pass through CPackConfig.cmake +set(CPACK_PACKAGE_INSTALL_DIRECTORY "Foo\\\\Bar") +set(CPACK_NSIS_DISPLAY_NAME "Bar\\\\Foo") diff --git a/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake b/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake index 6787eb8..16d2cf3 100644 --- a/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake @@ -1,3 +1,6 @@ include(RunCMake) run_cmake(Simple) +run_cmake(Default) +run_cmake(Special) +run_cmake(Verbatim) diff --git a/Tests/RunCMake/CPackConfig/Special-check.cmake b/Tests/RunCMake/CPackConfig/Special-check.cmake new file mode 100644 index 0000000..0624b79 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Special-check.cmake @@ -0,0 +1,5 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_BACKSLASH "\\") +test_variable(CPACK_QUOTE "a;b;c") +test_variable(CPACK_DOLLAR "ab") diff --git a/Tests/RunCMake/CPackConfig/Special.cmake b/Tests/RunCMake/CPackConfig/Special.cmake new file mode 100644 index 0000000..9442c93 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Special.cmake @@ -0,0 +1,3 @@ +set(CPACK_BACKSLASH "\\\\") +set(CPACK_QUOTE "a\" b \"c") +set(CPACK_DOLLAR "a\${NOTHING}b") diff --git a/Tests/RunCMake/CPackConfig/Verbatim-check.cmake b/Tests/RunCMake/CPackConfig/Verbatim-check.cmake new file mode 100644 index 0000000..958547d --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Verbatim-check.cmake @@ -0,0 +1,10 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_BACKSLASH "\\\\") +test_variable(CPACK_QUOTE "a\" b \"c") +test_variable(CPACK_DOLLAR "a\${NOTHING}b") + +# make sure the default for this is still set correctly with +# CPACK_VERBATIM_VARIABLES on +test_variable(CPACK_SOURCE_IGNORE_FILES + "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#") diff --git a/Tests/RunCMake/CPackConfig/Verbatim.cmake b/Tests/RunCMake/CPackConfig/Verbatim.cmake new file mode 100644 index 0000000..4d271c3 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Verbatim.cmake @@ -0,0 +1,5 @@ +set(CPACK_VERBATIM_VARIABLES YES) + +set(CPACK_BACKSLASH "\\\\") +set(CPACK_QUOTE "a\" b \"c") +set(CPACK_DOLLAR "a\${NOTHING}b") diff --git a/Tests/RunCMake/CPackConfig/check.cmake b/Tests/RunCMake/CPackConfig/check.cmake index 2fc9f11..ca6229e 100644 --- a/Tests/RunCMake/CPackConfig/check.cmake +++ b/Tests/RunCMake/CPackConfig/check.cmake @@ -1,3 +1,5 @@ +cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR) + function(test_variable NAME EXPECTED_VALUE) if(NOT "${${NAME}}" STREQUAL "${EXPECTED_VALUE}") message(FATAL_ERROR "${NAME}: variable mismatch; expected [${EXPECTED_VALUE}] actual [${${NAME}}]") @@ -5,3 +7,4 @@ function(test_variable NAME EXPECTED_VALUE) endfunction() include(${RunCMake_TEST_BINARY_DIR}/CPackConfig.cmake) +include(${RunCMake_TEST_BINARY_DIR}/CPackSourceConfig.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index dfc1e33..2bc3693 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -78,6 +78,21 @@ endfunction() run_LabelCount() +function(run_SerialFailed) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SerialFailed) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_test(NoSuchCommand no_such_command) +set_tests_properties(NoSuchCommand PROPERTIES RUN_SERIAL ON) +add_test(Echo \"${CMAKE_COMMAND}\" -E echo \"EchoTest\") +") + + run_cmake_command(SerialFailed ${CMAKE_CTEST_COMMAND} -V) +endfunction() +run_SerialFailed() + function(run_TestLoad name load) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestLoad) set(RunCMake_TEST_NO_CLEAN 1) @@ -108,3 +123,20 @@ run_TestLoad(test-load-invalid 'two') run_TestLoad(test-load-pass 10) unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING}) + +function(run_TestOutputSize) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestOutputSize) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " + add_test(PassingTest \"${CMAKE_COMMAND}\" -E echo PassingTestOutput) + add_test(FailingTest \"${CMAKE_COMMAND}\" -E no_such_command) +") + run_cmake_command(TestOutputSize + ${CMAKE_CTEST_COMMAND} -M Experimental -T Test + --test-output-size-passed 10 + --test-output-size-failed 12 + ) +endfunction() +run_TestOutputSize() diff --git a/Tests/RunCMake/CTestCommandLine/SerialFailed-result.txt b/Tests/RunCMake/CTestCommandLine/SerialFailed-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/SerialFailed-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/SerialFailed-stderr.txt b/Tests/RunCMake/CTestCommandLine/SerialFailed-stderr.txt new file mode 100644 index 0000000..cafe565 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/SerialFailed-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: no_such_command diff --git a/Tests/RunCMake/CTestCommandLine/SerialFailed-stdout.txt b/Tests/RunCMake/CTestCommandLine/SerialFailed-stdout.txt new file mode 100644 index 0000000..d7144f7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/SerialFailed-stdout.txt @@ -0,0 +1,10 @@ +Could not find executable no_such_command +.* +2/2 Test #2: Echo ............................. Passed +[0-9.]+ sec ++ +50% tests passed, 1 tests failed out of 2 ++ +Total Test time \(real\) = +[0-9.]+ sec ++ +The following tests FAILED: +[ ]+1 - NoSuchCommand \(Not Run\)$ diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake new file mode 100644 index 0000000..918d242 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake @@ -0,0 +1,17 @@ +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + file(READ "${test_xml_file}" test_xml LIMIT 4096) + if("${test_xml}" MATCHES [[(<Test Status="passed">.*</Test>).*(<Test Status="failed">.*</Test>)]]) + set(test_passed "${CMAKE_MATCH_1}") + set(test_failed "${CMAKE_MATCH_2}") + else() + set(RunCMake_TEST_FAILED "Test.xml does not contain a passed then failed test:\n ${test_xml}") + endif() + if(NOT "${test_passed}" MATCHES [[<Value>PassingTes\.\.\..*10 bytes]]) + set(RunCMake_TEST_FAILED "Test.xml passed test output not truncated at 10 bytes:\n ${test_passed}") + elseif(NOT "${test_failed}" MATCHES [[<Value>CMake Error:\.\.\..*12 bytes]]) + set(RunCMake_TEST_FAILED "Test.xml failed test output not truncated at 12 bytes:\n ${test_failed}") + endif() +else() + set(RunCMake_TEST_FAILED "Test.xml not found") +endif() diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt new file mode 100644 index 0000000..9c558e3 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt @@ -0,0 +1 @@ +. diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt new file mode 100644 index 0000000..ba4235d --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt @@ -0,0 +1 @@ +Errors while running CTest diff --git a/Tests/RunCMake/CommandLine/P_working-dir.cmake b/Tests/RunCMake/CommandLine/P_working-dir.cmake new file mode 100644 index 0000000..4ea0293 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_working-dir.cmake @@ -0,0 +1,14 @@ +if(NOT IS_DIRECTORY "${EXPECTED_WORKING_DIR}") + message(FATAL_ERROR "EXPECTED_WORKING_DIR is not a directory: ${EXPECTED_WORKING_DIR}") +endif() + +foreach(d CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_SOURCE_DIR) + if(NOT DEFINED ${d}) + message(FATAL_ERROR "${d} is not defined") + endif() + if(EXPECTED_WORKING_DIR STREQUAL "${${d}}") + message(STATUS "${d} is the expected working directory (${EXPECTED_WORKING_DIR})") + else() + message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})") + endif() +endforeach() diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 0da737d..2d94e29 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -115,6 +115,7 @@ run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1) run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1) run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}) +run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMake_BINARY_DIR}/P_working-dir-build -P ${RunCMake_SOURCE_DIR}/P_working-dir.cmake) set(RunCMake_TEST_OPTIONS "-DFOO=-DBAR:BOOL=BAZ") @@ -132,52 +133,6 @@ set(RunCMake_TEST_OPTIONS -Wno-dev -Wdev) run_cmake(Wdev) unset(RunCMake_TEST_OPTIONS) -set(RunCMake_TEST_OPTIONS -Werror=dev) -run_cmake(Werror_dev) -unset(RunCMake_TEST_OPTIONS) - -set(RunCMake_TEST_OPTIONS -Wno-error=dev) -run_cmake(Wno-error_deprecated) -unset(RunCMake_TEST_OPTIONS) - -# -Wdev should not override deprecated options if specified -set(RunCMake_TEST_OPTIONS -Wdev -Wno-deprecated) -run_cmake(Wno-deprecated) -unset(RunCMake_TEST_OPTIONS) -set(RunCMake_TEST_OPTIONS -Wno-deprecated -Wdev) -run_cmake(Wno-deprecated) -unset(RunCMake_TEST_OPTIONS) - -# -Wdev should enable deprecated warnings as well -set(RunCMake_TEST_OPTIONS -Wdev) -run_cmake(Wdeprecated) -unset(RunCMake_TEST_OPTIONS) - -# -Werror=dev should enable deprecated errors as well -set(RunCMake_TEST_OPTIONS -Werror=dev) -run_cmake(Werror_deprecated) -unset(RunCMake_TEST_OPTIONS) - -set(RunCMake_TEST_OPTIONS -Wdeprecated) -run_cmake(Wdeprecated) -unset(RunCMake_TEST_OPTIONS) - -set(RunCMake_TEST_OPTIONS -Wno-deprecated) -run_cmake(Wno-deprecated) -unset(RunCMake_TEST_OPTIONS) - -set(RunCMake_TEST_OPTIONS -Werror=deprecated) -run_cmake(Werror_deprecated) -unset(RunCMake_TEST_OPTIONS) - -set(RunCMake_TEST_OPTIONS -Wno-error=deprecated) -run_cmake(Wno-error_deprecated) -unset(RunCMake_TEST_OPTIONS) - -run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -W) -run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -Wno-) -run_cmake_command(W_bad-arg3 ${CMAKE_COMMAND} -Werror=) - set(RunCMake_TEST_OPTIONS --debug-output) run_cmake(debug-output) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/CommandLine/W_bad-arg1-result.txt b/Tests/RunCMake/CommandLine/W_bad-arg1-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/CommandLine/W_bad-arg1-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt deleted file mode 100644 index e912728..0000000 --- a/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error: -W must be followed with \[no-\]\[error=\]<name>. -CMake Error: Problem processing arguments. Aborting. diff --git a/Tests/RunCMake/CommandLine/W_bad-arg2-result.txt b/Tests/RunCMake/CommandLine/W_bad-arg2-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/CommandLine/W_bad-arg2-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt deleted file mode 100644 index cc643df..0000000 --- a/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error: No warning name provided. -CMake Error: Problem processing arguments. Aborting. diff --git a/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt deleted file mode 100644 index cc643df..0000000 --- a/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error: No warning name provided. -CMake Error: Problem processing arguments. Aborting. diff --git a/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt b/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt deleted file mode 100644 index e9be1dc..0000000 --- a/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Deprecation Warning at Wdeprecated.cmake:1 \(message\): - Some deprecated warning -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CommandLine/Wdeprecated.cmake b/Tests/RunCMake/CommandLine/Wdeprecated.cmake deleted file mode 100644 index 3142b42..0000000 --- a/Tests/RunCMake/CommandLine/Wdeprecated.cmake +++ /dev/null @@ -1 +0,0 @@ -message(DEPRECATION "Some deprecated warning") diff --git a/Tests/RunCMake/CommandLine/Wdev-stderr.txt b/Tests/RunCMake/CommandLine/Wdev-stderr.txt index f427303..92c1d23 100644 --- a/Tests/RunCMake/CommandLine/Wdev-stderr.txt +++ b/Tests/RunCMake/CommandLine/Wdev-stderr.txt @@ -2,4 +2,10 @@ Some Author Warning Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at Wdev.cmake:6 \(include\): + include\(\) given empty file name \(ignored\). +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/CommandLine/Wdev.cmake b/Tests/RunCMake/CommandLine/Wdev.cmake index 0242086..e5026ef 100644 --- a/Tests/RunCMake/CommandLine/Wdev.cmake +++ b/Tests/RunCMake/CommandLine/Wdev.cmake @@ -1 +1,6 @@ message(AUTHOR_WARNING "Some Author Warning") + +# with -Wdev this will also cause an AUTHOR_WARNING message, checks that +# messages issued outside of the message command, by other CMake commands, also +# are affected by -Wdev +include("") diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt deleted file mode 100644 index 6acdc73..0000000 --- a/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Deprecation Error at Werror_deprecated.cmake:1 \(message\): - Some deprecated warning -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated.cmake b/Tests/RunCMake/CommandLine/Werror_deprecated.cmake deleted file mode 100644 index 3142b42..0000000 --- a/Tests/RunCMake/CommandLine/Werror_deprecated.cmake +++ /dev/null @@ -1 +0,0 @@ -message(DEPRECATION "Some deprecated warning") diff --git a/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt deleted file mode 100644 index c6b4e74..0000000 --- a/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Error \(dev\) at Werror_dev.cmake:1 \(message\): - Some author warning -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This error is for project developers. Use -Wno-error=dev to suppress it.$ diff --git a/Tests/RunCMake/CommandLine/Werror_dev.cmake b/Tests/RunCMake/CommandLine/Werror_dev.cmake deleted file mode 100644 index e05cf9d..0000000 --- a/Tests/RunCMake/CommandLine/Werror_dev.cmake +++ /dev/null @@ -1 +0,0 @@ -message(AUTHOR_WARNING "Some author warning") diff --git a/Tests/RunCMake/CommandLine/Wno-deprecated.cmake b/Tests/RunCMake/CommandLine/Wno-deprecated.cmake deleted file mode 100644 index 3142b42..0000000 --- a/Tests/RunCMake/CommandLine/Wno-deprecated.cmake +++ /dev/null @@ -1 +0,0 @@ -message(DEPRECATION "Some deprecated warning") diff --git a/Tests/RunCMake/CommandLine/Wno-dev.cmake b/Tests/RunCMake/CommandLine/Wno-dev.cmake index 0242086..d81b858 100644 --- a/Tests/RunCMake/CommandLine/Wno-dev.cmake +++ b/Tests/RunCMake/CommandLine/Wno-dev.cmake @@ -1 +1,6 @@ message(AUTHOR_WARNING "Some Author Warning") + +# without -Wno-dev this will also cause an AUTHOR_WARNING message, checks that +# messages issued outside of the message command, by other CMake commands, also +# are affected by -Wno-dev +include("") diff --git a/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake b/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake deleted file mode 100644 index 3142b42..0000000 --- a/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake +++ /dev/null @@ -1 +0,0 @@ -message(DEPRECATION "Some deprecated warning") diff --git a/Tests/RunCMake/CommandLine/Wno-error_dev.cmake b/Tests/RunCMake/CommandLine/Wno-error_dev.cmake deleted file mode 100644 index e05cf9d..0000000 --- a/Tests/RunCMake/CommandLine/Wno-error_dev.cmake +++ /dev/null @@ -1 +0,0 @@ -message(AUTHOR_WARNING "Some author warning") diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake index c1b2227..8dc627d 100644 --- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake @@ -29,7 +29,7 @@ if (NOT CXX_FEATURES) run_cmake(NoSupportedCxxFeatures) run_cmake(NoSupportedCxxFeaturesGenex) else() - if(CXX_STANDARD_DEFAULT) + if(CXX_STANDARD_DEFAULT EQUAL 98) run_cmake(LinkImplementationFeatureCycle) endif() run_cmake(LinkImplementationFeatureCycleSolved) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt new file mode 100644 index 0000000..5f211eb --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt @@ -0,0 +1 @@ +-- g_ir_scanner: .*/g-ir-scanner diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake new file mode 100644 index 0000000..c85efaa --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake @@ -0,0 +1,9 @@ +find_package(PkgConfig REQUIRED) +pkg_check_modules(GOBJECT_INTROSPECTION QUIET gobject-introspection-1.0) + +if (GOBJECT_INTROSPECTION_FOUND) + pkg_get_variable(g_ir_scanner gobject-introspection-1.0 g_ir_scanner) + message(STATUS "g_ir_scanner: ${g_ir_scanner}") +else () + message(STATUS "g_ir_scanner: skipping test; gobject-introspection-1.0 not found /g-ir-scanner") +endif () diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index 29301d7..bb04aa2 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -9,3 +9,9 @@ if(APPLE) run_cmake(FindPkgConfig_CMAKE_FRAMEWORK_PATH) run_cmake(FindPkgConfig_CMAKE_APPBUNDLE_PATH) endif() + +# We need a real pkg-config to run the test for get_variable. +find_package(PkgConfig) +if (PKG_CONFIG_FOUND) + run_cmake(FindPkgConfig_GET_VARIABLE) +endif () diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh index 852e841..abe14bf 100755 --- a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh +++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh @@ -10,9 +10,10 @@ case $1 in ;; --exists) shift - echo "Expected: $@" + eval last=\${$#} + echo "Expected: ${last}" echo "Found: ${PKG_CONFIG_PATH}" - [ "$@" = "${PKG_CONFIG_PATH}" ] || exit 1 + [ "${last}" = "${PKG_CONFIG_PATH}" ] || exit 1 ;; *) exit 255 diff --git a/Tests/RunCMake/CommandLine/Werror_dev-result.txt b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/Werror_dev-result.txt +++ b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-stderr.txt new file mode 100644 index 0000000..8d3c4cc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadSHELL_PATH.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<SHELL_PATH:> + + "" is not an absolute path. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadSHELL_PATH.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<SHELL_PATH:Relative/Path> + + "Relative/Path" is not an absolute path. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH.cmake b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH.cmake new file mode 100644 index 0000000..5eff7bc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH.cmake @@ -0,0 +1,4 @@ +add_custom_target(check ALL COMMAND check + $<SHELL_PATH:> + $<SHELL_PATH:Relative/Path> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 0679024..45175d8 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -10,6 +10,7 @@ run_cmake(BadTargetName) run_cmake(BadTargetTypeInterface) run_cmake(BadTargetTypeObject) run_cmake(BadInstallPrefix) +run_cmake(BadSHELL_PATH) run_cmake(CMP0044-WARN) run_cmake(NonValidTarget-C_COMPILER_ID) run_cmake(NonValidTarget-CXX_COMPILER_ID) diff --git a/Tests/RunCMake/LinkStatic/CMakeLists.txt b/Tests/RunCMake/LinkStatic/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/LinkStatic/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/set_property/LINK_SEARCH_STATIC.cmake b/Tests/RunCMake/LinkStatic/LINK_SEARCH_STATIC.cmake index 70d2fee..6db5c85 100644 --- a/Tests/RunCMake/set_property/LINK_SEARCH_STATIC.cmake +++ b/Tests/RunCMake/LinkStatic/LINK_SEARCH_STATIC.cmake @@ -1,4 +1,4 @@ -project(LinkSearchStatic) +enable_language(C) set(CMAKE_LINK_SEARCH_START_STATIC ON) add_executable(LinkSearchStartStaticInit1 LinkStatic.c) diff --git a/Tests/RunCMake/set_property/LinkStatic.c b/Tests/RunCMake/LinkStatic/LinkStatic.c index 3600977..3600977 100644 --- a/Tests/RunCMake/set_property/LinkStatic.c +++ b/Tests/RunCMake/LinkStatic/LinkStatic.c diff --git a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake new file mode 100644 index 0000000..0d29492 --- /dev/null +++ b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(LINK_SEARCH_STATIC) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 46bc494..db9911d 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -102,7 +102,7 @@ function(run_cmake test) endif() foreach(o out err) string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}") - string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage|[a-z]+\\([0-9]+\\) malloc:|Error kstat returned)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") + string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage|[a-z]+\\([0-9]+\\) malloc:|Error kstat returned|[^\n]*from Time Machine by path|[^\n]*Bullseye Testing Technology)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") set(expect_${o} "") if(DEFINED expect_std${o}) @@ -115,7 +115,11 @@ function(run_cmake test) endif() endforeach() unset(RunCMake_TEST_FAILED) - include(${top_src}/${test}-check.cmake OPTIONAL) + if(RunCMake-check-file AND EXISTS ${top_src}/${RunCMake-check-file}) + include(${top_src}/${RunCMake-check-file}) + else() + include(${top_src}/${test}-check.cmake OPTIONAL) + endif() if(RunCMake_TEST_FAILED) set(msg "${RunCMake_TEST_FAILED}\n${msg}") endif() diff --git a/Tests/RunCMake/Swift/Enable-stdout.txt b/Tests/RunCMake/Swift/Enable-stdout.txt deleted file mode 100644 index 39e133f..0000000 --- a/Tests/RunCMake/Swift/Enable-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- The Swift compiler identification is Apple diff --git a/Tests/RunCMake/Swift/Enable.cmake b/Tests/RunCMake/Swift/Enable.cmake deleted file mode 100644 index 19f297a..0000000 --- a/Tests/RunCMake/Swift/Enable.cmake +++ /dev/null @@ -1 +0,0 @@ -enable_language(Swift) diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake index 0a57121..4864295 100644 --- a/Tests/RunCMake/Swift/RunCMakeTest.cmake +++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake @@ -3,8 +3,6 @@ include(RunCMake) if(RunCMake_GENERATOR STREQUAL Xcode) if(XCODE_BELOW_6_1) run_cmake(XcodeTooOld) - else() - run_cmake(Enable) endif() else() run_cmake(NotSupported) diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index d0aa995..57047fb 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -19,6 +19,7 @@ \* CMP0052 \* CMP0060 \* CMP0063 + \* CMP0065 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt new file mode 100644 index 0000000..b8d726f --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt @@ -0,0 +1,15 @@ +CMake Warning \(dev\) at CMP0063-WARN-exe.cmake:[0-9]+ \(add_executable\): + Policy CMP0063 is not set: Honor visibility properties for all target + types. Run "cmake --help-policy CMP0063" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "myexe" of type "EXECUTABLE" has the following visibility properties + set for CXX: + + CXX_VISIBILITY_PRESET + VISIBILITY_INLINES_HIDDEN + + For compatibility CMake is not honoring them for this target. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake index 3388e4d..cef1d75 100644 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes.cmake +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake @@ -5,4 +5,7 @@ enable_language(CXX) set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") -include(CMP0063-Common.cmake) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + +add_executable(myexe lib.cpp) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt new file mode 100644 index 0000000..3a7732a --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt @@ -0,0 +1,15 @@ +CMake Warning \(dev\) at CMP0063-WARN-obj.cmake:[0-9]+ \(add_library\): + Policy CMP0063 is not set: Honor visibility properties for all target + types. Run "cmake --help-policy CMP0063" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "myobject" of type "OBJECT_LIBRARY" has the following visibility + properties set for CXX: + + CXX_VISIBILITY_PRESET + VISIBILITY_INLINES_HIDDEN + + For compatibility CMake is not honoring them for this target. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake new file mode 100644 index 0000000..81d1c33 --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake @@ -0,0 +1,11 @@ + +enable_language(CXX) + +# Ensure CMake warns even if toolchain does not really have these flags. +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + +add_library(myobject OBJECT lib.cpp) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt new file mode 100644 index 0000000..1efa1b5 --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt @@ -0,0 +1,15 @@ +CMake Warning \(dev\) at CMP0063-WARN-sta.cmake:[0-9]+ \(add_library\): + Policy CMP0063 is not set: Honor visibility properties for all target + types. Run "cmake --help-policy CMP0063" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "mystatic" of type "STATIC_LIBRARY" has the following visibility + properties set for CXX: + + CXX_VISIBILITY_PRESET + VISIBILITY_INLINES_HIDDEN + + For compatibility CMake is not honoring them for this target. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake new file mode 100644 index 0000000..132e076 --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake @@ -0,0 +1,11 @@ + +enable_language(CXX) + +# Ensure CMake warns even if toolchain does not really have these flags. +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + +add_library(mystatic STATIC lib.cpp) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt deleted file mode 100644 index 59a4b8f..0000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt +++ /dev/null @@ -1,50 +0,0 @@ -^CMake Warning \(dev\) at CMP0063-Common.cmake:[0-9]+ \(add_executable\): - Policy CMP0063 is not set: Honor visibility properties for all target - types. Run "cmake --help-policy CMP0063" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - Target "myexe" of type "EXECUTABLE" has the following visibility properties - set for CXX: - - CXX_VISIBILITY_PRESET - VISIBILITY_INLINES_HIDDEN - - For compatibility CMake is not honoring them for this target. -Call Stack \(most recent call first\): - CMP0063-WARN-yes.cmake:[0-9]+ \(include\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) at CMP0063-Common.cmake:[0-9]+ \(add_library\): - Policy CMP0063 is not set: Honor visibility properties for all target - types. Run "cmake --help-policy CMP0063" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - Target "myobject" of type "OBJECT_LIBRARY" has the following visibility - properties set for CXX: - - CXX_VISIBILITY_PRESET - VISIBILITY_INLINES_HIDDEN - - For compatibility CMake is not honoring them for this target. -Call Stack \(most recent call first\): - CMP0063-WARN-yes.cmake:[0-9]+ \(include\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) at CMP0063-Common.cmake:[0-9]+ \(add_library\): - Policy CMP0063 is not set: Honor visibility properties for all target - types. Run "cmake --help-policy CMP0063" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - Target "mystatic" of type "STATIC_LIBRARY" has the following visibility - properties set for CXX: - - CXX_VISIBILITY_PRESET - VISIBILITY_INLINES_HIDDEN - - For compatibility CMake is not honoring them for this target. -Call Stack \(most recent call first\): - CMP0063-WARN-yes.cmake:[0-9]+ \(include\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake b/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake index c7eb808..7a000ee 100644 --- a/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake +++ b/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake @@ -2,6 +2,8 @@ include(RunCMake) run_cmake(PropertyTypo) run_cmake(CMP0063-OLD) -run_cmake(CMP0063-WARN-yes) +run_cmake(CMP0063-WARN-exe) +run_cmake(CMP0063-WARN-obj) +run_cmake(CMP0063-WARN-sta) run_cmake(CMP0063-WARN-no) run_cmake(CMP0063-NEW) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 8ab618b..f89d620 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -4,6 +4,9 @@ run_cmake(XcodeFileType) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) run_cmake(XcodeObjectNeedsQuote) +run_cmake(XcodeOptimizationFlags) +run_cmake(XcodePreserveNonOptimizationFlags) +run_cmake(XcodePreserveObjcFlag) if (NOT XCODE_VERSION VERSION_LESS 6) run_cmake(XcodePlatformFrameworks) endif() @@ -55,6 +58,38 @@ if(NOT XCODE_VERSION VERSION_LESS 5) endif() if(NOT XCODE_VERSION VERSION_LESS 7) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesWatchOS-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DTEST_WATCHOS=ON") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeBundles) + run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + +if(NOT XCODE_VERSION VERSION_LESS 7.1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesTvOS-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DTEST_TVOS=ON") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeBundles) + run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + +if(NOT XCODE_VERSION VERSION_LESS 7) set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/osx.cmake") run_cmake(XcodeTbdStub) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake index 2cbccfa..0fdc6af 100644 --- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake @@ -10,6 +10,22 @@ if(TEST_IOS) set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") endif(TEST_IOS) +if(TEST_WATCHOS) + set(CMAKE_OSX_SYSROOT watchos) + set(CMAKE_OSX_ARCHITECTURES "armv7k") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +if(TEST_TVOS) + set(CMAKE_OSX_SYSROOT appletvos) + set(CMAKE_OSX_ARCHITECTURES "arm64") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + # App Bundle add_executable(AppBundle MACOSX_BUNDLE main.m) @@ -35,11 +51,13 @@ endif() # Bundle -add_library(Bundle MODULE main.c) -set_target_properties(Bundle PROPERTIES BUNDLE TRUE) +if(NOT CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE) + add_library(Bundle MODULE main.c) + set_target_properties(Bundle PROPERTIES BUNDLE TRUE) -add_custom_target(BundleTest ALL - COMMAND ${CMAKE_COMMAND} -E copy - "$<TARGET_FILE:Bundle>" "$<TARGET_FILE:Bundle>.old") + add_custom_target(BundleTest ALL + COMMAND ${CMAKE_COMMAND} -E copy + "$<TARGET_FILE:Bundle>" "$<TARGET_FILE:Bundle>.old") -add_dependencies(BundleTest Bundle) + add_dependencies(BundleTest Bundle) +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags-check.cmake b/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags-check.cmake new file mode 100644 index 0000000..f5595b3 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags-check.cmake @@ -0,0 +1,7 @@ +foreach(level 1 2 3 s fast) + file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeOptimizationFlags.xcodeproj/project.pbxproj actual-${level} + REGEX "GCC_OPTIMIZATION_LEVEL = ${level};" LIMIT_COUNT 1) + if(NOT actual-${level}) + message(SEND_ERROR "Optimization level '${level}' not found in Xcode project.") + endif() +endforeach() diff --git a/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags.cmake b/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags.cmake new file mode 100644 index 0000000..e14bf80 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags.cmake @@ -0,0 +1,20 @@ +set(CMAKE_CONFIGURATION_TYPES "Release" CACHE INTERNAL "Supported configuration types") + +set(CMAKE_CXX_FLAGS_RELEASE "") + +project(XcodeOptimizationFlags CXX) + +add_library(fooO1 STATIC foo.cpp) +set_target_properties(fooO1 PROPERTIES COMPILE_OPTIONS -O1) + +add_library(fooO2 STATIC foo.cpp) +set_target_properties(fooO2 PROPERTIES COMPILE_OPTIONS -O2) + +add_library(fooO3 STATIC foo.cpp) +set_target_properties(fooO3 PROPERTIES COMPILE_OPTIONS -O3) + +add_library(fooOs STATIC foo.cpp) +set_target_properties(fooOs PROPERTIES COMPILE_OPTIONS -Os) + +add_library(fooOfast STATIC foo.cpp) +set_target_properties(fooOfast PROPERTIES COMPILE_OPTIONS -Ofast) diff --git a/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags-check.cmake b/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags-check.cmake new file mode 100644 index 0000000..2f6c03d --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags-check.cmake @@ -0,0 +1,8 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodePreserveNonOptimizationFlags.xcodeproj/project.pbxproj actual + REGEX "OTHER_CPLUSPLUSFLAGS = [^;]*;") +foreach(expect "-DA" "-DB +-DC" "-DD") + if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the lines:\n ${actual}\n" + "which do not match expected regex:\n ${expect}\n") + endif() +endforeach() diff --git a/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags.cmake b/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags.cmake new file mode 100644 index 0000000..16f0381 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags.cmake @@ -0,0 +1,12 @@ +set(CMAKE_CONFIGURATION_TYPES "Release" CACHE INTERNAL "Supported configuration types") + +project(XcodePreserveNonOptimizationFlags CXX) + +add_library(preserveStart STATIC foo.cpp) +set_property(TARGET preserveStart PROPERTY COMPILE_OPTIONS -DA -O1) + +add_library(preserveBoth STATIC foo.cpp) +set_property(TARGET preserveBoth PROPERTY COMPILE_OPTIONS -DB -O1 -DC) + +add_library(preserveEnd STATIC foo.cpp) +set_property(TARGET preserveEnd PROPERTY COMPILE_OPTIONS -O1 -DD) diff --git a/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag-check.cmake b/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag-check.cmake new file mode 100644 index 0000000..332906f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag-check.cmake @@ -0,0 +1,7 @@ +set(expect "-ObjC") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodePreserveObjcFlag.xcodeproj/project.pbxproj actual + REGEX "OTHER_CPLUSPLUSFLAGS = [^;]*;" LIMIT_COUNT 1) +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag.cmake b/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag.cmake new file mode 100644 index 0000000..64db633 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag.cmake @@ -0,0 +1,6 @@ +set(CMAKE_CONFIGURATION_TYPES "Release" CACHE INTERNAL "Supported configuration types") + +project(XcodePreserveObjcFlag CXX) + +add_library(foo STATIC foo.cpp) +set_target_properties(foo PROPERTIES COMPILE_OPTIONS -ObjC) diff --git a/Tests/RunCMake/ctest_test/CMakeLists.txt.in b/Tests/RunCMake/ctest_test/CMakeLists.txt.in index cedf379..e61b556 100644 --- a/Tests/RunCMake/ctest_test/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_test/CMakeLists.txt.in @@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.1) project(CTestTest@CASE_NAME@ NONE) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) +@CASE_CMAKELISTS_SUFFIX_CODE@ diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 76dc143..1b31726 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -59,3 +59,19 @@ function(run_TestChangeId) run_ctest(TestChangeId) endfunction() run_TestChangeId() + +function(run_TestOutputSize) + set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion) + set(CASE_TEST_PREFIX_CODE [[ +set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 10) +set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 12) + ]]) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_test(NAME PassingTest COMMAND ${CMAKE_COMMAND} -E echo PassingTestOutput) +add_test(NAME FailingTest COMMAND ${CMAKE_COMMAND} -E no_such_command) + ]]) + + unset(ENV{CTEST_PARALLEL_LEVEL}) + run_ctest(TestOutputSize) +endfunction() +run_TestOutputSize() diff --git a/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake b/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake new file mode 100644 index 0000000..74ad669 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake @@ -0,0 +1,17 @@ +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + file(READ "${test_xml_file}" test_xml LIMIT 4096) + if("${test_xml}" MATCHES [[(<Test Status="passed">.*</Test>).*(<Test Status="failed">.*</Test>)]]) + set(test_passed "${CMAKE_MATCH_1}") + set(test_failed "${CMAKE_MATCH_2}") + if(NOT "${test_passed}" MATCHES [[<Value>PassingTes\.\.\..*10 bytes]]) + set(RunCMake_TEST_FAILED "Test.xml passed test output not truncated at 10 bytes:\n ${test_passed}") + elseif(NOT "${test_failed}" MATCHES [[<Value>CMake Error:\.\.\..*12 bytes]]) + set(RunCMake_TEST_FAILED "Test.xml failed test output not truncated at 12 bytes:\n ${test_failed}") + endif() + else() + set(RunCMake_TEST_FAILED "Test.xml does not contain a passed then failed test:\n ${test_xml}") + endif() +else() + set(RunCMake_TEST_FAILED "Test.xml not found") +endif() diff --git a/Tests/RunCMake/find_program/A/testAandB b/Tests/RunCMake/find_program/A/testAandB new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/Tests/RunCMake/find_program/A/testAandB @@ -0,0 +1 @@ +#!/bin/sh diff --git a/Tests/RunCMake/find_program/B/testAandB b/Tests/RunCMake/find_program/B/testAandB new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/Tests/RunCMake/find_program/B/testAandB @@ -0,0 +1 @@ +#!/bin/sh diff --git a/Tests/RunCMake/find_program/EnvAndHints-stdout.txt b/Tests/RunCMake/find_program/EnvAndHints-stdout.txt new file mode 100644 index 0000000..39329b2 --- /dev/null +++ b/Tests/RunCMake/find_program/EnvAndHints-stdout.txt @@ -0,0 +1 @@ +-- PROG='[^']*/Tests/RunCMake/find_program/A/testAandB' diff --git a/Tests/RunCMake/find_program/EnvAndHints.cmake b/Tests/RunCMake/find_program/EnvAndHints.cmake new file mode 100644 index 0000000..14ebd6e --- /dev/null +++ b/Tests/RunCMake/find_program/EnvAndHints.cmake @@ -0,0 +1,8 @@ +set(ENV_PATH "$ENV{PATH}") +set(ENV{PATH} ${CMAKE_CURRENT_SOURCE_DIR}/A) +find_program(PROG + NAMES testAandB + HINTS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B + ) +message(STATUS "PROG='${PROG}'") +set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake index 2adec11..89307c1 100644 --- a/Tests/RunCMake/find_program/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(EnvAndHints) run_cmake(DirsPerName) run_cmake(NamesPerDir) diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt +++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-result.txt diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt new file mode 100644 index 0000000..9844158 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$<NOTAGENEX> + + Expression did not evaluate to a known generator expression diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake new file mode 100644 index 0000000..f050cdf --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake @@ -0,0 +1 @@ +install(DIRECTORY dir DESTINATION $<NOTAGENEX>) diff --git a/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt b/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt +++ b/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt b/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt new file mode 100644 index 0000000..9844158 --- /dev/null +++ b/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$<NOTAGENEX> + + Expression did not evaluate to a known generator expression diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake b/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake new file mode 100644 index 0000000..0fda078 --- /dev/null +++ b/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake @@ -0,0 +1 @@ +install(FILES empty.c DESTINATION $<NOTAGENEX>) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index a5f5bd0..043bd1f 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -6,6 +6,8 @@ run_cmake(DIRECTORY-message-lazy) run_cmake(SkipInstallRulesWarning) run_cmake(SkipInstallRulesNoWarning1) run_cmake(SkipInstallRulesNoWarning2) +run_cmake(DIRECTORY-DESTINATION-bad) +run_cmake(FILES-DESTINATION-bad) run_cmake(TARGETS-DESTINATION-bad) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) diff --git a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt new file mode 100644 index 0000000..dd5bae1 --- /dev/null +++ b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt @@ -0,0 +1,2 @@ +-- Target COMPILE_DEFINITIONS is 'a;b;c;d;;e' +-- Directory COMPILE_DEFINITIONS is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake new file mode 100644 index 0000000..f0c63bf --- /dev/null +++ b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake @@ -0,0 +1,3 @@ +include(Common.cmake) +test_target_property(COMPILE_DEFINITIONS) +test_directory_property(COMPILE_DEFINITIONS) diff --git a/Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt b/Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt new file mode 100644 index 0000000..bd5a992 --- /dev/null +++ b/Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt @@ -0,0 +1 @@ +-- Target COMPILE_FEATURES is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/COMPILE_FEATURES.cmake b/Tests/RunCMake/set_property/COMPILE_FEATURES.cmake new file mode 100644 index 0000000..1ab52ef --- /dev/null +++ b/Tests/RunCMake/set_property/COMPILE_FEATURES.cmake @@ -0,0 +1,2 @@ +include(Common.cmake) +test_target_property(COMPILE_FEATURES) diff --git a/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt b/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt new file mode 100644 index 0000000..1a20501 --- /dev/null +++ b/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt @@ -0,0 +1,2 @@ +-- Target COMPILE_OPTIONS is 'a;b;c;d;;e' +-- Directory COMPILE_OPTIONS is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake b/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake new file mode 100644 index 0000000..75f0535 --- /dev/null +++ b/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake @@ -0,0 +1,3 @@ +include(Common.cmake) +test_target_property(COMPILE_OPTIONS) +test_directory_property(COMPILE_OPTIONS) diff --git a/Tests/RunCMake/set_property/Common.cmake b/Tests/RunCMake/set_property/Common.cmake new file mode 100644 index 0000000..9d5e4f4 --- /dev/null +++ b/Tests/RunCMake/set_property/Common.cmake @@ -0,0 +1,28 @@ +macro(test_target_property PROP) + add_custom_target(CustomTarget) + set_property(TARGET CustomTarget PROPERTY ${PROP} x) + set_property(TARGET CustomTarget PROPERTY ${PROP}) + set_property(TARGET CustomTarget APPEND PROPERTY ${PROP}) + set_property(TARGET CustomTarget PROPERTY ${PROP} a) + set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} "") + set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} b c) + set_property(TARGET CustomTarget APPEND PROPERTY ${PROP}) + set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} "d;;e") + get_property(val TARGET CustomTarget PROPERTY ${PROP}) + message(STATUS "Target ${PROP} is '${val}'") + set_property(TARGET CustomTarget PROPERTY ${PROP}) +endmacro() + +macro(test_directory_property PROP) + set_property(DIRECTORY PROPERTY ${PROP} x) + set_property(DIRECTORY PROPERTY ${PROP}) + set_property(DIRECTORY APPEND PROPERTY ${PROP}) + set_property(DIRECTORY PROPERTY ${PROP} a) + set_property(DIRECTORY APPEND PROPERTY ${PROP} "") + set_property(DIRECTORY APPEND PROPERTY ${PROP} b c) + set_property(DIRECTORY APPEND PROPERTY ${PROP}) + set_property(DIRECTORY APPEND PROPERTY ${PROP} "d;;e") + get_property(val DIRECTORY PROPERTY ${PROP}) + message(STATUS "Directory ${PROP} is '${val}'") + set_property(DIRECTORY PROPERTY ${PROP}) +endmacro() diff --git a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt new file mode 100644 index 0000000..c957dd5 --- /dev/null +++ b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt @@ -0,0 +1,2 @@ +-- Target INCLUDE_DIRECTORIES is 'a;b;c;d;;e' +-- Directory INCLUDE_DIRECTORIES is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake new file mode 100644 index 0000000..c9a9151 --- /dev/null +++ b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake @@ -0,0 +1,3 @@ +include(Common.cmake) +test_target_property(INCLUDE_DIRECTORIES) +test_directory_property(INCLUDE_DIRECTORIES) diff --git a/Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt b/Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt new file mode 100644 index 0000000..9a3988e --- /dev/null +++ b/Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt @@ -0,0 +1 @@ +-- Target LINK_LIBRARIES is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake b/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake index 994e874..5155f59 100644 --- a/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake +++ b/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake @@ -1,7 +1,2 @@ -add_custom_target(CustomTarget) -set_property(TARGET CustomTarget PROPERTY LINK_LIBRARIES) -set_property(TARGET CustomTarget APPEND PROPERTY LINK_LIBRARIES) -get_property(val TARGET CustomTarget PROPERTY LINK_LIBRARIES) -if (NOT "${val}" STREQUAL "") - message(FATAL_ERROR "LINK_LIBRARIES value is '${val}' but should be ''") -endif() +include(Common.cmake) +test_target_property(LINK_LIBRARIES) diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index ada8804..37c7124 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -1,4 +1,9 @@ include(RunCMake) +run_cmake(COMPILE_DEFINITIONS) +run_cmake(COMPILE_FEATURES) +run_cmake(COMPILE_OPTIONS) +run_cmake(INCLUDE_DIRECTORIES) run_cmake(LINK_LIBRARIES) -run_cmake(LINK_SEARCH_STATIC) +run_cmake(SOURCES) +run_cmake(USER_PROP) diff --git a/Tests/RunCMake/set_property/SOURCES-stdout.txt b/Tests/RunCMake/set_property/SOURCES-stdout.txt new file mode 100644 index 0000000..921d5b1 --- /dev/null +++ b/Tests/RunCMake/set_property/SOURCES-stdout.txt @@ -0,0 +1 @@ +-- Target SOURCES is 'a;b;c;d;e' diff --git a/Tests/RunCMake/set_property/SOURCES.cmake b/Tests/RunCMake/set_property/SOURCES.cmake new file mode 100644 index 0000000..820641e --- /dev/null +++ b/Tests/RunCMake/set_property/SOURCES.cmake @@ -0,0 +1,2 @@ +include(Common.cmake) +test_target_property(SOURCES) diff --git a/Tests/RunCMake/set_property/USER_PROP-stdout.txt b/Tests/RunCMake/set_property/USER_PROP-stdout.txt new file mode 100644 index 0000000..107cc87 --- /dev/null +++ b/Tests/RunCMake/set_property/USER_PROP-stdout.txt @@ -0,0 +1,2 @@ +-- Target USER_PROP is 'a;b;c;d;;e' +-- Directory USER_PROP is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/USER_PROP.cmake b/Tests/RunCMake/set_property/USER_PROP.cmake new file mode 100644 index 0000000..aa0aa83 --- /dev/null +++ b/Tests/RunCMake/set_property/USER_PROP.cmake @@ -0,0 +1,3 @@ +include(Common.cmake) +test_target_property(USER_PROP) +test_directory_property(USER_PROP) diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index cc3c3be..e365076 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -209,9 +209,9 @@ else() ARCHIVE DESTINATION MyTest/lib/static OPTIONAL # for coverage...target should always exist ) - install(FILES lib1.h DESTINATION MyTest/include/foo) + install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>) install(FILES lib2.h - DESTINATION MyTest/include/foo + DESTINATION $<1:MyTest/include/foo>$<0:/wrong> COMPONENT Development PERMISSIONS OWNER_READ OWNER_WRITE RENAME lib2renamed.h @@ -252,7 +252,7 @@ else() file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") install( - DIRECTORY TestSubDir scripts/ DESTINATION MyTest/share + DIRECTORY TestSubDir scripts/ DESTINATION $<1:MyTest/share>$<0:/wrong> FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE @@ -263,14 +263,14 @@ else() # Alternate directory installation for coverage. install( - DIRECTORY scripts/ DESTINATION MyTest/share/alt + DIRECTORY scripts/ DESTINATION $<1:MyTest/share/alt>$<0:/wrong> COMPONENT Development USE_SOURCE_PERMISSIONS PATTERN "CVS" EXCLUDE REGEX "\\.txt$" EXCLUDE ) install( - DIRECTORY TestSubDir DESTINATION MyTest/share/alt + DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong> FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index cc3c3be..e365076 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -209,9 +209,9 @@ else() ARCHIVE DESTINATION MyTest/lib/static OPTIONAL # for coverage...target should always exist ) - install(FILES lib1.h DESTINATION MyTest/include/foo) + install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>) install(FILES lib2.h - DESTINATION MyTest/include/foo + DESTINATION $<1:MyTest/include/foo>$<0:/wrong> COMPONENT Development PERMISSIONS OWNER_READ OWNER_WRITE RENAME lib2renamed.h @@ -252,7 +252,7 @@ else() file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") install( - DIRECTORY TestSubDir scripts/ DESTINATION MyTest/share + DIRECTORY TestSubDir scripts/ DESTINATION $<1:MyTest/share>$<0:/wrong> FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE @@ -263,14 +263,14 @@ else() # Alternate directory installation for coverage. install( - DIRECTORY scripts/ DESTINATION MyTest/share/alt + DIRECTORY scripts/ DESTINATION $<1:MyTest/share/alt>$<0:/wrong> COMPONENT Development USE_SOURCE_PERMISSIONS PATTERN "CVS" EXCLUDE REGEX "\\.txt$" EXCLUDE ) install( - DIRECTORY TestSubDir DESTINATION MyTest/share/alt + DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong> FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE diff --git a/Tests/SubDir/CMakeLists.txt b/Tests/SubDir/CMakeLists.txt index 6822e6b..32aa93f 100644 --- a/Tests/SubDir/CMakeLists.txt +++ b/Tests/SubDir/CMakeLists.txt @@ -1,6 +1,10 @@ cmake_minimum_required (VERSION 2.6) project(SUBDIR) + subdirs(Executable EXCLUDE_FROM_ALL Examples) + +set(DEFINED_AFTER_SUBDIRS_COMMAND 42) + write_file(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.") #WATCOM WMAKE does not support + in the name of a file! if(WATCOM) diff --git a/Tests/SubDir/Executable/CMakeLists.txt b/Tests/SubDir/Executable/CMakeLists.txt index 77e6751..fbe338e 100644 --- a/Tests/SubDir/Executable/CMakeLists.txt +++ b/Tests/SubDir/Executable/CMakeLists.txt @@ -1 +1,13 @@ add_executable(test test.cxx) + +if (NOT DEFINED_AFTER_SUBDIRS_COMMAND) + message(FATAL_ERROR "DEFINED_AFTER_SUBDIRS_COMMAND should be defined.") +endif() + +string(FIND "${CMAKE_CURRENT_BINARY_DIR}" "SubDir/Executable" location) +string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}" dirLength) +math(EXPR suffixLength "${dirLength} - ${location}") + +if (NOT suffixLength EQUAL 17) + message(FATAL_ERROR "CMAKE_CURRENT_BINARY_DIR does not end with \"SubDir/Executable\"") +endif() diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift index 7e7c4ab..3629ac8 100644 --- a/Tests/SwiftMix/SwiftMain.swift +++ b/Tests/SwiftMix/SwiftMain.swift @@ -1,8 +1,10 @@ -@objc class SwiftMainClass { +import Foundation + +@objc class SwiftMainClass : NSObject { class func SwiftMain(argc:Int, argv:UnsafePointer<UnsafePointer<CChar>>) -> Int32 { dump("argc: \(argc)") for (var i = 0; i < argc; ++i) { - var argi = String.fromCString(argv[i]) + let argi = String.fromCString(argv[i]) dump("arg[\(i)]: \(argi)"); } return 0; diff --git a/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt b/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt index 3ee1855..f68e38e 100644 --- a/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt +++ b/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt @@ -35,12 +35,12 @@ add_library(hello SHARED hello.f) add_library(world SHARED world.f) target_link_libraries(hello world) if(CMAKE_Fortran_COMPILER_ID MATCHES SunPro) - target_link_libraries(hello fsu) + target_link_libraries(hello PRIVATE fsu) if(CMAKE_Fortran_PLATFORM_ID MATCHES SunOS) - target_link_libraries(hello sunmath m) + target_link_libraries(hello PRIVATE sunmath m) test_sunquad(CMAKE_HAS_SUNQUAD) if(CMAKE_HAS_SUNQUAD) - target_link_libraries(hello sunquad) + target_link_libraries(hello PRIVATE sunquad) endif() endif() endif() diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt index 8357d5f..ae82755 100644 --- a/Tests/VSWinStorePhone/CMakeLists.txt +++ b/Tests/VSWinStorePhone/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required(VERSION 3.0) project(VSWinStorePhone) - -if(MSVC_VERSION GREATER 1700) +if(MSVC_VERSION GREATER 1899) + set(COMPILER_VERSION "14") +elseif(MSVC_VERSION GREATER 1700) set(COMPILER_VERSION "12") elseif(MSVC_VERSION GREATER 1600) set(COMPILER_VERSION "11") @@ -91,6 +92,7 @@ elseif (NOT "${PLATFORM}" STREQUAL "DESKTOP") set(ASSET_FILES ${ASSET_FILES} Direct3DApp1/Assets/Logo.png Direct3DApp1/Assets/SmallLogo.png + Direct3DApp1/Assets/SmallLogo44x44.png Direct3DApp1/Assets/SplashScreen.png Direct3DApp1/Assets/StoreLogo.png ) @@ -124,4 +126,15 @@ source_group("Resource Files" FILES ${RESOURCE_FILES}) add_executable(${EXE_NAME} WIN32 ${SOURCE_FILES} ${HEADER_FILES} ${RESOURCE_FILES}) set_property(TARGET ${EXE_NAME} PROPERTY VS_WINRT_COMPONENT TRUE) + +string(SUBSTRING "${CMAKE_SYSTEM_VERSION}" 0, 4, SHORT_VERSION) + +if("${SHORT_VERSION}" STREQUAL "10.0") + message(STATUS "Targeting Windows 10. Setting Extensions to version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + set_property(TARGET ${EXE_NAME} PROPERTY VS_DESKTOP_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + set_property(TARGET ${EXE_NAME} PROPERTY VS_MOBILE_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + set_property(TARGET ${EXE_NAME} PROPERTY VS_IOT_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") +endif() + + target_link_libraries(${EXE_NAME} d3d11) diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo44x44.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo44x44.png Binary files differnew file mode 100644 index 0000000..28810b7 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo44x44.png diff --git a/Tests/VSWinStorePhone/cmake/Package_vc14.store.appxmanifest.in b/Tests/VSWinStorePhone/cmake/Package_vc14.store.appxmanifest.in new file mode 100644 index 0000000..6b27ab7 --- /dev/null +++ b/Tests/VSWinStorePhone/cmake/Package_vc14.store.appxmanifest.in @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<Package + xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" + xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" + xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" + IgnorableNamespaces="uap mp"> + + <Identity Name="@PACKAGE_GUID@" Publisher="CN=mgong" Version="1.1.0.0" /> + <mp:PhoneIdentity PhoneProductId="@PACKAGE_GUID@" PhonePublisherId="00000000-0000-0000-0000-000000000000"/> + + <Properties> + <DisplayName>@SHORT_NAME@</DisplayName> + <PublisherDisplayName>mgong</PublisherDisplayName> + <Logo>Assets/StoreLogo.png</Logo> + </Properties> + + <Dependencies> + <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.65535.65535" /> + </Dependencies> + + <Resources> + <Resource Language="x-generate" /> + </Resources> + <Applications> + <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@SHORT_NAME@.App"> + <uap:VisualElements + DisplayName="@SHORT_NAME@" + Description="@SHORT_NAME@" + BackgroundColor="#336699" + Square150x150Logo="Assets/Logo.png" + Square44x44Logo="Assets/SmallLogo44x44.png"> + <uap:SplashScreen Image="Assets/SplashScreen.png" /> + </uap:VisualElements> + </Application> + </Applications> +</Package> |