diff options
Diffstat (limited to 'Tests')
383 files changed, 4180 insertions, 532 deletions
diff --git a/Tests/BundleUtilities/CMakeLists.txt b/Tests/BundleUtilities/CMakeLists.txt index 3a1cf55..69ef535 100644 --- a/Tests/BundleUtilities/CMakeLists.txt +++ b/Tests/BundleUtilities/CMakeLists.txt @@ -109,7 +109,8 @@ if(APPLE AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 9.0) target_link_libraries(testbundleutils3 shared-3 framework-3 ${CMAKE_DL_LIBS}) set_target_properties(testbundleutils3 module3 PROPERTIES - LINK_FLAGS "-Wl,-rpath,@loader_path/") + LINK_FLAGS "-Wl,-rpath,@loader_path/" + BUILD_WITH_INSTALL_RPATH 1) # add custom target to install and test the app add_custom_target(testbundleutils3_test ALL diff --git a/Tests/CMakeBuildTest.cmake.in b/Tests/CMakeBuildTest.cmake.in index aaefe43..71bcb18 100644 --- a/Tests/CMakeBuildTest.cmake.in +++ b/Tests/CMakeBuildTest.cmake.in @@ -12,6 +12,7 @@ message("running: ${CMAKE_COMMAND}") execute_process(COMMAND "${CMAKE_COMMAND}" "@CMAKE_BUILD_TEST_SOURCE_DIR@" "-G@CMAKE_GENERATOR@" + -A "@CMAKE_GENERATOR_PLATFORM@" -T "@CMAKE_GENERATOR_TOOLSET@" WORKING_DIRECTORY "@CMAKE_BUILD_TEST_BINARY_DIR@" RESULT_VARIABLE RESULT) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 3e69f93..25cc846 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3,7 +3,7 @@ macro(ADD_TEST_MACRO NAME COMMAND) string(REPLACE "." "/" dir "${NAME}") string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}") - add_test(${NAME} ${CMAKE_CTEST_COMMAND} + add_test(NAME "${NAME}" COMMAND "${CMAKE_CTEST_COMMAND}" --build-and-test "${CMake_SOURCE_DIR}/Tests/${dir}" "${CMake_BINARY_DIR}/Tests/${dir}" @@ -77,7 +77,7 @@ if(BUILD_TESTING) # some old versions of make simply cannot handle spaces in paths if (MAKE_IS_GNU OR CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR - CMAKE_GENERATOR MATCHES "Visual Studio|XCode|Borland") + CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland") set(MAKE_SUPPORTS_SPACES 1) else() set(MAKE_SUPPORTS_SPACES 0) @@ -86,6 +86,11 @@ if(BUILD_TESTING) set(build_generator_args --build-generator ${CMAKE_GENERATOR} ) + if(CMAKE_GENERATOR_PLATFORM) + list(APPEND build_generator_args + --build-generator-platform ${CMAKE_GENERATOR_PLATFORM} + ) + endif() if(CMAKE_GENERATOR_TOOLSET) list(APPEND build_generator_args --build-generator-toolset ${CMAKE_GENERATOR_TOOLSET} @@ -508,6 +513,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator" --build-two-config --build-generator "Eclipse CDT4 - Unix Makefiles" + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project Simple --build-options ${build_options} @@ -523,6 +529,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator" --build-two-config --build-generator "CodeBlocks - Unix Makefiles" + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project Simple --build-options ${build_options} @@ -537,6 +544,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator" --build-two-config --build-generator "KDevelop3 - Unix Makefiles" + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project Simple --build-options ${build_options} @@ -577,6 +585,7 @@ if(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/SubProject/foo" "${CMake_BINARY_DIR}/Tests/SubProject/foo" --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" ${SubProject-Stage2_BUILD_MAKEPROGRAM} --build-nocmake @@ -863,6 +872,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" "-Dconfig=\${CTEST_CONFIGURATION_TYPE}" -P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake") + + set_property(TEST CPackWiXGenerator PROPERTY + ATTACHED_FILES_ON_FAIL + "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator/_CPack_Packages/win32/WIX/wix.log") endif() endif() @@ -1249,6 +1262,21 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_tests_properties(ExternalProject PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + add_test(ExternalProjectLocal ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/ExternalProjectLocal" + "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal" + ${build_generator_args} + --build-project ExternalProjectLocalTest + --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal" + --force-new-ctest-process + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal") + set_tests_properties(ExternalProjectLocal PROPERTIES + TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + add_test(ExternalProjectUpdateSetup ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate" @@ -1269,6 +1297,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release -DExternalProjectUpdate_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate -DExternalProjectUpdate_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate -DCMAKE_GENERATOR=${CMAKE_GENERATOR} + -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DCMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake @@ -1373,7 +1402,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Dependency") - if("${CMAKE_SYSTEM_NAME}" MATCHES syllable) + if(CMAKE_SYSTEM_NAME MATCHES syllable) # RPATH isn't supported under Syllable, so the tests don't # find their libraries. In order to fix that LIBRARY_OUTPUT_DIR @@ -1487,7 +1516,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - if(MAKE_SUPPORTS_SPACES) + if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode") add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDirSpaces" @@ -1664,6 +1693,14 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC") endif() + if(MSVC AND NOT MSVC_VERSION LESS 1310 + AND NOT CMAKE_GENERATOR MATCHES "Visual Studio [67]( |$)" + AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio [89]( |$)" + OR CMAKE_SIZEOF_VOID_P EQUAL 4) + ) + ADD_TEST_MACRO(VSMASM VSMASM) + endif() + if(${CMAKE_GENERATOR} MATCHES "Visual Studio") if(NOT MSVC60) ADD_TEST_MACRO(SBCS SBCS) @@ -1710,6 +1747,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-two-config --build-generator ${CMAKE_GENERATOR} --build-makeprogram ${CMake_TEST_DEVENV} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project VSExcludeFromDefaultBuild --test-command ${CMAKE_COMMAND} @@ -1734,6 +1772,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir" --build-two-config --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project VSProjectInSubdir --build-target test) @@ -1741,6 +1780,85 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if(WIN32) + 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_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_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]") + set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") + foreach(reg vs10 vs11 vs12 ws80 ws81 wp80 wp81 tegra) + get_filename_component(r "${reg_${reg}}" ABSOLUTE) + if(IS_DIRECTORY "${r}") + set(${reg} 1) + else() + set(${reg} 0) + endif() + endforeach() + endif() + + get_filename_component(ntver "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion;CurrentVersion]" NAME) + if(WIN32 AND ntver VERSION_GREATER 6.1) # Windows >= 8.0 + macro(add_test_VSWinStorePhone name generator systemName systemVersion) + add_test(NAME VSWinStorePhone.${name} COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/VSWinStorePhone" + "${CMake_BINARY_DIR}/Tests/VSWinStorePhone/${name}" + --build-generator "${generator}" + --build-project VSWinStorePhone + --build-config $<CONFIGURATION> + --build-options -DCMAKE_SYSTEM_NAME=${systemName} + -DCMAKE_SYSTEM_VERSION=${systemVersion} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSWinStorePhone/${name}") + endmacro() + + if(vs11 AND ws80) + add_test_VSWinStorePhone(vs11-store80-X86 "Visual Studio 11 2012" WindowsStore 8.0) + add_test_VSWinStorePhone(vs11-store80-ARM "Visual Studio 11 2012 ARM" WindowsStore 8.0) + add_test_VSWinStorePhone(vs11-store80-X64 "Visual Studio 11 2012 Win64" WindowsStore 8.0) + endif() + if(vs12 AND ws81) + add_test_VSWinStorePhone(vs12-store81-X86 "Visual Studio 12 2013" WindowsStore 8.1) + add_test_VSWinStorePhone(vs12-store81-ARM "Visual Studio 12 2013 ARM" WindowsStore 8.1) + add_test_VSWinStorePhone(vs12-store81-X64 "Visual Studio 12 2013 Win64" WindowsStore 8.1) + 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) + endif() + if(vs12 AND wp81) + add_test_VSWinStorePhone(vs12-phone81-X86 "Visual Studio 12 2013" WindowsPhone 8.1) + add_test_VSWinStorePhone(vs12-phone81-ARM "Visual Studio 12 2013 ARM" WindowsPhone 8.1) + endif() + endif() + + if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") + macro(add_test_VSNsightTegra name generator) + add_test(NAME VSNsightTegra.${name} COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/VSNsightTegra" + "${CMake_BINARY_DIR}/Tests/VSNsightTegra/${name}" + --build-generator "${generator}" + --build-project VSNsightTegra + --build-config $<CONFIGURATION> + --build-options -DCMAKE_SYSTEM_NAME=Android + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSNsightTegra/${name}") + endmacro() + if(vs10) + add_test_VSNsightTegra(vs10 "Visual Studio 10 2010") + endif() + if(vs11) + add_test_VSNsightTegra(vs11 "Visual Studio 11 2012") + endif() + if(vs12) + add_test_VSNsightTegra(vs12 "Visual Studio 12 2013") + endif() + endif() + if (APPLE) if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(BundleTestInstallDir @@ -1898,6 +2016,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release # A test for ctest_build() with targets in subdirectories set(ctest_configure_options) + if(CMAKE_GENERATOR_PLATFORM) + list(APPEND ctest_configure_options -A ${CMAKE_GENERATOR_PLATFORM}) + endif() if(CMAKE_GENERATOR_TOOLSET) list(APPEND ctest_configure_options -T ${CMAKE_GENERATOR_TOOLSET}) endif() @@ -2145,7 +2266,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestGTMCoverage PROPERTIES PASS_REGULAR_EXPRESSION - "Process file.*ZZCOVTST.m.*Total LOC:.*23.*Percentage Coverage: 82.61*" + "Process file.*ZZCOVTST.m.*Total LOC:.*30.*Percentage Coverage: 80.00*" ENVIRONMENT COVFILE=) configure_file( @@ -2163,7 +2284,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestCacheCoverage PROPERTIES PASS_REGULAR_EXPRESSION - "Process file.*ZZCOVTST.m.*Total LOC:.*22.*Percentage Coverage: 86.36.*" + "Process file.*ZZCOVTST.m.*Total LOC:.*29.*Percentage Coverage: 86.21.*" ENVIRONMENT COVFILE=) # Adding a test case for Python Coverage @@ -2202,6 +2323,22 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "Process file.*CoverageTest.java.*Total LOC:.*18.*Percentage Coverage: 72.22.*" ENVIRONMENT COVFILE=) + + # Adding a test case for JaCoCo Coverage + configure_file( + "${CMake_SOURCE_DIR}/Tests/JacocoCoverage/DartConfiguration.tcl.in" + "${CMake_BINARY_DIR}/Testing/JacocoCoverage/DartConfiguration.tcl") + file(COPY "${CMake_SOURCE_DIR}/Tests/JacocoCoverage/Coverage" + DESTINATION "${CMake_BINARY_DIR}/Testing/JacocoCoverage") + add_test(NAME CTestJacocoCoverage + COMMAND cmake -E chdir + ${CMake_BINARY_DIR}/Testing/JacocoCoverage + $<TARGET_FILE:ctest> -T Coverage --debug) + set_tests_properties(CTestJacocoCoverage PROPERTIES + PASS_REGULAR_EXPRESSION + "Process file.*CoverageTest.java.*Total LOC:.*17.*Percentage Coverage: 76.47*" + ENVIRONMENT COVFILE=) + function(add_config_tests cfg) set(base "${CMake_BINARY_DIR}/Tests/CTestConfig") @@ -2501,7 +2638,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(regex "${regex}|Error message was: ") set(regex "${regex}([Cc]ould *n.t resolve host") set(regex "${regex}|[Cc]ould *n.t connect to host") - set(regex "${regex}|Failed connect to") + set(regex "${regex}|Failed *t*o* connect to") set(regex "${regex}|Empty reply from server") set(regex "${regex}|The requested URL returned error") set(regex "${regex}|libcurl was built with SSL disabled. https: not supported)") @@ -2533,7 +2670,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if (CMAKE_TESTS_CDASH_SERVER) - set(regex "^([^:]+)://([^/]+)(/.*)$") + set(regex "^([^:]+)://([^/]+)(.*)$") if ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") set(protocol "${CMAKE_MATCH_1}") @@ -2541,8 +2678,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(path "${CMAKE_MATCH_3}") else () set(protocol "http") - set(server "www.cdash.org") - set(path "/CDash") + set(server "open.cdash.org") + set(path "") message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...") message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]") endif () diff --git a/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt index 74f5451..2511064 100644 --- a/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt +++ b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt @@ -20,13 +20,13 @@ endif () string(TOUPPER "${MAJOR_TEST_MODULE}" MODULE_UPPER) -if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND "${VERSION_VAR}") +if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND ${VERSION_VAR}) message(STATUS "${VERSION_VAR} is '${${VERSION_VAR}}'") - if ("${VERSION_VAR}" VERSION_LESS MAJOR_TEST_VERSION) + if (${VERSION_VAR} VERSION_LESS MAJOR_TEST_VERSION) message(SEND_ERROR "Found version ${${VERSION_VAR}} is less than requested major version ${MAJOR_TEST_VERSION}") endif () math(EXPR V_PLUS_ONE "${MAJOR_TEST_VERSION} + 1") - if ("${VERSION_VAR}" VERSION_GREATER V_PLUS_ONE) + if (${VERSION_VAR} VERSION_GREATER V_PLUS_ONE) message(SEND_ERROR "Found version ${${VERSION_VAR}} is greater than requested major version ${MAJOR_TEST_VERSION}") endif () endif () diff --git a/Tests/CMakeOnly/Test.cmake.in b/Tests/CMakeOnly/Test.cmake.in index 285643a..8d3258b 100644 --- a/Tests/CMakeOnly/Test.cmake.in +++ b/Tests/CMakeOnly/Test.cmake.in @@ -9,6 +9,7 @@ file(MAKE_DIRECTORY "${binary_dir}") execute_process( COMMAND ${CMAKE_COMMAND} ${CMAKE_ARGS} "${source_dir}" -G "@CMAKE_GENERATOR@" + -A "@CMAKE_GENERATOR_PLATFORM@" -T "@CMAKE_GENERATOR_TOOLSET@" WORKING_DIRECTORY "${binary_dir}" RESULT_VARIABLE result diff --git a/Tests/CTestConfig/dashboard.cmake.in b/Tests/CTestConfig/dashboard.cmake.in index 608501c..143fe71 100644 --- a/Tests/CTestConfig/dashboard.cmake.in +++ b/Tests/CTestConfig/dashboard.cmake.in @@ -19,6 +19,7 @@ message("cmake initial configure") execute_process(COMMAND ${CMAKE_COMMAND} ${arg} -G "@CMAKE_GENERATOR@" + -A "@CMAKE_GENERATOR_PLATFORM@" -T "@CMAKE_GENERATOR_TOOLSET@" ${CTEST_SOURCE_DIRECTORY} WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} diff --git a/Tests/CTestConfig/script.cmake.in b/Tests/CTestConfig/script.cmake.in index 166de3b..b6ccedb 100644 --- a/Tests/CTestConfig/script.cmake.in +++ b/Tests/CTestConfig/script.cmake.in @@ -1,4 +1,5 @@ set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_PROJECT_NAME "CTestConfig") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestConfig") diff --git a/Tests/CTestTest/test.cmake.in b/Tests/CTestTest/test.cmake.in index ab39b88..bb6346b 100644 --- a/Tests/CTestTest/test.cmake.in +++ b/Tests/CTestTest/test.cmake.in @@ -41,6 +41,7 @@ set (CTEST_INITIAL_CACHE " SITE:STRING=@SITE@ BUILDNAME:STRING=SmallAndFast-@BUILDNAME@ CMAKE_GENERATOR:INTERNAL=@CMAKE_GENERATOR@ +CMAKE_GENERATOR_PLATFORM:INTERNAL=@CMAKE_GENERATOR_PLATFORM@ CMAKE_GENERATOR_TOOLSET:INTERNAL=@CMAKE_GENERATOR_TOOLSET@ CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@ CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@ diff --git a/Tests/CTestTest2/test.cmake.in b/Tests/CTestTest2/test.cmake.in index c5a7b45..852bb6b 100644 --- a/Tests/CTestTest2/test.cmake.in +++ b/Tests/CTestTest2/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Source/kwsys") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTest2/kwsysBin") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") diff --git a/Tests/CTestTestBadExe/CTestConfig.cmake b/Tests/CTestTestBadExe/CTestConfig.cmake index 1d46ea3..c7286e2 100644 --- a/Tests/CTestTestBadExe/CTestConfig.cmake +++ b/Tests/CTestTestBadExe/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestBadExe") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestBadExe/test.cmake.in b/Tests/CTestTestBadExe/test.cmake.in index 601aab4..43a8572 100644 --- a/Tests/CTestTestBadExe/test.cmake.in +++ b/Tests/CTestTestBadExe/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestBadEx set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestBadExe") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestBadGenerator/CTestConfig.cmake b/Tests/CTestTestBadGenerator/CTestConfig.cmake index ef98189..1e61bf4 100644 --- a/Tests/CTestTestBadGenerator/CTestConfig.cmake +++ b/Tests/CTestTestBadGenerator/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestBadGenerator") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestBadGenerator/test.cmake.in b/Tests/CTestTestBadGenerator/test.cmake.in index fe4fba8..ae6d0b5 100644 --- a/Tests/CTestTestBadGenerator/test.cmake.in +++ b/Tests/CTestTestBadGenerator/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestBadGe set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestBadGenerator") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "Bad Generator") +set(CTEST_CMAKE_GENERATOR_PLATFORM "") set(CTEST_CMAKE_GENERATOR_TOOLSET "") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestChecksum/test.cmake.in b/Tests/CTestTestChecksum/test.cmake.in index 8413443..32d62bb 100644 --- a/Tests/CTestTestChecksum/test.cmake.in +++ b/Tests/CTestTestChecksum/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestParal set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestParallel") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake b/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake index d2c28f9..4458348 100644 --- a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake +++ b/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestConfigFileInBuildDir") set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in index d3510bb..6d29af7 100644 --- a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in +++ b/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfi set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir1") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in index 99b002c..fb298d4 100644 --- a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in +++ b/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfi set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir2") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestCostSerial/CTestConfig.cmake b/Tests/CTestTestCostSerial/CTestConfig.cmake index 05c20eb..3ab99ac 100644 --- a/Tests/CTestTestCostSerial/CTestConfig.cmake +++ b/Tests/CTestTestCostSerial/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestCostSerial") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestCostSerial/test.cmake.in b/Tests/CTestTestCostSerial/test.cmake.in index ce8720c..9b32a46 100644 --- a/Tests/CTestTestCostSerial/test.cmake.in +++ b/Tests/CTestTestCostSerial/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCostS set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCostSerial") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestCrash/CTestConfig.cmake b/Tests/CTestTestCrash/CTestConfig.cmake index e1c5b1b..5c2ca0e 100644 --- a/Tests/CTestTestCrash/CTestConfig.cmake +++ b/Tests/CTestTestCrash/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestCrash") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestCrash/test.cmake.in b/Tests/CTestTestCrash/test.cmake.in index 5906d12..3641cb0 100644 --- a/Tests/CTestTestCrash/test.cmake.in +++ b/Tests/CTestTestCrash/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCrash set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCrash") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestCycle/CTestConfig.cmake b/Tests/CTestTestCycle/CTestConfig.cmake index 43e9986..8aeb09b 100644 --- a/Tests/CTestTestCycle/CTestConfig.cmake +++ b/Tests/CTestTestCycle/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestCycle") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestCycle/test.cmake.in b/Tests/CTestTestCycle/test.cmake.in index 478badb..4a63dd6 100644 --- a/Tests/CTestTestCycle/test.cmake.in +++ b/Tests/CTestTestCycle/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCycle set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCycle") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestDepends/CTestConfig.cmake b/Tests/CTestTestDepends/CTestConfig.cmake index e3af7dd..7af9200 100644 --- a/Tests/CTestTestDepends/CTestConfig.cmake +++ b/Tests/CTestTestDepends/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestDepends") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestDepends/test.cmake.in b/Tests/CTestTestDepends/test.cmake.in index a7de8cc..74fddb3 100644 --- a/Tests/CTestTestDepends/test.cmake.in +++ b/Tests/CTestTestDepends/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestDepen set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestDepends") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestFailedSubmits/test.cmake.in b/Tests/CTestTestFailedSubmits/test.cmake.in index 36a09cf..5ff836f 100644 --- a/Tests/CTestTestFailedSubmits/test.cmake.in +++ b/Tests/CTestTestFailedSubmits/test.cmake.in @@ -21,6 +21,7 @@ set(CTEST_SOURCE_DIRECTORY "@source@") set(CTEST_BINARY_DIRECTORY "@build@") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestFailure/CTestConfig.cmake b/Tests/CTestTestFailure/CTestConfig.cmake index fd8d97a..07e1be0 100644 --- a/Tests/CTestTestFailure/CTestConfig.cmake +++ b/Tests/CTestTestFailure/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestFailure") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestFailure/testNoBuild.cmake.in b/Tests/CTestTestFailure/testNoBuild.cmake.in index 143daf8..86333af 100644 --- a/Tests/CTestTestFailure/testNoBuild.cmake.in +++ b/Tests/CTestTestFailure/testNoBuild.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFailu set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFailure") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestFailure/testNoExe.cmake.in b/Tests/CTestTestFailure/testNoExe.cmake.in index 11a1930..8875cee 100644 --- a/Tests/CTestTestFailure/testNoExe.cmake.in +++ b/Tests/CTestTestFailure/testNoExe.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFailu set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFailure") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestFdSetSize/test.cmake.in b/Tests/CTestTestFdSetSize/test.cmake.in index fbe0e82..bfe4459 100644 --- a/Tests/CTestTestFdSetSize/test.cmake.in +++ b/Tests/CTestTestFdSetSize/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFdSet set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFdSetSize") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake index bf404ab..669b0fb 100644 --- a/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake +++ b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake @@ -3,6 +3,6 @@ set(CTEST_PROJECT_NAME "CTestTestLaunchers") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestLaunchers/test.cmake.in b/Tests/CTestTestLaunchers/test.cmake.in index 43a6533..03a118a 100644 --- a/Tests/CTestTestLaunchers/test.cmake.in +++ b/Tests/CTestTestLaunchers/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_BUILD_NAME "Launchers-@BUILDNAME@-CTestTestLauncher set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_SOURCE}/launcher_test_project") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/launcher_test_project-bin") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 8984463..2023e74 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -103,6 +103,90 @@ unset(CTEST_EXTRA_CONFIG) unset(CTEST_EXTRA_CODE) unset(CMAKELISTS_EXTRA_CODE) +#----------------------------------------------------------------------------- +# add ThreadSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testThreadSanitizer.cmake\") +") +gen_mc_test_internal(DummyThreadSanitizer "" -DMEMCHECK_TYPE=ThreadSanitizer) +set_tests_properties(CTestTestMemcheckDummyThreadSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*data race.* - 1.*data race on vptr .ctor/dtor vs virtual call. - 1.*heap-use-after-free - 1.*thread leak - 1.*destroy of a locked mutex - 1.*double lock of a mutex - 1.*unlock of an unlocked mutex .or by a wrong thread. - 1.*read lock of a write locked mutex - 1.*read unlock of a write locked mutex - 1.*signal-unsafe call inside of a signal - 1.*signal handler spoils errno - 1.*lock-order-inversion .potential deadlock. - 1.*") +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add LeakSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testLeakSanitizer.cmake\") +") +gen_mc_test_internal(DummyLeakSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) +set_tests_properties(CTestTestMemcheckDummyLeakSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*Direct leak - 2.*Indirect leak - 1.*") + +#----------------------------------------------------------------------------- +# add AddressSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testAddressSanitizer.cmake\") +") +gen_mc_test_internal(DummyAddressSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) +set_tests_properties(CTestTestMemcheckDummyAddressSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*heap-buffer-overflow - 1.*") + +#----------------------------------------------------------------------------- +# add MemorySanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +") + +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testMemorySanitizer.cmake\") +") +gen_mc_test_internal(DummyMemorySanitizer "" -DMEMCHECK_TYPE=MemorySanitizer) +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) +set_tests_properties(CTestTestMemcheckDummyMemorySanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*use-of-uninitialized-value - 1.*") + +#----------------------------------------------------------------------------- +# add UndefinedBehaviorSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1\") +") + +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testUndefinedBehaviorSanitizer.cmake\") +") +gen_mc_test_internal(DummyUndefinedBehaviorSanitizer "" -DMEMCHECK_TYPE=UndefinedBehaviorSanitizer) +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) +set_tests_properties(CTestTestMemcheckDummyUndefinedBehaviorSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*left shift of negative value -256 - 1.*") + +#----------------------------------------------------------------------------- + gen_mc_test(DummyPurify "\${PSEUDO_PURIFY}") gen_mc_test(DummyValgrind "\${PSEUDO_VALGRIND}") gen_mc_test(DummyBC "\${PSEUDO_BC}") @@ -177,7 +261,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$") set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES - PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") + PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n${guard_malloc_lines}\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") @@ -189,6 +273,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrindTwoTargets PROPERTIES PASS_REGULAR_EXPRESSION "\nMemory check project ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets\n.*\n *Start 1: RunCMake\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.1.log\" \"-q\".*\n *Start 2: RunCMakeAgain\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.2.log\" \"-q\".*\n") + # Xcode 2.x forgets to create the output directory before linking # the individual architectures. if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt.in b/Tests/CTestTestMemcheck/CMakeLists.txt.in index e28e56a..d15d148 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt.in +++ b/Tests/CTestTestMemcheck/CMakeLists.txt.in @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheck@SUBTEST_NAME@) +project(CTestTestMemcheck@SUBTEST_NAME@ NONE) include(CTest) add_test(NAME RunCMake COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/CTestTestMemcheck/CTestConfig.cmake.in b/Tests/CTestTestMemcheck/CTestConfig.cmake.in index 6cf3782..19c76c2 100644 --- a/Tests/CTestTestMemcheck/CTestConfig.cmake.in +++ b/Tests/CTestTestMemcheck/CTestConfig.cmake.in @@ -2,8 +2,8 @@ set (CTEST_PROJECT_NAME "CTestTestMemcheck@SUBTEST_NAME@") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) @CTEST_EXTRA_CONFIG@ diff --git a/Tests/CTestTestMemcheck/memtester.cxx.in b/Tests/CTestTestMemcheck/memtester.cxx.in index 55a34e3..43c0ba7 100644 --- a/Tests/CTestTestMemcheck/memtester.cxx.in +++ b/Tests/CTestTestMemcheck/memtester.cxx.in @@ -1,11 +1,19 @@ #include <cmSystemTools.h> +#include <cmsys/Encoding.hxx> #include <string> +#include <locale.h> #define RETVAL @_retval@ int -main(int argc, char **argv) +main(int ac, char **av) { + setlocale(LC_CTYPE, ""); + cmsys::Encoding::CommandLineArguments args = + cmsys::Encoding::CommandLineArguments::Main(ac, av); + int argc = args.argc(); + const char* const* argv = args.argv(); + std::string exename = argv[0]; std::string logarg; bool nextarg = false; diff --git a/Tests/CTestTestMemcheck/test.cmake.in b/Tests/CTestTestMemcheck/test.cmake.in index 471e5a5..f2ffd06 100644 --- a/Tests/CTestTestMemcheck/test.cmake.in +++ b/Tests/CTestTestMemcheck/test.cmake.in @@ -9,12 +9,14 @@ set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/@SUBTEST_NAM set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/@SUBTEST_NAME@") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") set(CTEST_MEMORYCHECK_COMMAND "@CHECKER_COMMAND@") +set(CTEST_MEMORYCHECK_TYPE "${MEMCHECK_TYPE}") @CTEST_EXTRA_CODE@ diff --git a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake new file mode 100644 index 0000000..3082e4b --- /dev/null +++ b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake @@ -0,0 +1,58 @@ +# this file simulates a program that has been built with address sanitizer +# options + +message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +# if we are not asked to simulate address sanitizer don't do it +if(NOT "$ENV{ASAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") + return() +endif() +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an example error from address santizer + +file(APPEND "${LOG_FILE}.2343" +"================================================================= +==19278== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60080000bffc at pc 0x4009f1 bp 0x7fff82de6520 sp 0x7fff82de6518 +WRITE of size 4 at 0x60080000bffc thread T0 + #0 0x4009f0 (/home/kitware/msan/a.out+0x4009f0) + #1 0x7f18b02c876c (/lib/x86_64-linux-gnu/libc-2.15.so+0x2176c) + #2 0x400858 (/home/kitware/msan/a.out+0x400858) +0x60080000bffc is located 4 bytes to the right of 40-byte region [0x60080000bfd0,0x60080000bff8) +allocated by thread T0 here: + #0 0x7f18b088f9ca (/usr/lib/x86_64-linux-gnu/libasan.so.0.0.0+0x119ca) + #1 0x4009a2 (/home/kitware/msan/a.out+0x4009a2) + #2 0x7f18b02c876c (/lib/x86_64-linux-gnu/libc-2.15.so+0x2176c) +Shadow bytes around the buggy address: + 0x0c017fff97a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa +=>0x0c017fff97f0: fa fa fa fa fa fa fa fa fa fa 00 00 00 00 00[fa] + 0x0c017fff9800:fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9840: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa +Shadow byte legend (one shadow byte represents 8 application bytes): + Addressable: 00 + Partially addressable: 01 02 03 04 05 06 07 + Heap left redzone: fa + Heap righ redzone: fb + Freed Heap region: fd + Stack left redzone: f1 + Stack mid redzone: f2 + Stack right redzone: f3 + Stack partial redzone: f4 + Stack after return: f5 + Stack use after scope: f8 + Global redzone: f9 + Global init order: f6 + Poisoned by user: f7 + ASan internal: fe +==19278== ABORTING +") diff --git a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake new file mode 100644 index 0000000..02030be --- /dev/null +++ b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake @@ -0,0 +1,47 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") +# if we are not asked to simulate leak sanitizer don't do it +if(NOT "$ENV{ASAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") + return() +endif() + +# clear the log file +file(REMOVE "${LOG_FILE}.2343") +file(REMOVE "${LOG_FILE}.2344") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm + +file(APPEND "${LOG_FILE}.2343" +"================================================================= +==25308==ERROR: LeakSanitizer: detected memory leaks + +Direct leak of 4360 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4823b4 in main /home/kitware/msan/memcheck.cxx:12 + #2 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +SUMMARY: AddressSanitizer: 4436 byte(s) leaked in 2 allocation(s). +") +file(APPEND "${LOG_FILE}.2342" +"================================================================= +==25308==ERROR: LeakSanitizer: detected memory leaks + +Direct leak of 76 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 + #2 0x4823f2 in main /home/kitware/msan/memcheck.cxx:14 + #3 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +Indirect leak of 76 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 + #2 0x4823f2 in main /home/kitware/msan/memcheck.cxx:14 + #3 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +SUMMARY: AddressSanitizer: 4436 byte(s) leaked in 2 allocation(s). +") diff --git a/Tests/CTestTestMemcheck/testMemorySanitizer.cmake b/Tests/CTestTestMemcheck/testMemorySanitizer.cmake new file mode 100644 index 0000000..c87af9a --- /dev/null +++ b/Tests/CTestTestMemcheck/testMemorySanitizer.cmake @@ -0,0 +1,27 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("MSAN_OPTIONS = [$ENV{MSAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{MSAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +# if we are not asked to simulate address sanitizer don't do it +if(NOT "$ENV{MSAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") + return() +endif() +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm + +file(APPEND "${LOG_FILE}.2343" +"================================================================= +==28423== WARNING: MemorySanitizer: use-of-uninitialized-value + #0 0x7f4364210dd9 in main (/home/kitware/msan/msan-bin/umr+0x7bdd9) + #1 0x7f4362d9376c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + #2 0x7f4364210b0c in _start (/home/kitware/msan/msan-bin/umr+0x7bb0c) + +SUMMARY: MemorySanitizer: use-of-uninitialized-value ??:0 main +Exiting +") diff --git a/Tests/CTestTestMemcheck/testThreadSanitizer.cmake b/Tests/CTestTestMemcheck/testThreadSanitizer.cmake new file mode 100644 index 0000000..d591931 --- /dev/null +++ b/Tests/CTestTestMemcheck/testThreadSanitizer.cmake @@ -0,0 +1,47 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("TSAN_OPTIONS = [$ENV{TSAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +set(error_types + "data race" + "data race on vptr (ctor/dtor vs virtual call)" + "heap-use-after-free" + "thread leak" + "destroy of a locked mutex" + "double lock of a mutex" + "unlock of an unlocked mutex (or by a wrong thread)" + "read lock of a write locked mutex" + "read unlock of a write locked mutex" + "signal-unsafe call inside of a signal" + "signal handler spoils errno" + "lock-order-inversion (potential deadlock)" + ) + +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm +foreach(error_type ${error_types} ) + + file(APPEND "${LOG_FILE}.2343" +"================== +WARNING: ThreadSanitizer: ${error_type} (pid=27978) + Write of size 4 at 0x7fe017ce906c by thread T1: + #0 Thread1 ??:0 (exe+0x000000000bb0) + #1 <null> <null>:0 (libtsan.so.0+0x00000001b279) + + Previous write of size 4 at 0x7fe017ce906c by main thread: + #0 main ??:0 (exe+0x000000000c3c) + + Thread T1 (tid=27979, running) created by main thread at: + #0 <null> <null>:0 (libtsan.so.0+0x00000001ed7b) + #1 main ??:0 (exe+0x000000000c2c) + +SUMMARY: ThreadSanitizer: ${error_type} ??:0 Thread1 +================== +") +endforeach() diff --git a/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake b/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake new file mode 100644 index 0000000..8ef3c0a --- /dev/null +++ b/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake @@ -0,0 +1,21 @@ +# this file simulates a program that has been built with undefined behavior +# sanitizer options + +message("UBSAN_OPTIONS = [$ENV{UBSAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +# if we are not asked to simulate address sanitizer don't do it +if(NOT "$ENV{UBSAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") + return() +endif() +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error like undefined behavior santizer creates; +# these names come from ubsan_diag.cc and ubsan_handlers.cc +# in llvm + +file(APPEND "${LOG_FILE}.2343" +"<unknown>: runtime error: left shift of negative value -256 +") diff --git a/Tests/CTestTestParallel/CTestConfig.cmake b/Tests/CTestTestParallel/CTestConfig.cmake index c3c5038..fc5b666 100644 --- a/Tests/CTestTestParallel/CTestConfig.cmake +++ b/Tests/CTestTestParallel/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestParallel") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestParallel/test.cmake.in b/Tests/CTestTestParallel/test.cmake.in index 48631ca..045a4ca 100644 --- a/Tests/CTestTestParallel/test.cmake.in +++ b/Tests/CTestTestParallel/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestParal set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestParallel") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestResourceLock/CTestConfig.cmake b/Tests/CTestTestResourceLock/CTestConfig.cmake index 5fb560b..c118777 100644 --- a/Tests/CTestTestResourceLock/CTestConfig.cmake +++ b/Tests/CTestTestResourceLock/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestResourceLock") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestResourceLock/test.cmake.in b/Tests/CTestTestResourceLock/test.cmake.in index 6ec6dfe..67dde18 100644 --- a/Tests/CTestTestResourceLock/test.cmake.in +++ b/Tests/CTestTestResourceLock/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestResou set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestResourceLock") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestScheduler/CTestConfig.cmake b/Tests/CTestTestScheduler/CTestConfig.cmake index 7da8f6f..797387b 100644 --- a/Tests/CTestTestScheduler/CTestConfig.cmake +++ b/Tests/CTestTestScheduler/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestScheduler") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestScheduler/test.cmake.in b/Tests/CTestTestScheduler/test.cmake.in index 06ba33e..f8c8ab7 100644 --- a/Tests/CTestTestScheduler/test.cmake.in +++ b/Tests/CTestTestScheduler/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSched set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestScheduler") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestSkipReturnCode/CTestConfig.cmake b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake index ad8e00e..da0c76b 100644 --- a/Tests/CTestTestSkipReturnCode/CTestConfig.cmake +++ b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestSkipReturnCode") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestSkipReturnCode/test.cmake.in b/Tests/CTestTestSkipReturnCode/test.cmake.in index d3c44f5..112b0cd 100644 --- a/Tests/CTestTestSkipReturnCode/test.cmake.in +++ b/Tests/CTestTestSkipReturnCode/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSkipR set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestSkipReturnCode") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestStopTime/CTestConfig.cmake b/Tests/CTestTestStopTime/CTestConfig.cmake index 129db4d..412283e 100644 --- a/Tests/CTestTestStopTime/CTestConfig.cmake +++ b/Tests/CTestTestStopTime/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestStopTime") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestStopTime/test.cmake.in b/Tests/CTestTestStopTime/test.cmake.in index 8adf941..d3a9a4a 100644 --- a/Tests/CTestTestStopTime/test.cmake.in +++ b/Tests/CTestTestStopTime/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestStopT set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestStopTime") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestSubdir/CTestConfig.cmake b/Tests/CTestTestSubdir/CTestConfig.cmake index 4b848aa..47ebb92 100644 --- a/Tests/CTestTestSubdir/CTestConfig.cmake +++ b/Tests/CTestTestSubdir/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestSubdir") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestSubdir/test.cmake.in b/Tests/CTestTestSubdir/test.cmake.in index 5a6caf1..8b3957b 100644 --- a/Tests/CTestTestSubdir/test.cmake.in +++ b/Tests/CTestTestSubdir/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSubdi set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestSubdir") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestTestTimeout/CMakeLists.txt b/Tests/CTestTestTimeout/CMakeLists.txt index 2e3bd6a..c6cbc47 100644 --- a/Tests/CTestTestTimeout/CMakeLists.txt +++ b/Tests/CTestTestTimeout/CMakeLists.txt @@ -3,11 +3,8 @@ project(CTestTestTimeout) include(CTest) if(NOT TIMEOUT) - if(CYGWIN) - set(TIMEOUT 4) # Cygwin CMake sometimes takes > 1 second to load! - else() - set(TIMEOUT 1) - endif() + # Give the process time to load and start running. + set(TIMEOUT 4) endif() add_definitions(-DTIMEOUT=${TIMEOUT}) diff --git a/Tests/CTestTestTimeout/CTestConfig.cmake b/Tests/CTestTestTimeout/CTestConfig.cmake index 76d62ad..13114f1 100644 --- a/Tests/CTestTestTimeout/CTestConfig.cmake +++ b/Tests/CTestTestTimeout/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestTimeout") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestTimeout/test.cmake.in b/Tests/CTestTestTimeout/test.cmake.in index 68c74d8..4b5157e 100644 --- a/Tests/CTestTestTimeout/test.cmake.in +++ b/Tests/CTestTestTimeout/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestTimeo set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestTimeout") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") @@ -32,7 +33,7 @@ if(EXISTS "${log}") if(after_sleep) message(FATAL_ERROR "Log indicates timeout did not kill child.") else() - message("Log indicates timeout correctly killed child.") + message(STATUS "Log indicates timeout correctly killed child.") endif() else() message(FATAL_ERROR "Log does not exist:\n ${log}") diff --git a/Tests/CTestTestUpload/CTestConfig.cmake b/Tests/CTestTestUpload/CTestConfig.cmake index 89c5b94..a547088 100644 --- a/Tests/CTestTestUpload/CTestConfig.cmake +++ b/Tests/CTestTestUpload/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestUpload") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set (CTEST_DROP_METHOD "http") -set (CTEST_DROP_SITE "www.cdash.org") -set (CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set (CTEST_DROP_SITE "open.cdash.org") +set (CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set (CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestUpload/test.cmake.in b/Tests/CTestTestUpload/test.cmake.in index bb6ba25..701439d 100644 --- a/Tests/CTestTestUpload/test.cmake.in +++ b/Tests/CTestTestUpload/test.cmake.in @@ -8,6 +8,7 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Upload") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestUpload") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestUpload") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") diff --git a/Tests/CTestTestZeroTimeout/CTestConfig.cmake b/Tests/CTestTestZeroTimeout/CTestConfig.cmake index f8e0609..6094864 100644 --- a/Tests/CTestTestZeroTimeout/CTestConfig.cmake +++ b/Tests/CTestTestZeroTimeout/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestZeroTimeout") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestZeroTimeout/test.cmake.in b/Tests/CTestTestZeroTimeout/test.cmake.in index beb6d90..b829fef 100644 --- a/Tests/CTestTestZeroTimeout/test.cmake.in +++ b/Tests/CTestTestZeroTimeout/test.cmake.in @@ -9,6 +9,7 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestZeroT set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestZeroTimeout") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 857c6f5..97153f0 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -219,6 +219,36 @@ function(run_dashboard_command_line bin_dir) endfunction() #----------------------------------------------------------------------------- +# Function to find the Update.xml file and make sure +# it only has the Revision in it and no updates +function(check_no_update bin_dir) + set(PATTERN ${TOP}/${bin_dir}/Testing/*/Update.xml) + file(GLOB UPDATE_XML_FILE RELATIVE ${TOP} ${PATTERN}) + string(REGEX REPLACE "//Update.xml$" "/Update.xml" + UPDATE_XML_FILE "${UPDATE_XML_FILE}") + message(" found ${UPDATE_XML_FILE}") + set(rev_regex "Revision|PriorRevision") + file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_REVISIONS + REGEX "^\t<(${rev_regex})>[^<\n]+</(${rev_regex})>$" + ) + set(found_revisons FALSE) + foreach(r IN LISTS UPDATE_XML_REVISIONS) + if("${r}" MATCHES "PriorRevision") + message(FATAL_ERROR "Found PriorRevision in no update test") + endif() + if("${r}" MATCHES "<Revision>") + set(found_revisons TRUE) + endif() + endforeach() + if(found_revisons) + message(" found <Revision> in no update test") + else() + message(FATAL_ERROR " missing <Revision> in no update test") + endif() +endfunction() + + +#----------------------------------------------------------------------------- # Function to run the dashboard through a script function(run_dashboard_script bin_dir) run_child( @@ -228,13 +258,17 @@ function(run_dashboard_script bin_dir) # Verify the updates reported by CTest. list(APPEND UPDATE_MAYBE Updated{subdir} Updated{CTestConfig.cmake}) - check_updates(${bin_dir} - Updated{foo.txt} - Updated{bar.txt} - Updated{zot.txt} - Updated{subdir/foo.txt} - Updated{subdir/bar.txt} - ) + if(NO_UPDATE) + check_no_update(${bin_dir}) + else() + check_updates(${bin_dir} + Updated{foo.txt} + Updated{bar.txt} + Updated{zot.txt} + Updated{subdir/foo.txt} + Updated{subdir/bar.txt} + ) + endif() endfunction() #----------------------------------------------------------------------------- diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index f6939de..41b732b 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -317,3 +317,20 @@ set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master) # Run the dashboard script with CTest. run_dashboard_script(dash-binary-custom) + + +rewind_source(dash-source) + +#----------------------------------------------------------------------------- +# Test no update with a dashboard script. +message("Running CTest Dashboard Script (No update)...") + +create_dashboard_script(dash-binary-no-update + "# git command configuration +set(CTEST_GIT_COMMAND \"${GIT}\") +set(CTEST_UPDATE_VERSION_ONLY TRUE) +") + +# Run the dashboard script with CTest. +set(NO_UPDATE 1) +run_dashboard_script(dash-binary-no-update) diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt index 69cfdb8..87b7f1a 100644 --- a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt +++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt @@ -40,6 +40,9 @@ endif() if(DEFINED MSVC12) math(EXPR msvc_total "${msvc_total} + 1") endif() +if(DEFINED MSVC14) + math(EXPR msvc_total "${msvc_total} + 1") +endif() echo_var(MSVC) echo_var(MSVC60) @@ -50,6 +53,7 @@ echo_var(MSVC90) echo_var(MSVC10) echo_var(MSVC11) echo_var(MSVC12) +echo_var(MSVC14) echo_var(MSVC_IDE) if(MSVC) diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt index 350b518..668a97b 100644 --- a/Tests/CompatibleInterface/CMakeLists.txt +++ b/Tests/CompatibleInterface/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.0) project(CompatibleInterface) @@ -54,6 +54,15 @@ set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200) add_executable(CompatibleInterface main.cpp) target_link_libraries(CompatibleInterface iface1) +add_library(foo STATIC foo.cpp) +add_library(bar SHARED bar.cpp) +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP ON) +# Use LINK_ONLY to suppress usage requirements and allow the check to pass. +set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:foo>) +set_property(TARGET CompatibleInterface PROPERTY SOMEPROP OFF) +target_link_libraries(CompatibleInterface bar) + set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON) set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON) set_property(TARGET CompatibleInterface PROPERTY STRING_PROP2 prop2) diff --git a/Tests/CompatibleInterface/bar.cpp b/Tests/CompatibleInterface/bar.cpp new file mode 100644 index 0000000..2e09900 --- /dev/null +++ b/Tests/CompatibleInterface/bar.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int bar() +{ + return 0; +} diff --git a/Tests/CompatibleInterface/foo.cpp b/Tests/CompatibleInterface/foo.cpp new file mode 100644 index 0000000..e05eb7e --- /dev/null +++ b/Tests/CompatibleInterface/foo.cpp @@ -0,0 +1,4 @@ +int foo() +{ + return 0; +} diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp index e23625a..d20b64b 100644 --- a/Tests/CompatibleInterface/main.cpp +++ b/Tests/CompatibleInterface/main.cpp @@ -40,8 +40,14 @@ enum { #include "iface2.h" +int foo(); +#ifdef _WIN32 +__declspec(dllimport) +#endif +int bar(); + int main(int argc, char **argv) { Iface2 if2; - return if2.foo(); + return if2.foo() + foo() + bar(); } diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt index 2ca2869..311975c 100644 --- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt +++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt @@ -53,3 +53,8 @@ set_property(TARGET target_prop_mixed_executable APPEND PROPERTY COMPILE_DEFINIT "LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>" "C_EXECUTABLE_LINK_LANGUAGE_IS_$<TARGET_PROPERTY:target_prop_c_executable,LINKER_LANGUAGE>" ) + +add_library(tgt STATIC IMPORTED) +set_property(TARGET tgt APPEND PROPERTY COMPILE_DEFINITIONS TGT_DEF TGT_TYPE_$<TARGET_PROPERTY:TYPE>) +add_executable(usetgt usetgt.c) +target_compile_definitions(usetgt PRIVATE $<TARGET_PROPERTY:tgt,COMPILE_DEFINITIONS>) diff --git a/Tests/CompileDefinitions/target_prop/usetgt.c b/Tests/CompileDefinitions/target_prop/usetgt.c new file mode 100644 index 0000000..6672a3e --- /dev/null +++ b/Tests/CompileDefinitions/target_prop/usetgt.c @@ -0,0 +1,10 @@ +#ifndef TGT_DEF +# error TGT_DEF incorrectly not defined +#endif +#ifndef TGT_TYPE_STATIC_LIBRARY +# error TGT_TYPE_STATIC_LIBRARY incorrectly not defined +#endif +#ifdef TGT_TYPE_EXECUTABLE +# error TGT_TYPE_EXECUTABLE incorrectly defined +#endif +int main(void) { return 0; } diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 9b6c9c2..05a5f82 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -22,6 +22,12 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS ${cxx_tests} ) +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland") + set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS + "-DTEST_OCTOTHORPE=\"#\"" + ) +endif() + target_link_libraries(CompileOptions testlib) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp index 42f4cca..f3c1355 100644 --- a/Tests/CompileOptions/main.cpp +++ b/Tests/CompileOptions/main.cpp @@ -17,6 +17,9 @@ int main() { return (strcmp(NEEDS_ESCAPE, "E$CAPE") == 0 +#ifdef TEST_OCTOTHORPE + && strcmp(TEST_OCTOTHORPE, "#") == 0 +#endif && strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0 && strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == 0 && TEST_C_COMPILER_VERSION_EQUALITY == 1 diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 222250c..5e5eead 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -14,6 +14,21 @@ if(POLICY CMP0003) endif() endif() +# It is not recommended to set a policy to OLD, but this test +# covers the OLD behavior of some policies. +foreach(p + CMP0029 + CMP0032 + CMP0033 + CMP0034 + CMP0043 + CMP0050 + ) + if(POLICY ${p}) + cmake_policy(SET ${p} OLD) + endif() +endforeach() + # Test building without per-rule echo lines in Makefiles. set_property(GLOBAL PROPERTY RULE_MESSAGES OFF) diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index 3f17dcc..3b73e70 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -14,6 +14,21 @@ if(POLICY CMP0003) endif() endif() +# It is not recommended to set a policy to OLD, but this test +# covers the OLD behavior of some policies. +foreach(p + CMP0029 + CMP0032 + CMP0033 + CMP0034 + CMP0043 + CMP0050 + ) + if(POLICY ${p}) + cmake_policy(SET ${p} OLD) + endif() +endforeach() + # Test building without per-rule echo lines in Makefiles. set_property(GLOBAL PROPERTY RULE_MESSAGES OFF) diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt index a6f8921..eaad3d4 100644 --- a/Tests/ExportImport/CMakeLists.txt +++ b/Tests/ExportImport/CMakeLists.txt @@ -44,6 +44,7 @@ add_custom_command( --build-project Export --build-target install --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake VERBATIM @@ -65,6 +66,7 @@ add_custom_command( --build-noclean --build-project Import --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake VERBATIM diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 0ed5561..d2fa86a 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -3,6 +3,8 @@ project(ExternalProjectTest NONE) include(ExternalProject) +# Test ExternalProject, especially with checkouts from VCS + find_package(CVS) find_package(Subversion) find_package(Git) @@ -23,33 +25,6 @@ set(binary_base "${base}/Build") set_property(DIRECTORY PROPERTY EP_BASE ${base}) set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) -if(NOT DEFINED can_build_tutorial_step5) - set(can_build_tutorial_step5 1) - - # Tutorial Step5 cannot build correctly using Visual Studio 6 - # on Windows 98 if the path of its build tree exceeds 72 - # characters in length... So don't attempt to build it - # in a long path on Win98: - # - if(CMAKE_SYSTEM STREQUAL "Windows-4.10") - string(LENGTH "${binary_base}/TutorialStep5-Local" n) - if(n GREATER 72) - set(can_build_tutorial_step5 0) - endif() - endif() - - # The ExternalProject builds of Tutorial Step5 cannot be built - # correctly 2nd and later times in an in-source build... - # (because the CMakeCache.txt from the real in-source build of - # the Tests/Tutorial/Step5 directory gets copied when we do - # the "source directory copy" step... but it still refers to - # its original path which yields a configure error.) So: - # - if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - set(can_build_tutorial_step5 0) - endif() -endif() - add_custom_target(NonExternalProjectTarget COMMAND ${CMAKE_COMMAND} -E echo NonExternalProjectTarget) @@ -116,142 +91,6 @@ ExternalProject_Add(${proj} set_property(TARGET ${proj} PROPERTY FOLDER "") -# Local DIR: -# -if(can_build_tutorial_step5) - set(proj TutorialStep5-Local) - ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" - CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> - CMAKE_ARGS -G ${CMAKE_GENERATOR} <SOURCE_DIR> - TEST_BEFORE_INSTALL 1 - LOG_INSTALL 1 - ) - set_property(TARGET ${proj} PROPERTY FOLDER "Local") - ExternalProject_Get_Property(${proj} install_dir) - set(TutorialStep5_install_dir ${install_dir}) - - set(proj TutorialStep5-Local-TestAfterInstall) - ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> - TEST_AFTER_INSTALL 1 - LOG_TEST 1 - ) - set_property(TARGET ${proj} PROPERTY FOLDER "Local") -endif() - - -# Local TAR: -# -set(proj TutorialStep1-LocalTAR) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar" - URL_MD5 a87c5b47c0201c09ddfe1d5738fdb1e3 - LIST_SEPARATOR :: - PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake - CMAKE_GENERATOR "${CMAKE_GENERATOR}" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> - -DTEST_LIST:STRING=A::B::C - INSTALL_COMMAND "" - LOG_CONFIGURE 1 -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") - -set(proj TutorialStep1-LocalNoDirTAR) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar" - URL_MD5 d09e3d370c5c908fa035c30939ee438e - LIST_SEPARATOR @@ - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> - -DTEST_LIST:STRING=1@@2@@3 - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") -ExternalProject_Add_Step(${proj} mypatch - COMMAND ${CMAKE_COMMAND} -E echo "This is a custom external project step." - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake - WORKING_DIRECTORY <SOURCE_DIR> - DEPENDEES download - DEPENDERS configure - ) - - -# Local TGZ: -# -set(proj TutorialStep1-LocalTGZ) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz" - URL_MD5 38c648e817339c356f6be00eeed79bd0 - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> - INSTALL_COMMAND "" - LOG_BUILD 1 -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") - -set(proj TutorialStep1-LocalNoDirTGZ) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" - URL_HASH SHA256=496229e2a5ed620a37c385ad9406004a18026beab8b55dd2c4565d4b7f1d5383 - CMAKE_GENERATOR "${CMAKE_GENERATOR}" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") - - -# Local BZ2: -# -# (The bz2 tests are here just to verify that the bz2 decompression is executed -# during a test suite run... The configure and build commands are set to -# nothing to make the test quicker. To make this more complete, I should add -# a diff between this and the TGZ source tree since that one does build...) -# -set(proj TutorialStep1-LocalBZ2) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar.bz2" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") - -set(proj TutorialStep1-LocalNoDirBZ2) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar.bz2" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") - - -# Local ZIP: -# -# (The zip tests are here just to verify that the zip decompression is executed -# during a test suite run... The configure and build commands are set to -# nothing to make the test quicker. To make this more complete, I should add -# a diff between this and the TGZ source tree since that one does build...) -# -set(proj TutorialStep1-LocalZIP) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.zip" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") - -set(proj TutorialStep1-LocalNoDirZIP) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.zip" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") - - # CVS-based tests: # set(do_cvs_tests 0) @@ -337,10 +176,6 @@ if(do_cvs_tests) INSTALL_COMMAND "" DEPENDS "SetupLocalCVSRepository" DEPENDS "EmptyNoOpProject" - DEPENDS "TutorialStep1-LocalTAR" - DEPENDS "TutorialStep1-LocalNoDirTAR" - DEPENDS "TutorialStep1-LocalTGZ" - DEPENDS "TutorialStep1-LocalNoDirTGZ" DEPENDS "TutorialStep1-CVS-20090626" DEPENDS "TutorialStep1-CVS-testtag1" ) @@ -537,6 +372,13 @@ if(HG_EXECUTABLE) set(do_hg_tests 1) endif() +if(do_hg_tests AND NOT UNIX) + if("${HG_EXECUTABLE}" MATCHES "cygwin") + message(STATUS "No ExternalProject hg tests with cygwin hg outside cygwin!") + set(do_hg_tests 0) + endif() +endif() + if(do_hg_tests) set(local_hg_repo "../../LocalRepositories/HG") @@ -612,29 +454,6 @@ enable_testing() # # BuildTree tests: # -if(can_build_tutorial_step5) - add_test(TutorialStep5-Local-BuildTreeTest - "${binary_base}/TutorialStep5-Local/Tutorial" 42) - set_property(TEST TutorialStep5-Local-BuildTreeTest - APPEND PROPERTY LABELS Step5 BuildTree) -endif() - -add_test(TutorialStep1-LocalTAR-BuildTreeTest - "${binary_base}/TutorialStep1-LocalTAR/EP-Tutorial" 36) -set_property(TEST TutorialStep1-LocalTAR-BuildTreeTest - APPEND PROPERTY LABELS TAR) - -add_test(TutorialStep1-LocalNoDirTAR-BuildTreeTest - "${binary_base}/TutorialStep1-LocalNoDirTAR/EP-Tutorial" 25) - -add_test(TutorialStep1-LocalTGZ-BuildTreeTest - "${binary_base}/TutorialStep1-LocalTGZ/Tutorial" 16) -set_property(TEST TutorialStep1-LocalTGZ-BuildTreeTest - APPEND PROPERTY LABELS TGZ) - -add_test(TutorialStep1-LocalNoDirTGZ-BuildTreeTest - "${binary_base}/TutorialStep1-LocalNoDirTGZ/Tutorial" 9) - if(do_cvs_tests) add_test(TutorialStep1-CVS-20090626-BuildTreeTest "${binary_base}/TutorialStep1-CVS-20090626/Tutorial" 4) @@ -669,17 +488,6 @@ if(do_git_tests) endif() -# InstallTree tests: -# -if(can_build_tutorial_step5) - add_test(TutorialStep5-InstallTreeTest - "${TutorialStep5_install_dir}/bin/Tutorial" 49) - set_property(TEST TutorialStep5-InstallTreeTest - APPEND PROPERTY LABELS Step5 InstallTree) -endif() - - -message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") message(STATUS "do_cvs_tests='${do_cvs_tests}'") message(STATUS "do_svn_tests='${do_svn_tests}'") message(STATUS "do_git_tests='${do_git_tests}' GIT_EXECUTABLE='${GIT_EXECUTABLE}'") diff --git a/Tests/ExternalProject/TryCheckout.cmake b/Tests/ExternalProject/TryCheckout.cmake deleted file mode 100644 index 6a396c3..0000000 --- a/Tests/ExternalProject/TryCheckout.cmake +++ /dev/null @@ -1,54 +0,0 @@ -find_package(CVS) -find_package(Subversion) - - -function(try_cvs_checkout repository module dir result_var) - # Assume cvs checkouts will not work: - set(${result_var} 0 PARENT_SCOPE) - - if(CVS_EXECUTABLE) - message(STATUS "try_cvs_checkout") - - # Ensure directory exists so we can call cvs in it: - file(MAKE_DIRECTORY "${dir}") - - # Try to do the cvs checkout command: - execute_process(COMMAND ${CVS_EXECUTABLE} -d ${repository} co ${module} - WORKING_DIRECTORY ${dir} - TIMEOUT 30 - RESULT_VARIABLE rv) - - # If it worked, cvs checkouts will work: - if(rv EQUAL 0) - set(${result_var} 1 PARENT_SCOPE) - endif() - - message(STATUS "try_cvs_checkout -- done") - endif() -endfunction() - - -function(try_svn_checkout repository dir result_var) - # Assume svn checkouts will not work: - set(${result_var} 0 PARENT_SCOPE) - - if(Subversion_SVN_EXECUTABLE) - message(STATUS "try_svn_checkout") - - # Ensure directory exists so we can call svn in it: - file(MAKE_DIRECTORY "${dir}") - - # Try to do the svn checkout command: - execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} co ${repository} ${dir} - WORKING_DIRECTORY ${dir} - TIMEOUT 30 - RESULT_VARIABLE rv) - - # If it worked, svn checkouts will work: - if(rv EQUAL 0) - set(${result_var} 1 PARENT_SCOPE) - endif() - - message(STATUS "try_svn_checkout -- done") - endif() -endfunction() diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt new file mode 100644 index 0000000..f942197 --- /dev/null +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -0,0 +1,229 @@ +cmake_minimum_required(VERSION 2.8) +project(ExternalProjectLocalTest NONE) + +include(ExternalProject) + +# Test ExternalProject with local projects + +option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON) +if(ExternalProjectTest_USE_FOLDERS) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +else() + set_property(GLOBAL PROPERTY USE_FOLDERS OFF) +endif() + +set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER + "CMakePredefinedTargets-in-ExternalProjectTest") + +set(base "${CMAKE_BINARY_DIR}/CMakeExternals") +set(binary_base "${base}/Build") +set_property(DIRECTORY PROPERTY EP_BASE ${base}) +set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) + +if(NOT DEFINED can_build_tutorial_step5) + set(can_build_tutorial_step5 1) + + # Tutorial Step5 cannot build correctly using Visual Studio 6 + # on Windows 98 if the path of its build tree exceeds 72 + # characters in length... So don't attempt to build it + # in a long path on Win98: + # + if(CMAKE_SYSTEM STREQUAL "Windows-4.10") + string(LENGTH "${binary_base}/TutorialStep5-Local" n) + if(n GREATER 72) + set(can_build_tutorial_step5 0) + endif() + endif() + + # The ExternalProject builds of Tutorial Step5 cannot be built + # correctly 2nd and later times in an in-source build... + # (because the CMakeCache.txt from the real in-source build of + # the Tests/Tutorial/Step5 directory gets copied when we do + # the "source directory copy" step... but it still refers to + # its original path which yields a configure error.) So: + # + if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + set(can_build_tutorial_step5 0) + endif() +endif() + +# Local DIR: +# +if(can_build_tutorial_step5) + set(proj TutorialStep5-Local) + ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" + CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + CMAKE_ARGS -G ${CMAKE_GENERATOR} <SOURCE_DIR> + TEST_BEFORE_INSTALL 1 + LOG_INSTALL 1 + ) + set_property(TARGET ${proj} PROPERTY FOLDER "Local") + ExternalProject_Get_Property(${proj} install_dir) + set(TutorialStep5_install_dir ${install_dir}) + + set(proj TutorialStep5-Local-TestAfterInstall) + ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> + TEST_AFTER_INSTALL 1 + LOG_TEST 1 + ) + set_property(TARGET ${proj} PROPERTY FOLDER "Local") +endif() + + +# Local TAR: +# +set(proj TutorialStep1-LocalTAR) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar" + URL_MD5 a87c5b47c0201c09ddfe1d5738fdb1e3 + LIST_SEPARATOR :: + PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DTEST_LIST:STRING=A::B::C + INSTALL_COMMAND "" + LOG_CONFIGURE 1 +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") + +set(proj TutorialStep1-LocalNoDirTAR) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar" + URL_MD5 d09e3d370c5c908fa035c30939ee438e + LIST_SEPARATOR @@ + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> + -DTEST_LIST:STRING=1@@2@@3 + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") +ExternalProject_Add_Step(${proj} mypatch + COMMAND ${CMAKE_COMMAND} -E echo "This is a custom external project step." + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake + WORKING_DIRECTORY <SOURCE_DIR> + DEPENDEES download + DEPENDERS configure + ) + + +# Local TGZ: +# +set(proj TutorialStep1-LocalTGZ) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz" + URL_MD5 38c648e817339c356f6be00eeed79bd0 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> + INSTALL_COMMAND "" + LOG_BUILD 1 +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") + +set(proj TutorialStep1-LocalNoDirTGZ) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" + URL_HASH SHA256=496229e2a5ed620a37c385ad9406004a18026beab8b55dd2c4565d4b7f1d5383 + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") + + +# Local BZ2: +# +# (The bz2 tests are here just to verify that the bz2 decompression is executed +# during a test suite run... The configure and build commands are set to +# nothing to make the test quicker. To make this more complete, I should add +# a diff between this and the TGZ source tree since that one does build...) +# +set(proj TutorialStep1-LocalBZ2) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar.bz2" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") + +set(proj TutorialStep1-LocalNoDirBZ2) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar.bz2" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") + + +# Local ZIP: +# +# (The zip tests are here just to verify that the zip decompression is executed +# during a test suite run... The configure and build commands are set to +# nothing to make the test quicker. To make this more complete, I should add +# a diff between this and the TGZ source tree since that one does build...) +# +set(proj TutorialStep1-LocalZIP) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.zip" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") + +set(proj TutorialStep1-LocalNoDirZIP) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.zip" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") + + +# Test the testable built/installed products: +# +enable_testing() + + +# Do at least a smoke test of a built executable from each +# project's build directory... +# +# BuildTree tests: +# +if(can_build_tutorial_step5) + add_test(TutorialStep5-Local-BuildTreeTest + "${binary_base}/TutorialStep5-Local/Tutorial" 42) + set_property(TEST TutorialStep5-Local-BuildTreeTest + APPEND PROPERTY LABELS Step5 BuildTree) +endif() + +add_test(TutorialStep1-LocalTAR-BuildTreeTest + "${binary_base}/TutorialStep1-LocalTAR/EP-Tutorial" 36) +set_property(TEST TutorialStep1-LocalTAR-BuildTreeTest + APPEND PROPERTY LABELS TAR) + +add_test(TutorialStep1-LocalNoDirTAR-BuildTreeTest + "${binary_base}/TutorialStep1-LocalNoDirTAR/EP-Tutorial" 25) + +add_test(TutorialStep1-LocalTGZ-BuildTreeTest + "${binary_base}/TutorialStep1-LocalTGZ/Tutorial" 16) +set_property(TEST TutorialStep1-LocalTGZ-BuildTreeTest + APPEND PROPERTY LABELS TGZ) + +add_test(TutorialStep1-LocalNoDirTGZ-BuildTreeTest + "${binary_base}/TutorialStep1-LocalNoDirTGZ/Tutorial" 9) + +# InstallTree tests: +# +if(can_build_tutorial_step5) + add_test(TutorialStep5-InstallTreeTest + "${TutorialStep5_install_dir}/bin/Tutorial" 49) + set_property(TEST TutorialStep5-InstallTreeTest + APPEND PROPERTY LABELS Step5 InstallTree) +endif() + + +message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") diff --git a/Tests/ExternalProject/Step1.tar b/Tests/ExternalProjectLocal/Step1.tar Binary files differindex 3711f07..3711f07 100644 --- a/Tests/ExternalProject/Step1.tar +++ b/Tests/ExternalProjectLocal/Step1.tar diff --git a/Tests/ExternalProject/Step1.tar.bz2 b/Tests/ExternalProjectLocal/Step1.tar.bz2 Binary files differindex 49b5f23..49b5f23 100644 --- a/Tests/ExternalProject/Step1.tar.bz2 +++ b/Tests/ExternalProjectLocal/Step1.tar.bz2 diff --git a/Tests/ExternalProject/Step1.tgz b/Tests/ExternalProjectLocal/Step1.tgz Binary files differindex d9b4cd2..d9b4cd2 100644 --- a/Tests/ExternalProject/Step1.tgz +++ b/Tests/ExternalProjectLocal/Step1.tgz diff --git a/Tests/ExternalProject/Step1.zip b/Tests/ExternalProjectLocal/Step1.zip Binary files differindex 49dac24..49dac24 100644 --- a/Tests/ExternalProject/Step1.zip +++ b/Tests/ExternalProjectLocal/Step1.zip diff --git a/Tests/ExternalProject/Step1NoDir.tar b/Tests/ExternalProjectLocal/Step1NoDir.tar Binary files differindex 03664b8..03664b8 100644 --- a/Tests/ExternalProject/Step1NoDir.tar +++ b/Tests/ExternalProjectLocal/Step1NoDir.tar diff --git a/Tests/ExternalProject/Step1NoDir.tar.bz2 b/Tests/ExternalProjectLocal/Step1NoDir.tar.bz2 Binary files differindex 92eb480..92eb480 100644 --- a/Tests/ExternalProject/Step1NoDir.tar.bz2 +++ b/Tests/ExternalProjectLocal/Step1NoDir.tar.bz2 diff --git a/Tests/ExternalProject/Step1NoDir.tgz b/Tests/ExternalProjectLocal/Step1NoDir.tgz Binary files differindex 71a2d81..71a2d81 100644 --- a/Tests/ExternalProject/Step1NoDir.tgz +++ b/Tests/ExternalProjectLocal/Step1NoDir.tgz diff --git a/Tests/ExternalProject/Step1NoDir.zip b/Tests/ExternalProjectLocal/Step1NoDir.zip Binary files differindex b42d318..b42d318 100644 --- a/Tests/ExternalProject/Step1NoDir.zip +++ b/Tests/ExternalProjectLocal/Step1NoDir.zip diff --git a/Tests/ExternalProject/Step1Patch.cmake b/Tests/ExternalProjectLocal/Step1Patch.cmake index 35e09d9..35e09d9 100644 --- a/Tests/ExternalProject/Step1Patch.cmake +++ b/Tests/ExternalProjectLocal/Step1Patch.cmake diff --git a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake index ea59a8e..6c7bcfe 100644 --- a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake +++ b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake @@ -13,6 +13,7 @@ macro(check_a_tag desired_tag resulting_sha fetch_expected) # Configure execute_process(COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} -T "${CMAKE_GENERATOR_TOOLSET}" + -A "${CMAKE_GENERATOR_PLATFORM}" -DTEST_GIT_TAG:STRING=${desired_tag} ${ExternalProjectUpdate_SOURCE_DIR} WORKING_DIRECTORY ${ExternalProjectUpdate_BINARY_DIR} diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 092bf20..f311fb9 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -374,6 +374,7 @@ endif() include(CMakePackageConfigHelpers) +# Generate a config file ready to be installed. set(INCLUDE_INSTALL_DIR include ) set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" ) set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) @@ -407,6 +408,43 @@ if(Relocatable_FOUND) message(SEND_ERROR "Relocatable_FOUND set to TRUE !") endif() +# Generate a config file for the build tree. +set(INCLUDE_INSTALL_DIR include ) +set(SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/share/" ) +set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) + +configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake" + INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" + PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR + INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}" + ) + +set(Relocatable_FIND_COMPONENTS AComp BComp CComp) +set(Relocatable_FIND_REQUIRED_BComp 1) +include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake") + +if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include") + message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to \"${RELOC_INCLUDE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/include\")") +endif() + +if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/") + message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to \"${RELOC_SHARE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/share/\")") +endif() + +if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to \"${RELOC_BUILD_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}\")") +endif() + +if(NOT DEFINED Relocatable_FOUND) + message(SEND_ERROR "Relocatable_FOUND not defined !") +endif() + +if(Relocatable_FOUND) + message(SEND_ERROR "Relocatable_FOUND set to TRUE !") +endif() + + + #----------------------------------------------------------------------------- # Test write_basic_config_version_file(). diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index ef3b317..1982a60 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -201,6 +201,7 @@ if(TEST_MODULE_DEPENDS) --build-two-config --build-project ExtFort --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-options -DCMAKE_Fortran_COMPILER:STRING=${CMAKE_Fortran_COMPILER} -DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS} diff --git a/Tests/FortranC/Flags.cmake.in b/Tests/FortranC/Flags.cmake.in index 28c38e4..2300fc6 100644 --- a/Tests/FortranC/Flags.cmake.in +++ b/Tests/FortranC/Flags.cmake.in @@ -15,6 +15,7 @@ set(COMMAND) execute_process( WORKING_DIRECTORY "${bld}" COMMAND ${CMAKE_COMMAND} "${src}" -G "@CMAKE_GENERATOR@" + -A "@CMAKE_GENERATOR_PLATFORM@" -T "@CMAKE_GENERATOR_TOOLSET@" "-DFortranC_TEST_FLAGS=1" "-DCMAKE_C_COMPILER=${bld}/cc.sh" diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index d57a8b2..f55e727 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -8,13 +8,14 @@ set_property(TARGET FortranOnlylib PROPERTY Fortran_FORMAT FIXED) set_property(SOURCE world.f PROPERTY Fortran_FORMAT FREE) # create an executable that calls hello and world -add_executable(FortranOnly testf.f) -target_link_libraries(FortranOnly FortranOnlylib) +add_executable(FortranOnly1 testf.f) +set_property(TARGET FortranOnly1 PROPERTY OUTPUT_NAME FortranOnly) +target_link_libraries(FortranOnly1 FortranOnlylib) -# create a custom command that runs FortranOnly and puts +# create a custom command that runs FortranOnly1 and puts # the output into the file testfhello.txt add_custom_command(OUTPUT ${FortranOnly_BINARY_DIR}/testfhello.txt - COMMAND ${FortranOnly_BINARY_DIR}/${CMAKE_CFG_INTDIR}/FortranOnly + COMMAND FortranOnly1 > testfhello.txt) # create a second executable FortranOnly2 that has # testfhello.txt has an source file so that it will @@ -27,15 +28,15 @@ add_custom_target(checktestf2 ALL COMMAND ${CMAKE_COMMAND} -P ${FortranOnly_SOURCE_DIR}/checktestf2.cmake) -# create a custom target that runs FortranOnly exectuable and creates +# create a custom target that runs FortranOnly1 exectuable and creates # a file out.txt that should have hello world in it. add_custom_target(sayhello ALL - COMMAND ${FortranOnly_BINARY_DIR}/${CMAKE_CFG_INTDIR}/FortranOnly > out.txt + COMMAND FortranOnly1 > out.txt ) # make sure stuff is built in the right order add_dependencies(checktestf2 FortranOnly2) -add_dependencies(sayhello FortranOnly) -add_dependencies(FortranOnly2 FortranOnly) +add_dependencies(sayhello FortranOnly1) +add_dependencies(FortranOnly2 FortranOnly1) # add a custom target that checkes that out.txt has the correct # content @@ -43,3 +44,25 @@ add_custom_target(checksayhello ALL COMMAND ${CMAKE_COMMAND} -P ${FortranOnly_SOURCE_DIR}/checksayhello.cmake ) add_dependencies(checksayhello sayhello) + +# Exclude this test on IBM XL for now because the check strangely +# fails with 'ld: 0706-029 Use a number with the -H flag'. +if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL XL) + set(err_log ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log) + file(REMOVE "${err_log}") + include(CheckFortranSourceCompiles) + unset(HAVE_PRINT CACHE) + CHECK_Fortran_SOURCE_COMPILES([[ + PROGRAM TEST_HAVE_PRINT + PRINT *, 'Hello' + END +]] HAVE_PRINT) + if(NOT HAVE_PRINT) + if(EXISTS "${err_log}") + file(READ "${err_log}" err) + endif() + string(REPLACE "\n" "\n " err " ${err}") + message(SEND_ERROR "CHECK_Fortran_SOURCE_COMPILES for HAVE_PRINT failed:\n" + "${err}") + endif() +endif() diff --git a/Tests/FunctionTest/CMakeLists.txt b/Tests/FunctionTest/CMakeLists.txt index d1fada4..68da972 100644 --- a/Tests/FunctionTest/CMakeLists.txt +++ b/Tests/FunctionTest/CMakeLists.txt @@ -92,7 +92,7 @@ endfunction() STRANGE_FUNCTION(var) set(second_var "second_var") -if("${var}" STREQUAL "strange_function" AND "${second_var}" STREQUAL "second_var") +if("x${var}" STREQUAL "xstrange_function" AND "x${second_var}" STREQUAL "xsecond_var") PASS("Case Test" "(${var} ${second_var})") else() FAILED("Case test" "(${var} ${second_var})") diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index 81b34e6..fe202dd 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -8,8 +8,22 @@ target_compile_definitions(iface_nodepends INTERFACE IFACE_DEFINE) add_subdirectory(headerdir) +# Add an interface target in a subdirectory that uses an imported interface. +add_subdirectory(ifacedir) + +# Poison an imported interface with the same name as that in the subdir +# to ensure that the transitive lookup occurs in the subdir. +add_library(imp::iface INTERFACE IMPORTED) +set_property(TARGET imp::iface APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOMEPROP OFF) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist.cpp) + +add_library(objlib OBJECT obj.cpp) +add_library(iface_objlib INTERFACE) +target_sources(iface_objlib INTERFACE $<TARGET_OBJECTS:objlib>) + add_executable(InterfaceLibrary definetestexe.cpp) -target_link_libraries(InterfaceLibrary iface_nodepends headeriface) +target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface iface_objlib) add_subdirectory(libsdir) diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp index e7a10c1..9044076 100644 --- a/Tests/InterfaceLibrary/definetestexe.cpp +++ b/Tests/InterfaceLibrary/definetestexe.cpp @@ -15,7 +15,10 @@ #error Expected IFACE_HEADER_BUILDDIR #endif +extern int obj(); +extern int sub(); + int main(int,char**) { - return 0; + return obj() + sub(); } diff --git a/Tests/InterfaceLibrary/ifacedir/CMakeLists.txt b/Tests/InterfaceLibrary/ifacedir/CMakeLists.txt new file mode 100644 index 0000000..228715e --- /dev/null +++ b/Tests/InterfaceLibrary/ifacedir/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(imp::iface INTERFACE IMPORTED) +set_property(TARGET imp::iface APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOMEPROP ON) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/sub.cpp) + +add_library(subiface INTERFACE) +target_link_libraries(subiface INTERFACE imp::iface) +set_property(TARGET subiface PROPERTY INTERFACE_SOMEPROP ON) diff --git a/Tests/InterfaceLibrary/ifacedir/sub.cpp b/Tests/InterfaceLibrary/ifacedir/sub.cpp new file mode 100644 index 0000000..165a66a --- /dev/null +++ b/Tests/InterfaceLibrary/ifacedir/sub.cpp @@ -0,0 +1 @@ +int sub() { return 0; } diff --git a/Tests/InterfaceLibrary/obj.cpp b/Tests/InterfaceLibrary/obj.cpp new file mode 100644 index 0000000..ee6f5fe --- /dev/null +++ b/Tests/InterfaceLibrary/obj.cpp @@ -0,0 +1 @@ +int obj() { return 0; } diff --git a/Tests/InterfaceLinkLibraries/CMakeLists.txt b/Tests/InterfaceLinkLibraries/CMakeLists.txt index bd0cf74..9e14c44 100644 --- a/Tests/InterfaceLinkLibraries/CMakeLists.txt +++ b/Tests/InterfaceLinkLibraries/CMakeLists.txt @@ -9,6 +9,9 @@ target_compile_definitions(foo_shared INTERFACE FOO_LIBRARY) add_library(bar_shared SHARED bar_vs6_1.cpp) target_compile_definitions(bar_shared INTERFACE BAR_LIBRARY) set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared) +add_library(zot_shared SHARED zot_vs6_1.cpp) +target_compile_definitions(zot_shared INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:zot_shared>) add_executable(shared_test main_vs6_1.cpp) set_property(TARGET shared_test APPEND PROPERTY LINK_LIBRARIES bar_shared) @@ -18,6 +21,9 @@ target_compile_definitions(foo_static INTERFACE FOO_LIBRARY) add_library(bar_static STATIC bar_vs6_2.cpp) target_compile_definitions(bar_static INTERFACE BAR_LIBRARY) set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_static) +add_library(zot_static STATIC zot_vs6_2.cpp) +target_compile_definitions(zot_static INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:zot_static>) add_executable(static_test main_vs6_2.cpp) set_property(TARGET static_test APPEND PROPERTY LINK_LIBRARIES bar_static) @@ -31,6 +37,9 @@ target_compile_definitions(bar_shared_private INTERFACE BAR_LIBRARY) target_compile_definitions(bar_shared_private PRIVATE BAR_USE_BANG) set_property(TARGET bar_shared_private APPEND PROPERTY LINK_LIBRARIES bang_shared_private) set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared_private) +add_library(zot_shared_private SHARED zot_vs6_3.cpp) +target_compile_definitions(zot_shared_private INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:zot_shared_private>) add_executable(shared_private_test main_vs6_3.cpp) set_property(TARGET shared_private_test APPEND PROPERTY LINK_LIBRARIES bar_shared_private) @@ -44,6 +53,9 @@ target_compile_definitions(bar_static_private INTERFACE BAR_LIBRARY) target_compile_definitions(bar_static_private PRIVATE BAR_USE_BANG) set_property(TARGET bar_static_private APPEND PROPERTY LINK_LIBRARIES bang_static_private) set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:bang_static_private> foo_static_private) +add_library(zot_static_private STATIC zot_vs6_4.cpp) +target_compile_definitions(zot_static_private INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:zot_static_private>) add_executable(InterfaceLinkLibraries main_vs6_4.cpp) set_property(TARGET InterfaceLinkLibraries APPEND PROPERTY LINK_LIBRARIES bar_static_private) diff --git a/Tests/InterfaceLinkLibraries/main.cpp b/Tests/InterfaceLinkLibraries/main.cpp index a54076a..6e1295a 100644 --- a/Tests/InterfaceLinkLibraries/main.cpp +++ b/Tests/InterfaceLinkLibraries/main.cpp @@ -11,9 +11,13 @@ #error Unexpected BANG_LIBRARY #endif -#include "bar.h" +#ifdef ZOT_LIBRARY +#error Unexpected ZOT_LIBRARY +#endif + +#include "zot.h" int main(void) { - return foo() + bar(); + return foo() + bar() + zot(); } diff --git a/Tests/InterfaceLinkLibraries/zot.cpp b/Tests/InterfaceLinkLibraries/zot.cpp new file mode 100644 index 0000000..69462b0 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot.cpp @@ -0,0 +1,6 @@ +#include "zot.h" + +int zot() +{ + return 0; +} diff --git a/Tests/InterfaceLinkLibraries/zot.h b/Tests/InterfaceLinkLibraries/zot.h new file mode 100644 index 0000000..5e4fb1e --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot.h @@ -0,0 +1,7 @@ + +#include "bar.h" + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int zot(); diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/JacocoCoverage/Coverage/src/main/java/org/cmake/CoverageTest.java b/Tests/JacocoCoverage/Coverage/src/main/java/org/cmake/CoverageTest.java new file mode 100644 index 0000000..4fb43c6 --- /dev/null +++ b/Tests/JacocoCoverage/Coverage/src/main/java/org/cmake/CoverageTest.java @@ -0,0 +1,52 @@ +package org.cmake.Coverage; + +import java.io.Serializable; +import java.util.Map; +import java.util.List; +import java.awt.*; + +public class CoverageTest { + + public static String VarOne = "test1"; + public static String VarTwo = "test2"; + private Integer IntOne = 4; + + public static Boolean equalsVarOne(String inString) { + + if(VarOne.equals(inString)){ + return true; + } + else { + return false; + } + } + + public static boolean equalsVarTwo(String inString){ + + if(VarTwo.equals(inString)){ + return true; + } + else { + return false; + } + } + + private Integer timesIntOne(Integer inVal){ + + return inVal * IntOne; + } + + public static boolean whileLoop(Integer StopInt){ + + Integer i = 0; + while(i < StopInt){ + i=i+1; + } + if (i.equals(5)){ + return true; + } + else { + return false; + } + } +} diff --git a/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml b/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml new file mode 100644 index 0000000..49c3e87 --- /dev/null +++ b/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE report PUBLIC "-//JACOCO//DTD Report 1.0//EN" "report.dtd"><report name="Coverage"><sessioninfo id="vagrant-ubuntu-precise-32-f1c264e9" start="1402427058670" dump="1402427059269"/><package name="org/cmake"><class name="org/cmake/Coverage/CoverageTest"><method name="<init>" desc="()V" line="8"><counter type="INSTRUCTION" missed="7" covered="0"/><counter type="LINE" missed="2" covered="0"/><counter type="COMPLEXITY" missed="1" covered="0"/><counter type="METHOD" missed="1" covered="0"/></method><method name="equalsVarOne" desc="(Ljava/lang/String;)Ljava/lang/Boolean;" line="16"><counter type="INSTRUCTION" missed="3" covered="7"/><counter type="BRANCH" missed="1" covered="1"/><counter type="LINE" missed="1" covered="2"/><counter type="COMPLEXITY" missed="1" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><method name="equalsVarTwo" desc="(Ljava/lang/String;)Z" line="26"><counter type="INSTRUCTION" missed="0" covered="8"/><counter type="BRANCH" missed="0" covered="2"/><counter type="LINE" missed="0" covered="3"/><counter type="COMPLEXITY" missed="0" covered="2"/><counter type="METHOD" missed="0" covered="1"/></method><method name="timesIntOne" desc="(Ljava/lang/Integer;)Ljava/lang/Integer;" line="36"><counter type="INSTRUCTION" missed="8" covered="0"/><counter type="LINE" missed="1" covered="0"/><counter type="COMPLEXITY" missed="1" covered="0"/><counter type="METHOD" missed="1" covered="0"/></method><method name="whileLoop" desc="(Ljava/lang/Integer;)Z" line="41"><counter type="INSTRUCTION" missed="0" covered="24"/><counter type="BRANCH" missed="0" covered="4"/><counter type="LINE" missed="0" covered="6"/><counter type="COMPLEXITY" missed="0" covered="3"/><counter type="METHOD" missed="0" covered="1"/></method><method name="<clinit>" desc="()V" line="10"><counter type="INSTRUCTION" missed="0" covered="5"/><counter type="LINE" missed="0" covered="2"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><counter type="INSTRUCTION" missed="18" covered="44"/><counter type="BRANCH" missed="1" covered="7"/><counter type="LINE" missed="4" covered="13"/><counter type="COMPLEXITY" missed="3" covered="7"/><counter type="METHOD" missed="2" covered="4"/><counter type="CLASS" missed="0" covered="1"/></class><sourcefile name="CoverageTest.java"><line nr="8" mi="2" ci="0" mb="0" cb="0"/><line nr="10" mi="0" ci="2" mb="0" cb="0"/><line nr="11" mi="0" ci="3" mb="0" cb="0"/><line nr="12" mi="5" ci="0" mb="0" cb="0"/><line nr="16" mi="0" ci="4" mb="1" cb="1"/><line nr="17" mi="0" ci="3" mb="0" cb="0"/><line nr="20" mi="3" ci="0" mb="0" cb="0"/><line nr="26" mi="0" ci="4" mb="0" cb="2"/><line nr="27" mi="0" ci="2" mb="0" cb="0"/><line nr="30" mi="0" ci="2" mb="0" cb="0"/><line nr="36" mi="8" ci="0" mb="0" cb="0"/><line nr="41" mi="0" ci="3" mb="0" cb="0"/><line nr="42" mi="0" ci="5" mb="0" cb="2"/><line nr="43" mi="0" ci="7" mb="0" cb="0"/><line nr="45" mi="0" ci="5" mb="0" cb="2"/><line nr="46" mi="0" ci="2" mb="0" cb="0"/><line nr="49" mi="0" ci="2" mb="0" cb="0"/><counter type="INSTRUCTION" missed="18" covered="44"/><counter type="BRANCH" missed="1" covered="7"/><counter type="LINE" missed="4" covered="13"/><counter type="COMPLEXITY" missed="3" covered="7"/><counter type="METHOD" missed="2" covered="4"/><counter type="CLASS" missed="0" covered="1"/></sourcefile><counter type="INSTRUCTION" missed="18" covered="44"/><counter type="BRANCH" missed="1" covered="7"/><counter type="LINE" missed="4" covered="13"/><counter type="COMPLEXITY" missed="3" covered="7"/><counter type="METHOD" missed="2" covered="4"/><counter type="CLASS" missed="0" covered="1"/></package><counter type="INSTRUCTION" missed="18" covered="44"/><counter type="BRANCH" missed="1" covered="7"/><counter type="LINE" missed="4" covered="13"/><counter type="COMPLEXITY" missed="3" covered="7"/><counter type="METHOD" missed="2" covered="4"/><counter type="CLASS" missed="0" covered="1"/></report> diff --git a/Tests/JacocoCoverage/DartConfiguration.tcl.in b/Tests/JacocoCoverage/DartConfiguration.tcl.in new file mode 100644 index 0000000..cc10e9c --- /dev/null +++ b/Tests/JacocoCoverage/DartConfiguration.tcl.in @@ -0,0 +1,8 @@ +# This file is configured by CMake automatically as DartConfiguration.tcl +# If you choose not to use CMake, this file may be hand configured, by +# filling in the required variables. + + +# Configuration directories and files +SourceDirectory: ${CMake_BINARY_DIR}/Testing/JacocoCoverage +BuildDirectory: ${CMake_BINARY_DIR}/Testing/JacocoCoverage diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt index c933798..03a3b49 100644 --- a/Tests/LoadCommand/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeLists.txt @@ -8,10 +8,6 @@ include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) CHECK_TYPE_SIZE(char SIZEOF_CHAR) CHECK_TYPE_SIZE(short SIZEOF_SHORT) -include (CheckFunctionExists) -CHECK_FUNCTION_EXISTS(printf HAVE_PRINTF) -CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA) - configure_file(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in ${LoadCommand_BINARY_DIR}/LoadedCommand.h) diff --git a/Tests/LoadCommand/LoadedCommand.cxx.in b/Tests/LoadCommand/LoadedCommand.cxx.in index c58bcf1..72ec014 100644 --- a/Tests/LoadCommand/LoadedCommand.cxx.in +++ b/Tests/LoadCommand/LoadedCommand.cxx.in @@ -9,15 +9,6 @@ int testSizeOf(int s1, int s2) int main () { int ret = 0; -#ifdef HAVE_VSBLABLA - printf("Should not be able to find vsblabla\n"); - ret = 1; -#endif - -#if !defined( HAVE_PRINTF ) - printf("Should be able to find printf\n"); - ret= 1; -#endif #if !defined( ADDED_DEFINITION ) printf("Should have ADDED_DEFINITION defined\n"); diff --git a/Tests/LoadCommand/LoadedCommand.h.in b/Tests/LoadCommand/LoadedCommand.h.in index 7516a66..733c414 100644 --- a/Tests/LoadCommand/LoadedCommand.h.in +++ b/Tests/LoadCommand/LoadedCommand.h.in @@ -1,7 +1,3 @@ /* Check for size of types */ #cmakedefine SIZEOF_CHAR ${SIZEOF_CHAR} #cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT} - -/* Check for functions */ -#cmakedefine HAVE_PRINTF -#cmakedefine HAVE_VSBLABLA diff --git a/Tests/LoadCommandOneConfig/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeLists.txt index a75ad5a..6affd34 100644 --- a/Tests/LoadCommandOneConfig/CMakeLists.txt +++ b/Tests/LoadCommandOneConfig/CMakeLists.txt @@ -8,10 +8,6 @@ include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) CHECK_TYPE_SIZE(char SIZEOF_CHAR) CHECK_TYPE_SIZE(short SIZEOF_SHORT) -include (CheckFunctionExists) -CHECK_FUNCTION_EXISTS(printf HAVE_PRINTF) -CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA) - include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) CHECK_INCLUDE_FILE("sys/prctl.h" HAVE_SYS_PRCTL_H) diff --git a/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in b/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in index c58bcf1..72ec014 100644 --- a/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in +++ b/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in @@ -9,15 +9,6 @@ int testSizeOf(int s1, int s2) int main () { int ret = 0; -#ifdef HAVE_VSBLABLA - printf("Should not be able to find vsblabla\n"); - ret = 1; -#endif - -#if !defined( HAVE_PRINTF ) - printf("Should be able to find printf\n"); - ret= 1; -#endif #if !defined( ADDED_DEFINITION ) printf("Should have ADDED_DEFINITION defined\n"); diff --git a/Tests/LoadCommandOneConfig/LoadedCommand.h.in b/Tests/LoadCommandOneConfig/LoadedCommand.h.in index 7a0a15d..d748d06 100644 --- a/Tests/LoadCommandOneConfig/LoadedCommand.h.in +++ b/Tests/LoadCommandOneConfig/LoadedCommand.h.in @@ -2,10 +2,6 @@ #cmakedefine SIZEOF_CHAR ${SIZEOF_CHAR} #cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT} -/* Check for functions */ -#cmakedefine HAVE_PRINTF -#cmakedefine HAVE_VSBLABLA - /* Check for headers */ #cmakedefine HAVE_SYS_PRCTL_H diff --git a/Tests/MacRuntimePath/CMakeLists.txt b/Tests/MacRuntimePath/CMakeLists.txt index eeb3653..3e9ab8a 100644 --- a/Tests/MacRuntimePath/CMakeLists.txt +++ b/Tests/MacRuntimePath/CMakeLists.txt @@ -39,6 +39,7 @@ add_custom_command( --build-project MacRuntimePath_A --build-target install --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-options -C${MacRuntimePath_BINARY_DIR}/InitialCache.cmake VERBATIM @@ -60,6 +61,7 @@ add_custom_command( --build-noclean --build-project MacRuntimePath_B --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-options -C${MacRuntimePath_BINARY_DIR}/InitialCache.cmake VERBATIM diff --git a/Tests/MacroTest/CMakeLists.txt b/Tests/MacroTest/CMakeLists.txt index 02bb31f..6c6dfb6 100644 --- a/Tests/MacroTest/CMakeLists.txt +++ b/Tests/MacroTest/CMakeLists.txt @@ -36,7 +36,7 @@ macro(strange_macro m) endmacro() STRANGE_MACRO(var) set(second_var "second_var") -if("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") +if("x${var}" STREQUAL "xstrange_macro" AND "x${second_var}" STREQUAL "xsecond_var") PASS("Case Test" "(${var} ${second_var})") else() FAILED("Case test" "(${var} ${second_var})") diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index ab0ebc3..645cc65 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -35,6 +35,10 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES) return() endif() +string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_CXX_COMPILER_VERSION}") +string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}") +string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_CXX_COMPILER_VERSION}") + macro(set_defines target true_defs false_defs) set(defines) foreach(def ${true_defs}) @@ -46,6 +50,9 @@ macro(set_defines target true_defs false_defs) target_compile_definitions(${target} PRIVATE ${defines} + EXPECTED_COMPILER_VERSION_MAJOR=${COMPILER_VERSION_MAJOR} + EXPECTED_COMPILER_VERSION_MINOR=${COMPILER_VERSION_MINOR} + EXPECTED_COMPILER_VERSION_PATCH=${COMPILER_VERSION_PATCH} ) endmacro() diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.cpp b/Tests/Module/WriteCompilerDetectionHeader/main.cpp index 8b4ea52..b807ad5 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/main.cpp +++ b/Tests/Module/WriteCompilerDetectionHeader/main.cpp @@ -13,6 +13,18 @@ #error cxx_variadic_templates expected availability did not match. #endif +#if !CHECK(VERSION_MAJOR) +#error Compiler major version did not match. +#endif + +#if !CHECK(VERSION_MINOR) +#error Compiler minor version did not match. +#endif + +#if !CHECK(VERSION_PATCH) +#error Compiler patch version did not match. +#endif + int main() { return 0; diff --git a/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m b/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m index 9a08edf..ee70682 100644 --- a/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m +++ b/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m @@ -10,6 +10,7 @@ EN ; This entry point shouldn't be found without fixing I '$$T5 W "RETURNED FROM t5",! Q ; This line not executable + D T6^ZZCOVTST ; T1 ; This line should always be found N D @@ -33,4 +34,10 @@ T4 N D S D=5 W "Shouldn't be executed" T5(EQ) ;this entry point is called with a $$ notation W "THIS IS THE $$ NOTATION!",! Q 0 +T6 ; An entry point to show comments inside of "DO" blocks + D + . W "This is executable code",! + . ;This is a comment inside the do block, not executable + . S ZZBLAH="blah" + W "Ending T6",! ; diff --git a/Tests/MumpsCoverage/ZZCOVTST.cmcov b/Tests/MumpsCoverage/ZZCOVTST.cmcov index 798e5b2..7a5df61 100644 --- a/Tests/MumpsCoverage/ZZCOVTST.cmcov +++ b/Tests/MumpsCoverage/ZZCOVTST.cmcov @@ -1,5 +1,5 @@ Routine,Line,RtnLine,Code
-ZZCOVTST,1,0,"ZZCOVTST;OSEHRA/JPS -- Test routine for Coverage Parsing;4/28/2014"
+ZZCOVTST,1,1,"ZZCOVTST;OSEHRA/JPS -- Test routine for Coverage Parsing;4/28/2014"
,2,0," ; (tab) This is series of comments"
,3,0," ; (tab) it should all be not executable"
,4,0," ; (spaces) one of these sets might be a problem"
@@ -8,31 +8,38 @@ ZZCOVTST,1,0,"ZZCOVTST;OSEHRA/JPS -- Test routine for Coverage Parsing;4/28/2014 ,7,1," N D"
,8,1," S D=1 ;An executable line"
,9,1," D T1^ZZCOVTST"
-,10,1,"I '$$T5 W ""RETURNED FROM t5"",!"
-,11,1," Q"
-,12,0," ; This line not executable"
-,13,0," ;"
-,14,0,"T1 ; This line should always be found"
-,15,1," N D"
-,16,1," S D=2"
-,17,1," W !,D,!,""This is the second entry point"",!"
-,18,1," D T2^ZZCOVTST(D)"
-,19,1," Q"
-,20,0," ;"
-,21,0,"T2(EQ) ; This is debatable"
-,22,1," N D"
-,23,1," S D=3"
-,24,1," W !,D,!,EQ,""This is the third entry point"",!"
-,25,1," D T3^ZZCOVTST"
-,26,1," Q"
-,27,0," ;"
-,28,1,"T3 N D S D=4 W D,!,""Fourth Entry point"",! Q"
-,29,0," ;"
-,30,0,"T4 N D S D=5 W ""Shouldn't be executed"""
-,31,0," W ""Lots to not do"""
-,32,0," Q"
-,33,1,"T5()"
-,34,1," W ""THIS IS ONE WITH $$ NOTATION"",1"
-,35,1," Q 0"
-,36,0," ;"
-Totals for ZZCOVTST,,19,
+,10,1," I '$$T5 W ""RETURNED FROM t5"",!"
+,11,1," D T6^ZZCOVTST"
+,12,1," Q"
+,13,0," ; This line not executable"
+,14,0," ;"
+,15,0,"T1 ; This line should always be found"
+,16,1," N D"
+,17,1," S D=2"
+,18,1," W !,D,!,""This is the second entry point"",!"
+,19,1," D T2^ZZCOVTST(D)"
+,20,1," Q"
+,21,0," ;"
+,22,0,"T2(EQ) ; This is debatable and only called with ENT^ROU notation"
+,23,1," N D"
+,24,1," S D=3"
+,25,1," W !,D,!,EQ,""This is the third entry point"",!"
+,26,1," D T3^ZZCOVTST"
+,27,1," Q"
+,28,0," ;"
+,29,1,"T3 N D S D=4 W D,!,""Fourth Entry point"",! Q"
+,30,0," ;"
+,31,0,"T4 N D S D=5 W ""Shouldn't be executed"""
+,32,0," W ""Lots to not do"""
+,33,0," Q"
+,34,1,"T5(EQ) ;this entry point is called with a $$ notation"
+,35,1," W ""THIS IS THE $$ NOTATION!"",!"
+,36,1," Q 0"
+,37,0,"T6 ; An entry point to show comments inside of ""DO"" blocks"
+,38,1," D"
+,39,1," . W ""This is executable code"",!"
+,40,0," . ; This is a comment inside the do block, not executable"
+,41,1," . S ZZBLAH=""blah"""
+,42,1," W ""Ending T6"",!"
+,43,0," ;"
+Totals for ZZCOVTST,,25,
\ No newline at end of file diff --git a/Tests/MumpsCoverage/ZZCOVTST.mcov b/Tests/MumpsCoverage/ZZCOVTST.mcov index f73d354..b2608d9 100644 --- a/Tests/MumpsCoverage/ZZCOVTST.mcov +++ b/Tests/MumpsCoverage/ZZCOVTST.mcov @@ -1,30 +1,38 @@ %GO Global Output Utility -GT.M 30-APR-2014 14:24:46 ZWR -^ZZCOVERAGE("*CHILDREN")="0:0:0" -^ZZCOVERAGE("*RUN")="24000:88000:112000" -^ZZCOVERAGE("ZZCOVTST","EN")="1:4000:8000:12000:6464583" -^ZZCOVERAGE("ZZCOVTST","EN",1)="1:0:0:0:20" -^ZZCOVERAGE("ZZCOVTST","EN",2)="1:0:0:0:14" -^ZZCOVERAGE("ZZCOVTST","EN",3)="1:0:0:0:26" -^ZZCOVERAGE("ZZCOVTST","EN",4)="1:0:0:0:228" -^ZZCOVERAGE("ZZCOVTST","T1")="1:0:0:0:92" -^ZZCOVERAGE("ZZCOVTST","T1",1)="1:0:0:0:13" -^ZZCOVERAGE("ZZCOVTST","T1",2)="1:0:0:0:12" -^ZZCOVERAGE("ZZCOVTST","T1",3)="1:0:0:0:14" -^ZZCOVERAGE("ZZCOVTST","T1",4)="1:0:0:0:29" -^ZZCOVERAGE("ZZCOVTST","T1",5)="1:0:0:0:12" -^ZZCOVERAGE("ZZCOVTST","T2")="1:0:0:0:102" -^ZZCOVERAGE("ZZCOVTST","T2",0)="1:0:0:0:14" -^ZZCOVERAGE("ZZCOVTST","T2",1)="1:0:0:0:12" -^ZZCOVERAGE("ZZCOVTST","T2",2)="1:0:0:0:12" -^ZZCOVERAGE("ZZCOVTST","T2",3)="1:0:0:0:14" -^ZZCOVERAGE("ZZCOVTST","T2",4)="1:0:0:0:25" -^ZZCOVERAGE("ZZCOVTST","T2",5)="1:0:0:0:12" -^ZZCOVERAGE("ZZCOVTST","T3")="1:0:0:0:28" -^ZZCOVERAGE("ZZCOVTST","T3",0)="1:0:0:0:17" -^ZZCOVERAGE("ZZCOVTST","T5")="1:0:0:0:388" -^ZZCOVERAGE("ZZCOVTST","T5",0)="1:0:0:0:114" -^ZZCOVERAGE("ZZCOVTST","T5",1)="1:0:0:0:28" -^ZZCOVERAGE("ZZCOVTST","T5",2)="1:0:0:0:14" +GT.M 15-AUG-2014 10:14:32 ZWR +^ZZCOVERAGE("*CHILDREN")="212000:68000:280000" +^ZZCOVERAGE("*RUN")="56000:136000:192000" +^ZZCOVERAGE("ZZCOVTST","EN")="1:4000:4000:8000:8627798" +^ZZCOVERAGE("ZZCOVTST","EN",1)="1:0:0:0:27" +^ZZCOVERAGE("ZZCOVTST","EN",2)="1:0:0:0:23" +^ZZCOVERAGE("ZZCOVTST","EN",3)="1:0:0:0:70" +^ZZCOVERAGE("ZZCOVTST","EN",4)="1:0:0:0:74" +^ZZCOVERAGE("ZZCOVTST","EN",5)="1:0:0:0:66" +^ZZCOVERAGE("ZZCOVTST","EN",6)="1:0:0:0:40" +^ZZCOVERAGE("ZZCOVTST","T1")="1:0:0:0:208" +^ZZCOVERAGE("ZZCOVTST","T1",1)="1:0:0:0:23" +^ZZCOVERAGE("ZZCOVTST","T1",2)="1:0:0:0:24" +^ZZCOVERAGE("ZZCOVTST","T1",3)="1:0:0:0:26" +^ZZCOVERAGE("ZZCOVTST","T1",4)="1:0:0:0:73" +^ZZCOVERAGE("ZZCOVTST","T1",5)="1:0:0:0:40" +^ZZCOVERAGE("ZZCOVTST","T2")="1:0:0:0:1783" +^ZZCOVERAGE("ZZCOVTST","T2",0)="1:0:0:0:25" +^ZZCOVERAGE("ZZCOVTST","T2",1)="1:0:0:0:524" +^ZZCOVERAGE("ZZCOVTST","T2",2)="1:0:0:0:40" +^ZZCOVERAGE("ZZCOVTST","T2",3)="1:0:0:0:95" +^ZZCOVERAGE("ZZCOVTST","T2",4)="1:0:0:0:607" +^ZZCOVERAGE("ZZCOVTST","T2",5)="1:0:0:0:470" +^ZZCOVERAGE("ZZCOVTST","T3")="1:0:0:0:254" +^ZZCOVERAGE("ZZCOVTST","T3",0)="1:0:0:0:76" +^ZZCOVERAGE("ZZCOVTST","T5")="1:0:0:0:153" +^ZZCOVERAGE("ZZCOVTST","T5",0)="1:0:0:0:40" +^ZZCOVERAGE("ZZCOVTST","T5",1)="1:0:0:0:41" +^ZZCOVERAGE("ZZCOVTST","T5",2)="1:0:0:0:41" +^ZZCOVERAGE("ZZCOVTST","T6")="1:0:0:0:227" +^ZZCOVERAGE("ZZCOVTST","T6",1)="1:0:0:0:41" +^ZZCOVERAGE("ZZCOVTST","T6",2)="1:0:0:0:42" +^ZZCOVERAGE("ZZCOVTST","T6",4)="1:0:0:0:41" +^ZZCOVERAGE("ZZCOVTST","T6",5)="1:0:0:0:34" +^ZZCOVERAGE("ZZCOVTST","T6",6)="1:0:0:0:38" diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt index 55778ea..c24c5ed 100644 --- a/Tests/ObjectLibrary/A/CMakeLists.txt +++ b/Tests/ObjectLibrary/A/CMakeLists.txt @@ -1,18 +1,26 @@ project(ObjectLibraryA C) # Add -fPIC so objects can be used in shared libraries. -# TODO: Need property for this. -if(CMAKE_SHARED_LIBRARY_C_FLAGS AND NOT WATCOM) - set(CMAKE_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} ${CMAKE_C_FLAGS}") -endif() +set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_definitions(-DA_DEF) add_custom_command( OUTPUT a1.c - DEPENDS a1.c.in + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/a1.c.in COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/a1.c.in ${CMAKE_CURRENT_BINARY_DIR}/a1.c ) -add_library(A OBJECT a1.c a2.c) +# Remove the custom command output to be sure it runs in an +# incremental test. Skip this on VS 6 because it sometimes +# re-runs CMake after the custom command runs. +if(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 6") + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/a.cmake) +endif() +add_custom_command( + OUTPUT a.cmake + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/a.cmake + ) + +add_library(A OBJECT a1.c a2.c a.cmake) target_include_directories(A PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/Tests/ObjectLibrary/B/CMakeLists.txt b/Tests/ObjectLibrary/B/CMakeLists.txt index a567f96..2158084 100644 --- a/Tests/ObjectLibrary/B/CMakeLists.txt +++ b/Tests/ObjectLibrary/B/CMakeLists.txt @@ -5,10 +5,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") endif() # Add -fPIC so objects can be used in shared libraries. -# TODO: Need property for this. -if(CMAKE_SHARED_LIBRARY_C_FLAGS AND NOT WATCOM) - set(CMAKE_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} ${CMAKE_C_FLAGS}") -endif() +set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_library(B OBJECT b1.c b2.c) target_include_directories(B PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 0aeefaa..e9f553e 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -12,6 +12,7 @@ add_library(Cshared SHARED c.c $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:Bexport>) add_executable(UseCshared main.c) set_property(TARGET UseCshared PROPERTY COMPILE_DEFINITIONS SHARED_C) target_link_libraries(UseCshared Cshared) +add_custom_command(TARGET UseCshared POST_BUILD COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/A/a.cmake) add_executable(UseCinternal main.c c.c $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:B>) @@ -59,4 +60,10 @@ add_executable(UseABinternal ${dummy} $<TARGET_OBJECTS:ABmain> $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:B> ) +# Test target-level dependencies of executable without sources. +file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/UseABinternalDep.cmake) +add_custom_target(UseABinternalDep COMMAND ${CMAKE_COMMAND} -E touch UseABinternalDep.cmake) +add_custom_command(TARGET UseABinternal POST_BUILD COMMAND ${CMAKE_COMMAND} -P UseABinternalDep.cmake) +add_dependencies(UseABinternal UseABinternalDep) + add_subdirectory(ExportLanguages) diff --git a/Tests/PerConfig/perconfig.cmake b/Tests/PerConfig/perconfig.cmake index 0731041..5286307 100644 --- a/Tests/PerConfig/perconfig.cmake +++ b/Tests/PerConfig/perconfig.cmake @@ -29,7 +29,7 @@ endif() # Verify that the implementation files are named correctly. foreach(lib pcStatic pcShared) - file(STRINGS "${${lib}_file}" info LIMIT_COUNT 1 REGEX "INFO:[^[]*\\[") + file(STRINGS "${${lib}_file}" info LIMIT_COUNT 1 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]") if(NOT "${info}" MATCHES "INFO:symbol\\[${lib}\\]") message(SEND_ERROR "No INFO:symbol[${lib}] found in:\n ${${lib}_file}") endif() diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index d44cb9c..cdfdcc1 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -34,15 +34,6 @@ endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") set(PP_VS 1) endif() -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 10") - set(PP_VS100 1) -endif() -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 11") - set(PP_VS110 1) -endif() -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 12") - set(PP_VS120 1) -endif() # Some tests below check the PP_* variables set above. They are meant # to test the case that the build tool is at fault. Other tests below diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 3973653..3fd00b8 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -37,6 +37,9 @@ else() endif() +add_executable(rcconly rcconly.cpp second_resource.qrc) +set_property(TARGET rcconly PROPERTY AUTORCC ON) +target_link_libraries(rcconly ${QT_QTCORE_TARGET}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) @@ -71,6 +74,7 @@ if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]" AND NOT CMAKE_CONFIGURATION_ endif() add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp + multiplewidgets.cpp xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot> test.qrc second_resource.qrc resourcetester.cpp generated.cpp ${debug_srcs} ) diff --git a/Tests/QtAutogen/multiplewidgets.cpp b/Tests/QtAutogen/multiplewidgets.cpp new file mode 100644 index 0000000..f143875 --- /dev/null +++ b/Tests/QtAutogen/multiplewidgets.cpp @@ -0,0 +1,19 @@ + +#include "multiplewidgets.h" + +#include "ui_widget1.h" +#include "ui_widget2.h" + +Widget1::Widget1(QWidget *parent) + : QWidget(parent), + ui(new Ui::Widget1) +{ + ui->setupUi(this); +} + +Widget2::Widget2(QWidget *parent) + : QWidget(parent), + ui(new Ui::Widget2) +{ + ui->setupUi(this); +} diff --git a/Tests/QtAutogen/multiplewidgets.h b/Tests/QtAutogen/multiplewidgets.h new file mode 100644 index 0000000..6ae6ad1 --- /dev/null +++ b/Tests/QtAutogen/multiplewidgets.h @@ -0,0 +1,33 @@ + +#ifndef MULTIPLEWIDGETS_H +#define MULTIPLEWIDGETS_H + +#include <QWidget> + +namespace Ui { +class Widget1; +} + +class Widget1 : public QWidget +{ + Q_OBJECT +public: + Widget1(QWidget *parent = 0); +private: + Ui::Widget1 *ui; +}; + +namespace Ui { +class Widget2; +} + +class Widget2 : public QWidget +{ + Q_OBJECT +public: + Widget2(QWidget *parent = 0); +private: + Ui::Widget2 *ui; +}; + +#endif diff --git a/Tests/QtAutogen/rcconly.cpp b/Tests/QtAutogen/rcconly.cpp new file mode 100644 index 0000000..854c4c1 --- /dev/null +++ b/Tests/QtAutogen/rcconly.cpp @@ -0,0 +1,9 @@ + +extern int qInitResources_second_resource(); + +int main(int, char**) +{ + // Fails to link if the symbol is not present. + qInitResources_second_resource(); + return 0; +} diff --git a/Tests/QtAutogen/widget1.ui b/Tests/QtAutogen/widget1.ui new file mode 100644 index 0000000..8fce81a --- /dev/null +++ b/Tests/QtAutogen/widget1.ui @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Widget1</class> + <widget class="QWidget" name="Widget1"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="QPushButton" name="pushButton"> + <property name="geometry"> + <rect> + <x>140</x> + <y>80</y> + <width>80</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + <widget class="QPushButton" name="pushButton_2"> + <property name="geometry"> + <rect> + <x>190</x> + <y>170</y> + <width>80</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutogen/widget2.ui b/Tests/QtAutogen/widget2.ui new file mode 100644 index 0000000..1f411b9 --- /dev/null +++ b/Tests/QtAutogen/widget2.ui @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Widget2</class> + <widget class="QWidget" name="Widget1"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="QListWidget" name="listWidget"> + <property name="geometry"> + <rect> + <x>20</x> + <y>20</y> + <width>256</width> + <height>192</height> + </rect> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt new file mode 100644 index 0000000..f5a8fbe --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt @@ -0,0 +1 @@ +$^ diff --git a/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake b/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake new file mode 100644 index 0000000..23a9124 --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake @@ -0,0 +1,47 @@ +cmake_policy(SET CMP0054 NEW) + +set(FOO "BAR") +set(BAZ "ZZZ") +set(MYTRUE ON) +set(MYNUMBER 3) +set(MYVERSION 3.0) + +function(assert_unquoted PREFIX FIRST) + string(REPLACE ";" " " ARGN_SP "${ARGN}") + if(${PREFIX} ${FIRST} ${ARGN}) + message(FATAL_ERROR "Assertion failed [${PREFIX} ${FIRST} ${ARGN_SP}]") + endif() +endfunction() + +function(assert_quoted PREFIX FIRST) + string(REPLACE ";" " " ARGN_SP "${ARGN}") + if(${PREFIX} "${FIRST}" ${ARGN}) + message(FATAL_ERROR "Assertion failed [${PREFIX} \"${FIRST}\" ${ARGN_SP}]") + endif() +endfunction() + +function(assert FIRST) + assert_unquoted(NOT ${FIRST} ${ARGN}) + assert_quoted("" ${FIRST} ${ARGN}) +endfunction() + +assert(MYTRUE) + +assert(FOO MATCHES "^BAR$") + +assert(MYNUMBER LESS 4) +assert(MYNUMBER GREATER 2) +assert(MYNUMBER EQUAL 3) + +assert(FOO STRLESS CCC) +assert(BAZ STRGREATER CCC) +assert(FOO STREQUAL BAR) + +assert_unquoted(NOT MYVERSION VERSION_LESS 3.1) +assert_unquoted("" MYVERSION VERSION_LESS 2.9) + +assert_quoted(NOT MYVERSION VERSION_LESS 2.9) +assert_quoted(NOT MYVERSION VERSION_LESS 3.1) + +assert(MYVERSION VERSION_GREATER 2.9) +assert(MYVERSION VERSION_EQUAL 3.0) diff --git a/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt new file mode 100644 index 0000000..f5a8fbe --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt @@ -0,0 +1 @@ +$^ diff --git a/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake b/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake new file mode 100644 index 0000000..0c4cede --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake @@ -0,0 +1,47 @@ +cmake_policy(SET CMP0054 OLD) + +set(FOO "BAR") +set(BAZ "ZZZ") +set(MYTRUE ON) +set(MYNUMBER 3) +set(MYVERSION 3.0) + +function(assert_unquoted PREFIX FIRST) + string(REPLACE ";" " " ARGN_SP "${ARGN}") + if(${PREFIX} ${FIRST} ${ARGN}) + message(FATAL_ERROR "Assertion failed [${PREFIX} ${FIRST} ${ARGN_SP}]") + endif() +endfunction() + +function(assert_quoted PREFIX FIRST) + string(REPLACE ";" " " ARGN_SP "${ARGN}") + if(${PREFIX} "${FIRST}" ${ARGN}) + message(FATAL_ERROR "Assertion failed [${PREFIX} \"${FIRST}\" ${ARGN_SP}]") + endif() +endfunction() + +function(assert FIRST) + assert_unquoted(NOT ${FIRST} ${ARGN}) + assert_quoted(NOT ${FIRST} ${ARGN}) +endfunction() + +assert(MYTRUE) + +assert(FOO MATCHES "^BAR$") + +assert(MYNUMBER LESS 4) +assert(MYNUMBER GREATER 2) +assert(MYNUMBER EQUAL 3) + +assert(FOO STRLESS CCC) +assert(BAZ STRGREATER CCC) +assert(FOO STREQUAL BAR) + +assert_unquoted(NOT MYVERSION VERSION_LESS 3.1) +assert_unquoted("" MYVERSION VERSION_LESS 2.9) + +assert_quoted("" MYVERSION VERSION_LESS 2.9) +assert_quoted(NOT MYVERSION VERSION_LESS 3.1) + +assert(MYVERSION VERSION_GREATER 2.9) +assert(MYVERSION VERSION_EQUAL 3.0) diff --git a/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt new file mode 100644 index 0000000..3d875ae --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at CMP0054-WARN.cmake:3 \(if\): + 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 new file mode 100644 index 0000000..37855fc --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake @@ -0,0 +1,5 @@ +set(FOO "BAR") + +if(NOT "FOO" STREQUAL "BAR") + message(FATAL_ERROR "The given literals should match") +endif() diff --git a/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt new file mode 100644 index 0000000..485db52 --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt @@ -0,0 +1,24 @@ +CMake Warning \(dev\) at CMP0054-duplicate-warnings.cmake:4 \(if\): + 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\): + CMP0054-duplicate-warnings.cmake:8 \(generate_warning\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at CMP0054-duplicate-warnings.cmake:11 \(if\): + 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-duplicate-warnings.cmake b/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings.cmake new file mode 100644 index 0000000..04fbe14 --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings.cmake @@ -0,0 +1,12 @@ +set(FOO "BAR") + +function(generate_warning) + if("FOO" STREQUAL "BAR") + endif() +endfunction() + +generate_warning() +generate_warning() + +if("FOO" STREQUAL "BAR") +endif() diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-result.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt new file mode 100644 index 0000000..f444684 --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMP0054-keywords-NEW.cmake:23 \(if\): + if given arguments: + + "NOT" "1" + + Unknown arguments specified +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake new file mode 100644 index 0000000..b957658 --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake @@ -0,0 +1,25 @@ +cmake_policy(SET CMP0054 NEW) + +function(assert KEYWORD) + if("${KEYWORD}" STREQUAL "${KEYWORD}") + else() + message(FATAL_ERROR + "Assertion failed [\"${KEYWORD}\" STREQUAL \"${KEYWORD}\"]") + endif() +endfunction() + +assert("NOT") +assert("COMMAND") +assert("POLICY") +assert("TARGET") +assert("EXISTS") +assert("IS_DIRECTORY") +assert("IS_SYMLINK") +assert("IS_ABSOLUTE") +assert("DEFINED") +assert("(") +assert(")") + +if("NOT" 1) + message(FATAL_ERROR "[\"NOT\" 1] evaluated true") +endif() diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt new file mode 100644 index 0000000..f5a8fbe --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt @@ -0,0 +1 @@ +$^ diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake new file mode 100644 index 0000000..a2a7f51 --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake @@ -0,0 +1,9 @@ +cmake_policy(SET CMP0054 OLD) + +if(NOT 1) + message(FATAL_ERROR "[NOT 1] evaluated true") +endif() + +if("NOT" 1) + message(FATAL_ERROR "[\"NOT\" 1] evaluated true") +endif() diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt new file mode 100644 index 0000000..b1ebd49 --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0054-keywords-WARN.cmake:1 \(if\): + 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 "NOT" 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 new file mode 100644 index 0000000..ee0a623 --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake @@ -0,0 +1,3 @@ +if("NOT" 1) + message(FATAL_ERROR "[\"NOT\" 1] evaluated true") +endif() diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt new file mode 100644 index 0000000..f5a8fbe --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt @@ -0,0 +1 @@ +$^ diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake new file mode 100644 index 0000000..b6b243c --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake @@ -0,0 +1,53 @@ +set(FOO BAR) + +cmake_policy(SET CMP0054 NEW) + +function(function_defined_new_called_old) + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") + endif() +endfunction() + +macro(macro_defined_new_called_old) + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") + endif() +endmacro() + +cmake_policy(SET CMP0054 OLD) + +function_defined_new_called_old() +macro_defined_new_called_old() + +function(function_defined_old_called_new) + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") + endif() +endfunction() + +macro(macro_defined_old_called_new) + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") + endif() +endmacro() + +cmake_policy(SET CMP0054 NEW) + +function_defined_old_called_new() +macro_defined_old_called_new() diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt new file mode 100644 index 0000000..f5a8fbe --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt @@ -0,0 +1 @@ +$^ diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake new file mode 100644 index 0000000..87c968a --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake @@ -0,0 +1,49 @@ +set(FOO BAR) + +cmake_policy(SET CMP0054 NEW) + +foreach(loop_var arg1 arg2) + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") + endif() + + cmake_policy(SET CMP0054 OLD) + + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") + endif() + + cmake_policy(SET CMP0054 NEW) +endforeach() + +cmake_policy(SET CMP0054 OLD) + +foreach(loop_var arg1 arg2) + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") + endif() + + cmake_policy(SET CMP0054 NEW) + + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") + endif() + + cmake_policy(SET CMP0054 OLD) +endforeach() diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt new file mode 100644 index 0000000..f5a8fbe --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt @@ -0,0 +1 @@ +$^ diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake new file mode 100644 index 0000000..dd7434d --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake @@ -0,0 +1,41 @@ +set(FOO BAR) + +cmake_policy(SET CMP0054 NEW) + +if("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") + + if("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") + endif() + + cmake_policy(SET CMP0054 OLD) + + if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") + endif() +endif() + +if("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") +endif() + +cmake_policy(SET CMP0054 OLD) + +if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") + + if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") + endif() + + cmake_policy(SET CMP0054 NEW) + + if("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") + endif() +endif() + +if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") +endif() diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt new file mode 100644 index 0000000..f5a8fbe --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt @@ -0,0 +1 @@ +$^ diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake new file mode 100644 index 0000000..2b22778 --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake @@ -0,0 +1,65 @@ +set(FOO BAR) + +set(LOOP_VAR "") + +cmake_policy(SET CMP0054 NEW) + +while(NOT LOOP_VAR STREQUAL "xx") + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") + endif() + + cmake_policy(SET CMP0054 OLD) + + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") + endif() + + cmake_policy(SET CMP0054 NEW) + + set(LOOP_VAR "${LOOP_VAR}x") +endwhile() + +while("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") +endwhile() + +set(LOOP_VAR "") + +cmake_policy(SET CMP0054 OLD) + +while(NOT LOOP_VAR STREQUAL "xx") + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") + endif() + + cmake_policy(SET CMP0054 NEW) + + if(NOT FOO STREQUAL BAR) + message(FATAL_ERROR "The variable should match the string") + endif() + + if("FOO" STREQUAL BAR) + message(FATAL_ERROR "The strings should not match") + endif() + + cmake_policy(SET CMP0054 OLD) + + set(LOOP_VAR "${LOOP_VAR}x") +endwhile() + +if(NOT "FOO" STREQUAL BAR) + message(FATAL_ERROR "The quoted variable should match the string") +endif() diff --git a/Tests/RunCMake/CMP0054/CMakeLists.txt b/Tests/RunCMake/CMP0054/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/CMP0054/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0054/RunCMakeTest.cmake b/Tests/RunCMake/CMP0054/RunCMakeTest.cmake new file mode 100644 index 0000000..2f2fb76 --- /dev/null +++ b/Tests/RunCMake/CMP0054/RunCMakeTest.cmake @@ -0,0 +1,13 @@ +include(RunCMake) + +run_cmake(CMP0054-OLD) +run_cmake(CMP0054-NEW) +run_cmake(CMP0054-WARN) +run_cmake(CMP0054-keywords-NEW) +run_cmake(CMP0054-keywords-OLD) +run_cmake(CMP0054-keywords-WARN) +run_cmake(CMP0054-duplicate-warnings) +run_cmake(CMP0054-policy-command-scope) +run_cmake(CMP0054-policy-foreach-scope) +run_cmake(CMP0054-policy-while-scope) +run_cmake(CMP0054-policy-nested-if) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 06272ce..fd3bb03 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -4,6 +4,7 @@ macro(add_RunCMake_test test) add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} + -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} @@ -18,6 +19,13 @@ endif() if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2) set(TargetSources_ARGS -DXCODE_BELOW_2=1) + set(File_Generate_ARGS -DXCODE_BELOW_2=1) +endif() + +# Test MSVC for older host CMake versions, and test +# WIN32/CMAKE_C_COMPILER_ID to fix check on Intel for Windows. +if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel")) + set(GeneratorExpression_ARGS -DLINKER_SUPPORTS_PDB=1) endif() add_RunCMake_test(CMP0019) @@ -40,8 +48,9 @@ add_RunCMake_test(CMP0049) add_RunCMake_test(CMP0050) add_RunCMake_test(CMP0051) add_RunCMake_test(CMP0053) +add_RunCMake_test(CMP0054) add_RunCMake_test(CTest) -if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") +if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() add_RunCMake_test(CompilerNotFound) @@ -51,6 +60,7 @@ add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) add_RunCMake_test(GeneratorExpression) +add_RunCMake_test(GeneratorPlatform) add_RunCMake_test(GeneratorToolset) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) diff --git a/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt b/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt b/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt new file mode 100644 index 0000000..2143ba4 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: unknown option '-bad-arg1'$ diff --git a/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt b/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt b/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt new file mode 100644 index 0000000..d2efa53 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: no command given$ diff --git a/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt b/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt b/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt new file mode 100644 index 0000000..d2efa53 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: no command given$ diff --git a/Tests/RunCMake/CommandLine/E_env-set-stdout.txt b/Tests/RunCMake/CommandLine/E_env-set-stdout.txt new file mode 100644 index 0000000..feff117 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-set-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: 1$ diff --git a/Tests/RunCMake/CommandLine/E_env-set.cmake b/Tests/RunCMake/CommandLine/E_env-set.cmake new file mode 100644 index 0000000..c2639b6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-set.cmake @@ -0,0 +1,5 @@ +if(DEFINED ENV{TEST_ENV}) + message(STATUS "TEST_ENV is correctly set in environment: $ENV{TEST_ENV}") +else() + message(FATAL_ERROR "TEST_ENV is incorrectly not set in environment") +endif() diff --git a/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt b/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt new file mode 100644 index 0000000..a1d5c01 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly not set in environment$ diff --git a/Tests/RunCMake/CommandLine/E_env-unset.cmake b/Tests/RunCMake/CommandLine/E_env-unset.cmake new file mode 100644 index 0000000..04976fb --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-unset.cmake @@ -0,0 +1,5 @@ +if(DEFINED ENV{TEST_ENV}) + message(FATAL_ERROR "TEST_ENV is incorrectly set in environment") +else() + message(STATUS "TEST_ENV is correctly not set in environment") +endif() diff --git a/Tests/RunCMake/CommandLine/P_directory-result.txt b/Tests/RunCMake/CommandLine/P_directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/P_directory-stderr.txt b/Tests/RunCMake/CommandLine/P_directory-stderr.txt new file mode 100644 index 0000000..b8319a1 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_directory-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Error processing file: .*/Tests/RunCMake/CommandLine$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 3aaeac0..5622a5b 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -31,7 +31,15 @@ if(UNIX) ) endif() +run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) +run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) +run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) +run_cmake_command(E_env-set ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake) +run_cmake_command(E_env-unset ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -E env --unset=TEST_ENV ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake) + run_cmake_command(E_sleep-no-args ${CMAKE_COMMAND} -E sleep) run_cmake_command(E_sleep-bad-arg1 ${CMAKE_COMMAND} -E sleep x) 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}) diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt index 82a34d5..17b8a5c 100644 --- a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt @@ -1,11 +1,4 @@ CMake Debug Log: - Boolean compatibility of property "BOOL_PROP7" for target - "CompatibleInterface" \(result: "FALSE"\): - - \* Target "CompatibleInterface" property is implied by use. - \* Target "iface1" property value "FALSE" \(Agree\) -+ -CMake Debug Log: Boolean compatibility of property "BOOL_PROP1" for target "CompatibleInterface" \(result: "TRUE"\): @@ -47,6 +40,13 @@ CMake Debug Log: \* Target "iface2" property value "FALSE" \(Agree\) + CMake Debug Log: + Boolean compatibility of property "BOOL_PROP7" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property is implied by use. + \* Target "iface1" property value "FALSE" \(Agree\) ++ +CMake Debug Log: String compatibility of property "STRING_PROP1" for target "CompatibleInterface" \(result: "prop1"\): diff --git a/Tests/RunCMake/Configure/CustomTargetAfterError-result.txt b/Tests/RunCMake/Configure/CustomTargetAfterError-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Configure/CustomTargetAfterError-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Configure/CustomTargetAfterError-stderr.txt b/Tests/RunCMake/Configure/CustomTargetAfterError-stderr.txt new file mode 100644 index 0000000..7ce7daf --- /dev/null +++ b/Tests/RunCMake/Configure/CustomTargetAfterError-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at CustomTargetAfterError.cmake:1 \(message\): + Error before add_custom_target +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at CustomTargetAfterError.cmake:3 \(message\): + Error after add_custom_target +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Configure/CustomTargetAfterError.cmake b/Tests/RunCMake/Configure/CustomTargetAfterError.cmake new file mode 100644 index 0000000..3e26455 --- /dev/null +++ b/Tests/RunCMake/Configure/CustomTargetAfterError.cmake @@ -0,0 +1,3 @@ +message(SEND_ERROR "Error before add_custom_target") +add_custom_target(foo COMMAND echo) +message(SEND_ERROR "Error after add_custom_target") diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake index 5ef0384..58e1a2a 100644 --- a/Tests/RunCMake/Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(CustomTargetAfterError) run_cmake(ErrorLogs) run_cmake(FailCopyFileABI) diff --git a/Tests/RunCMake/FPHSA/FindPseudo.cmake b/Tests/RunCMake/FPHSA/FindPseudo.cmake new file mode 100644 index 0000000..dc3558b --- /dev/null +++ b/Tests/RunCMake/FPHSA/FindPseudo.cmake @@ -0,0 +1,6 @@ +# pseudo find_module + +set(FOOBAR TRUE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Pseudo REQUIRED_VARS FOOBAR VERSION_VAR Pseudo_VERSION) diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake index 0d48fa9..bb7743c 100644 --- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake +++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake @@ -1,3 +1,28 @@ include(RunCMake) run_cmake(BadFoundVar) + +# The pseudo module will "find" a package with the given version. Check if the +# version selection code in FPHSA works correctly. +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=1.2.3.4.5") +run_cmake(any_version) + +# test EXACT mode with every subcomponent +run_cmake(exact_1) +run_cmake(exact_1.2) +run_cmake(exact_1.2.3) +run_cmake(exact_1.2.3.4) + +# now test every component with an invalid version +run_cmake(exact_0) +run_cmake(exact_2) +run_cmake(exact_1.1) +run_cmake(exact_1.3) +run_cmake(exact_1.2.2) +run_cmake(exact_1.2.4) +run_cmake(exact_1.2.3.3) +run_cmake(exact_1.2.3.5) + +# check if searching for a version 0 works +list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0") +run_cmake(exact_0_matching) diff --git a/Tests/RunCMake/FPHSA/any_version.cmake b/Tests/RunCMake/FPHSA/any_version.cmake new file mode 100644 index 0000000..b34a540 --- /dev/null +++ b/Tests/RunCMake/FPHSA/any_version.cmake @@ -0,0 +1 @@ +find_package(Pseudo REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_0-result.txt b/Tests/RunCMake/FPHSA/exact_0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/exact_0.cmake b/Tests/RunCMake/FPHSA/exact_0.cmake new file mode 100644 index 0000000..432887b --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_0.cmake @@ -0,0 +1 @@ +find_package(Pseudo 0 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_0_matching.cmake b/Tests/RunCMake/FPHSA/exact_0_matching.cmake new file mode 100644 index 0000000..432887b --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_0_matching.cmake @@ -0,0 +1 @@ +find_package(Pseudo 0 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1.1-result.txt b/Tests/RunCMake/FPHSA/exact_1.1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/exact_1.1.cmake b/Tests/RunCMake/FPHSA/exact_1.1.cmake new file mode 100644 index 0000000..d967da9 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.1.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1.1 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1.2.2-result.txt b/Tests/RunCMake/FPHSA/exact_1.2.2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/exact_1.2.2.cmake b/Tests/RunCMake/FPHSA/exact_1.2.2.cmake new file mode 100644 index 0000000..e959f61 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.2.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1.2.2 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1.2.3.3-result.txt b/Tests/RunCMake/FPHSA/exact_1.2.3.3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.3.3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/exact_1.2.3.3.cmake b/Tests/RunCMake/FPHSA/exact_1.2.3.3.cmake new file mode 100644 index 0000000..af53cc8 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.3.3.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1.2.3.3 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1.2.3.4.cmake b/Tests/RunCMake/FPHSA/exact_1.2.3.4.cmake new file mode 100644 index 0000000..1e2baa6 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.3.4.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1.2.3.4 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1.2.3.5-result.txt b/Tests/RunCMake/FPHSA/exact_1.2.3.5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.3.5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/exact_1.2.3.5.cmake b/Tests/RunCMake/FPHSA/exact_1.2.3.5.cmake new file mode 100644 index 0000000..ddb0d13 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.3.5.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1.2.3.5 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1.2.3.cmake b/Tests/RunCMake/FPHSA/exact_1.2.3.cmake new file mode 100644 index 0000000..bf9b2a3 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.3.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1.2.3 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1.2.4-result.txt b/Tests/RunCMake/FPHSA/exact_1.2.4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/exact_1.2.4.cmake b/Tests/RunCMake/FPHSA/exact_1.2.4.cmake new file mode 100644 index 0000000..548a079 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.4.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1.2.4 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1.2.cmake b/Tests/RunCMake/FPHSA/exact_1.2.cmake new file mode 100644 index 0000000..080d961 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.2.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1.2 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1.3-result.txt b/Tests/RunCMake/FPHSA/exact_1.3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/exact_1.3.cmake b/Tests/RunCMake/FPHSA/exact_1.3.cmake new file mode 100644 index 0000000..e36b0c5 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.3.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1.3 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1.cmake b/Tests/RunCMake/FPHSA/exact_1.cmake new file mode 100644 index 0000000..adadbc4 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1 EXACT REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_2-result.txt b/Tests/RunCMake/FPHSA/exact_2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/exact_2.cmake b/Tests/RunCMake/FPHSA/exact_2.cmake new file mode 100644 index 0000000..55353a8 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_2.cmake @@ -0,0 +1 @@ +find_package(Pseudo 2 EXACT REQUIRED) diff --git a/Tests/RunCMake/File_Generate/CMakeLists.txt b/Tests/RunCMake/File_Generate/CMakeLists.txt index 12cd3c7..bc0cf5d 100644 --- a/Tests/RunCMake/File_Generate/CMakeLists.txt +++ b/Tests/RunCMake/File_Generate/CMakeLists.txt @@ -1,3 +1,6 @@ cmake_minimum_required(VERSION 2.8.4) project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) +if(NOT TEST_FILE) + set(TEST_FILE ${RunCMake_TEST}.cmake) +endif() +include(${TEST_FILE}) diff --git a/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt b/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt index 9fe39cc..e823b25 100644 --- a/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt +++ b/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt @@ -1,4 +1,4 @@ CMake Error at EmptyCondition1.cmake:2 \(file\): file Incorrect arguments to GENERATE subcommand. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/File_Generate/EmptyCondition2-stderr.txt b/Tests/RunCMake/File_Generate/EmptyCondition2-stderr.txt index 73d5f25..b042946 100644 --- a/Tests/RunCMake/File_Generate/EmptyCondition2-stderr.txt +++ b/Tests/RunCMake/File_Generate/EmptyCondition2-stderr.txt @@ -1,4 +1,4 @@ CMake Error at EmptyCondition2.cmake:2 \(file\): file CONDITION of sub-command GENERATE must not be empty if specified. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index f23fa19..dee0692 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -1,8 +1,8 @@ include(RunCMake) run_cmake(CommandConflict) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio" OR "${RunCMake_GENERATOR}" MATCHES "XCode" ) - run_cmake(OutputConflict) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) + run_cmake(OutputConflict) endif() run_cmake(EmptyCondition1) run_cmake(EmptyCondition2) @@ -12,10 +12,10 @@ run_cmake(DebugEvaluate) set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") -set(RunCMake_TEST_FILE "WriteIfDifferent") +set(RunCMake_TEST_OPTIONS "-DTEST_FILE=WriteIfDifferent.cmake") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/WriteIfDifferent-build") run_cmake(WriteIfDifferent-prepare) -unset(RunCMake_TEST_FILE) +unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_BINARY_DIR) file(TIMESTAMP "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt" timestamp ${timeformat}) if(NOT timestamp) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake index 924976e..89ce4c6 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake @@ -26,7 +26,7 @@ endif() pkg_check_modules(FOO "${expected_path}") -if(NOT "FOO_FOUND") +if(NOT FOO_FOUND) message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") endif() @@ -36,6 +36,6 @@ set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) pkg_check_modules(BAR "${expected_path}" NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) -if(NOT "BAR_FOUND") +if(NOT BAR_FOUND) message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake index 4a66e85..c903279 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake @@ -46,6 +46,6 @@ endif() pkg_check_modules(FOO "${expected_path}") -if(NOT "FOO_FOUND") +if(NOT FOO_FOUND) message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake index 0b057b8..a52bcbf 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake @@ -46,6 +46,6 @@ endif() pkg_check_modules(FOO "${expected_path}" NO_CMAKE_ENVIRONMENT_PATH) -if(NOT "FOO_FOUND") +if(NOT FOO_FOUND) message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake index a3154f1..2fabe5b 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake @@ -46,6 +46,6 @@ endif() pkg_check_modules(FOO "${expected_path}" NO_CMAKE_PATH) -if(NOT "FOO_FOUND") +if(NOT FOO_FOUND) message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") endif() diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..831edad --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE:empty> + + TARGET_PDB_FILE is not supported by the target linker. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_PDB_FILE:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..e5f21e2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidTarget-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE:empty> + + TARGET_PDB_FILE is allowed only for targets with linker created artifacts. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_PDB_FILE:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index c8f3fdf..6c32393 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -16,3 +16,10 @@ run_cmake(NonValidTarget-C_COMPILER_VERSION) run_cmake(NonValidTarget-CXX_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_PROPERTY) run_cmake(NonValidTarget-TARGET_POLICY) + +if(LINKER_SUPPORTS_PDB) + run_cmake(NonValidTarget-TARGET_PDB_FILE) + run_cmake(ValidTarget-TARGET_PDB_FILE) +else() + run_cmake(NonValidCompiler-TARGET_PDB_FILE) +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake new file mode 100644 index 0000000..748d14f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake @@ -0,0 +1,17 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT) + +list(GET TEST_TXT 0 PDB_PATH) +list(GET TEST_TXT 1 PDB_NAME) +list(GET TEST_TXT 2 PDB_DIR) + +if(NOT PDB_PATH MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_PATH [${PDB_PATH}]") +endif() + +if(NOT PDB_NAME STREQUAL "empty.pdb") + message(FATAL_ERROR "unexpected PDB_NAME [${PDB_NAME}]") +endif() + +if(PDB_DIR MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_DIR [${PDB_DIR}]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..38e47f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,19 @@ + +enable_language(C) + +add_library(empty SHARED empty.c) + +if(CMAKE_CONFIGURATION_TYPES) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) +endif() + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT +[[$<TARGET_PDB_FILE:empty> +$<TARGET_PDB_FILE_NAME:empty> +$<TARGET_PDB_FILE_DIR:empty> +]] + ${GENERATE_CONDITION} +) diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatform-result.txt b/Tests/RunCMake/GeneratorPlatform/BadPlatform-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatform-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatform-stderr.txt b/Tests/RunCMake/GeneratorPlatform/BadPlatform-stderr.txt new file mode 100644 index 0000000..e315714 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatform-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + does not support platform specification, but platform + + Bad Platform + + was specified.$ diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatform-toolchain.cmake b/Tests/RunCMake/GeneratorPlatform/BadPlatform-toolchain.cmake new file mode 100644 index 0000000..1c544b0 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatform-toolchain.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR_PLATFORM "Bad Platform") diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatform.cmake b/Tests/RunCMake/GeneratorPlatform/BadPlatform.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatform.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-result.txt b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-stderr.txt b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-stderr.txt new file mode 100644 index 0000000..e315714 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + does not support platform specification, but platform + + Bad Platform + + was specified.$ diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain.cmake b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt b/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorPlatform/NoPlatform-result.txt b/Tests/RunCMake/GeneratorPlatform/NoPlatform-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/NoPlatform-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorPlatform/NoPlatform-stderr.txt b/Tests/RunCMake/GeneratorPlatform/NoPlatform-stderr.txt new file mode 100644 index 0000000..e1c0da4 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/NoPlatform-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoPlatform.cmake:2 \(message\): + CMAKE_GENERATOR_PLATFORM is empty as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorPlatform/NoPlatform.cmake b/Tests/RunCMake/GeneratorPlatform/NoPlatform.cmake new file mode 100644 index 0000000..1e0ca6d --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/NoPlatform.cmake @@ -0,0 +1,7 @@ +if("x${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x") + message(FATAL_ERROR "CMAKE_GENERATOR_PLATFORM is empty as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_PLATFORM is \"${CMAKE_GENERATOR_PLATFORM}\" " + "but should be empty!") +endif() diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake new file mode 100644 index 0000000..4d0a0a1 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake @@ -0,0 +1,28 @@ +include(RunCMake) + +set(RunCMake_GENERATOR_PLATFORM "") +run_cmake(NoPlatform) + +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[0124])( 20[0-9][0-9])?$") + set(RunCMake_GENERATOR_PLATFORM "x64") + run_cmake(x64Platform) +else() + set(RunCMake_GENERATOR_PLATFORM "Bad Platform") + run_cmake(BadPlatform) +endif() + +set(RunCMake_GENERATOR_TOOLSET "") + +set(RunCMake_TEST_OPTIONS -A "Extra Platform") +run_cmake(TwoPlatforms) +unset(RunCMake_TEST_OPTIONS) + +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[0124])( 20[0-9][0-9])?$") + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestPlatform-toolchain.cmake) + run_cmake(TestPlatformToolchain) + unset(RunCMake_TEST_OPTIONS) +else() + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/BadPlatform-toolchain.cmake) + run_cmake(BadPlatformToolchain) + unset(RunCMake_TEST_OPTIONS) +endif() diff --git a/Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake b/Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake new file mode 100644 index 0000000..763478c --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR_PLATFORM "Test Platform") diff --git a/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-result.txt b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt new file mode 100644 index 0000000..b9bb3b2 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TestPlatformToolchain.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_PLATFORM is "Test Platform" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at TestPlatformToolchain.cmake:[0-9]+ \(message\): + CMAKE_VS_PLATFORM_NAME is "Test Platform" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain.cmake b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain.cmake new file mode 100644 index 0000000..c4430a5 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain.cmake @@ -0,0 +1,16 @@ +if("x${CMAKE_GENERATOR_PLATFORM}" STREQUAL "xTest Platform") + message(SEND_ERROR "CMAKE_GENERATOR_PLATFORM is \"Test Platform\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_PLATFORM is \"${CMAKE_GENERATOR_PLATFORM}\" " + "but should be \"Test Platform\"!") +endif() +if(CMAKE_GENERATOR MATCHES "Visual Studio") + if("x${CMAKE_VS_PLATFORM_NAME}" STREQUAL "xTest Platform") + message(SEND_ERROR "CMAKE_VS_PLATFORM_NAME is \"Test Platform\" as expected.") + else() + message(FATAL_ERROR + "CMAKE_VS_PLATFORM_NAME is \"${CMAKE_VS_PLATFORM_NAME}\" " + "but should be \"Test Platform\"!") + endif() +endif() diff --git a/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-result.txt b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-stderr.txt b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-stderr.txt new file mode 100644 index 0000000..90e4eca --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-stderr.txt @@ -0,0 +1 @@ +CMake Error: Multiple -A options not allowed diff --git a/Tests/RunCMake/GeneratorPlatform/TwoPlatforms.cmake b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt b/Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt new file mode 100644 index 0000000..05a83ff --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_GENERATOR_PLATFORM is 'x64' as expected. +-- CMAKE_VS_PLATFORM_NAME is 'x64' as expected. diff --git a/Tests/RunCMake/GeneratorPlatform/x64Platform.cmake b/Tests/RunCMake/GeneratorPlatform/x64Platform.cmake new file mode 100644 index 0000000..a23bdc7 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/x64Platform.cmake @@ -0,0 +1,7 @@ +foreach(v CMAKE_GENERATOR_PLATFORM CMAKE_VS_PLATFORM_NAME) + if("x${${v}}" STREQUAL "xx64") + message(STATUS "${v} is 'x64' as expected.") + else() + message(FATAL_ERROR "${v} is '${${v}}' but should be 'x64'!") + endif() +endforeach() diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index d39f33f..6220657 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) set(RunCMake_GENERATOR_TOOLSET "") run_cmake(NoToolset) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012]|Xcode" AND NOT XCODE_BELOW_3) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[0124]|Xcode" AND NOT XCODE_BELOW_3) set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) else() @@ -17,7 +17,7 @@ set(RunCMake_TEST_OPTIONS -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012]|Xcode" AND NOT XCODE_BELOW_3) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[0124]|Xcode" AND NOT XCODE_BELOW_3) set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake) run_cmake(TestToolsetToolchain) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt index a5d5d50..3a7f480 100644 --- a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt +++ b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt @@ -1,7 +1,9 @@ -CMake Error: +CMake Error at LINK_LANGUAGE-genex.cmake:[0-9]+ \(target_link_libraries\): Error evaluating generator expression: \$<TARGET_PROPERTY:LINKER_LANGUAGE> LINKER_LANGUAGE target property can not be used while evaluating link - libraries + libraries for a static library +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt b/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt index 2d7a3c9..d8bc238 100644 --- a/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt +++ b/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt @@ -1,7 +1,9 @@ -CMake Error: +CMake Error at link-libraries-TARGET_FILE-genex.cmake:[0-9]+ \(target_link_libraries\): Error evaluating generator expression: \$<TARGET_FILE:foo> Expressions which require the linker language may not be used while evaluating link libraries +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt index b31225b..a09552b 100644 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt @@ -3,6 +3,7 @@ CMake Error at BadObjSource1.cmake:1 \(add_library\): bad.def - but may contain only headers and sources that compile. + but may contain only sources that compile, header files, and other files + that would not affect linking of a normal library. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt index 906cf0b..b91ffd0 100644 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt @@ -3,6 +3,7 @@ CMake Error at BadObjSource2.cmake:1 \(add_library\): bad.obj - but may contain only headers and sources that compile. + but may contain only sources that compile, header files, and other files + that would not affect linking of a normal library. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 4ed2f43..56d69c8 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -38,9 +38,6 @@ function(run_cmake test) if(NOT DEFINED RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS "") endif() - if (NOT RunCMake_TEST_FILE) - set(RunCMake_TEST_FILE "${test}") - endif() if(APPLE) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) endif() @@ -56,8 +53,9 @@ function(run_cmake test) execute_process( COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" -G "${RunCMake_GENERATOR}" + -A "${RunCMake_GENERATOR_PLATFORM}" -T "${RunCMake_GENERATOR_TOOLSET}" - -DRunCMake_TEST=${RunCMake_TEST_FILE} + -DRunCMake_TEST=${test} --no-warn-unused-cli ${RunCMake_TEST_OPTIONS} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" diff --git a/Tests/RunCMake/Syntax/Unquoted1-stderr.txt b/Tests/RunCMake/Syntax/Unquoted1-stderr.txt index ff8194a..85a7a9d 100644 --- a/Tests/RunCMake/Syntax/Unquoted1-stderr.txt +++ b/Tests/RunCMake/Syntax/Unquoted1-stderr.txt @@ -1 +1 @@ -^\[\]\[=\]\[\$\$\(MV\)-DSTR=" \[="\[;\]$ +^\[\]\[=\]\[\$\$\(MV\)-DSTR=" \[="\[;\]\]\[$ diff --git a/Tests/RunCMake/Syntax/Unquoted1.cmake b/Tests/RunCMake/Syntax/Unquoted1.cmake index 0344fbd..515161f 100644 --- a/Tests/RunCMake/Syntax/Unquoted1.cmake +++ b/Tests/RunCMake/Syntax/Unquoted1.cmake @@ -1 +1 @@ -message([] [=] [$ $(MV) -DSTR=" [=" [;]) +message([] [=] [$ $(MV) -DSTR=" [=" [;] ] [) diff --git a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt index 92f2c91..b78189e 100644 --- a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt +++ b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadContext.cmake:2 \(file\): +(CMake Error at BadContext.cmake:4 \(file\): Error evaluating generator expression: \$<TARGET_OBJECTS:NoTarget> @@ -7,7 +7,17 @@ CMake Error at BadContext.cmake:2 \(file\): for consumption by CMake. It is not suitable for writing out elsewhere. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) -+ +*)+ +(CMake Error at BadContext.cmake:5 \(file\): + Error evaluating generator expression: + + \$<TARGET_OBJECTS:NoTarget> + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake. It is not suitable for writing out elsewhere. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +*)+ CMake Error: Error evaluating generator expression: diff --git a/Tests/RunCMake/TargetObjects/BadContext.cmake b/Tests/RunCMake/TargetObjects/BadContext.cmake index 67962a4..5d7e33e 100644 --- a/Tests/RunCMake/TargetObjects/BadContext.cmake +++ b/Tests/RunCMake/TargetObjects/BadContext.cmake @@ -1,4 +1,7 @@ +add_library(iface INTERFACE) +target_sources(iface INTERFACE $<TARGET_OBJECTS:NoTarget>) file(GENERATE OUTPUT test_output CONTENT $<TARGET_OBJECTS:NoTarget>) +file(GENERATE OUTPUT test_output2 CONTENT $<TARGET_PROPERTY:iface,INTERFACE_SOURCES>) install(FILES $<TARGET_OBJECTS:NoTarget> DESTINATION objects) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt new file mode 100644 index 0000000..7e002f5 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at LinkImplementationCycle1.cmake:5 \(target_link_libraries\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:INCLUDE_DIRECTORIES> + + \$<TARGET_PROPERTY:...> expression in link libraries evaluation depends on + target property which is transitive over the link libraries, creating a + recursion. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake new file mode 100644 index 0000000..4b60214 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake @@ -0,0 +1,8 @@ + +add_library(empty1 empty.cpp) +add_library(empty2 empty.cpp) + +target_link_libraries(empty1 + LINK_PUBLIC + $<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2> +) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt new file mode 100644 index 0000000..2f72de6 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at LinkImplementationCycle2.cmake:5 \(target_link_libraries\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES> + + \$<TARGET_PROPERTY:...> expression in link libraries evaluation depends on + target property which is transitive over the link libraries, creating a + recursion. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake new file mode 100644 index 0000000..557eac1 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake @@ -0,0 +1,8 @@ + +add_library(empty1 empty.cpp) +add_library(empty2 empty.cpp) + +target_link_libraries(empty1 + LINK_PUBLIC + $<$<STREQUAL:$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>,/foo/bar>:empty2> +) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake new file mode 100644 index 0000000..0f921d4 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake @@ -0,0 +1,10 @@ + +add_library(empty1 empty.cpp) +add_library(empty2 empty.cpp) + +# This is OK, because evaluating the INCLUDE_DIRECTORIES is not affected by +# the content of the INTERFACE_LINK_LIBRARIES. +target_link_libraries(empty1 + INTERFACE + $<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2> +) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt new file mode 100644 index 0000000..5cfeb0a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: + Error evaluating generator expression: + + \$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES> + + \$<TARGET_PROPERTY:...> expression in link libraries evaluation depends on + target property which is transitive over the link libraries, creating a + recursion. diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake new file mode 100644 index 0000000..ab6d0b2 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake @@ -0,0 +1,14 @@ + +add_library(empty1 empty.cpp) +add_library(empty2 empty.cpp) + +# The INTERFACE_INCLUDE_DIRECTORIES do not depend on the link interface. +# On its own, this is fine. It is only when used by empty3 that an error +# is appropriately issued. +target_link_libraries(empty1 + INTERFACE + $<$<STREQUAL:$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>,/foo/bar>:empty2> +) + +add_library(empty3 empty.cpp) +target_link_libraries(empty3 empty1) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt new file mode 100644 index 0000000..5cfeb0a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: + Error evaluating generator expression: + + \$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES> + + \$<TARGET_PROPERTY:...> expression in link libraries evaluation depends on + target property which is transitive over the link libraries, creating a + recursion. diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake new file mode 100644 index 0000000..dc180e3 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake @@ -0,0 +1,10 @@ + +add_library(empty1 INTERFACE IMPORTED) +add_library(empty2 INTERFACE IMPORTED) + +set_property(TARGET empty1 PROPERTY INTERFACE_LINK_LIBRARIES + $<$<STREQUAL:$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>,/foo/bar>:empty2> +) + +add_library(empty3 empty.cpp) +target_link_libraries(empty3 empty1) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt new file mode 100644 index 0000000..5cfeb0a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: + Error evaluating generator expression: + + \$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES> + + \$<TARGET_PROPERTY:...> expression in link libraries evaluation depends on + target property which is transitive over the link libraries, creating a + recursion. diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake new file mode 100644 index 0000000..91252d0 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake @@ -0,0 +1,14 @@ + +add_library(empty1 SHARED empty.cpp) +add_library(empty2 SHARED empty.cpp) + +# The INTERFACE_INCLUDE_DIRECTORIES do not depend on the link interface. +# On its own, this is fine. It is only when used by empty3 that an error +# is appropriately issued. +target_link_libraries(empty1 + INTERFACE + $<$<STREQUAL:$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>,/foo/bar>:empty2> +) + +add_library(empty3 SHARED empty.cpp) +target_link_libraries(empty3 empty1) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake index 0ee3238..645a57d 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake @@ -15,3 +15,9 @@ run_cmake(BadInvalidName5) run_cmake(BadInvalidName6) run_cmake(BadInvalidName7) run_cmake(BadInvalidName8) +run_cmake(LinkImplementationCycle1) +run_cmake(LinkImplementationCycle2) +run_cmake(LinkImplementationCycle3) +run_cmake(LinkImplementationCycle4) +run_cmake(LinkImplementationCycle5) +run_cmake(LinkImplementationCycle6) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp b/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt new file mode 100644 index 0000000..cf8578e --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + A prefix must be specified +Call Stack \(most recent call first\): + EmptyPrefix.cmake:[0-9]+ \(write_compiler_detection_header\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake new file mode 100644 index 0000000..eda6b18 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX "" + VERSION 3.1 + COMPILERS GNU + FEATURES cxx_final +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt new file mode 100644 index 0000000..ea1bf67 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + The prefix must be a valid C identifier. +Call Stack \(most recent call first\): + InvalidPrefix.cmake:[0-9]+ \(write_compiler_detection_header\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake new file mode 100644 index 0000000..6599f35 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX "0compile" + VERSION 3.1 + COMPILERS GNU + FEATURES cxx_final +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt index 842eb3f..8d4db34 100644 --- a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt @@ -1,5 +1,9 @@ CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): - VERSION parameter too low. + VERSION compatibility for write_compiler_detection_header is set to 3.0, + which is too low. It must be set to at least 3.1.0. Either set the + VERSION parameter to the write_compiler_detection_header function, or + update your minimum required CMake version with the cmake_minimum_required + command. Call Stack \(most recent call first\): OldVersion.cmake:4 \(write_compiler_detection_header\) CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake index be79d41..6dded44 100644 --- a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake @@ -10,3 +10,5 @@ run_cmake(OldVersion) run_cmake(InvalidCompiler) run_cmake(InvalidFeature) run_cmake(InvalidCXXFeature) +run_cmake(EmptyPrefix) +run_cmake(InvalidPrefix) diff --git a/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt b/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt new file mode 100644 index 0000000..561a6b1 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt @@ -0,0 +1,8 @@ +-- Before Installing +-- Installing: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Installing: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- After Installing diff --git a/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake b/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake new file mode 100644 index 0000000..0bc1d18 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake @@ -0,0 +1,10 @@ +set(src ${CMAKE_CURRENT_SOURCE_DIR}/dir) +set(dst ${CMAKE_CURRENT_BINARY_DIR}/dir) +file(REMOVE RECURSE ${dst}) +message(STATUS "Before Installing") +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_NEVER) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_LAZY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_ALWAYS) +message(STATUS "After Installing") diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt new file mode 100644 index 0000000..557b817 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt @@ -0,0 +1,32 @@ +CMake Error at INSTALL-MESSAGE-bad.cmake:1 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:2 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:3 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:4 \(file\): + file option MESSAGE_ALWAYS may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:5 \(file\): + file option MESSAGE_LAZY may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:6 \(file\): + file option MESSAGE_NEVER may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake b/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake new file mode 100644 index 0000000..f878c69 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake @@ -0,0 +1,6 @@ +file(INSTALL DESTINATION dir MESSAGE_ALWAYS MESSAGE_LAZY) +file(INSTALL DESTINATION dir MESSAGE_ALWAYS MESSAGE_NEVER) +file(INSTALL DESTINATION dir MESSAGE_LAZY MESSAGE_NEVER) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_ALWAYS) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_LAZY) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_NEVER) diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 7b05229..bf14263 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -1,3 +1,5 @@ include(RunCMake) +run_cmake(INSTALL-DIRECTORY) +run_cmake(INSTALL-MESSAGE-bad) run_cmake(FileOpenFailRead) diff --git a/Tests/RunCMake/file/dir/empty.txt b/Tests/RunCMake/file/dir/empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/dir/empty.txt diff --git a/Tests/RunCMake/include_directories/BinaryDirectoryInInterface.cmake b/Tests/RunCMake/include_directories/BinaryDirectoryInInterface.cmake index 8754540..67ee7de 100644 --- a/Tests/RunCMake/include_directories/BinaryDirectoryInInterface.cmake +++ b/Tests/RunCMake/include_directories/BinaryDirectoryInInterface.cmake @@ -1,5 +1,5 @@ -project(BinaryDirectoryInInterface) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/foo") diff --git a/Tests/RunCMake/include_directories/CMakeLists.txt b/Tests/RunCMake/include_directories/CMakeLists.txt index 3482e6b..5cd4825 100644 --- a/Tests/RunCMake/include_directories/CMakeLists.txt +++ b/Tests/RunCMake/include_directories/CMakeLists.txt @@ -1,3 +1,6 @@ cmake_minimum_required(VERSION 3.0) -project(${RunCMake_TEST} CXX) -include(${RunCMake_TEST}.cmake) +project(${RunCMake_TEST} NONE) +if(NOT TEST_FILE) + set(TEST_FILE ${RunCMake_TEST}.cmake) +endif() +include(${TEST_FILE}) diff --git a/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt b/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt index 71e6456..8dff90f 100644 --- a/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt +++ b/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt @@ -5,7 +5,7 @@ CMake Debug Log at DebugIncludes.cmake:8 \(include_directories\): \* .*/Tests/RunCMake/include_directories/two Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + CMake Debug Log at DebugIncludes.cmake:13 \(set_property\): Used includes for target lll: @@ -13,7 +13,7 @@ CMake Debug Log at DebugIncludes.cmake:13 \(set_property\): \* .*/Tests/RunCMake/include_directories/three Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + CMake Debug Log at DebugIncludes.cmake:18 \(include_directories\): Used includes for target lll: @@ -21,7 +21,7 @@ CMake Debug Log at DebugIncludes.cmake:18 \(include_directories\): \* .*/Tests/RunCMake/include_directories/four Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + CMake Debug Log at DebugIncludes.cmake:33 \(set_property\): Used includes for target lll: @@ -33,7 +33,7 @@ CMake Debug Log at DebugIncludes.cmake:33 \(set_property\): Call Stack \(most recent call first\): DebugIncludes.cmake:44 \(some_macro\) DebugIncludes.cmake:47 \(some_function\) - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + CMake Debug Log at DebugIncludes.cmake:30 \(target_link_libraries\): Used includes for target lll: @@ -41,7 +41,7 @@ CMake Debug Log at DebugIncludes.cmake:30 \(target_link_libraries\): \* .*/Tests/RunCMake/include_directories/eight Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + CMake Debug Log at DebugIncludes.cmake:55 \(set_property\): Used includes for target lll: @@ -50,4 +50,4 @@ CMake Debug Log at DebugIncludes.cmake:55 \(set_property\): \* .*/Tests/RunCMake/include_directories/ten Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/include_directories/DebugIncludes.cmake b/Tests/RunCMake/include_directories/DebugIncludes.cmake index bbc9e46..10a4c50 100644 --- a/Tests/RunCMake/include_directories/DebugIncludes.cmake +++ b/Tests/RunCMake/include_directories/DebugIncludes.cmake @@ -1,5 +1,5 @@ -project(DebugIncludes) +enable_language(CXX) set(CMAKE_DEBUG_TARGET_PROPERTIES INCLUDE_DIRECTORIES) diff --git a/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake b/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake index d6f08bd..fab7717 100644 --- a/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake +++ b/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library(testTarget empty.cpp) target_include_directories(testTarget INTERFACE "${CMAKE_INSTALL_PREFIX}/dir") diff --git a/Tests/RunCMake/include_directories/ImportedTarget.cmake b/Tests/RunCMake/include_directories/ImportedTarget.cmake index e1a20b1..f752f98 100644 --- a/Tests/RunCMake/include_directories/ImportedTarget.cmake +++ b/Tests/RunCMake/include_directories/ImportedTarget.cmake @@ -1,5 +1,5 @@ -project(ImportedTarget) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake b/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake index 0f08e58..8d777f5 100644 --- a/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake +++ b/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake @@ -1,5 +1,5 @@ -project(InstallPrefixInInterface) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") target_include_directories(testTarget INTERFACE "${CMAKE_INSTALL_PREFIX}/foo") diff --git a/Tests/RunCMake/include_directories/RelativePathInGenex.cmake b/Tests/RunCMake/include_directories/RelativePathInGenex.cmake index f72cf3a..070a381 100644 --- a/Tests/RunCMake/include_directories/RelativePathInGenex.cmake +++ b/Tests/RunCMake/include_directories/RelativePathInGenex.cmake @@ -1,5 +1,5 @@ -project(RelativePathInInterface) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>") diff --git a/Tests/RunCMake/include_directories/RelativePathInInterface.cmake b/Tests/RunCMake/include_directories/RelativePathInInterface.cmake index f2ce54a..4c4727d 100644 --- a/Tests/RunCMake/include_directories/RelativePathInInterface.cmake +++ b/Tests/RunCMake/include_directories/RelativePathInInterface.cmake @@ -1,5 +1,5 @@ -project(RelativePathInInterface) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "foo") diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index c5b29d0..fa76f24 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -31,19 +31,22 @@ configure_file( "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" COPYONLY ) -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix") -set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface") +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix" + "-DTEST_FILE=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" + ) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/copy") run_cmake(InstallInSrcDir) unset(RunCMake_TEST_SOURCE_DIR) -unset(RunCMake_TEST_FILE) set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix") +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix" + "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake" + ) set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/InstallInBinDir-build") -set(RunCMake_TEST_FILE "${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface") run_cmake(InstallInBinDir) unset(RunCMake_TEST_BINARY_DIR) -unset(RunCMake_TEST_FILE) configure_file( "${RunCMake_SOURCE_DIR}/CMakeLists.txt" @@ -68,22 +71,25 @@ foreach(policyStatus "" NEW OLD) unset(policyOption) set(policyStatus WARN) endif() - set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} + "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake" + ) # Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run # the test suite in-source properly. Otherwise the install directory would be # a subdirectory or the source directory, which is allowed and tested separately # below. set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build") - set(RunCMake_TEST_FILE "${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface") run_cmake(BinInInstallPrefix-CMP0052-${policyStatus}) unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_FILE) - set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface") + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} + "-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake" + ) run_cmake(SrcInInstallPrefix-CMP0052-${policyStatus}) unset(RunCMake_TEST_SOURCE_DIR) - unset(RunCMake_TEST_FILE) endforeach() set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix") @@ -104,12 +110,13 @@ configure_file( "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake" COPYONLY ) -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface/prefix") -set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface") +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface/prefix" + "-DTEST_FILE=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake" + ) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrc") run_cmake(InstallToPrefixInSrcDirOutOfSource) unset(RunCMake_TEST_SOURCE_DIR) -unset(RunCMake_TEST_FILE) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/installToSrcInSrc") @@ -131,12 +138,13 @@ configure_file( COPYONLY ) -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface/prefix") -set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface") +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface/prefix" + "-DTEST_FILE=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface.cmake" + ) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") run_cmake(InstallToPrefixInSrcDirInSource) unset(RunCMake_TEST_SOURCE_DIR) unset(RunCMake_TEST_BINARY_DIR) -unset(RunCMake_TEST_FILE) unset(RunCMake_TEST_NO_CLEAN) diff --git a/Tests/RunCMake/include_directories/SourceDirectoryInInterface.cmake b/Tests/RunCMake/include_directories/SourceDirectoryInInterface.cmake index c9a9c45..f814a3c 100644 --- a/Tests/RunCMake/include_directories/SourceDirectoryInInterface.cmake +++ b/Tests/RunCMake/include_directories/SourceDirectoryInInterface.cmake @@ -1,5 +1,5 @@ -project(SourceDirectoryInInterface) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/foo") diff --git a/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt b/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt index 481e358..4e15de1 100644 --- a/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt +++ b/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt @@ -1,4 +1,4 @@ CMake Error at TID-bad-target.cmake:6 \(target_include_directories\): target_include_directories called with non-compilable target type Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/include_directories/export-NOWARN.cmake b/Tests/RunCMake/include_directories/export-NOWARN.cmake index 307ce5a..50720a0 100644 --- a/Tests/RunCMake/include_directories/export-NOWARN.cmake +++ b/Tests/RunCMake/include_directories/export-NOWARN.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library(foo empty.cpp) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<0:>/include/subdir) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_PREFIX>/include/subdir) diff --git a/Tests/RunCMake/include_directories/incomplete-genex.cmake b/Tests/RunCMake/include_directories/incomplete-genex.cmake index b6900a4..976695a 100644 --- a/Tests/RunCMake/include_directories/incomplete-genex.cmake +++ b/Tests/RunCMake/include_directories/incomplete-genex.cmake @@ -1,4 +1,4 @@ -project(incomplete-genex) +enable_language(CXX) cmake_policy(SET CMP0022 NEW) cmake_policy(SET CMP0023 NEW) diff --git a/Tests/RunCMake/include_external_msproject/check_utils.cmake b/Tests/RunCMake/include_external_msproject/check_utils.cmake index 7f5ef53..408cadb 100644 --- a/Tests/RunCMake/include_external_msproject/check_utils.cmake +++ b/Tests/RunCMake/include_external_msproject/check_utils.cmake @@ -80,7 +80,9 @@ function(check_project test name guid type platform) set(type 8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942) endif() if(NOT platform) - if("${RunCMake_GENERATOR}" MATCHES "Win64") + if(RunCMake_GENERATOR_PLATFORM) + set(platform "${RunCMake_GENERATOR_PLATFORM}") + elseif("${RunCMake_GENERATOR}" MATCHES "Win64") set(platform "x64") else() set(platform "Win32") diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake new file mode 100644 index 0000000..2c716e1 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake @@ -0,0 +1,13 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix) +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +if(out MATCHES "-- Installing: [^\n]*prefix/dir") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}Installation output was not quiet:\n${out}") +endif() +set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt) +if(NOT EXISTS "${f}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n") +endif() diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake new file mode 100644 index 0000000..eefb837 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake @@ -0,0 +1,3 @@ +set(CMAKE_INSTALL_MESSAGE "ALWAYS") +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix") +install(DIRECTORY dir/ DESTINATION dir MESSAGE_NEVER) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt new file mode 100644 index 0000000..166ba6f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at DIRECTORY-PATTERN-MESSAGE_NEVER.cmake:[0-9]+ \(install\): + install DIRECTORY does not allow "MESSAGE_NEVER" after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake new file mode 100644 index 0000000..de844f7 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake @@ -0,0 +1 @@ +install(DIRECTORY src DESTINATION src PATTERN *.txt MESSAGE_NEVER) diff --git a/Tests/RunCMake/install/DIRECTORY-message-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-check.cmake new file mode 100644 index 0000000..857681f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message-check.cmake @@ -0,0 +1,28 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix) +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +set(expect " +-- Installing: [^\n]*/prefix/dir\r? +-- Installing: [^\n]*/prefix/dir/empty.txt\r? +") +if(NOT out MATCHES "${expect}") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}First install did not say 'Installing' as expected:\n${out}") +endif() +set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt) +if(NOT EXISTS "${f}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n") +endif() +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +set(expect " +-- Up-to-date: [^\n]*/prefix/dir\r? +-- Up-to-date: [^\n]*/prefix/dir/empty.txt\r? +") +if(NOT out MATCHES "${expect}") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}Second install did not say 'Up-to-date' as expected:\n${out}") +endif() diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake new file mode 100644 index 0000000..c7e6018 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake @@ -0,0 +1,24 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix) +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +set(expect " +-- Installing: [^\n]*/prefix/dir\r? +-- Installing: [^\n]*/prefix/dir/empty.txt\r? +") +if(NOT out MATCHES "${expect}") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}First install did not say 'Installing' as expected:\n${out}") +endif() +set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt) +if(NOT EXISTS "${f}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n") +endif() +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +if(out MATCHES "(Installing|Up-to-date)") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}Second install was not silent as expected:\n${out}") +endif() diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake new file mode 100644 index 0000000..ed43567 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake @@ -0,0 +1,3 @@ +set(CMAKE_INSTALL_MESSAGE "LAZY") +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix") +install(DIRECTORY dir/ DESTINATION dir) diff --git a/Tests/RunCMake/install/DIRECTORY-message.cmake b/Tests/RunCMake/install/DIRECTORY-message.cmake new file mode 100644 index 0000000..913ed15 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message.cmake @@ -0,0 +1,3 @@ +set(CMAKE_INSTALL_MESSAGE "ALWAYS") +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix") +install(DIRECTORY dir/ DESTINATION dir) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index c8dc379..53b91f3 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -1,4 +1,8 @@ include(RunCMake) +run_cmake(DIRECTORY-MESSAGE_NEVER) +run_cmake(DIRECTORY-PATTERN-MESSAGE_NEVER) +run_cmake(DIRECTORY-message) +run_cmake(DIRECTORY-message-lazy) run_cmake(SkipInstallRulesWarning) run_cmake(SkipInstallRulesNoWarning1) run_cmake(SkipInstallRulesNoWarning2) diff --git a/Tests/RunCMake/install/dir/empty.txt b/Tests/RunCMake/install/dir/empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/install/dir/empty.txt diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake index 501acd2..e83db27 100644 --- a/Tests/RunCMake/string/RunCMakeTest.cmake +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -2,3 +2,11 @@ include(RunCMake) run_cmake(Concat) run_cmake(ConcatNoArgs) + +run_cmake(Uuid) +run_cmake(UuidMissingNamespace) +run_cmake(UuidMissingNamespaceValue) +run_cmake(UuidBadNamespace) +run_cmake(UuidMissingNameValue) +run_cmake(UuidMissingTypeValue) +run_cmake(UuidBadType) diff --git a/Tests/RunCMake/string/Uuid.cmake b/Tests/RunCMake/string/Uuid.cmake new file mode 100644 index 0000000..2613d26 --- /dev/null +++ b/Tests/RunCMake/string/Uuid.cmake @@ -0,0 +1,17 @@ +set(UUID_DNS_NAMESPACE 6ba7b810-9dad-11d1-80b4-00c04fd430c8) + +string(UUID WWW_EXAMPLE_COM_MD5_UUID + NAMESPACE ${UUID_DNS_NAMESPACE} NAME www.example.com TYPE MD5) + +if(NOT WWW_EXAMPLE_COM_MD5_UUID STREQUAL "5df41881-3aed-3515-88a7-2f4a814cf09e") + message(SEND_ERROR + "UUID did not create the expected MD5 result: ${WWW_EXAMPLE_COM_MD5_UUID}") +endif() + +string(UUID WWW_EXAMPLE_COM_SHA1_UUID + NAMESPACE ${UUID_DNS_NAMESPACE} NAME www.example.com TYPE SHA1 UPPER) + +if(NOT WWW_EXAMPLE_COM_SHA1_UUID STREQUAL "2ED6657D-E927-568B-95E1-2665A8AEA6A2") + message(SEND_ERROR + "UUID did not create the expected SHA1 result: ${WWW_EXAMPLE_COM_SHA1_UUID}") +endif() diff --git a/Tests/RunCMake/string/UuidBadNamespace-result.txt b/Tests/RunCMake/string/UuidBadNamespace-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/UuidBadNamespace-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/UuidBadNamespace-stderr.txt b/Tests/RunCMake/string/UuidBadNamespace-stderr.txt new file mode 100644 index 0000000..cb12903 --- /dev/null +++ b/Tests/RunCMake/string/UuidBadNamespace-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at UuidBadNamespace.cmake:3 \(string\): + string UUID sub-command, malformed NAMESPACE UUID. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/UuidBadNamespace.cmake b/Tests/RunCMake/string/UuidBadNamespace.cmake new file mode 100644 index 0000000..f607925 --- /dev/null +++ b/Tests/RunCMake/string/UuidBadNamespace.cmake @@ -0,0 +1,4 @@ +set(UUID_DNS_NAMESPACE 6ba7b810-9dad-fooo-80b4-00c04fd430c8) + +string(UUID WWW_EXAMPLE_COM_MD5_UUID + NAMESPACE ${UUID_DNS_NAMESPACE} NAME www.example.com TYPE MD5) diff --git a/Tests/RunCMake/string/UuidBadType-result.txt b/Tests/RunCMake/string/UuidBadType-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/UuidBadType-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/UuidBadType-stderr.txt b/Tests/RunCMake/string/UuidBadType-stderr.txt new file mode 100644 index 0000000..1993c04 --- /dev/null +++ b/Tests/RunCMake/string/UuidBadType-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at UuidBadType.cmake:3 \(string\): + string UUID sub-command, unknown TYPE 'FOO'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/UuidBadType.cmake b/Tests/RunCMake/string/UuidBadType.cmake new file mode 100644 index 0000000..bf4909e --- /dev/null +++ b/Tests/RunCMake/string/UuidBadType.cmake @@ -0,0 +1,4 @@ +set(UUID_DNS_NAMESPACE 6ba7b810-9dad-11d1-80b4-00c04fd430c8) + +string(UUID WWW_EXAMPLE_COM_MD5_UUID + NAMESPACE ${UUID_DNS_NAMESPACE} NAME www.example.com TYPE FOO) diff --git a/Tests/RunCMake/string/UuidMissingNameValue-result.txt b/Tests/RunCMake/string/UuidMissingNameValue-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingNameValue-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/UuidMissingNameValue-stderr.txt b/Tests/RunCMake/string/UuidMissingNameValue-stderr.txt new file mode 100644 index 0000000..0b7cde4 --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingNameValue-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at UuidMissingNameValue.cmake:3 \(string\): + string UUID sub-command, NAME requires a value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/UuidMissingNameValue.cmake b/Tests/RunCMake/string/UuidMissingNameValue.cmake new file mode 100644 index 0000000..407a1d7 --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingNameValue.cmake @@ -0,0 +1,4 @@ +set(UUID_DNS_NAMESPACE 6ba7b810-9dad-11d1-80b4-00c04fd430c8) + +string(UUID WWW_EXAMPLE_COM_MD5_UUID + NAMESPACE ${UUID_DNS_NAMESPACE} TYPE MD5 NAME) diff --git a/Tests/RunCMake/string/UuidMissingNamespace-result.txt b/Tests/RunCMake/string/UuidMissingNamespace-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingNamespace-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/UuidMissingNamespace-stderr.txt b/Tests/RunCMake/string/UuidMissingNamespace-stderr.txt new file mode 100644 index 0000000..dfcfe42 --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingNamespace-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at UuidMissingNamespace.cmake:3 \(string\): + string UUID sub-command, malformed NAMESPACE UUID. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/UuidMissingNamespace.cmake b/Tests/RunCMake/string/UuidMissingNamespace.cmake new file mode 100644 index 0000000..5a71e4f --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingNamespace.cmake @@ -0,0 +1,4 @@ +set(UUID_DNS_NAMESPACE 6ba7b810-9dad-11d1-80b4-00c04fd430c8) + +string(UUID WWW_EXAMPLE_COM_MD5_UUID + NAME www.example.com TYPE MD5) diff --git a/Tests/RunCMake/string/UuidMissingNamespaceValue-result.txt b/Tests/RunCMake/string/UuidMissingNamespaceValue-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingNamespaceValue-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/UuidMissingNamespaceValue-stderr.txt b/Tests/RunCMake/string/UuidMissingNamespaceValue-stderr.txt new file mode 100644 index 0000000..86585ad --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingNamespaceValue-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at UuidMissingNamespaceValue.cmake:3 \(string\): + string UUID sub-command, NAMESPACE requires a value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/UuidMissingNamespaceValue.cmake b/Tests/RunCMake/string/UuidMissingNamespaceValue.cmake new file mode 100644 index 0000000..f2219c0 --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingNamespaceValue.cmake @@ -0,0 +1,4 @@ +set(UUID_DNS_NAMESPACE 6ba7b810-9dad-11d1-80b4-00c04fd430c8) + +string(UUID WWW_EXAMPLE_COM_MD5_UUID + NAME www.example.com TYPE MD5 NAMESPACE) diff --git a/Tests/RunCMake/string/UuidMissingTypeValue-result.txt b/Tests/RunCMake/string/UuidMissingTypeValue-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingTypeValue-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/UuidMissingTypeValue-stderr.txt b/Tests/RunCMake/string/UuidMissingTypeValue-stderr.txt new file mode 100644 index 0000000..70252f8 --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingTypeValue-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at UuidMissingTypeValue.cmake:3 \(string\): + string UUID sub-command, TYPE requires a value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/UuidMissingTypeValue.cmake b/Tests/RunCMake/string/UuidMissingTypeValue.cmake new file mode 100644 index 0000000..6678a46 --- /dev/null +++ b/Tests/RunCMake/string/UuidMissingTypeValue.cmake @@ -0,0 +1,4 @@ +set(UUID_DNS_NAMESPACE 6ba7b810-9dad-11d1-80b4-00c04fd430c8) + +string(UUID WWW_EXAMPLE_COM_MD5_UUID + NAMESPACE ${UUID_DNS_NAMESPACE} NAME www.example.com TYPE) diff --git a/Tests/StagingPrefix/CMakeLists.txt b/Tests/StagingPrefix/CMakeLists.txt index 922776d..49ff7fe 100644 --- a/Tests/StagingPrefix/CMakeLists.txt +++ b/Tests/StagingPrefix/CMakeLists.txt @@ -38,6 +38,7 @@ add_custom_command( --build-project Producer --build-target install --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-options -DCMAKE_VERBOSE_MAKEFILE=1 @@ -71,6 +72,7 @@ add_custom_command( --build-project Consumer --build-target install --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-options "-DCMAKE_FIND_ROOT_PATH=${CMAKE_BINARY_DIR}/ignored" diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index 4fa5a86..e6c6152 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -55,6 +55,16 @@ else() "file(STRINGS) incorrectly read from srec file [${infile_strings}]") endif() +#this file has utf-8 content +file(STRINGS test.utf8 infile_strings ENCODING UTF-8) +list(LENGTH infile_strings content_len) +if(content_len MATCHES "3") + message("file(STRINGS) correctly read from utf8 file [${infile_strings}]") +else() + message(SEND_ERROR + "file(STRINGS) incorrectly read from utf8 file [${infile_strings}]") +endif() + # String test string(REGEX MATCH "[cC][mM][aA][kK][eE]" rmvar "CMake is great") string(REGEX MATCHALL "[cC][mM][aA][kK][eE]" rmallvar "CMake is better than cmake or CMake") @@ -113,7 +123,7 @@ string(STRIP "ST2 " ST2) string(STRIP " ST3" ST3) foreach(var ST1 ST2 ST3) - if("${var}" STREQUAL "${${var}}") + if("x${var}" STREQUAL "x${${var}}") message("[${var}] == [${${var}}]") else() message(SEND_ERROR "Problem with the STRIP command for ${var}: [${${var}}]") diff --git a/Tests/StringFileTest/test.utf8 b/Tests/StringFileTest/test.utf8 new file mode 100644 index 0000000..6c29170 --- /dev/null +++ b/Tests/StringFileTest/test.utf8 @@ -0,0 +1,3 @@ +The value of Ï€ (pi) is 3.141593 +Line mixed with binary partially matches valid utf8: Ï€ is à93.1593 +à
\ No newline at end of file diff --git a/Tests/SubProject/CMakeLists.txt b/Tests/SubProject/CMakeLists.txt index b669621..b2bada9 100644 --- a/Tests/SubProject/CMakeLists.txt +++ b/Tests/SubProject/CMakeLists.txt @@ -1,6 +1,15 @@ cmake_minimum_required (VERSION 2.6) project(SubProject) -message("${CMAKE_IMPORT_LIBRARY_SUFFIX}") +file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/gen.cxx) # require generation +add_custom_command( + OUTPUT gen.cxx + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen.cxx.in + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/gen.cxx.in gen.cxx + ) +add_custom_target(gen DEPENDS gen.cxx) add_library(bar bar.cxx) +target_include_directories(bar PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +add_dependencies(bar gen) add_executable(car car.cxx) add_subdirectory(foo) diff --git a/Tests/SubProject/bar.cxx b/Tests/SubProject/bar.cxx index c3f6a18..c8b8743 100644 --- a/Tests/SubProject/bar.cxx +++ b/Tests/SubProject/bar.cxx @@ -1,4 +1 @@ -int bar() -{ - return 10; -} +#include "gen.cxx" diff --git a/Tests/SubProject/gen.cxx.in b/Tests/SubProject/gen.cxx.in new file mode 100644 index 0000000..c3f6a18 --- /dev/null +++ b/Tests/SubProject/gen.cxx.in @@ -0,0 +1,4 @@ +int bar() +{ + return 10; +} diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt index 8fc2871..73ea05a 100644 --- a/Tests/VSExternalInclude/CMakeLists.txt +++ b/Tests/VSExternalInclude/CMakeLists.txt @@ -6,7 +6,7 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") else() set(PROJECT_EXT vcproj) endif() -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[0124]") set(PROJECT_EXT vcxproj) endif() @@ -19,7 +19,9 @@ make_directory("${LIB2_BINARY_DIR}") # generate lib1 execute_process( - COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -T "${CMAKE_GENERATOR_TOOLSET}" "${VSExternalInclude_SOURCE_DIR}/Lib1" + COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" + -A "${CMAKE_GENERATOR_PLATFORM}" + -T "${CMAKE_GENERATOR_TOOLSET}" "${VSExternalInclude_SOURCE_DIR}/Lib1" WORKING_DIRECTORY ${LIB1_BINARY_DIR} OUTPUT_VARIABLE OUT ERROR_VARIABLE OUT @@ -28,7 +30,9 @@ message("CMAKE Ran with the following output:\n\"${OUT}\"") # generate lib2 execute_process( - COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -T "${CMAKE_GENERATOR_TOOLSET}" "${VSExternalInclude_SOURCE_DIR}/Lib2" + COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" + -A "${CMAKE_GENERATOR_PLATFORM}" + -T "${CMAKE_GENERATOR_TOOLSET}" "${VSExternalInclude_SOURCE_DIR}/Lib2" WORKING_DIRECTORY ${LIB2_BINARY_DIR} OUTPUT_VARIABLE OUT ERROR_VARIABLE OUT @@ -54,7 +58,7 @@ add_dependencies(VSExternalInclude lib2) # and the sln file can no longer be the only source # of that depend. So, for VS 10 make the executable # depend on lib1 and lib2 -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[0124]") add_dependencies(VSExternalInclude lib1) endif() diff --git a/Tests/VSMASM/CMakeLists.txt b/Tests/VSMASM/CMakeLists.txt new file mode 100644 index 0000000..f2570a3 --- /dev/null +++ b/Tests/VSMASM/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8.12) +project(VSMASM C ASM_MASM) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + add_definitions(-DTESTx64) +else() + add_definitions(-DTESTi386) + set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /safeseh") +endif() +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +add_executable(VSMASM main.c foo.asm) diff --git a/Tests/VSMASM/foo.asm b/Tests/VSMASM/foo.asm new file mode 100644 index 0000000..51cb969 --- /dev/null +++ b/Tests/VSMASM/foo.asm @@ -0,0 +1,7 @@ +ifndef TESTx64 +.386 +.model flat, c +endif +.code +include <foo-proc.asm> +end diff --git a/Tests/VSMASM/include/foo-proc.asm b/Tests/VSMASM/include/foo-proc.asm new file mode 100644 index 0000000..e8ba5dc --- /dev/null +++ b/Tests/VSMASM/include/foo-proc.asm @@ -0,0 +1,4 @@ +foo proc public + mov eax,0 + ret +foo endp diff --git a/Tests/VSMASM/main.c b/Tests/VSMASM/main.c new file mode 100644 index 0000000..570ba16 --- /dev/null +++ b/Tests/VSMASM/main.c @@ -0,0 +1,2 @@ +extern int foo(void); +int main(void) { return foo(); } diff --git a/Tests/VSNsightTegra/AndroidManifest.xml b/Tests/VSNsightTegra/AndroidManifest.xml new file mode 100644 index 0000000..951e8f3 --- /dev/null +++ b/Tests/VSNsightTegra/AndroidManifest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.twolibs" + android:versionCode="1" + android:versionName="1.0"> + <uses-sdk android:minSdkVersion="3" /> + <application android:label="@string/app_name"> + <activity android:name=".TwoLibs" + android:label="@string/app_name"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/Tests/VSNsightTegra/CMakeLists.txt b/Tests/VSNsightTegra/CMakeLists.txt new file mode 100644 index 0000000..570733b --- /dev/null +++ b/Tests/VSNsightTegra/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 3.0) +project(VSNsightTegra C CXX) + +set(CMAKE_ANDROID_API 15) +set(CMAKE_ANDROID_GUI 1) + +set(FIRST_C_FILES + jni/first.c + jni/first.h + ) + +source_group(jni FILES ${FIRST_C_FILES}) +add_library(twolib-first ${FIRST_C_FILES}) + +set(SECOND_C_FILES + jni/second.c + ) +set(SECOND_JAVA_FILES + src/com/example/twolibs/TwoLibs.java + ) +set(SECOND_RES_FILES + res/values/strings.xml + ) +set(SECOND_ANDROID_FILES + AndroidManifest.xml + ) + +source_group(jni FILES ${SECOND_C_FILES}) +source_group(res\\values FILES ${SECOND_RES_FILES}) +source_group(src\\com\\example\\twolibs FILES ${SECOND_JAVA_FILES}) +add_executable(twolib-second + ${SECOND_C_FILES} + ${SECOND_JAVA_FILES} + ${SECOND_RES_FILES} + ${SECOND_ANDROID_FILES} + ) +target_include_directories(twolib-second PUBLIC jni) +target_link_libraries(twolib-second twolib-first) +target_link_libraries(twolib-second m) # test linking to library by name diff --git a/Tests/VSNsightTegra/build.xml b/Tests/VSNsightTegra/build.xml new file mode 100644 index 0000000..17a2cc0 --- /dev/null +++ b/Tests/VSNsightTegra/build.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="TwoLibs" default="help"> + <import file="${sdk.dir}/tools/ant/build.xml" /> +</project> diff --git a/Tests/VSNsightTegra/jni/first.c b/Tests/VSNsightTegra/jni/first.c new file mode 100644 index 0000000..f09e376 --- /dev/null +++ b/Tests/VSNsightTegra/jni/first.c @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "first.h" + +int first(int x, int y) +{ + return x + y; +} diff --git a/Tests/VSNsightTegra/jni/first.h b/Tests/VSNsightTegra/jni/first.h new file mode 100644 index 0000000..d893480 --- /dev/null +++ b/Tests/VSNsightTegra/jni/first.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#ifndef FIRST_H +#define FIRST_H + +extern int first(int x, int y); + +#endif /* FIRST_H */ diff --git a/Tests/VSNsightTegra/jni/second.c b/Tests/VSNsightTegra/jni/second.c new file mode 100644 index 0000000..4631848 --- /dev/null +++ b/Tests/VSNsightTegra/jni/second.c @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "first.h" +#include <jni.h> + +jint +Java_com_example_twolibs_TwoLibs_add( JNIEnv* env, + jobject this, + jint x, + jint y ) +{ + return first(x, y); +} diff --git a/Tests/VSNsightTegra/res/values/strings.xml b/Tests/VSNsightTegra/res/values/strings.xml new file mode 100644 index 0000000..858cdb4 --- /dev/null +++ b/Tests/VSNsightTegra/res/values/strings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">TwoLibs</string> +</resources> diff --git a/Tests/VSNsightTegra/src/com/example/twolibs/TwoLibs.java b/Tests/VSNsightTegra/src/com/example/twolibs/TwoLibs.java new file mode 100644 index 0000000..ef9da01 --- /dev/null +++ b/Tests/VSNsightTegra/src/com/example/twolibs/TwoLibs.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.twolibs; + +import android.app.Activity; +import android.widget.TextView; +import android.os.Bundle; + +public class TwoLibs extends Activity +{ + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + TextView tv = new TextView(this); + int x = 1000; + int y = 42; + + // here, we dynamically load the library at runtime + // before calling the native method. + // + System.loadLibrary("twolib-second"); + + int z = add(x, y); + + tv.setText( "The sum of " + x + " and " + y + " is " + z ); + setContentView(tv); + } + + public native int add(int x, int y); +} diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt index c5cb336..17eb041 100644 --- a/Tests/VSResource/CMakeLists.txt +++ b/Tests/VSResource/CMakeLists.txt @@ -18,6 +18,11 @@ if(CMAKE_RC_COMPILER MATCHES windres) message(STATUS "CMAKE_RC_COMPILER MATCHES windres") add_definitions(/DCMAKE_RCDEFINE=test.txt) add_definitions(/DCMAKE_RCDEFINE_NO_QUOTED_STRINGS) + if(MSYS AND CMAKE_CURRENT_BINARY_DIR MATCHES " ") + # windres cannot handle spaces in include dir, and + # for the MSys shell we do not convert to shortpath. + set(CMAKE_RC_NO_INCLUDE 1) + endif() elseif(MSVC60) # VS6 rc compiler does not deal well with spaces in a "/D" value, but it can # handle the quoting @@ -30,10 +35,17 @@ else() set(TEXTFILE_FROM_SOURCE_DIR "textfile, spaces in name, from binary dir") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test.txt "${CMAKE_CURRENT_BINARY_DIR}/test with spaces.txt" @ONLY) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_definitions(/DCMAKE_RCDEFINE="test with spaces.txt") endif() +if(CMAKE_RC_NO_INCLUDE) + add_definitions(/DCMAKE_RC_NO_INCLUDE) +else() + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include.rc.in + "${CMAKE_CURRENT_BINARY_DIR}/include.rc" @ONLY) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) +endif() + add_executable(VSResource main.cpp test.rc) set_property(TARGET VSResource diff --git a/Tests/VSResource/include.rc.in b/Tests/VSResource/include.rc.in new file mode 100644 index 0000000..f0f6859 --- /dev/null +++ b/Tests/VSResource/include.rc.in @@ -0,0 +1 @@ +// This file should be included. diff --git a/Tests/VSResource/test.rc b/Tests/VSResource/test.rc index 4ce4b53..0de4683 100644 --- a/Tests/VSResource/test.rc +++ b/Tests/VSResource/test.rc @@ -1,4 +1,7 @@ #ifdef CMAKE_RCDEFINE +# ifndef CMAKE_RC_NO_INCLUDE +# include <include.rc> +# endif // This line can compile with either an unquoted or a quoted string 1025 TEXTFILE CMAKE_RCDEFINE diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt new file mode 100644 index 0000000..0041c75 --- /dev/null +++ b/Tests/VSWinStorePhone/CMakeLists.txt @@ -0,0 +1,114 @@ +cmake_minimum_required(VERSION 3.0) +project(VSWinStorePhone) + +if(MSVC_VERSION GREATER 1700) + set(COMPILER_VERSION "12") +elseif(MSVC_VERSION GREATER 1600) + set(COMPILER_VERSION "11") +endif() + +set (APP_MANIFEST_NAME Package.appxmanifest) +if("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone") + set(PLATFORM WP) + add_definitions("-DPHONE") + if("${CMAKE_SYSTEM_VERSION}" STREQUAL "8.0") + set(APP_MANIFEST_NAME WMAppManifest.xml) + set(WINDOWS_PHONE8 1) + endif() +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") + set(PLATFORM STORE) +else() + set(PLATFORM DESKTOP) + message(FATAL_ERROR "This app supports Store / Phone only. Please edit the target platform.") +endif() + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +set(EXE_NAME Direct3DApp1) +set(SHORT_NAME ${EXE_NAME}) +set(PACKAGE_GUID "6514377e-dfd4-4cdb-80df-4e0366346efc") + +if (NOT "${PLATFORM}" STREQUAL "DESKTOP") + configure_file( + cmake/Package_vc${COMPILER_VERSION}.${PLATFORM}.appxmanifest.in + ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME} + @ONLY) +endif() + +set(SOURCE_FILES + Direct3DApp1/CubeRenderer.cpp + Direct3DApp1/Direct3DApp1.cpp + Direct3DApp1/Direct3DBase.cpp + Direct3DApp1/pch.cpp + ) + +set(HEADER_FILES + Direct3DApp1/BasicTimer.h + Direct3DApp1/CubeRenderer.h + Direct3DApp1/Direct3DApp1.h + Direct3DApp1/Direct3DBase.h + Direct3DApp1/DirectXHelper.h + Direct3DApp1/pch.h + ) + +set(PIXELSHADER_FILES + Direct3DApp1/SimplePixelShader.hlsl + ) + +set(VERTEXSHADER_FILES + Direct3DApp1/SimpleVertexShader.hlsl + ) + +set(CONTENT_FILES ${PIXELSHADER_FILES} ${VERTEXSHADER_FILES}) + +if (WINDOWS_PHONE8) + set(CONTENT_FILES ${CONTENT_FILES} + ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME} + Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png + Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png + Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png + Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png + Direct3DApp1/Assets/Tiles/IconicTileSmall.png + Direct3DApp1/Assets/ApplicationIcon.png + ) + # Windows Phone 8.0 needs to copy all the images. + # It doesn't know to use relative paths. + file(COPY + Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png + Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png + Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png + Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png + Direct3DApp1/Assets/Tiles/IconicTileSmall.png + Direct3DApp1/Assets/ApplicationIcon.png + DESTINATION ${CMAKE_CURRENT_BINARY_DIR} + ) + +elseif (NOT "${PLATFORM}" STREQUAL "DESKTOP") + set(CONTENT_FILES ${CONTENT_FILES} + ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME} + Direct3DApp1/Assets/Logo.png + Direct3DApp1/Assets/SmallLogo.png + Direct3DApp1/Assets/SplashScreen.png + Direct3DApp1/Assets/StoreLogo.png + ) +endif() + +set(RESOURCE_FILES + ${CONTENT_FILES} ${DEBUG_CONTENT_FILES} ${RELEASE_CONTENT_FILES} + Direct3DApp1/Direct3DApp1_TemporaryKey.pfx) + +set_property(SOURCE ${CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1) +set_property(SOURCE ${DEBUG_CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT $<CONFIG:Debug>) +set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY + VS_DEPLOYMENT_CONTENT $<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>) + +set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel) +set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex) + +source_group("Source Files" FILES ${SOURCE_FILES}) +source_group("Header Files" FILES ${HEADER_FILES}) +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) +target_link_libraries(${EXE_NAME} d3d11) diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/ApplicationIcon.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/ApplicationIcon.png Binary files differnew file mode 100644 index 0000000..7d95d4e --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/ApplicationIcon.png diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Logo.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Logo.png Binary files differnew file mode 100644 index 0000000..e26771c --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Logo.png diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo.png Binary files differnew file mode 100644 index 0000000..1eb0d9d --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo.png diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/SplashScreen.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SplashScreen.png Binary files differnew file mode 100644 index 0000000..c951e03 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SplashScreen.png diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/StoreLogo.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/StoreLogo.png Binary files differnew file mode 100644 index 0000000..dcb6727 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/StoreLogo.png diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png Binary files differnew file mode 100644 index 0000000..e0c59ac --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png Binary files differnew file mode 100644 index 0000000..e93b89d --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png Binary files differnew file mode 100644 index 0000000..550b1b5 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png Binary files differnew file mode 100644 index 0000000..686e6b5 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileSmall.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileSmall.png Binary files differnew file mode 100644 index 0000000..d4b5ede --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileSmall.png diff --git a/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h b/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h new file mode 100644 index 0000000..b58c77d --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h @@ -0,0 +1,76 @@ +#pragma once + +#include <wrl.h> + +// Helper class for basic timing. +ref class BasicTimer sealed +{ +public: + // Initializes internal timer values. + BasicTimer() + { + if (!QueryPerformanceFrequency(&m_frequency)) + { + throw ref new Platform::FailureException(); + } + Reset(); + } + + // Reset the timer to initial values. + void Reset() + { + Update(); + m_startTime = m_currentTime; + m_total = 0.0f; + m_delta = 1.0f / 60.0f; + } + + // Update the timer's internal values. + void Update() + { + if (!QueryPerformanceCounter(&m_currentTime)) + { + throw ref new Platform::FailureException(); + } + + m_total = static_cast<float>( + static_cast<double>(m_currentTime.QuadPart - m_startTime.QuadPart) / + static_cast<double>(m_frequency.QuadPart) + ); + + if (m_lastTime.QuadPart == m_startTime.QuadPart) + { + // If the timer was just reset, report a time delta equivalent to 60Hz frame time. + m_delta = 1.0f / 60.0f; + } + else + { + m_delta = static_cast<float>( + static_cast<double>(m_currentTime.QuadPart - m_lastTime.QuadPart) / + static_cast<double>(m_frequency.QuadPart) + ); + } + + m_lastTime = m_currentTime; + } + + // Duration in seconds between the last call to Reset() and the last call to Update(). + property float Total + { + float get() { return m_total; } + } + + // Duration in seconds between the previous two calls to Update(). + property float Delta + { + float get() { return m_delta; } + } + +private: + LARGE_INTEGER m_frequency; + LARGE_INTEGER m_currentTime; + LARGE_INTEGER m_startTime; + LARGE_INTEGER m_lastTime; + float m_total; + float m_delta; +}; diff --git a/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp new file mode 100644 index 0000000..f4827f2 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp @@ -0,0 +1,260 @@ +#include "pch.h" +#include "CubeRenderer.h" + +using namespace DirectX; +using namespace Microsoft::WRL; +using namespace Windows::Foundation; +using namespace Windows::UI::Core; + +CubeRenderer::CubeRenderer() : + m_loadingComplete(false), + m_indexCount(0) +{ +} + +void CubeRenderer::CreateDeviceResources() +{ + Direct3DBase::CreateDeviceResources(); + + auto loadVSTask = DX::ReadDataAsync("SimpleVertexShader.cso"); + auto loadPSTask = DX::ReadDataAsync("SimplePixelShader.cso"); + + auto createVSTask = loadVSTask.then([this](Platform::Array<byte>^ fileData) { + DX::ThrowIfFailed( + m_d3dDevice->CreateVertexShader( + fileData->Data, + fileData->Length, + nullptr, + &m_vertexShader + ) + ); + + const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + + DX::ThrowIfFailed( + m_d3dDevice->CreateInputLayout( + vertexDesc, + ARRAYSIZE(vertexDesc), + fileData->Data, + fileData->Length, + &m_inputLayout + ) + ); + }); + + auto createPSTask = loadPSTask.then([this](Platform::Array<byte>^ fileData) { + DX::ThrowIfFailed( + m_d3dDevice->CreatePixelShader( + fileData->Data, + fileData->Length, + nullptr, + &m_pixelShader + ) + ); + + CD3D11_BUFFER_DESC constantBufferDesc(sizeof(ModelViewProjectionConstantBuffer), D3D11_BIND_CONSTANT_BUFFER); + DX::ThrowIfFailed( + m_d3dDevice->CreateBuffer( + &constantBufferDesc, + nullptr, + &m_constantBuffer + ) + ); + }); + + auto createCubeTask = (createPSTask && createVSTask).then([this] () { + VertexPositionColor cubeVertices[] = + { + {XMFLOAT3(-0.5f, -0.5f, -0.5f), XMFLOAT3(0.0f, 0.0f, 0.0f)}, + {XMFLOAT3(-0.5f, -0.5f, 0.5f), XMFLOAT3(0.0f, 0.0f, 1.0f)}, + {XMFLOAT3(-0.5f, 0.5f, -0.5f), XMFLOAT3(0.0f, 1.0f, 0.0f)}, + {XMFLOAT3(-0.5f, 0.5f, 0.5f), XMFLOAT3(0.0f, 1.0f, 1.0f)}, + {XMFLOAT3( 0.5f, -0.5f, -0.5f), XMFLOAT3(1.0f, 0.0f, 0.0f)}, + {XMFLOAT3( 0.5f, -0.5f, 0.5f), XMFLOAT3(1.0f, 0.0f, 1.0f)}, + {XMFLOAT3( 0.5f, 0.5f, -0.5f), XMFLOAT3(1.0f, 1.0f, 0.0f)}, + {XMFLOAT3( 0.5f, 0.5f, 0.5f), XMFLOAT3(1.0f, 1.0f, 1.0f)}, + }; + + D3D11_SUBRESOURCE_DATA vertexBufferData = {0}; + vertexBufferData.pSysMem = cubeVertices; + vertexBufferData.SysMemPitch = 0; + vertexBufferData.SysMemSlicePitch = 0; + CD3D11_BUFFER_DESC vertexBufferDesc(sizeof(cubeVertices), D3D11_BIND_VERTEX_BUFFER); + DX::ThrowIfFailed( + m_d3dDevice->CreateBuffer( + &vertexBufferDesc, + &vertexBufferData, + &m_vertexBuffer + ) + ); + + unsigned short cubeIndices[] = + { + 0,2,1, // -x + 1,2,3, + + 4,5,6, // +x + 5,7,6, + + 0,1,5, // -y + 0,5,4, + + 2,6,7, // +y + 2,7,3, + + 0,4,6, // -z + 0,6,2, + + 1,3,7, // +z + 1,7,5, + }; + + m_indexCount = ARRAYSIZE(cubeIndices); + + D3D11_SUBRESOURCE_DATA indexBufferData = {0}; + indexBufferData.pSysMem = cubeIndices; + indexBufferData.SysMemPitch = 0; + indexBufferData.SysMemSlicePitch = 0; + CD3D11_BUFFER_DESC indexBufferDesc(sizeof(cubeIndices), D3D11_BIND_INDEX_BUFFER); + DX::ThrowIfFailed( + m_d3dDevice->CreateBuffer( + &indexBufferDesc, + &indexBufferData, + &m_indexBuffer + ) + ); + }); + + createCubeTask.then([this] () { + m_loadingComplete = true; + }); +} + +void CubeRenderer::CreateWindowSizeDependentResources() +{ + Direct3DBase::CreateWindowSizeDependentResources(); + + float aspectRatio = m_windowBounds.Width / m_windowBounds.Height; + float fovAngleY = 70.0f * XM_PI / 180.0f; + if (aspectRatio < 1.0f) + { + fovAngleY /= aspectRatio; + } + + // Note that the m_orientationTransform3D matrix is post-multiplied here + // in order to correctly orient the scene to match the display orientation. + // This post-multiplication step is required for any draw calls that are + // made to the swap chain render target. For draw calls to other targets, + // this transform should not be applied. + XMStoreFloat4x4( + &m_constantBufferData.projection, + XMMatrixTranspose( + XMMatrixMultiply( + XMMatrixPerspectiveFovRH( + fovAngleY, + aspectRatio, + 0.01f, + 100.0f + ), + XMLoadFloat4x4(&m_orientationTransform3D) + ) + ) + ); +} + +void CubeRenderer::Update(float timeTotal, float timeDelta) +{ + (void) timeDelta; // Unused parameter. + + XMVECTOR eye = XMVectorSet(0.0f, 0.7f, 1.5f, 0.0f); + XMVECTOR at = XMVectorSet(0.0f, -0.1f, 0.0f, 0.0f); + XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f); + + XMStoreFloat4x4(&m_constantBufferData.view, XMMatrixTranspose(XMMatrixLookAtRH(eye, at, up))); + XMStoreFloat4x4(&m_constantBufferData.model, XMMatrixTranspose(XMMatrixRotationY(timeTotal * XM_PIDIV4))); +} + +void CubeRenderer::Render() +{ + const float midnightBlue[] = { 0.098f, 0.098f, 0.439f, 1.000f }; + m_d3dContext->ClearRenderTargetView( + m_renderTargetView.Get(), + midnightBlue + ); + + m_d3dContext->ClearDepthStencilView( + m_depthStencilView.Get(), + D3D11_CLEAR_DEPTH, + 1.0f, + 0 + ); + + // Only draw the cube once it is loaded (loading is asynchronous). + if (!m_loadingComplete) + { + return; + } + + m_d3dContext->OMSetRenderTargets( + 1, + m_renderTargetView.GetAddressOf(), + m_depthStencilView.Get() + ); + + m_d3dContext->UpdateSubresource( + m_constantBuffer.Get(), + 0, + NULL, + &m_constantBufferData, + 0, + 0 + ); + + UINT stride = sizeof(VertexPositionColor); + UINT offset = 0; + m_d3dContext->IASetVertexBuffers( + 0, + 1, + m_vertexBuffer.GetAddressOf(), + &stride, + &offset + ); + + m_d3dContext->IASetIndexBuffer( + m_indexBuffer.Get(), + DXGI_FORMAT_R16_UINT, + 0 + ); + + m_d3dContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + + m_d3dContext->IASetInputLayout(m_inputLayout.Get()); + + m_d3dContext->VSSetShader( + m_vertexShader.Get(), + nullptr, + 0 + ); + + m_d3dContext->VSSetConstantBuffers( + 0, + 1, + m_constantBuffer.GetAddressOf() + ); + + m_d3dContext->PSSetShader( + m_pixelShader.Get(), + nullptr, + 0 + ); + + m_d3dContext->DrawIndexed( + m_indexCount, + 0, + 0 + ); +} diff --git a/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.h b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.h new file mode 100644 index 0000000..68cb188 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.h @@ -0,0 +1,44 @@ +#pragma once + +#include "Direct3DBase.h" + +struct ModelViewProjectionConstantBuffer +{ + DirectX::XMFLOAT4X4 model; + DirectX::XMFLOAT4X4 view; + DirectX::XMFLOAT4X4 projection; +}; + +struct VertexPositionColor +{ + DirectX::XMFLOAT3 pos; + DirectX::XMFLOAT3 color; +}; + +// This class renders a simple spinning cube. +ref class CubeRenderer sealed : public Direct3DBase +{ +public: + CubeRenderer(); + + // Direct3DBase methods. + virtual void CreateDeviceResources() override; + virtual void CreateWindowSizeDependentResources() override; + virtual void Render() override; + + // Method for updating time-dependent objects. + void Update(float timeTotal, float timeDelta); + +private: + bool m_loadingComplete; + + Microsoft::WRL::ComPtr<ID3D11InputLayout> m_inputLayout; + Microsoft::WRL::ComPtr<ID3D11Buffer> m_vertexBuffer; + Microsoft::WRL::ComPtr<ID3D11Buffer> m_indexBuffer; + Microsoft::WRL::ComPtr<ID3D11VertexShader> m_vertexShader; + Microsoft::WRL::ComPtr<ID3D11PixelShader> m_pixelShader; + Microsoft::WRL::ComPtr<ID3D11Buffer> m_constantBuffer; + + uint32 m_indexCount; + ModelViewProjectionConstantBuffer m_constantBufferData; +}; diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.cpp b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.cpp new file mode 100644 index 0000000..3dbb97f --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.cpp @@ -0,0 +1,153 @@ +#include "pch.h" +#include "Direct3DApp1.h" +#include "BasicTimer.h" + +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::System; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; +using namespace concurrency; + +Direct3DApp1::Direct3DApp1() : + m_windowClosed(false), + m_windowVisible(true) +{ +} + +void Direct3DApp1::Initialize(CoreApplicationView^ applicationView) +{ + applicationView->Activated += + ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &Direct3DApp1::OnActivated); + + CoreApplication::Suspending += + ref new EventHandler<SuspendingEventArgs^>(this, &Direct3DApp1::OnSuspending); + + CoreApplication::Resuming += + ref new EventHandler<Platform::Object^>(this, &Direct3DApp1::OnResuming); + + m_renderer = ref new CubeRenderer(); +} + +void Direct3DApp1::SetWindow(CoreWindow^ window) +{ + window->SizeChanged += + ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &Direct3DApp1::OnWindowSizeChanged); + + window->VisibilityChanged += + ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &Direct3DApp1::OnVisibilityChanged); + + window->Closed += + ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &Direct3DApp1::OnWindowClosed); + +#ifndef PHONE + window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0); +#endif + + window->PointerPressed += + ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &Direct3DApp1::OnPointerPressed); + + window->PointerMoved += + ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &Direct3DApp1::OnPointerMoved); + + m_renderer->Initialize(CoreWindow::GetForCurrentThread()); +} + +void Direct3DApp1::Load(Platform::String^ entryPoint) +{ +} + +void Direct3DApp1::Run() +{ + BasicTimer^ timer = ref new BasicTimer(); + + while (!m_windowClosed) + { + if (m_windowVisible) + { + timer->Update(); + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + m_renderer->Update(timer->Total, timer->Delta); + m_renderer->Render(); + m_renderer->Present(); // This call is synchronized to the display frame rate. + } + else + { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); + } + } +} + +void Direct3DApp1::Uninitialize() +{ +} + +void Direct3DApp1::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) +{ + m_renderer->UpdateForWindowSizeChange(); +} + +void Direct3DApp1::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) +{ + m_windowVisible = args->Visible; +} + +void Direct3DApp1::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) +{ + m_windowClosed = true; +} + +void Direct3DApp1::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args) +{ + // Insert your code here. +} + +void Direct3DApp1::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args) +{ + // Insert your code here. +} + +void Direct3DApp1::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) +{ + CoreWindow::GetForCurrentThread()->Activate(); +} + +void Direct3DApp1::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) +{ + // Save app state asynchronously after requesting a deferral. Holding a deferral + // indicates that the application is busy performing suspending operations. Be + // aware that a deferral may not be held indefinitely. After about five seconds, + // the app will be forced to exit. + SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); + m_renderer->ReleaseResourcesForSuspending(); + + create_task([this, deferral]() + { + // Insert your code here. + + deferral->Complete(); + }); +} + +void Direct3DApp1::OnResuming(Platform::Object^ sender, Platform::Object^ args) +{ + // Restore any data or state that was unloaded on suspend. By default, data + // and state are persisted when resuming from suspend. Note that this event + // does not occur if the app was previously terminated. + m_renderer->CreateWindowSizeDependentResources(); +} + +IFrameworkView^ Direct3DApplicationSource::CreateView() +{ + return ref new Direct3DApp1(); +} + +[Platform::MTAThread] +int main(Platform::Array<Platform::String^>^) +{ + auto direct3DApplicationSource = ref new Direct3DApplicationSource(); + CoreApplication::Run(direct3DApplicationSource); + return 0; +} diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.h b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.h new file mode 100644 index 0000000..40b69a1 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.h @@ -0,0 +1,40 @@ +#pragma once + +#include "pch.h" +#include "CubeRenderer.h" + +ref class Direct3DApp1 sealed : public Windows::ApplicationModel::Core::IFrameworkView +{ +public: + Direct3DApp1(); + + // IFrameworkView Methods. + virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView); + virtual void SetWindow(Windows::UI::Core::CoreWindow^ window); + virtual void Load(Platform::String^ entryPoint); + virtual void Run(); + virtual void Uninitialize(); + +protected: + // Event Handlers. + void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args); + void OnLogicalDpiChanged(Platform::Object^ sender); + void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args); + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args); + void OnResuming(Platform::Object^ sender, Platform::Object^ args); + void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); + void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); + void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); + void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); + +private: + CubeRenderer^ m_renderer; + bool m_windowClosed; + bool m_windowVisible; +}; + +ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource +{ +public: + virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView(); +}; diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1_TemporaryKey.pfx b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1_TemporaryKey.pfx Binary files differnew file mode 100644 index 0000000..1cad999 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1_TemporaryKey.pfx diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.cpp b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.cpp new file mode 100644 index 0000000..46727b5 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.cpp @@ -0,0 +1,384 @@ +#include "pch.h" +#include "Direct3DBase.h" + +using namespace DirectX; +using namespace Microsoft::WRL; +using namespace Windows::UI::Core; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; + +// Constructor. +Direct3DBase::Direct3DBase() +{ +} + +// Initialize the Direct3D resources required to run. +void Direct3DBase::Initialize(CoreWindow^ window) +{ + m_window = window; + + CreateDeviceResources(); + CreateWindowSizeDependentResources(); +} + +// Recreate all device resources and set them back to the current state. +void Direct3DBase::HandleDeviceLost() +{ + // Reset these member variables to ensure that UpdateForWindowSizeChange recreates all resources. + m_windowBounds.Width = 0; + m_windowBounds.Height = 0; + m_swapChain = nullptr; + + CreateDeviceResources(); + UpdateForWindowSizeChange(); +} + +// These are the resources that depend on the device. +void Direct3DBase::CreateDeviceResources() +{ + // This flag adds support for surfaces with a different color channel ordering + // than the API default. It is required for compatibility with Direct2D. + UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; + +#if defined(_DEBUG) + // If the project is in a debug build, enable debugging via SDK Layers with this flag. + creationFlags |= D3D11_CREATE_DEVICE_DEBUG; +#endif + + // This array defines the set of DirectX hardware feature levels this app will support. + // Note the ordering should be preserved. + // Don't forget to declare your application's minimum required feature level in its + // description. All applications are assumed to support 9.1 unless otherwise stated. + D3D_FEATURE_LEVEL featureLevels[] = + { + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, + D3D_FEATURE_LEVEL_9_3, + D3D_FEATURE_LEVEL_9_2, + D3D_FEATURE_LEVEL_9_1 + }; + + // Create the Direct3D 11 API device object and a corresponding context. + ComPtr<ID3D11Device> device; + ComPtr<ID3D11DeviceContext> context; + DX::ThrowIfFailed( + D3D11CreateDevice( + nullptr, // Specify nullptr to use the default adapter. + D3D_DRIVER_TYPE_HARDWARE, + nullptr, + creationFlags, // Set set debug and Direct2D compatibility flags. + featureLevels, // List of feature levels this app can support. + ARRAYSIZE(featureLevels), + D3D11_SDK_VERSION, // Always set this to D3D11_SDK_VERSION for Windows Store apps. + &device, // Returns the Direct3D device created. + &m_featureLevel, // Returns feature level of device created. + &context // Returns the device immediate context. + ) + ); + + // Get the Direct3D 11.1 API device and context interfaces. + DX::ThrowIfFailed( + device.As(&m_d3dDevice) + ); + + DX::ThrowIfFailed( + context.As(&m_d3dContext) + ); +} + +// Allocate all memory resources that change on a window SizeChanged event. +void Direct3DBase::CreateWindowSizeDependentResources() +{ + // Store the window bounds so the next time we get a SizeChanged event we can + // avoid rebuilding everything if the size is identical. + m_windowBounds = m_window->Bounds; + + // Calculate the necessary swap chain and render target size in pixels. + float windowWidth = ConvertDipsToPixels(m_windowBounds.Width); + float windowHeight = ConvertDipsToPixels(m_windowBounds.Height); + + // The width and height of the swap chain must be based on the window's + // landscape-oriented width and height. If the window is in a portrait + // orientation, the dimensions must be reversed. +#if WINVER > 0x0602 + m_orientation = DisplayInformation::GetForCurrentView()->CurrentOrientation; +#else +#if PHONE + // WP8 doesn't support rotations so always make it landscape + m_orientation = DisplayOrientations::Landscape; +#else + m_orientation = DisplayProperties::CurrentOrientation; +#endif +#endif + bool swapDimensions = + m_orientation == DisplayOrientations::Portrait || + m_orientation == DisplayOrientations::PortraitFlipped; + m_renderTargetSize.Width = swapDimensions ? windowHeight : windowWidth; + m_renderTargetSize.Height = swapDimensions ? windowWidth : windowHeight; + + if(m_swapChain != nullptr) + { + // If the swap chain already exists, resize it. + DX::ThrowIfFailed( + m_swapChain->ResizeBuffers( + 2, // Double-buffered swap chain. + static_cast<UINT>(m_renderTargetSize.Width), + static_cast<UINT>(m_renderTargetSize.Height), + DXGI_FORMAT_B8G8R8A8_UNORM, + 0 + ) + ); + } + else + { + // Otherwise, create a new one using the same adapter as the existing Direct3D device. + DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0}; + swapChainDesc.Width = static_cast<UINT>(m_renderTargetSize.Width); // Match the size of the window. + swapChainDesc.Height = static_cast<UINT>(m_renderTargetSize.Height); + swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // This is the most common swap chain format. + swapChainDesc.Stereo = false; + swapChainDesc.SampleDesc.Count = 1; // Don't use multi-sampling. + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; +#if PHONE && WINVER <= 0x0602 + swapChainDesc.BufferCount = 1; // Use double-buffering to minimize latency. + swapChainDesc.Scaling = DXGI_SCALING_STRETCH; // On phone, only stretch and aspect-ratio stretch scaling are allowed. + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; // On phone, no swap effects are supported. +#else + swapChainDesc.BufferCount = 2; // Use double-buffering to minimize latency. + swapChainDesc.Scaling = DXGI_SCALING_NONE; + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // All Windows Store apps must use this SwapEffect. +#endif + swapChainDesc.Flags = 0; + + ComPtr<IDXGIDevice1> dxgiDevice; + DX::ThrowIfFailed( + m_d3dDevice.As(&dxgiDevice) + ); + + ComPtr<IDXGIAdapter> dxgiAdapter; + DX::ThrowIfFailed( + dxgiDevice->GetAdapter(&dxgiAdapter) + ); + + ComPtr<IDXGIFactory2> dxgiFactory; + DX::ThrowIfFailed( + dxgiAdapter->GetParent( + __uuidof(IDXGIFactory2), + &dxgiFactory + ) + ); + + Windows::UI::Core::CoreWindow^ window = m_window.Get(); + DX::ThrowIfFailed( + dxgiFactory->CreateSwapChainForCoreWindow( + m_d3dDevice.Get(), + reinterpret_cast<IUnknown*>(window), + &swapChainDesc, + nullptr, // Allow on all displays. + &m_swapChain + ) + ); + + // Ensure that DXGI does not queue more than one frame at a time. This both reduces latency and + // ensures that the application will only render after each VSync, minimizing power consumption. + DX::ThrowIfFailed( + dxgiDevice->SetMaximumFrameLatency(1) + ); + } + + // Set the proper orientation for the swap chain, and generate the + // 3D matrix transformation for rendering to the rotated swap chain. + DXGI_MODE_ROTATION rotation = DXGI_MODE_ROTATION_UNSPECIFIED; + switch (m_orientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_IDENTITY; + m_orientationTransform3D = XMFLOAT4X4( // 0-degree Z-rotation + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_ROTATE270; + m_orientationTransform3D = XMFLOAT4X4( // 90-degree Z-rotation + 0.0f, 1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + m_orientationTransform3D = XMFLOAT4X4( // 180-degree Z-rotation + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE90; + m_orientationTransform3D = XMFLOAT4X4( // 270-degree Z-rotation + 0.0f, -1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + break; + + default: + throw ref new Platform::FailureException(); + } + +#if !PHONE || WINVER > 0x0602 + DX::ThrowIfFailed( + m_swapChain->SetRotation(rotation) + ); +#endif // !PHONE + + // Create a render target view of the swap chain back buffer. + ComPtr<ID3D11Texture2D> backBuffer; + DX::ThrowIfFailed( + m_swapChain->GetBuffer( + 0, + __uuidof(ID3D11Texture2D), + &backBuffer + ) + ); + + DX::ThrowIfFailed( + m_d3dDevice->CreateRenderTargetView( + backBuffer.Get(), + nullptr, + &m_renderTargetView + ) + ); + + // Create a depth stencil view. + CD3D11_TEXTURE2D_DESC depthStencilDesc( + DXGI_FORMAT_D24_UNORM_S8_UINT, + static_cast<UINT>(m_renderTargetSize.Width), + static_cast<UINT>(m_renderTargetSize.Height), + 1, + 1, + D3D11_BIND_DEPTH_STENCIL + ); + + ComPtr<ID3D11Texture2D> depthStencil; + DX::ThrowIfFailed( + m_d3dDevice->CreateTexture2D( + &depthStencilDesc, + nullptr, + &depthStencil + ) + ); + + CD3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc(D3D11_DSV_DIMENSION_TEXTURE2D); + DX::ThrowIfFailed( + m_d3dDevice->CreateDepthStencilView( + depthStencil.Get(), + &depthStencilViewDesc, + &m_depthStencilView + ) + ); + + // Set the rendering viewport to target the entire window. + CD3D11_VIEWPORT viewport( + 0.0f, + 0.0f, + m_renderTargetSize.Width, + m_renderTargetSize.Height + ); + + m_d3dContext->RSSetViewports(1, &viewport); +} + +// This method is called in the event handler for the SizeChanged event. +void Direct3DBase::UpdateForWindowSizeChange() +{ + if (m_window->Bounds.Width != m_windowBounds.Width || + m_window->Bounds.Height != m_windowBounds.Height || +#if WINVER > 0x0602 + m_orientation != DisplayInformation::GetForCurrentView()->CurrentOrientation) +#else + m_orientation != DisplayProperties::CurrentOrientation) +#endif + { + ID3D11RenderTargetView* nullViews[] = {nullptr}; + m_d3dContext->OMSetRenderTargets(ARRAYSIZE(nullViews), nullViews, nullptr); + m_renderTargetView = nullptr; + m_depthStencilView = nullptr; + m_d3dContext->Flush(); + CreateWindowSizeDependentResources(); + } +} + +void Direct3DBase::ReleaseResourcesForSuspending() +{ + // Phone applications operate in a memory-constrained environment, so when entering + // the background it is a good idea to free memory-intensive objects that will be + // easy to restore upon reactivation. The swapchain and backbuffer are good candidates + // here, as they consume a large amount of memory and can be reinitialized quickly. + m_swapChain = nullptr; + m_renderTargetView = nullptr; + m_depthStencilView = nullptr; +} + +// Method to deliver the final image to the display. +void Direct3DBase::Present() +{ + // The first argument instructs DXGI to block until VSync, putting the application + // to sleep until the next VSync. This ensures we don't waste any cycles rendering + // frames that will never be displayed to the screen. +#if PHONE && WINVER <= 0x0602 + HRESULT hr = m_swapChain->Present(1, 0); +#else + // The application may optionally specify "dirty" or "scroll" + // rects to improve efficiency in certain scenarios. + DXGI_PRESENT_PARAMETERS parameters = { 0 }; + parameters.DirtyRectsCount = 0; + parameters.pDirtyRects = nullptr; + parameters.pScrollRect = nullptr; + parameters.pScrollOffset = nullptr; + + HRESULT hr = m_swapChain->Present1(1, 0 , ¶meters); +#endif + + // Discard the contents of the render target. + // This is a valid operation only when the existing contents will be entirely + // overwritten. If dirty or scroll rects are used, this call should be removed. + m_d3dContext->DiscardView(m_renderTargetView.Get()); + + // Discard the contents of the depth stencil. + m_d3dContext->DiscardView(m_depthStencilView.Get()); + + // If the device was removed either by a disconnect or a driver upgrade, we + // must recreate all device resources. + if (hr == DXGI_ERROR_DEVICE_REMOVED) + { + HandleDeviceLost(); + } + else + { + DX::ThrowIfFailed(hr); + } +} + +// Method to convert a length in device-independent pixels (DIPs) to a length in physical pixels. +float Direct3DBase::ConvertDipsToPixels(float dips) +{ + static const float dipsPerInch = 96.0f; +#if WINVER > 0x0602 + return floor(dips * DisplayInformation::GetForCurrentView()->LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer. +#else + return floor(dips * DisplayProperties::LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer. +#endif +} diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.h b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.h new file mode 100644 index 0000000..bba9f16 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.h @@ -0,0 +1,39 @@ +#pragma once + +#include "DirectXHelper.h" + +// Helper class that initializes DirectX APIs for 3D rendering. +ref class Direct3DBase abstract +{ +internal: + Direct3DBase(); + +public: + virtual void Initialize(Windows::UI::Core::CoreWindow^ window); + virtual void HandleDeviceLost(); + virtual void CreateDeviceResources(); + virtual void CreateWindowSizeDependentResources(); + virtual void UpdateForWindowSizeChange(); + virtual void ReleaseResourcesForSuspending(); + virtual void Render() = 0; + virtual void Present(); + virtual float ConvertDipsToPixels(float dips); + +protected private: + // Direct3D Objects. + Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice; + Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext; + Microsoft::WRL::ComPtr<IDXGISwapChain1> m_swapChain; + Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_renderTargetView; + Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_depthStencilView; + + // Cached renderer properties. + D3D_FEATURE_LEVEL m_featureLevel; + Windows::Foundation::Size m_renderTargetSize; + Windows::Foundation::Rect m_windowBounds; + Platform::Agile<Windows::UI::Core::CoreWindow> m_window; + Windows::Graphics::Display::DisplayOrientations m_orientation; + + // Transform used for display orientation. + DirectX::XMFLOAT4X4 m_orientationTransform3D; +}; diff --git a/Tests/VSWinStorePhone/Direct3DApp1/DirectXHelper.h b/Tests/VSWinStorePhone/Direct3DApp1/DirectXHelper.h new file mode 100644 index 0000000..d411a9b --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/DirectXHelper.h @@ -0,0 +1,45 @@ +#pragma once + +#include <wrl/client.h> +#include <ppl.h> +#include <ppltasks.h> + +namespace DX +{ + inline void ThrowIfFailed(HRESULT hr) + { + if (FAILED(hr)) + { + // Set a breakpoint on this line to catch Win32 API errors. + throw Platform::Exception::CreateException(hr); + } + } + + // Function that reads from a binary file asynchronously. + inline Concurrency::task<Platform::Array<byte>^> ReadDataAsync(Platform::String^ filename) + { + using namespace Windows::Storage; + using namespace Concurrency; + + auto folder = Windows::ApplicationModel::Package::Current->InstalledLocation; + + return create_task(folder->GetFileAsync(filename)).then([] (StorageFile^ file) + { +#if !PHONE + return FileIO::ReadBufferAsync(file); +#else + return file->OpenReadAsync(); + }).then([](Streams::IRandomAccessStreamWithContentType^ stream) + { + unsigned int bufferSize = static_cast<unsigned int>(stream->Size); + auto fileBuffer = ref new Streams::Buffer(bufferSize); + return stream->ReadAsync(fileBuffer, bufferSize, Streams::InputStreamOptions::None); +#endif + }).then([] (Streams::IBuffer^ fileBuffer) -> Platform::Array<byte>^ + { + auto fileData = ref new Platform::Array<byte>(fileBuffer->Length); + Streams::DataReader::FromBuffer(fileBuffer)->ReadBytes(fileData); + return fileData; + }); + } +} diff --git a/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.cso b/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.cso Binary files differnew file mode 100644 index 0000000..56f9c17 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.cso diff --git a/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl b/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl new file mode 100644 index 0000000..d61e2c8 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl @@ -0,0 +1,10 @@ +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float3 color : COLOR0; +}; + +float4 main(PixelShaderInput input) : SV_TARGET +{ + return float4(input.color,1.0f); +} diff --git a/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.cso b/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.cso Binary files differnew file mode 100644 index 0000000..ea80258 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.cso diff --git a/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl b/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl new file mode 100644 index 0000000..65d60e5 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl @@ -0,0 +1,35 @@ +cbuffer ModelViewProjectionConstantBuffer : register(b0) +{ + matrix model; + matrix view; + matrix projection; +}; + +struct VertexShaderInput +{ + float3 pos : POSITION; + float3 color : COLOR0; +}; + +struct VertexShaderOutput +{ + float4 pos : SV_POSITION; + float3 color : COLOR0; +}; + +VertexShaderOutput main(VertexShaderInput input) +{ + VertexShaderOutput output; + float4 pos = float4(input.pos, 1.0f); + + // Transform the vertex position into projected space. + pos = mul(pos, model); + pos = mul(pos, view); + pos = mul(pos, projection); + output.pos = pos; + + // Pass through the color without modification. + output.color = input.color; + + return output; +} diff --git a/Tests/VSWinStorePhone/Direct3DApp1/pch.cpp b/Tests/VSWinStorePhone/Direct3DApp1/pch.cpp new file mode 100644 index 0000000..1d9f38c --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/Tests/VSWinStorePhone/Direct3DApp1/pch.h b/Tests/VSWinStorePhone/Direct3DApp1/pch.h new file mode 100644 index 0000000..2302e66 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/pch.h @@ -0,0 +1,7 @@ +#pragma once + +#include <wrl/client.h> +#include <d3d11_1.h> +#include <DirectXMath.h> +#include <memory> +#include <agile.h> diff --git a/Tests/VSWinStorePhone/cmake/Package_vc11.store.appxmanifest.in b/Tests/VSWinStorePhone/cmake/Package_vc11.store.appxmanifest.in new file mode 100644 index 0000000..d3cb21f --- /dev/null +++ b/Tests/VSWinStorePhone/cmake/Package_vc11.store.appxmanifest.in @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest"> + <Identity Name="@PACKAGE_GUID@" Publisher="CN=mgong" Version="1.0.0.0" /> + <Properties> + <DisplayName>@SHORT_NAME@</DisplayName> + <PublisherDisplayName>mgong</PublisherDisplayName> + <Logo>StoreLogo.png</Logo> + </Properties> + <Prerequisites> + <OSMinVersion>6.2.1</OSMinVersion> + <OSMaxVersionTested>6.2.1</OSMaxVersionTested> + </Prerequisites> + <Resources> + <Resource Language="x-generate" /> + </Resources> + <Applications> + <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@SHORT_NAME@.App"> + <VisualElements DisplayName="@SHORT_NAME@" Description="@SHORT_NAME@" BackgroundColor="#336699" ForegroundText="light" Logo="Logo.png" SmallLogo="SmallLogo.png"> + <DefaultTile ShowName="allLogos" ShortName="@SHORT_NAME@" /> + <SplashScreen Image="SplashScreen.png" /> + </VisualElements> + </Application> + </Applications> +</Package> diff --git a/Tests/VSWinStorePhone/cmake/Package_vc11.wp.appxmanifest.in b/Tests/VSWinStorePhone/cmake/Package_vc11.wp.appxmanifest.in new file mode 100644 index 0000000..70f3abf --- /dev/null +++ b/Tests/VSWinStorePhone/cmake/Package_vc11.wp.appxmanifest.in @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0"> + <DefaultLanguage xmlns="" code="en-US"/> + <App xmlns="" ProductID="{@PACKAGE_GUID@}" Title="@SHORT_NAME@" RuntimeType="Modern Native" Version="1.0.0.0" Genre="apps.normal" Author="mgong" Description="Simple Direct3D application" Publisher="@SHORT_NAME@" PublisherID="{c618991e-1d39-41c2-a881-d3310705a091}"> + <IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath> + <Capabilities> + <Capability Name="ID_CAP_NETWORKING" /> + <Capability Name="ID_CAP_MEDIALIB_AUDIO" /> + <Capability Name="ID_CAP_MEDIALIB_PLAYBACK" /> + </Capabilities> + <Tasks> + <DefaultTask Name="_default" ImagePath="@SHORT_NAME@.exe" ImageParams="" /> + </Tasks> + <Tokens> + <PrimaryToken TokenID="@SHORT_NAME@Token" TaskName="_default"> + <TemplateFlip> + <SmallImageURI IsRelative="true" IsResource="false">FlipCycleTileSmall.png</SmallImageURI> + <Count>0</Count> + <BackgroundImageURI IsRelative="true" IsResource="false">FlipCycleTileMedium.png</BackgroundImageURI> + <Title>@SHORT_NAME@</Title> + <BackContent></BackContent> + <BackBackgroundImageURI></BackBackgroundImageURI> + <BackTitle></BackTitle> + <DeviceLockImageURI></DeviceLockImageURI> + <HasLarge></HasLarge> + </TemplateFlip> + </PrimaryToken> + </Tokens> + <ScreenResolutions> + <ScreenResolution Name="ID_RESOLUTION_WVGA" /> + <ScreenResolution Name="ID_RESOLUTION_WXGA" /> + <ScreenResolution Name="ID_RESOLUTION_HD720P" /> + </ScreenResolutions> + </App> +</Deployment> diff --git a/Tests/VSWinStorePhone/cmake/Package_vc12.store.appxmanifest.in b/Tests/VSWinStorePhone/cmake/Package_vc12.store.appxmanifest.in new file mode 100644 index 0000000..495f18e --- /dev/null +++ b/Tests/VSWinStorePhone/cmake/Package_vc12.store.appxmanifest.in @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest"> + <Identity Name="@PACKAGE_GUID@" Publisher="CN=mgong" Version="1.1.0.0" /> + <Properties> + <DisplayName>@SHORT_NAME@</DisplayName> + <PublisherDisplayName>mgong</PublisherDisplayName> + <Logo>StoreLogo.png</Logo> + </Properties> + <Prerequisites> + <OSMinVersion>6.3</OSMinVersion> + <OSMaxVersionTested>6.3</OSMaxVersionTested> + </Prerequisites> + <Resources> + <Resource Language="x-generate" /> + </Resources> + <Applications> + <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@SHORT_NAME@.App"> + <m2:VisualElements + DisplayName="@SHORT_NAME@" + Description="@SHORT_NAME@" + BackgroundColor="#336699" + ForegroundText="light" + Square150x150Logo="Logo.png" + Square30x30Logo="SmallLogo.png"> + <m2:DefaultTile ShortName="@SHORT_NAME@"> + <m2:ShowNameOnTiles> + <m2:ShowOn Tile="square150x150Logo" /> + </m2:ShowNameOnTiles> + </m2:DefaultTile> + <m2:SplashScreen Image="SplashScreen.png" /> + </m2:VisualElements> + </Application> + </Applications> +</Package> diff --git a/Tests/VSWinStorePhone/cmake/Package_vc12.wp.appxmanifest.in b/Tests/VSWinStorePhone/cmake/Package_vc12.wp.appxmanifest.in new file mode 100644 index 0000000..2d4d389 --- /dev/null +++ b/Tests/VSWinStorePhone/cmake/Package_vc12.wp.appxmanifest.in @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"> + <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>StoreLogo.png</Logo> + </Properties> + <Prerequisites> + <OSMinVersion>6.3.1</OSMinVersion> + <OSMaxVersionTested>6.3.1</OSMaxVersionTested> + </Prerequisites> + <Resources> + <Resource Language="x-generate" /> + </Resources> + <Applications> + <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@SHORT_NAME@.App"> + <m2:VisualElements + DisplayName="@SHORT_NAME@" + Description="@SHORT_NAME@" + BackgroundColor="#336699" + ForegroundText="light" + Square150x150Logo="Logo.png" + Square30x30Logo="SmallLogo.png"> + <m2:DefaultTile ShortName="@SHORT_NAME@"> + <m2:ShowNameOnTiles> + <m2:ShowOn Tile="square150x150Logo" /> + </m2:ShowNameOnTiles> + </m2:DefaultTile> + <m2:SplashScreen Image="SplashScreen.png" /> + </m2:VisualElements> + </Application> + </Applications> +</Package> |