diff options
Diffstat (limited to 'Tests')
619 files changed, 4316 insertions, 794 deletions
diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index 0702ab5..3de9ef7 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -83,3 +83,8 @@ get_target_property(_res imp INCLUDE_DIRECTORIES) if (_res) message(SEND_ERROR "include_directories populated the INCLUDE_DIRECTORIES target property") endif() + +# Test selecting lexicographically-later header of same name via include order. +# Xcode 'USE_HEADERMAP = YES' breaks this. +add_library(same STATIC same.c same_one/same.h same_two/same.h) +target_include_directories(same PRIVATE same_two) diff --git a/Tests/CMakeCommands/target_include_directories/same.c b/Tests/CMakeCommands/target_include_directories/same.c new file mode 100644 index 0000000..8fb8d29 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/same.c @@ -0,0 +1,7 @@ +#include "same.h" +#ifndef CORRECT_SAME_H_INCLUDED +# error "Correct \"same.h\" not included!" +#endif +void same(void) +{ +} diff --git a/Tests/CMakeCommands/target_include_directories/same_one/same.h b/Tests/CMakeCommands/target_include_directories/same_one/same.h new file mode 100644 index 0000000..e71fe01 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/same_one/same.h @@ -0,0 +1 @@ +#error "Wrong \"same.h\" included!" diff --git a/Tests/CMakeCommands/target_include_directories/same_two/same.h b/Tests/CMakeCommands/target_include_directories/same_two/same.h new file mode 100644 index 0000000..91ac63c --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/same_two/same.h @@ -0,0 +1 @@ +#define CORRECT_SAME_H_INCLUDED diff --git a/Tests/CMakeGUI/CatchShow.h b/Tests/CMakeGUI/CatchShow.h index 0254c15..7d370b6 100644 --- a/Tests/CMakeGUI/CatchShow.h +++ b/Tests/CMakeGUI/CatchShow.h @@ -30,12 +30,13 @@ void CatchShow::setCallback(F&& func) this->m_callback = [this, func](QObject* obj) { auto* d = qobject_cast<T*>(obj); if (d) { - QMetaObject::invokeMethod(obj, - [this, func, d]() { - ++this->m_count; - func(d); - }, - Qt::QueuedConnection); + QMetaObject::invokeMethod( + obj, + [this, func, d]() { + ++this->m_count; + func(d); + }, + Qt::QueuedConnection); } }; } diff --git a/Tests/CMakeLib/testArgumentParser.cxx b/Tests/CMakeLib/testArgumentParser.cxx index e044794..2647fef 100644 --- a/Tests/CMakeLib/testArgumentParser.cxx +++ b/Tests/CMakeLib/testArgumentParser.cxx @@ -365,7 +365,7 @@ bool testArgumentParserStaticBool() } // namespace -int testArgumentParser(int /*unused*/, char* /*unused*/ []) +int testArgumentParser(int /*unused*/, char* /*unused*/[]) { if (!testArgumentParserDynamic()) { std::cout << "While executing testArgumentParserDynamic().\n"; diff --git a/Tests/CMakeLib/testCMExtAlgorithm.cxx b/Tests/CMakeLib/testCMExtAlgorithm.cxx index b8319c3..c909f24 100644 --- a/Tests/CMakeLib/testCMExtAlgorithm.cxx +++ b/Tests/CMakeLib/testCMExtAlgorithm.cxx @@ -110,7 +110,7 @@ void testAppend() } } -int testCMExtAlgorithm(int /*unused*/, char* /*unused*/ []) +int testCMExtAlgorithm(int /*unused*/, char* /*unused*/[]) { testAppend(); diff --git a/Tests/CMakeLib/testCMExtEnumSet.cxx b/Tests/CMakeLib/testCMExtEnumSet.cxx index dbb0a54..ecf6d11 100644 --- a/Tests/CMakeLib/testCMExtEnumSet.cxx +++ b/Tests/CMakeLib/testCMExtEnumSet.cxx @@ -203,7 +203,7 @@ void testEdition() } } -int testCMExtEnumSet(int /*unused*/, char* /*unused*/ []) +int testCMExtEnumSet(int /*unused*/, char* /*unused*/[]) { testDeclaration(); testIteration(); diff --git a/Tests/CMakeLib/testCMExtMemory.cxx b/Tests/CMakeLib/testCMExtMemory.cxx index d8932ce..0143515 100644 --- a/Tests/CMakeLib/testCMExtMemory.cxx +++ b/Tests/CMakeLib/testCMExtMemory.cxx @@ -55,7 +55,7 @@ bool testReferenceCast() } } -int testCMExtMemory(int /*unused*/, char* /*unused*/ []) +int testCMExtMemory(int /*unused*/, char* /*unused*/[]) { if (!testReferenceCast()) { return 1; diff --git a/Tests/CMakeLib/testCMFilesystemPath.cxx b/Tests/CMakeLib/testCMFilesystemPath.cxx index 579ba99..52cb43a 100644 --- a/Tests/CMakeLib/testCMFilesystemPath.cxx +++ b/Tests/CMakeLib/testCMFilesystemPath.cxx @@ -969,7 +969,7 @@ bool testNonMemberFunctions() } } -int testCMFilesystemPath(int /*unused*/, char* /*unused*/ []) +int testCMFilesystemPath(int /*unused*/, char* /*unused*/[]) { int result = 0; diff --git a/Tests/CMakeLib/testCTestBinPacker.cxx b/Tests/CMakeLib/testCTestBinPacker.cxx index 772f417..038ceea 100644 --- a/Tests/CMakeLib/testCTestBinPacker.cxx +++ b/Tests/CMakeLib/testCTestBinPacker.cxx @@ -275,7 +275,7 @@ static bool TestExpectedPackResult(const ExpectedPackResult& expected) return true; } -int testCTestBinPacker(int /*unused*/, char* /*unused*/ []) +int testCTestBinPacker(int /*unused*/, char* /*unused*/[]) { int retval = 0; diff --git a/Tests/CMakeLib/testCTestResourceGroups.cxx b/Tests/CMakeLib/testCTestResourceGroups.cxx index 776d65d..b68301f 100644 --- a/Tests/CMakeLib/testCTestResourceGroups.cxx +++ b/Tests/CMakeLib/testCTestResourceGroups.cxx @@ -127,7 +127,7 @@ static bool TestExpectedParseResult(const ExpectedParseResult& expected) return true; } -int testCTestResourceGroups(int /*unused*/, char* /*unused*/ []) +int testCTestResourceGroups(int /*unused*/, char* /*unused*/[]) { int retval = 0; diff --git a/Tests/CMakeLib/testFindPackageCommand.cxx b/Tests/CMakeLib/testFindPackageCommand.cxx index bfd429f..30749be 100644 --- a/Tests/CMakeLib/testFindPackageCommand.cxx +++ b/Tests/CMakeLib/testFindPackageCommand.cxx @@ -14,7 +14,7 @@ std::cout << "FAILED: " << (m) << "\n"; \ failed = 1 -int testFindPackageCommand(int /*unused*/, char* /*unused*/ []) +int testFindPackageCommand(int /*unused*/, char* /*unused*/[]) { int failed = 0; diff --git a/Tests/CMakeLib/testGeneratedFileStream.cxx b/Tests/CMakeLib/testGeneratedFileStream.cxx index de44a0b..ad1c9e5 100644 --- a/Tests/CMakeLib/testGeneratedFileStream.cxx +++ b/Tests/CMakeLib/testGeneratedFileStream.cxx @@ -10,7 +10,7 @@ std::cout << "FAILED: " << (m1) << (m2) << "\n"; \ failed = 1 -int testGeneratedFileStream(int /*unused*/, char* /*unused*/ []) +int testGeneratedFileStream(int /*unused*/, char* /*unused*/[]) { int failed = 0; cmGeneratedFileStream gm; diff --git a/Tests/CMakeLib/testJSONHelpers.cxx b/Tests/CMakeLib/testJSONHelpers.cxx index 2cd3f75..053c163 100644 --- a/Tests/CMakeLib/testJSONHelpers.cxx +++ b/Tests/CMakeLib/testJSONHelpers.cxx @@ -457,7 +457,7 @@ bool testRequired() } } -int testJSONHelpers(int /*unused*/, char* /*unused*/ []) +int testJSONHelpers(int /*unused*/, char* /*unused*/[]) { if (!testInt()) { return 1; diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx index 2007fff..785f031 100644 --- a/Tests/CMakeLib/testOptional.cxx +++ b/Tests/CMakeLib/testOptional.cxx @@ -760,7 +760,7 @@ static bool testMemoryRange(std::vector<Event>& expected) return true; } -int testOptional(int /*unused*/, char* /*unused*/ []) +int testOptional(int /*unused*/, char* /*unused*/[]) { int retval = 0; diff --git a/Tests/CMakeLib/testRange.cxx b/Tests/CMakeLib/testRange.cxx index 4efe98e..36c1e18 100644 --- a/Tests/CMakeLib/testRange.cxx +++ b/Tests/CMakeLib/testRange.cxx @@ -15,7 +15,7 @@ } \ } while (false) -int testRange(int /*unused*/, char* /*unused*/ []) +int testRange(int /*unused*/, char* /*unused*/[]) { std::vector<int> const testData = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; diff --git a/Tests/CMakeLib/testString.cxx b/Tests/CMakeLib/testString.cxx index 5a9cad1..af34a2f 100644 --- a/Tests/CMakeLib/testString.cxx +++ b/Tests/CMakeLib/testString.cxx @@ -1163,7 +1163,7 @@ static bool testStability() return true; } -int testString(int /*unused*/, char* /*unused*/ []) +int testString(int /*unused*/, char* /*unused*/[]) { if (!testConstructDefault()) { return 1; diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx index 1e6b611..1bb23df 100644 --- a/Tests/CMakeLib/testStringAlgorithms.cxx +++ b/Tests/CMakeLib/testStringAlgorithms.cxx @@ -6,13 +6,15 @@ #include <iostream> #include <sstream> #include <string> +#include <type_traits> +#include <utility> #include <vector> #include <cm/string_view> #include "cmStringAlgorithms.h" -int testStringAlgorithms(int /*unused*/, char* /*unused*/ []) +int testStringAlgorithms(int /*unused*/, char* /*unused*/[]) { int failed = 0; @@ -144,6 +146,28 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ []) d -= val; assert_ok((d < div) && (d > -div), "cmStrCat double"); } + { + std::string val; + std::string expect; + val.reserve(50 * cmStrLen("cmStrCat move ") + 1); + auto data = val.data(); + auto capacity = val.capacity(); + bool moved = true; + for (int i = 0; i < 100; i++) { + if (i % 2 == 0) { + val = cmStrCat(std::move(val), "move "); + expect += "move "; + } else { + val = cmStrCat("cmStrCat ", std::move(val)); + expect = "cmStrCat " + std::move(expect); + } + if (val.data() != data || val.capacity() != capacity) { + moved = false; + } + } + assert_ok(moved, "cmStrCat move"); + assert_string(val, expect, "cmStrCat move"); + } // ---------------------------------------------------------------------- // Test cmWrap diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx index 92f5275..754205e 100644 --- a/Tests/CMakeLib/testSystemTools.cxx +++ b/Tests/CMakeLib/testSystemTools.cxx @@ -25,7 +25,7 @@ } \ } while (false) -int testSystemTools(int /*unused*/, char* /*unused*/ []) +int testSystemTools(int /*unused*/, char* /*unused*/[]) { int failed = 0; // ---------------------------------------------------------------------- diff --git a/Tests/CMakeLib/testUTF8.cxx b/Tests/CMakeLib/testUTF8.cxx index 1bf88cf..fc0b539 100644 --- a/Tests/CMakeLib/testUTF8.cxx +++ b/Tests/CMakeLib/testUTF8.cxx @@ -164,7 +164,7 @@ static bool is_invalid(const char* s) return true; } -int testUTF8(int /*unused*/, char* /*unused*/ []) +int testUTF8(int /*unused*/, char* /*unused*/[]) { int result = 0; for (test_utf8_entry const* e = good_entry; e->n; ++e) { diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx index fd88e24..0bdd44c 100644 --- a/Tests/CMakeLib/testUVRAII.cxx +++ b/Tests/CMakeLib/testUVRAII.cxx @@ -30,8 +30,7 @@ static bool testAsyncShutdown() std::thread([&] { std::this_thread::sleep_for(std::chrono::seconds(2)); signal.send(); - }) - .detach(); + }).detach(); if (uv_run(&Loop, UV_RUN_DEFAULT) != 0) { std::cerr << "Unclean exit state in testAsyncDtor" << std::endl; diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx index 760fa29..f9ed6af 100644 --- a/Tests/CMakeLib/testUVStreambuf.cxx +++ b/Tests/CMakeLib/testUVStreambuf.cxx @@ -404,12 +404,13 @@ static bool testUVStreambufRead( << std::endl; goto end; } - uv_timer_start(timer, - [](uv_timer_t* handle) { - auto buf = static_cast<cmUVStreambuf*>(handle->data); - buf->close(); - }, - 0, 0); + uv_timer_start( + timer, + [](uv_timer_t* handle) { + auto buf = static_cast<cmUVStreambuf*>(handle->data); + buf->close(); + }, + 0, 0); if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) { std::cout << "sgetn() returned " << readLen << ", should be 0" << std::endl; diff --git a/Tests/CMakeLib/testVisualStudioSlnParser.cxx b/Tests/CMakeLib/testVisualStudioSlnParser.cxx index 7fdba9a..c1bf3d4 100644 --- a/Tests/CMakeLib/testVisualStudioSlnParser.cxx +++ b/Tests/CMakeLib/testVisualStudioSlnParser.cxx @@ -27,7 +27,7 @@ static bool parsedRight(cmVisualStudioSlnParser& parser, return false; } -int testVisualStudioSlnParser(int, char* []) +int testVisualStudioSlnParser(int, char*[]) { cmVisualStudioSlnParser parser; diff --git a/Tests/CMakeLib/testXMLParser.cxx b/Tests/CMakeLib/testXMLParser.cxx index 8617cc1..32ee3ec 100644 --- a/Tests/CMakeLib/testXMLParser.cxx +++ b/Tests/CMakeLib/testXMLParser.cxx @@ -4,7 +4,7 @@ #include "cmXMLParser.h" -int testXMLParser(int /*unused*/, char* /*unused*/ []) +int testXMLParser(int /*unused*/, char* /*unused*/[]) { // TODO: Derive from parser and check attributes. cmXMLParser parser; diff --git a/Tests/CMakeLib/testXMLSafe.cxx b/Tests/CMakeLib/testXMLSafe.cxx index dc62eb9..f0bd9c9 100644 --- a/Tests/CMakeLib/testXMLSafe.cxx +++ b/Tests/CMakeLib/testXMLSafe.cxx @@ -25,7 +25,7 @@ static test_pair const pairs[] = { { nullptr, nullptr } }; -int testXMLSafe(int /*unused*/, char* /*unused*/ []) +int testXMLSafe(int /*unused*/, char* /*unused*/[]) { int result = 0; for (test_pair const* p = pairs; p->in; ++p) { diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6e35df9..c22f704 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -271,14 +271,6 @@ if(BUILD_TESTING) find_package(Qt5Widgets QUIET NO_MODULE) endif() - if(NOT CMake_TEST_EXTERNAL_CMAKE) - add_subdirectory(CMakeLib) - endif() - add_subdirectory(CMakeOnly) - add_subdirectory(RunCMake) - - add_subdirectory(FindPackageModeMakefileTest) - # Collect a list of all test build directories. set(TEST_BUILD_DIRS) @@ -342,6 +334,27 @@ if(BUILD_TESTING) endif() endif() + if(CMake_TEST_XCODE_VERSION AND CMAKE_OSX_SDKVERSION AND CMAKE_OSX_SDKPRODUCT) + if((NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1) AND + ((NOT CMAKE_OSX_SDKPRODUCT STREQUAL "Mac OS X") OR + (NOT CMAKE_OSX_SDKVERSION VERSION_LESS 10.10))) + if(CMAKE_GENERATOR STREQUAL "Xcode") + set(CMake_TEST_XCODE_SWIFT 1) + endif() + endif() + endif() + if(NOT DEFINED CMake_TEST_Swift) + if(CMAKE_Swift_COMPILER OR CMake_TEST_XCODE_SWIFT) + set(CMake_TEST_Swift 1) + endif() + endif() + + if(NOT DEFINED CMake_TEST_OBJC) + if(APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") + set(CMake_TEST_OBJC 1) + endif() + endif() + # Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value, # whichever is greater. set(CMAKE_LONG_TEST_TIMEOUT 1500) @@ -352,6 +365,14 @@ if(BUILD_TESTING) set(CMAKE_LONG_TEST_TIMEOUT 1500) endif() + if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_subdirectory(CMakeLib) + endif() + add_subdirectory(CMakeOnly) + add_subdirectory(RunCMake) + + add_subdirectory(FindPackageModeMakefileTest) + add_test(NAME CMake.Copyright COMMAND ${CMAKE_CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCopyright.cmake) @@ -380,16 +401,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(MissingSourceFile MissingSourceFile) set_tests_properties(MissingSourceFile PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c") - if(CMake_TEST_XCODE_VERSION AND CMAKE_OSX_SDKVERSION AND CMAKE_OSX_SDKPRODUCT) - if((NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1) AND - ((NOT CMAKE_OSX_SDKPRODUCT STREQUAL "Mac OS X") OR - (NOT CMAKE_OSX_SDKVERSION VERSION_LESS 10.10))) - if(CMAKE_GENERATOR STREQUAL "Xcode") - set(CMake_TEST_XCODE_SWIFT 1) - endif() - endif() - endif() - if(CMAKE_Swift_COMPILER OR CMake_TEST_XCODE_SWIFT) + if(CMake_TEST_Swift) ADD_TEST_MACRO(SwiftOnly SwiftOnly) if(CMake_TEST_XCODE_SWIFT) ADD_TEST_MACRO(SwiftMix SwiftMix) @@ -432,6 +444,11 @@ if(BUILD_TESTING) endif() endif() + if(CMake_TEST_OBJC) + add_subdirectory(ObjC) + add_subdirectory(ObjCXX) + endif() + if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") ADD_TEST_MACRO(CSharpOnly CSharpOnly) if(NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") @@ -1463,6 +1480,7 @@ if(BUILD_TESTING) GTK2 Iconv ICU + ImageMagick Intl Jasper JNI @@ -1521,8 +1539,11 @@ if(BUILD_TESTING) add_subdirectory(GoogleTest) endif() - if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy + if(CMake_TEST_FindPython OR CMake_TEST_FindPython_SABIModule OR CMake_TEST_FindPython_NumPy OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython OR CMake_TEST_FindPython_PyPy) + if (CMake_TEST_FindPython AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") + set(CMake_TEST_FindPython_SABIModule TRUE) + endif() add_subdirectory(FindPython) endif() @@ -2144,10 +2165,16 @@ if(BUILD_TESTING) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC") endif() + if(MSVC AND NOT MSVC_VERSION LESS 1700 + AND (CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64") + ) + ADD_TEST_MACRO(VSMARMASM VSMARMASM) + endif() + if(MSVC AND NOT MSVC_VERSION LESS 1310 AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio 9 " OR CMAKE_SIZEOF_VOID_P EQUAL 4) - AND (NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") + AND (NOT CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64") ) ADD_TEST_MACRO(VSMASM VSMASM) endif() @@ -2500,9 +2527,6 @@ if(BUILD_TESTING) -Dgen=${CMAKE_GENERATOR} -P ${CMake_SOURCE_DIR}/Tests/CFBundleTest/VerifyResult.cmake) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CFBundleTest") - - add_subdirectory(ObjC) - add_subdirectory(ObjCXX) endif() endif() diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 0907d03..c990eb4 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -96,8 +96,8 @@ foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG check_version_string(${VTEST} ${VTEST}_VERSION_STRING) endforeach() -foreach(VTEST BISON Boost CUDA DOXYGEN FLEX GIF GTK2 - HDF5 JPEG LibArchive OPENSCENEGRAPH Ruby RUBY SWIG Protobuf) +foreach(VTEST BISON Boost BZIP2 CUDA DOXYGEN FLEX GIF GTK2 + HDF5 JPEG LibArchive LIBLZMA OPENSCENEGRAPH Ruby RUBY SWIG Protobuf ZLIB) check_version_string(${VTEST} ${VTEST}_VERSION) endforeach() diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index bd2dd7e..16e631b 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -32,16 +32,6 @@ AddCMakeTest(ProcessorCount "-DKWSYS_TEST_EXE=$<TARGET_FILE:cmsysTestsCxx>") AddCMakeTest(PushCheckState "") AddCMakeTest(While "") -AddCMakeTest(FileDownload "") -set_tests_properties(CMake.FileDownload PROPERTIES - PASS_REGULAR_EXPRESSION "file already exists with expected MD5 sum" - FAIL_REGULAR_EXPRESSION "Unexpected status|incorrectly interpreted" - ) -AddCMakeTest(FileDownloadBadHash "") -set_property(TEST CMake.FileDownloadBadHash PROPERTY - WILL_FAIL TRUE - ) - AddCMakeTest(FileUpload "") set(EndStuff_PreArgs diff --git a/Tests/CMakeTests/FileDownloadBadHashTest.cmake.in b/Tests/CMakeTests/FileDownloadBadHashTest.cmake.in deleted file mode 100644 index 64b45ed..0000000 --- a/Tests/CMakeTests/FileDownloadBadHashTest.cmake.in +++ /dev/null @@ -1,13 +0,0 @@ -if(NOT "@CMAKE_CURRENT_SOURCE_DIR@" MATCHES "^/") - set(slash /) -endif() -set(url "file://${slash}@CMAKE_CURRENT_SOURCE_DIR@/FileDownloadInput.png") -set(dir "@CMAKE_CURRENT_BINARY_DIR@/downloads") - -file(DOWNLOAD - ${url} - ${dir}/file3.png - TIMEOUT 2 - STATUS status - EXPECTED_HASH SHA1=5555555555555555555555555555555555555555 - ) diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in deleted file mode 100644 index 255909d..0000000 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ /dev/null @@ -1,229 +0,0 @@ -# We do not contact any real URLs, but do try a bogus one. -# Remove any proxy configuration that may change behavior. -unset(ENV{http_proxy}) -unset(ENV{https_proxy}) - -set(timeout 4) - -if(NOT "@CMAKE_CURRENT_SOURCE_DIR@" MATCHES "^/") - set(slash /) -endif() -set(url "file://${slash}@CMAKE_CURRENT_SOURCE_DIR@/FileDownloadInput.png") -set(dir "@CMAKE_CURRENT_BINARY_DIR@/downloads") - -# Beware Windows asynchronous file/directory removal, rename and then -# remove the renamed dir so we can be certain the dir isn't there when -# we get to the file() commands below -if(EXISTS "${dir}") - file(RENAME ${dir} "${dir}_beingRemoved") - file(REMOVE_RECURSE "${dir}_beingRemoved") -endif() - -function(__reportIfWrongStatus statusPair expectedStatusCode) - list(GET statusPair 0 statusCode) - if(NOT statusCode EQUAL expectedStatusCode) - message(SEND_ERROR - "Unexpected status: ${statusCode}, expected: ${expectedStatusCode}") - endif() -endfunction() - -message(STATUS "FileDownload:1") -file(DOWNLOAD - ${url} - ${dir}/file1.png - TIMEOUT ${timeout} - STATUS status - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:2") -file(DOWNLOAD - ${url} - ${dir}/file2.png - TIMEOUT ${timeout} - STATUS status - SHOW_PROGRESS - ) -__reportIfWrongStatus("${status}" 0) - -# Two calls in a row, exactly the same arguments. -# Since downloaded file should exist already for 2nd call, -# the 2nd call will short-circuit and return early... -# -if(EXISTS ${dir}/file3.png) - file(REMOVE ${dir}/file3.png) -endif() - -message(STATUS "FileDownload:3") -file(DOWNLOAD - ${url} - ${dir}/file3.png - TIMEOUT ${timeout} - STATUS status - EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92 - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:4") -file(DOWNLOAD - ${url} - ${dir}/file3.png - TIMEOUT ${timeout} - STATUS status - EXPECTED_HASH SHA1=67eee17f79d9ac557284fc0b8ad19f25723fb578 - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:5") -file(DOWNLOAD - ${url} - ${dir}/file3.png - TIMEOUT ${timeout} - STATUS status - EXPECTED_HASH SHA224=ba283726bbb602776818b463943189afd91836cb7ee5dd6e2c7b5ae4 - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:6") -file(DOWNLOAD - ${url} - ${dir}/file3.png - TIMEOUT ${timeout} - STATUS status - EXPECTED_HASH SHA256=cf3334b1275071e1da6e8c396ccb72cf1b2388d8c937526f3af26230affb9423 - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:7") -file(DOWNLOAD - ${url} - ${dir}/file3.png - TIMEOUT ${timeout} - STATUS status - EXPECTED_HASH SHA384=43a5d13978d97c660db44481aee0604cb4ff6ca0775cd5c2cd68cd8000e107e507c4caf6c228941231041e282ffb8950 - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:8") -file(DOWNLOAD - ${url} - ${dir}/file3.png - TIMEOUT ${timeout} - STATUS status - EXPECTED_HASH SHA512=6984e0909a1018030ccaa418e3be1654223cdccff0fe6adc745f9aea7e377f178be53b9fc7d54a6f81c2b62ef9ddcd38ba1978fedf4c5e7139baaf355eefad5b - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:9") -file(DOWNLOAD - ${url} - ${dir}/file3.png - TIMEOUT ${timeout} - STATUS status - EXPECTED_HASH MD5=dbd330d52f4dbd60115d4191904ded92 - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:10") -file(DOWNLOAD - ${url} - ${dir}/file3.png - TIMEOUT ${timeout} - STATUS status - EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92 - ) -__reportIfWrongStatus("${status}" 0) -# Print status because we check its message too -message(STATUS "${status}") - -# do not use proxy for lookup of invalid site (DNS failure by proxy looks -# different than DNS failure without proxy) -set(ENV{no_proxy} "$ENV{no_proxy},badhostname.invalid") -message(STATUS "FileDownload:11") -file(DOWNLOAD - badhostname.invalid - ${dir}/file11.png - TIMEOUT 30 - STATUS status - ) -message(STATUS "${status}") -__reportIfWrongStatus("${status}" 6) # 6 corresponds to an unresolvable host name - -message(STATUS "FileDownload:12") -set(absFile "@CMAKE_CURRENT_BINARY_DIR@/file12.png") -if(EXISTS "${absFile}") - file(RENAME ${absFile} "${absFile}_beingRemoved") - file(REMOVE "${absFile}_beingRemoved") -endif() -file(DOWNLOAD - ${url} - file12.png - TIMEOUT ${timeout} - EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92 - STATUS status - ) -__reportIfWrongStatus("${status}" 0) -if(NOT EXISTS file12.png) - message(SEND_ERROR "file12.png not downloaded: ${status}") -endif() - -message(STATUS "FileDownload:13") -file(DOWNLOAD - ${url} - TIMEOUT ${timeout} - STATUS status - ) -__reportIfWrongStatus("${status}" 0) -if(EXISTS TIMEOUT) - file(REMOVE TIMEOUT) - message(SEND_ERROR "TIMEOUT argument was incorrectly interpreted as a filename") -endif() -message(STATUS "${status}") - -message(STATUS "FileDownload:14") -file(DOWNLOAD - ${url} - ${dir}/file14.bin - TIMEOUT ${timeout} - STATUS status - RANGE_START 0 - EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92 - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:15") -file(DOWNLOAD - ${url} - ${dir}/file15.bin - TIMEOUT ${timeout} - STATUS status - RANGE_END 50 - EXPECTED_MD5 8592e5665b839b5d23825dc84c135b61 - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:16") -file(DOWNLOAD - ${url} - ${dir}/file16.bin - TIMEOUT ${timeout} - STATUS status - RANGE_START 10 - RANGE_END 50 - EXPECTED_MD5 36cd52681e6c6c8fef85fcd9e86fc30d - ) -__reportIfWrongStatus("${status}" 0) - -message(STATUS "FileDownload:17") -file(DOWNLOAD - ${url} - ${dir}/file17.bin - TIMEOUT ${timeout} - STATUS status - RANGE_START 0 - RANGE_END 50 - RANGE_START 60 - RANGE_END 100 - EXPECTED_MD5 c5c9e74e82d493dd901eecccd659cebc - ) -__reportIfWrongStatus("${status}" 0) diff --git a/Tests/CMakeTests/FileDownloadInput.png b/Tests/CMakeTests/FileUploadInput.png Binary files differindex 9ab565a..9ab565a 100644 --- a/Tests/CMakeTests/FileDownloadInput.png +++ b/Tests/CMakeTests/FileUploadInput.png diff --git a/Tests/CMakeTests/FileUploadTest.cmake.in b/Tests/CMakeTests/FileUploadTest.cmake.in index 0e6f080..7725041 100644 --- a/Tests/CMakeTests/FileUploadTest.cmake.in +++ b/Tests/CMakeTests/FileUploadTest.cmake.in @@ -9,7 +9,7 @@ endif() file(MAKE_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/uploads") -set(filename "@CMAKE_CURRENT_SOURCE_DIR@/FileDownloadInput.png") +set(filename "@CMAKE_CURRENT_SOURCE_DIR@/FileUploadInput.png") if(NOT "@CMAKE_CURRENT_BINARY_DIR@" MATCHES "^/") set(slash /) endif() diff --git a/Tests/CMakeTests/String-TIMESTAMP-TimeZone.cmake b/Tests/CMakeTests/String-TIMESTAMP-TimeZone.cmake new file mode 100644 index 0000000..eb2eb42 --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-TimeZone.cmake @@ -0,0 +1,22 @@ +string(TIMESTAMP output "%z") + +STRING(LENGTH output output_length) + +message("~${output}~") + +set(expected_output_length 6) + +if(NOT(${output_length} EQUAL ${expected_output_length})) + message(FATAL_ERROR "expected ${expected_output_length} entries in output with all specifiers; found ${output_length}") +endif() + +string(SUBSTRING ${output} 0 1 output0) +string(SUBSTRING ${output} 4 1 output4) + +if(NOT((${output0} STREQUAL "-") OR (${output0} STREQUAL "+"))) + message(FATAL_ERROR "expected output[0] equ '+' or '-'; found: '${output0}'") +endif() + +if(NOT((${output4} STREQUAL "0") OR (${output4} STREQUAL "5"))) + message(FATAL_ERROR "expected output[4] equ '0' or '5'; found: '${output4}'") +endif() diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index 154afa7..5f8b111 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -44,6 +44,8 @@ set(TIMESTAMP-IncompleteSpecifier-RESULT 0) set(TIMESTAMP-IncompleteSpecifier-STDERR "~foobar%~") set(TIMESTAMP-AllSpecifiers-RESULT 0) set(TIMESTAMP-AllSpecifiers-STDERR "~[0-9]+(;[0-9]+)*~") +set(TIMESTAMP-TimeZone-RESULT 0) +set(TIMESTAMP-TimeZone-STDERR "~[-,+][0-9][0-9][0-9][0-9]~") set(TIMESTAMP-MonthWeekNames-RESULT 0) set(TIMESTAMP-MonthWeekNames-STDERR "~[^%]+;[^%]+~") set(TIMESTAMP-UnixTime-RESULT 0) @@ -75,6 +77,7 @@ check_cmake_test(String TIMESTAMP-IncompleteSpecifier TIMESTAMP-AllSpecifiers TIMESTAMP-MonthWeekNames + TIMESTAMP-TimeZone TIMESTAMP-UnixTime ) diff --git a/Tests/CSharpLinkFromCxx/.gitattributes b/Tests/CSharpLinkFromCxx/.gitattributes index cf9d355..57a39049 100644 --- a/Tests/CSharpLinkFromCxx/.gitattributes +++ b/Tests/CSharpLinkFromCxx/.gitattributes @@ -1 +1 @@ -UsefulManagedCppClass.* -format.clang-format-6.0 +UsefulManagedCppClass.* -format.clang-format diff --git a/Tests/CheckFortran.cmake b/Tests/CheckFortran.cmake index 36293f5..1e943a1 100644 --- a/Tests/CheckFortran.cmake +++ b/Tests/CheckFortran.cmake @@ -33,6 +33,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" RESULT_VARIABLE result ) include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran/result.cmake OPTIONAL) + # FIXME: Replace with message(CONFIGURE_LOG) when CMake version is high enough. if(CMAKE_Fortran_COMPILER AND "${result}" STREQUAL "0") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "${_desc} passed with the following output:\n" diff --git a/Tests/CheckSourceTree/check.cmake b/Tests/CheckSourceTree/check.cmake index c2e3529..655e419 100644 --- a/Tests/CheckSourceTree/check.cmake +++ b/Tests/CheckSourceTree/check.cmake @@ -3,6 +3,15 @@ if(DEFINED ENV{CTEST_REAL_HOME}) set(ENV{HOME} "$ENV{CTEST_REAL_HOME}") endif() +file(GLOB known_files + "${CMake_SOURCE_DIR}/Tests/Java/hs_err_pid*.log" + "${CMake_SOURCE_DIR}/Tests/JavaExportImport/InstallExport/hs_err_pid*.log" + "${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders/hs_err_pid*.log" + ) +if(known_files) + file(REMOVE ${known_files}) +endif() + execute_process( COMMAND "${GIT_EXECUTABLE}" status WORKING_DIRECTORY "${CMake_SOURCE_DIR}" diff --git a/Tests/CheckSwift.cmake b/Tests/CheckSwift.cmake index 099c298..86ea603 100644 --- a/Tests/CheckSwift.cmake +++ b/Tests/CheckSwift.cmake @@ -42,6 +42,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckSwift/result.cmake OPTIONAL) + # FIXME: Replace with message(CONFIGURE_LOG) when CMake version is high enough. if(CMAKE_Swift_COMPILER AND "${result}" STREQUAL "0") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "${_desc} passed with the following output:\n" diff --git a/Tests/CompileFeatures/.gitattributes b/Tests/CompileFeatures/.gitattributes index 95a8956..83da28d 100644 --- a/Tests/CompileFeatures/.gitattributes +++ b/Tests/CompileFeatures/.gitattributes @@ -1,2 +1,2 @@ # Do not format a source containing C++11 '>>' syntax as C++98. -cxx_right_angle_brackets.cpp -format.clang-format-6.0 +cxx_right_angle_brackets.cpp -format.clang-format diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index f3d3a73..17f4408 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -374,3 +374,16 @@ else() target_link_libraries(CompileFeaturesGenex3 PRIVATE std_11_iface) target_compile_definitions(CompileFeaturesGenex3 PRIVATE ${genex_test_defs} ALLOW_LATER_STANDARDS=1) endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" + AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.30 + # The MSVC 14.29.30133 toolset supports C++20, + # but MSBuild puts the flags in the wrong order. + OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30129 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + ) + ) + add_library(msvc_permissive msvc_permissive.cxx) + target_compile_features(msvc_permissive PRIVATE cxx_std_20) + # The `-std:c++20` flag implies `-permissive-`. Test passing `-permissive` afterward. + target_compile_options(msvc_permissive PRIVATE -permissive) +endif() diff --git a/Tests/CompileFeatures/cxx_attribute_deprecated.cpp b/Tests/CompileFeatures/cxx_attribute_deprecated.cpp index 8faeca8..5482db8 100644 --- a/Tests/CompileFeatures/cxx_attribute_deprecated.cpp +++ b/Tests/CompileFeatures/cxx_attribute_deprecated.cpp @@ -1,5 +1,8 @@ -[[deprecated]] int foo() { return 0; } +[[deprecated]] int foo() +{ + return 0; +} int someFunc() { diff --git a/Tests/CompileFeatures/cxx_attributes.cpp b/Tests/CompileFeatures/cxx_attributes.cpp index 1434317..543a3f5 100644 --- a/Tests/CompileFeatures/cxx_attributes.cpp +++ b/Tests/CompileFeatures/cxx_attributes.cpp @@ -1,5 +1,5 @@ -void unusedFunc[[noreturn]]() +void unusedFunc [[noreturn]] () { throw 1; } diff --git a/Tests/CompileFeatures/msvc_permissive.cxx b/Tests/CompileFeatures/msvc_permissive.cxx new file mode 100644 index 0000000..a8f2ff3 --- /dev/null +++ b/Tests/CompileFeatures/msvc_permissive.cxx @@ -0,0 +1,9 @@ +#if !defined(_MSVC_LANG) || _MSVC_LANG < 202002L +# error "This source must be compiled with MSVC as C++20 or later." +#endif +// Test a construct that is allowed by MSVC only with 'cl -permissive'. +enum class X +{ + Y = 1 +}; +int array[X::Y]; diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt index 669c412..0041b07 100644 --- a/Tests/Cuda/CMakeLists.txt +++ b/Tests/Cuda/CMakeLists.txt @@ -16,6 +16,7 @@ add_cuda_test_macro(Cuda.SeparableCompCXXOnly SeparableCompCXXOnly) add_cuda_test_macro(Cuda.Toolkit Toolkit) add_cuda_test_macro(Cuda.IncludePathNoToolkit IncludePathNoToolkit) add_cuda_test_macro(Cuda.SharedRuntimePlusToolkit SharedRuntimePlusToolkit) +add_cuda_test_macro(Cuda.StaticRuntimePlusToolkit StaticRuntimePlusToolkit) add_cuda_test_macro(Cuda.Complex CudaComplex) add_cuda_test_macro(Cuda.ProperLinkFlags ProperLinkFlags) @@ -24,10 +25,4 @@ if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") add_cuda_test_macro(Cuda.ProperDeviceLibraries ProperDeviceLibraries) endif() -# The CUDA only ships the shared version of the toolkit libraries -# on windows -if(NOT WIN32) - add_cuda_test_macro(Cuda.StaticRuntimePlusToolkit StaticRuntimePlusToolkit) -endif() - add_cuda_test_macro(Cuda.WithC CudaWithC) diff --git a/Tests/Cuda/SeparableCompCXXOnly/main.cpp b/Tests/Cuda/SeparableCompCXXOnly/main.cpp index 8135246..ed913ff 100644 --- a/Tests/Cuda/SeparableCompCXXOnly/main.cpp +++ b/Tests/Cuda/SeparableCompCXXOnly/main.cpp @@ -1,5 +1,5 @@ -int main(int, char const* []) +int main(int, char const*[]) { return 0; } diff --git a/Tests/Cuda/SharedRuntimePlusToolkit/CMakeLists.txt b/Tests/Cuda/SharedRuntimePlusToolkit/CMakeLists.txt index 61a3190..088be3b 100644 --- a/Tests/Cuda/SharedRuntimePlusToolkit/CMakeLists.txt +++ b/Tests/Cuda/SharedRuntimePlusToolkit/CMakeLists.txt @@ -15,16 +15,19 @@ add_library(SharedToolkit SHARED shared.cpp) target_link_libraries(SharedToolkit PRIVATE Common PUBLIC CUDA::curand CUDA::nppif) target_link_libraries(SharedToolkit PUBLIC CUDA::cudart) -# The CUDA only ships the shared version of the toolkit libraries -# on windows -if(NOT WIN32) +# Verify the CUDA Toolkit has static libraries +if(TARGET CUDA::curand_static AND + TARGET CUDA::nppif_static) #shared runtime with static toolkit libraries add_library(StaticToolkit SHARED static.cpp) + target_compile_definitions(StaticToolkit INTERFACE "HAS_STATIC_VERSION") target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static) target_link_libraries(StaticToolkit PUBLIC CUDA::cudart) - #static runtime with mixed toolkit libraries + + #shared runtime with mixed toolkit libraries add_library(MixedToolkit SHARED mixed.cpp) + target_compile_definitions(MixedToolkit INTERFACE "HAS_MIXED_VERSION") target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand_static CUDA::nppif) target_link_libraries(MixedToolkit PUBLIC CUDA::cudart) endif() diff --git a/Tests/Cuda/SharedRuntimePlusToolkit/main.cpp b/Tests/Cuda/SharedRuntimePlusToolkit/main.cpp index 2a4da22..d958c3a 100644 --- a/Tests/Cuda/SharedRuntimePlusToolkit/main.cpp +++ b/Tests/Cuda/SharedRuntimePlusToolkit/main.cpp @@ -1,19 +1,28 @@ #ifdef _WIN32 # define IMPORT __declspec(dllimport) +#else +# define IMPORT +#endif + IMPORT int shared_version(); + +#ifdef HAS_STATIC_VERSION +IMPORT int static_version(); +#else int static_version() { return 0; } +#endif + +#ifdef HAS_MIXED_VERSION +IMPORT int mixed_version(); +#else int mixed_version() { return 0; } -#else -int shared_version(); -int static_version(); -int mixed_version(); #endif int main() diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt b/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt index df6c392..bb3dadf 100644 --- a/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt +++ b/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt @@ -15,15 +15,23 @@ add_library(SharedToolkit SHARED shared.cpp) target_link_libraries(SharedToolkit PRIVATE Common PUBLIC CUDA::curand CUDA::nppif) target_link_libraries(SharedToolkit PUBLIC CUDA::cudart_static) -#static runtime with static toolkit libraries -add_library(StaticToolkit SHARED static.cpp) -target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static) -target_link_libraries(StaticToolkit PUBLIC CUDA::cudart_static) +# Verify the CUDA Toolkit has static libraries +if(TARGET CUDA::curand_static AND + TARGET CUDA::nppif_static) + #static runtime with static toolkit libraries + add_library(StaticToolkit SHARED static.cpp) + target_compile_definitions(StaticToolkit INTERFACE "HAS_STATIC_VERSION") + target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static) + target_link_libraries(StaticToolkit PUBLIC CUDA::cudart_static) -#static runtime with mixed toolkit libraries -add_library(MixedToolkit SHARED mixed.cpp) -target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand CUDA::nppif_static) -target_link_libraries(MixedToolkit PUBLIC CUDA::cudart_static) + #static runtime with mixed toolkit libraries + add_library(MixedToolkit SHARED mixed.cpp) + target_compile_definitions(MixedToolkit INTERFACE "HAS_MIXED_VERSION") + target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand CUDA::nppif_static) + target_link_libraries(MixedToolkit PUBLIC CUDA::cudart_static) +endif() add_executable(StaticRuntimePlusToolkit main.cpp) -target_link_libraries(StaticRuntimePlusToolkit PRIVATE SharedToolkit StaticToolkit MixedToolkit) +target_link_libraries(StaticRuntimePlusToolkit PRIVATE SharedToolkit + $<TARGET_NAME_IF_EXISTS:StaticToolkit> + $<TARGET_NAME_IF_EXISTS:MixedToolkit>) diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/curand.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/curand.cpp index 95872f0..fdd7b53 100644 --- a/Tests/Cuda/StaticRuntimePlusToolkit/curand.cpp +++ b/Tests/Cuda/StaticRuntimePlusToolkit/curand.cpp @@ -1,6 +1,12 @@ // Comes from: // https://docs.nvidia.com/cuda/curand/host-api-overview.html#host-api-example +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + /* * This program uses the host CURAND API to generate 100 * pseudorandom floats. @@ -25,7 +31,7 @@ } \ } while (0) -int curand_main() +EXPORT int curand_main() { size_t n = 100; size_t i; diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/main.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/main.cpp index 5a09f8e..d958c3a 100644 --- a/Tests/Cuda/StaticRuntimePlusToolkit/main.cpp +++ b/Tests/Cuda/StaticRuntimePlusToolkit/main.cpp @@ -1,8 +1,29 @@ +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +#else +# define IMPORT +#endif -int shared_version(); -int static_version(); -int mixed_version(); +IMPORT int shared_version(); + +#ifdef HAS_STATIC_VERSION +IMPORT int static_version(); +#else +int static_version() +{ + return 0; +} +#endif + +#ifdef HAS_MIXED_VERSION +IMPORT int mixed_version(); +#else +int mixed_version() +{ + return 0; +} +#endif int main() { diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/mixed.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/mixed.cpp index a05140d..6de6886 100644 --- a/Tests/Cuda/StaticRuntimePlusToolkit/mixed.cpp +++ b/Tests/Cuda/StaticRuntimePlusToolkit/mixed.cpp @@ -1,8 +1,16 @@ -int curand_main(); -int nppif_main(); +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +# define EXPORT __declspec(dllexport) +#else +# define IMPORT +# define EXPORT +#endif -int mixed_version() +IMPORT int curand_main(); +IMPORT int nppif_main(); + +EXPORT int mixed_version() { return curand_main() == 0 && nppif_main() == 0; } diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp index 2871090..ac5341c 100644 --- a/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp +++ b/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp @@ -1,6 +1,12 @@ // Comes from // https://devtalk.nvidia.com/default/topic/1037482/gpu-accelerated-libraries/help-me-help-you-with-modern-cmake-and-cuda-mwe-for-npp/post/5271066/#5271066 +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + #include <cstdio> #include <iostream> @@ -8,7 +14,7 @@ #include <cuda_runtime_api.h> #include <nppi_filtering_functions.h> -int nppif_main() +EXPORT int nppif_main() { /** * 8-bit unsigned single-channel 1D row convolution. diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/shared.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/shared.cpp index 9967b66..f3c3dbc 100644 --- a/Tests/Cuda/StaticRuntimePlusToolkit/shared.cpp +++ b/Tests/Cuda/StaticRuntimePlusToolkit/shared.cpp @@ -1,8 +1,16 @@ +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +# define EXPORT __declspec(dllexport) +#else +# define IMPORT +# define EXPORT +#endif + int curand_main(); int nppif_main(); -int shared_version() +EXPORT int shared_version() { return curand_main() == 0 && nppif_main() == 0; } diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/static.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/static.cpp index ca7eb4c..6932fa3 100644 --- a/Tests/Cuda/StaticRuntimePlusToolkit/static.cpp +++ b/Tests/Cuda/StaticRuntimePlusToolkit/static.cpp @@ -1,8 +1,16 @@ -int curand_main(); -int nppif_main(); +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +# define EXPORT __declspec(dllexport) +#else +# define IMPORT +# define EXPORT +#endif -int static_version() +IMPORT int curand_main(); +IMPORT int nppif_main(); + +EXPORT int static_version() { return curand_main() == 0 && nppif_main() == 0; } diff --git a/Tests/Cuda/Toolkit/CMakeLists.txt b/Tests/Cuda/Toolkit/CMakeLists.txt index 4df29fa..b67aa32 100644 --- a/Tests/Cuda/Toolkit/CMakeLists.txt +++ b/Tests/Cuda/Toolkit/CMakeLists.txt @@ -22,6 +22,9 @@ set(cuda_libs cudart cuda_driver cublas cufft cufftw curand cusolver cusparse) if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1) list(APPEND cuda_libs cublasLt) endif() +if(CUDAToolkit_VERSION_MAJOR VERSION_GREATER 11) + list(APPEND cuda_libs nvJitLink) +endif() if(CUDAToolkit_VERSION_MAJOR VERSION_LESS 11) list(APPEND cuda_libs nvgraph) endif() @@ -30,6 +33,8 @@ endif() foreach (cuda_lib IN LISTS cuda_libs) if(NOT CUDA_${cuda_lib}_LIBRARY) message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY not found") + elseif(CUDA_${cuda_lib}_LIBRARY MATCHES [[\.\./]]) + message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY[\"${CUDA_${cuda_lib}_LIBRARY}\"] to not contain /..") endif() if(NOT TARGET CUDA::${cuda_lib}) message(FATAL_ERROR "expected CUDAToolkit target CUDA::${cuda_lib} not found") @@ -41,6 +46,9 @@ if(CUDAToolkit_VERSION_MAJOR VERSION_LESS 11) list(APPEND npp_libs nppicom) endif() foreach (cuda_lib IN LISTS npp_libs) + if(CUDA_${cuda_lib}_LIBRARY MATCHES [[\.\./]]) + message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY[\"${CUDA_${cuda_lib}_LIBRARY}\"] to not contain /..") + endif() if(NOT TARGET CUDA::${cuda_lib}) message(FATAL_ERROR "The CUDA::${cuda_lib} target was expected but couldn't be found") endif() diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index 39634ac..db08076 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -10,6 +10,7 @@ add_cuda_test_macro(CudaOnly.CompileFlags CudaOnlyCompileFlags) add_cuda_test_macro(CudaOnly.EnableStandard CudaOnlyEnableStandard) add_cuda_test_macro(CudaOnly.ExportPTX CudaOnlyExportPTX) add_cuda_test_macro(CudaOnly.SharedRuntimePlusToolkit CudaOnlySharedRuntimePlusToolkit) +add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit) add_cuda_test_macro(CudaOnly.Standard98 CudaOnlyStandard98) add_cuda_test_macro(CudaOnly.Toolkit CudaOnlyToolkit) add_cuda_test_macro(CudaOnly.ToolkitBeforeLang CudaOnlyToolkitBeforeLang) @@ -28,12 +29,6 @@ if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") add_cuda_test_macro(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) endif() -# The CUDA only ships the shared version of the toolkit libraries -# on windows -if(NOT WIN32) - add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit) -endif() - add_cuda_test_macro(CudaOnly.DeviceLTO CudaOnlyDeviceLTO) if(MSVC) diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt index 17069e3..ca73b1a 100644 --- a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt +++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt @@ -15,6 +15,9 @@ get_property(sep_comp TARGET CUDASeparateLibA PROPERTY CUDA_SEPARABLE_COMPILATIO if(NOT sep_comp) message(FATAL_ERROR "CUDA_SEPARABLE_COMPILATION not initialized") endif() +set_target_properties(CUDASeparateLibA + PROPERTIES + POSITION_INDEPENDENT_CODE ON) unset(CMAKE_CUDA_SEPARABLE_COMPILATION) if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC") @@ -26,17 +29,24 @@ if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC") target_compile_options(CUDASeparateLibA PRIVATE -Xcompiler=-bigobj) endif() -#Having file4/file5 in a shared library causes serious problems -#with the nvcc linker and it will generate bad entries that will -#cause a segv when trying to run the executable +#Have file4 and file5 in different shared libraries so that we +#verify that hidden visibility is passed to the device linker. +#Otherwise we will get a segv when trying to run the executable # -add_library(CUDASeparateLibB STATIC file4.cu file5.cu) +add_library(CUDASeparateLibB SHARED file4.cu) target_compile_features(CUDASeparateLibB PRIVATE cuda_std_11) target_link_libraries(CUDASeparateLibB PRIVATE CUDASeparateLibA) -set_target_properties(CUDASeparateLibA - CUDASeparateLibB - PROPERTIES CUDA_SEPARABLE_COMPILATION ON - POSITION_INDEPENDENT_CODE ON) +add_library(CUDASeparateLibC SHARED file5.cu) +target_compile_features(CUDASeparateLibC PRIVATE cuda_std_11) +target_link_libraries(CUDASeparateLibC PRIVATE CUDASeparateLibA) + +set_target_properties(CUDASeparateLibB + CUDASeparateLibC + PROPERTIES + CUDA_SEPARABLE_COMPILATION ON + POSITION_INDEPENDENT_CODE ON + CUDA_VISIBILITY_PRESET hidden + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/main") add_subdirectory(main) diff --git a/Tests/CudaOnly/SeparateCompilation/file1.h b/Tests/CudaOnly/SeparateCompilation/file1.h index ff1945c..1cedc20 100644 --- a/Tests/CudaOnly/SeparateCompilation/file1.h +++ b/Tests/CudaOnly/SeparateCompilation/file1.h @@ -1,5 +1,14 @@ #pragma once + +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +# define IMPORT __declspec(dllimport) +#else +# define EXPORT __attribute__((__visibility__("default"))) +# define IMPORT +#endif + struct result_type { int input; diff --git a/Tests/CudaOnly/SeparateCompilation/file4.cu b/Tests/CudaOnly/SeparateCompilation/file4.cu index 2e3e01e..cc24a46 100644 --- a/Tests/CudaOnly/SeparateCompilation/file4.cu +++ b/Tests/CudaOnly/SeparateCompilation/file4.cu @@ -15,7 +15,7 @@ static __global__ void file4_kernel(result_type& r, int x) result_type_dynamic rd = file2_func(x); } -int file4_launch_kernel(int x) +EXPORT int file4_launch_kernel(int x) { result_type r; file4_kernel<<<1, 1>>>(r, x); diff --git a/Tests/CudaOnly/SeparateCompilation/file5.cu b/Tests/CudaOnly/SeparateCompilation/file5.cu index fee8e9e..38cbeb2 100644 --- a/Tests/CudaOnly/SeparateCompilation/file5.cu +++ b/Tests/CudaOnly/SeparateCompilation/file5.cu @@ -15,7 +15,7 @@ static __global__ void file5_kernel(result_type& r, int x) result_type_dynamic rd = file2_func(x); } -int file5_launch_kernel(int x) +EXPORT int file5_launch_kernel(int x) { result_type r; file5_kernel<<<1, 1>>>(r, x); diff --git a/Tests/CudaOnly/SeparateCompilation/main/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/main/CMakeLists.txt index c181078..ce066c6 100644 --- a/Tests/CudaOnly/SeparateCompilation/main/CMakeLists.txt +++ b/Tests/CudaOnly/SeparateCompilation/main/CMakeLists.txt @@ -1,5 +1,5 @@ add_executable(CudaOnlySeparateCompilation main.cu) -target_link_libraries(CudaOnlySeparateCompilation PRIVATE CUDASeparateLibB) +target_link_libraries(CudaOnlySeparateCompilation PRIVATE CUDASeparateLibB CUDASeparateLibC) set_target_properties(CudaOnlySeparateCompilation PROPERTIES CUDA_STANDARD 11 CUDA_STANDARD_REQUIRED TRUE diff --git a/Tests/CudaOnly/SeparateCompilation/main/main.cu b/Tests/CudaOnly/SeparateCompilation/main/main.cu index 2b6e8f4..c3f7ce7 100644 --- a/Tests/CudaOnly/SeparateCompilation/main/main.cu +++ b/Tests/CudaOnly/SeparateCompilation/main/main.cu @@ -4,8 +4,8 @@ #include "../file1.h" #include "../file2.h" -int file4_launch_kernel(int x); -int file5_launch_kernel(int x); +IMPORT int file4_launch_kernel(int x); +IMPORT int file5_launch_kernel(int x); int choose_cuda_device() { diff --git a/Tests/CudaOnly/SeparateCompilationPTX/main.cu b/Tests/CudaOnly/SeparateCompilationPTX/main.cu index 164cde5..f94beff 100644 --- a/Tests/CudaOnly/SeparateCompilationPTX/main.cu +++ b/Tests/CudaOnly/SeparateCompilationPTX/main.cu @@ -21,10 +21,11 @@ int main() cuCtxCreate(&context, 0, device); CUmodule module; - cuModuleLoadData(&module, kernels); - if (module == nullptr) { - std::cerr << "Failed to load the embedded ptx" << std::endl; + CUresult result = cuModuleLoadData(&module, kernels); + std::cout << "module pointer: " << module << '\n'; + if (result != CUDA_SUCCESS || module == nullptr) { + std::cerr << "Failed to load the embedded ptx with error: " + << static_cast<unsigned int>(result) << '\n'; return 1; } - std::cout << module << std::endl; } diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt b/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt index 03fba22..0b01085 100644 --- a/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt +++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt @@ -16,16 +16,18 @@ target_link_libraries(SharedToolkit PRIVATE Common PUBLIC CUDA::curand CUDA::npp set_target_properties(SharedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY none) target_link_libraries(SharedToolkit PUBLIC CUDA::cudart) -# The CUDA only ships the shared version of the toolkit libraries -# on windows -if(NOT WIN32) +# Verify the CUDA Toolkit has static libraries +if(TARGET CUDA::curand_static AND + TARGET CUDA::nppif_static) #shared runtime with static toolkit libraries add_library(StaticToolkit SHARED static.cu) + target_compile_definitions(StaticToolkit INTERFACE "HAS_STATIC_VERSION") target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static) set_target_properties(StaticToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Shared) - #static runtime with mixed toolkit libraries + #shared runtime with mixed toolkit libraries add_library(MixedToolkit SHARED mixed.cu) + target_compile_definitions(MixedToolkit INTERFACE "HAS_MIXED_VERSION") target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand_static CUDA::nppif) set_target_properties(MixedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Shared) endif() diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu b/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu index 2a4da22..d958c3a 100644 --- a/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu +++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu @@ -1,19 +1,28 @@ #ifdef _WIN32 # define IMPORT __declspec(dllimport) +#else +# define IMPORT +#endif + IMPORT int shared_version(); + +#ifdef HAS_STATIC_VERSION +IMPORT int static_version(); +#else int static_version() { return 0; } +#endif + +#ifdef HAS_MIXED_VERSION +IMPORT int mixed_version(); +#else int mixed_version() { return 0; } -#else -int shared_version(); -int static_version(); -int mixed_version(); #endif int main() diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt b/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt index 534bab2..ae03b66 100644 --- a/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt @@ -16,17 +16,25 @@ target_link_libraries(SharedToolkit PRIVATE Common CUDA::curand CUDA::nppif ) set_target_properties(SharedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY none) target_link_libraries(SharedToolkit PUBLIC CUDA::cudart_static) -#static runtime with static toolkit libraries -add_library(StaticToolkit SHARED static.cu) -target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static) +# Verify the CUDA Toolkit has static libraries +if(TARGET CUDA::curand_static AND + TARGET CUDA::nppif_static) + #static runtime with static toolkit libraries + add_library(StaticToolkit SHARED static.cu) + target_compile_definitions(StaticToolkit INTERFACE "HAS_STATIC_VERSION") + target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static) -#static runtime with mixed toolkit libraries -add_library(MixedToolkit SHARED mixed.cu) -target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand CUDA::nppif_static) -set_target_properties(MixedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Static) + #static runtime with mixed toolkit libraries + add_library(MixedToolkit SHARED mixed.cu) + target_compile_definitions(MixedToolkit INTERFACE "HAS_MIXED_VERSION") + target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand CUDA::nppif_static) + set_target_properties(MixedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Static) +endif() add_executable(CudaOnlyStaticRuntimePlusToolkit main.cu) -target_link_libraries(CudaOnlyStaticRuntimePlusToolkit PRIVATE SharedToolkit StaticToolkit MixedToolkit) +target_link_libraries(CudaOnlyStaticRuntimePlusToolkit PRIVATE SharedToolkit + $<TARGET_NAME_IF_EXISTS:StaticToolkit> + $<TARGET_NAME_IF_EXISTS:MixedToolkit>) if(UNIX) # Help the shared cuda runtime find libcurand and libnppif when they are not located diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu index 95872f0..fdd7b53 100644 --- a/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu @@ -1,6 +1,12 @@ // Comes from: // https://docs.nvidia.com/cuda/curand/host-api-overview.html#host-api-example +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + /* * This program uses the host CURAND API to generate 100 * pseudorandom floats. @@ -25,7 +31,7 @@ } \ } while (0) -int curand_main() +EXPORT int curand_main() { size_t n = 100; size_t i; diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu index 5a09f8e..d958c3a 100644 --- a/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu @@ -1,8 +1,29 @@ +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +#else +# define IMPORT +#endif -int shared_version(); -int static_version(); -int mixed_version(); +IMPORT int shared_version(); + +#ifdef HAS_STATIC_VERSION +IMPORT int static_version(); +#else +int static_version() +{ + return 0; +} +#endif + +#ifdef HAS_MIXED_VERSION +IMPORT int mixed_version(); +#else +int mixed_version() +{ + return 0; +} +#endif int main() { diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu index a05140d..6de6886 100644 --- a/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu @@ -1,8 +1,16 @@ -int curand_main(); -int nppif_main(); +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +# define EXPORT __declspec(dllexport) +#else +# define IMPORT +# define EXPORT +#endif -int mixed_version() +IMPORT int curand_main(); +IMPORT int nppif_main(); + +EXPORT int mixed_version() { return curand_main() == 0 && nppif_main() == 0; } diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu index 2871090..ac5341c 100644 --- a/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu @@ -1,6 +1,12 @@ // Comes from // https://devtalk.nvidia.com/default/topic/1037482/gpu-accelerated-libraries/help-me-help-you-with-modern-cmake-and-cuda-mwe-for-npp/post/5271066/#5271066 +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + #include <cstdio> #include <iostream> @@ -8,7 +14,7 @@ #include <cuda_runtime_api.h> #include <nppi_filtering_functions.h> -int nppif_main() +EXPORT int nppif_main() { /** * 8-bit unsigned single-channel 1D row convolution. diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu index 9967b66..f3c3dbc 100644 --- a/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu @@ -1,8 +1,16 @@ +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +# define EXPORT __declspec(dllexport) +#else +# define IMPORT +# define EXPORT +#endif + int curand_main(); int nppif_main(); -int shared_version() +EXPORT int shared_version() { return curand_main() == 0 && nppif_main() == 0; } diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu index ca7eb4c..6932fa3 100644 --- a/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu @@ -1,8 +1,16 @@ -int curand_main(); -int nppif_main(); +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +# define EXPORT __declspec(dllexport) +#else +# define IMPORT +# define EXPORT +#endif -int static_version() +IMPORT int curand_main(); +IMPORT int nppif_main(); + +EXPORT int static_version() { return curand_main() == 0 && nppif_main() == 0; } diff --git a/Tests/CudaOnly/Toolkit/CMakeLists.txt b/Tests/CudaOnly/Toolkit/CMakeLists.txt index 1486c1a..e0801a3 100644 --- a/Tests/CudaOnly/Toolkit/CMakeLists.txt +++ b/Tests/CudaOnly/Toolkit/CMakeLists.txt @@ -20,14 +20,20 @@ set(cuda_libs cudart cuda_driver cublas cufft cufftw curand cusolver cusparse) if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1) list(APPEND cuda_libs cublasLt) endif() +if(CUDAToolkit_VERSION_MAJOR VERSION_GREATER 11) + list(APPEND cuda_libs nvJitLink) +endif() if(CUDAToolkit_VERSION_MAJOR VERSION_LESS 11) list(APPEND cuda_libs nvgraph) endif() + # Verify that all the CUDA:: targets and variables exist foreach (cuda_lib IN LISTS cuda_libs) if(NOT CUDA_${cuda_lib}_LIBRARY) message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY not found") + elseif(CUDA_${cuda_lib}_LIBRARY MATCHES [[\.\./]]) + message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY[\"${CUDA_${cuda_lib}_LIBRARY}\"] to not contain /..") endif() if(NOT TARGET CUDA::${cuda_lib}) message(FATAL_ERROR "expected CUDAToolkit target CUDA::${cuda_lib} not found") @@ -41,6 +47,8 @@ endif() foreach (cuda_lib ) if(NOT CUDA_${cuda_lib}_LIBRARY) message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY not found") + elseif(CUDA_${cuda_lib}_LIBRARY MATCHES [[\.\./]]) + message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY[\"${CUDA_${cuda_lib}_LIBRARY}\"] to not contain /..") endif() if(NOT TARGET CUDA::${cuda_lib}) message(FATAL_ERROR "expected CUDAToolkit target CUDA::${cuda_lib} not found") @@ -50,6 +58,8 @@ endforeach() foreach (cuda_lib nvrtc nvToolsExt OpenCL) if(NOT CUDA_${cuda_lib}_LIBRARY) message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY not found") + elseif(CUDA_${cuda_lib}_LIBRARY MATCHES [[\.\./]]) + message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY[\"${CUDA_${cuda_lib}_LIBRARY}\"] to not contain /..") endif() if(NOT TARGET CUDA::${cuda_lib}) diff --git a/Tests/CustomCommandByproducts/CMakeLists.txt b/Tests/CustomCommandByproducts/CMakeLists.txt index 08c897c..e391a6f 100644 --- a/Tests/CustomCommandByproducts/CMakeLists.txt +++ b/Tests/CustomCommandByproducts/CMakeLists.txt @@ -149,6 +149,29 @@ set_property(TARGET ExternalLibraryWithSubstitution PROPERTY IMPORTED_LOCATION ${binary_dir}${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX}) add_dependencies(ExternalLibraryWithSubstitution ExtTargetSubst) +# Generate the library file of an imported target as an install byproduct +# of an external project. The byproduct uses <INSTALL_DIR> that is substituted +# by the real install path +if(_isMultiConfig) + set(cfg /${CMAKE_CFG_INTDIR}) +else() + set(cfg) +endif() +include(ExternalProject) +ExternalProject_Add(ExtTargetInstallSubst + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND + "${CMAKE_COMMAND}" -E copy_directory "<BINARY_DIR>${cfg}" "<INSTALL_DIR>${cfg}" + BUILD_BYPRODUCTS "<BINARY_DIR>${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX}" + INSTALL_BYPRODUCTS "<INSTALL_DIR>${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) +ExternalProject_Get_Property(ExtTargetInstallSubst install_dir) +add_library(ExternalLibraryWithInstallDirSubstitution STATIC IMPORTED) +set_property(TARGET ExternalLibraryWithInstallDirSubstitution PROPERTY IMPORTED_LOCATION + ${install_dir}${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX}) +add_dependencies(ExternalLibraryWithInstallDirSubstitution ExtTargetInstallSubst) + # Add an executable consuming all the byproducts. add_executable(CustomCommandByproducts CustomCommandByproducts.c @@ -169,6 +192,18 @@ add_dependencies(CustomCommandByproducts Producer2) target_link_libraries(CustomCommandByproducts ExternalLibrary) +add_executable(ExternalLibraryByproducts ExternalLibraryByproducts.c) +target_link_libraries(ExternalLibraryByproducts ExternalLibrary) + +add_executable(ExternalLibraryByproducts_WithSubstitution ExternalLibraryByproducts.c) +target_link_libraries(ExternalLibraryByproducts_WithSubstitution ExternalLibraryWithSubstitution) + +add_executable(ExternalLibraryByproducts_WithInstallDirSubstitution ExternalLibraryByproducts.c) +target_link_libraries( + ExternalLibraryByproducts_WithInstallDirSubstitution + ExternalLibraryWithInstallDirSubstitution +) + if(CMAKE_GENERATOR STREQUAL "Ninja") add_custom_target(CheckNinja ALL COMMENT "Checking build.ninja" diff --git a/Tests/CustomCommandByproducts/ExternalLibraryByproducts.c b/Tests/CustomCommandByproducts/ExternalLibraryByproducts.c new file mode 100644 index 0000000..3588e53 --- /dev/null +++ b/Tests/CustomCommandByproducts/ExternalLibraryByproducts.c @@ -0,0 +1,5 @@ +extern int ExternalLibrary(void); +int main(void) +{ + return (ExternalLibrary() + 1); +} diff --git a/Tests/FindImageMagick/CMakeLists.txt b/Tests/FindImageMagick/CMakeLists.txt new file mode 100644 index 0000000..8a3c70c --- /dev/null +++ b/Tests/FindImageMagick/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindImageMagick.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindImageMagick/Test" + "${CMake_BINARY_DIR}/Tests/FindImageMagick/Test" + ${build_generator_args} + --build-project TestFindImageMagick + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindImageMagick/Test/CMakeLists.txt b/Tests/FindImageMagick/Test/CMakeLists.txt new file mode 100644 index 0000000..6182260 --- /dev/null +++ b/Tests/FindImageMagick/Test/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.4) +project(FindImageMagick C CXX) +include(CTest) + +find_package(ImageMagick REQUIRED COMPONENTS Magick++ MagickWand) + +add_executable(test_magick++ main_magick++.cxx) +target_link_libraries(test_magick++ PRIVATE ImageMagick::Magick++) +add_test(NAME test_magick++ COMMAND test_magick++) + +add_executable(test_magick_wand main_magick_wand.c) +target_link_libraries(test_magick_wand ImageMagick::MagickWand) +add_test(NAME test_magick_wand COMMAND test_magick_wand) diff --git a/Tests/FindImageMagick/Test/main_magick++.cxx b/Tests/FindImageMagick/Test/main_magick++.cxx new file mode 100644 index 0000000..d0208d4 --- /dev/null +++ b/Tests/FindImageMagick/Test/main_magick++.cxx @@ -0,0 +1,10 @@ +#include <iostream> +#include <string> + +#include <Magick++.h> + +int main() +{ + Magick::InitializeMagick(""); + return 0; +} diff --git a/Tests/FindImageMagick/Test/main_magick_wand.c b/Tests/FindImageMagick/Test/main_magick_wand.c new file mode 100644 index 0000000..fa6d170 --- /dev/null +++ b/Tests/FindImageMagick/Test/main_magick_wand.c @@ -0,0 +1,8 @@ +#include <wand/MagickWand.h> + +int main() +{ + MagickWand* wand = NewMagickWand(); + wand = DestroyMagickWand(wand); + return 0; +} diff --git a/Tests/FindOpenACC/CXXTest/main.cxx b/Tests/FindOpenACC/CXXTest/main.cxx index 7369045..14b912b 100644 --- a/Tests/FindOpenACC/CXXTest/main.cxx +++ b/Tests/FindOpenACC/CXXTest/main.cxx @@ -8,7 +8,7 @@ void vecaddgpu(float* r, float* a, float* b, std::size_t n) r[i] = a[i] + b[i]; } -int main(int, char* []) +int main(int, char*[]) { const std::size_t n = 100000; /* vector length */ std::vector<float> a(n); /* input vector 1 */ diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index d4cf36b..b6942c9 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -377,6 +377,7 @@ if(CMake_TEST_FindPython) --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" + "-DCMake_TEST_FindPython_SABIModule=${CMake_TEST_FindPython_SABIModule}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) @@ -478,6 +479,35 @@ if(CMake_TEST_FindPython) endif() endif() +if(CMake_TEST_FindPython_SABIModule) + add_test(NAME FindPython.Python2.Development.SABIModule COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python2SABIModule" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2SABIModule" + ${build_generator_args} + --build-project TestPython2SABIModule + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + set_tests_properties(FindPython.Python2.Development.SABIModule PROPERTIES + PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: .*Development\\.SABIModule") + + # Use exclusively Release configuration because Debug is, on Windows with MSVC, + # unusable with SABI: Python force link with debug version of full versioned library rather than + # the stable ABI one. + add_test(NAME FindPython.Python3.Development.SABIModule COMMAND + ${CMAKE_CTEST_COMMAND} -C Release + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python3SABIModule" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3SABIModule" + ${build_generator_args} + --build-project TestPython3SABIModule + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C Release + ) +endif() + if(CMake_TEST_FindPython_NumPy) add_test(NAME FindPython.NumPy COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> diff --git a/Tests/FindPython/Python2SABIModule/CMakeLists.txt b/Tests/FindPython/Python2SABIModule/CMakeLists.txt new file mode 100644 index 0000000..4f01197 --- /dev/null +++ b/Tests/FindPython/Python2SABIModule/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython2SABIModule LANGUAGES C) + +find_package(Python2 REQUIRED COMPONENTS Interpreter Development.Module Development.SABIModule) diff --git a/Tests/FindPython/Python3Module/CMakeLists.txt b/Tests/FindPython/Python3Module/CMakeLists.txt index 5945962..ccc1fdb 100644 --- a/Tests/FindPython/Python3Module/CMakeLists.txt +++ b/Tests/FindPython/Python3Module/CMakeLists.txt @@ -11,6 +11,9 @@ endif() if (Python3_Development_FOUND) message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found") endif() +if (Python3_Development.SABIModule_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.SABIModule' unexpectedly found") +endif() if (Python3_Development.Embed_FOUND) message (FATAL_ERROR "Python 3, COMPONENT 'Development.Embed' unexpectedly found") endif() @@ -25,6 +28,12 @@ endif() if(TARGET Python3::Python) message(SEND_ERROR "Python3::Python unexpectedly found") endif() +if(TARGET Python3::SABIMOdule) + message(SEND_ERROR "Python3::SABIModule unexpectedly found") +endif() +if(TARGET Python3::Embed) + message(SEND_ERROR "Python3::Embed unexpectedly found") +endif() if(NOT TARGET Python3::Module) message(SEND_ERROR "Python3::Module not found") endif() diff --git a/Tests/FindPython/Python3SABIModule/CMakeLists.txt b/Tests/FindPython/Python3SABIModule/CMakeLists.txt new file mode 100644 index 0000000..2a067d0 --- /dev/null +++ b/Tests/FindPython/Python3SABIModule/CMakeLists.txt @@ -0,0 +1,51 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython3SABIModule LANGUAGES C) + +include(CTest) + +find_package(Python3 REQUIRED COMPONENTS Interpreter Development.SABIModule) +if (NOT Python3_FOUND) + message (FATAL_ERROR "Failed to find Python 3") +endif() +if (Python3_Development_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found") +endif() +if (Python3_Development.Embed_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.Embed' unexpectedly found") +endif() +if (Python3_Development.Module_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.Module' unexpectedly found") +endif() +if (NOT Python3_Development.SABIModule_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.SABIModule' not found") +endif() + +if(NOT TARGET Python3::Interpreter) + message(SEND_ERROR "Python3::Interpreter not found") +endif() + +if(TARGET Python3::Python) + message(SEND_ERROR "Python3::Python unexpectedly found") +endif() +if(TARGET Python3::Module) + message(SEND_ERROR "Python3::Module unexpectedly found") +endif() +if(NOT TARGET Python3::SABIModule) + message(SEND_ERROR "Python3::SABIModule not found") +endif() + +Python3_add_library (spam3 MODULE USE_SABI 3 WITH_SOABI ../spam.c) +target_compile_definitions (spam3 PRIVATE PYTHON3) + +if (Python3_SOSABI) + get_property (suffix TARGET spam3 PROPERTY SUFFIX) + if (NOT suffix MATCHES "^.${Python3_SOSABI}") + message(FATAL_ERROR "Module suffix do not include Python3_SOSABI") + endif() +endif() + + +add_test (NAME python3_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" + "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt index ae50f32..42d282d 100644 --- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt @@ -8,7 +8,12 @@ find_package(Python2 REQUIRED COMPONENTS Interpreter Development) if (NOT Python2_FOUND) message (FATAL_ERROR "Failed to find Python 2") endif() -find_package(Python3 REQUIRED COMPONENTS Interpreter Development) + +set(components Interpreter Development) +if (CMake_TEST_FindPython_SABIModule AND WIN32) + list (APPEND components Development.SABIModule) +endif() +find_package(Python3 REQUIRED COMPONENTS ${components}) if (NOT Python3_FOUND) message (FATAL_ERROR "Failed to find Python 3") endif() @@ -108,3 +113,28 @@ add_test(NAME FindPython.RequiredArtifacts.Library-Include.INVALID COMMAND "-DPython3_INCLUDE_DIR=${Python2_INCLUDE_DIRS}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + +if (CMake_TEST_FindPython_SABIModule AND WIN32) + add_test(NAME FindPython.RequiredArtifacts.SABILibrary.VALID COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check" + "${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/SABILibrary.VALID" + ${build_generator_args} + --build-project TestRequiredArtifacts.Check + --build-options -DPYTHON_IS_FOUND=TRUE -DCHECK_SABI_LIBRARY=ON + "-DPython3_SABI_LIBRARY=${Python3_SABI_LIBRARY_RELEASE}" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.RequiredArtifacts.SABILibrary.INVALID COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check" + "${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/SABILibrary.INVALID" + ${build_generator_args} + --build-project TestRequiredArtifacts.Check + --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_SABI_LIBRARY=ON + "-DPython3_SABI_LIBRARY=${Python2_LIBRARY_RELEASE}" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +endif() diff --git a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt index 287cfdb..bb4f67c 100644 --- a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt @@ -16,6 +16,10 @@ if (CHECK_LIBRARY OR CHECK_INCLUDE) set (required_include "${Python3_INCLUDE_DIR}") endif() endif() +if (CHECK_SABI_LIBRARY) + list (APPEND components Development.SABIModule) + set (required_sabi_library "${Python3_SABI_LIBRARY}") +endif() find_package (Python3 COMPONENTS ${components}) @@ -39,3 +43,7 @@ endif() if (CHECK_INCLUDE AND NOT Python3_INCLUDE_DIRS STREQUAL required_include) message (FATAL_ERROR "Failed to use input variable Python3_INCLUDE_DIR") endif() + +if (CHECK_SABI_LIBRARY AND NOT Python3_SABI_LIBRARY_RELEASE STREQUAL required_sabi_library) + message (FATAL_ERROR "Failed to use input variable Python3_SABI_LIBRARY") +endif() diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index b07c214..fc71a18 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -56,8 +56,6 @@ add_custom_target(checksayhello ALL ) add_dependencies(checksayhello sayhello) -set(err_log ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log) -file(REMOVE "${err_log}") include(CheckFortranSourceCompiles) unset(HAVE_PRINT CACHE) CHECK_Fortran_SOURCE_COMPILES([[ @@ -66,10 +64,24 @@ CHECK_Fortran_SOURCE_COMPILES([[ END ]] HAVE_PRINT) if(NOT HAVE_PRINT) - if(EXISTS "${err_log}") - file(READ "${err_log}" err) + set(configure_log "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeConfigureLog.yaml") + if(EXISTS "${configure_log}") + file(READ "${configure_log}" log_content) + else() + set(log_content "") + endif() + if(log_content MATCHES [[( - + kind: "try_compile-v1"( ++ [^ +]+)+ + checks: + - "Performing Test HAVE_PRINT"( ++ [^ +]+)+)]]) + set(err "${CMAKE_MATCH_1}") + else() + set(err "") endif() - string(REPLACE "\n" "\n " err " ${err}") message(SEND_ERROR "CHECK_Fortran_SOURCE_COMPILES for HAVE_PRINT failed:\n" "${err}") endif() diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index ebbe288..3fb53d1 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -200,6 +200,12 @@ set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION fallback_loc) set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_DEBUG "" DEBUG) set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_RELEASE "") +add_library(importedFallback_genex STATIC IMPORTED) +set_property(TARGET importedFallback_genex PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_property(TARGET importedFallback_genex PROPERTY IMPORTED_LOCATION_RELEASE release_loc) +set_property(TARGET importedFallback_genex PROPERTY + INTERFACE_COMPILE_DEFINITIONS $<$<CONFIG:Release>:FOOBAR=1>) + add_custom_target(check-part3 ALL COMMAND ${msys2_no_conv} ${CMAKE_COMMAND} -Dtest_version_greater_1=$<VERSION_GREATER:1.0,1.1.1> @@ -211,6 +217,7 @@ add_custom_target(check-part3 ALL -Dconfig=$<CONFIGURATION> -Dtest_imported_includes=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> -Dtest_imported_fallback=$<STREQUAL:$<TARGET_FILE_NAME:importedFallback>,fallback_loc> + -Dtest_imported_fallback_genex=$<STREQUAL:$<TARGET_PROPERTY:importedFallback_genex,INTERFACE_COMPILE_DEFINITIONS>,FOOBAR=1> -Dtest_alias_file_exe=$<STREQUAL:$<TARGET_FILE:Alias::SomeExe>,$<TARGET_FILE:someexe>> -Dtest_alias_file_lib=$<STREQUAL:$<TARGET_FILE:Alias::SomeLib>,$<TARGET_FILE:empty1>> -Dtest_alias_target_name=$<STREQUAL:$<TARGET_PROPERTY:Alias::SomeLib,NAME>,$<TARGET_PROPERTY:empty1,NAME>> @@ -261,13 +268,24 @@ else() set(test_shell_path2 /shell/path /another/path) endif() +set(test_shell_path_genex "$<SHELL_PATH:${test_shell_path}>") +set(test_shell_path2_genex "$<SHELL_PATH:${test_shell_path2}>") +if(msys1_prefix) + # Add a prefix to the value produced by the genex so that the path does + # not look absolute, thus suppressing conversion by MSYS 1.0 bash. + set(test_shell_path_genex "${msys1_prefix}${test_shell_path_genex}") + # There is no way to suppress conversion of the second path in + # MSYS 1.0 bash, so do the comparison at generate time instead. + set(test_shell_path2_genex "$<STREQUAL:${test_shell_path2_genex},/c/shell/path:/d/another/path>") +endif() + add_custom_target(check-part4 ALL COMMAND ${msys2_no_conv} ${CMAKE_COMMAND} # Prefix path to bypass its further conversion when being processed by # CMake as command-line argument -Dmsys1_prefix=${msys1_prefix} - -Dtest_shell_path=${msys1_prefix}$<SHELL_PATH:${test_shell_path}> - "-Dtest_shell_path2=$<SHELL_PATH:${test_shell_path2}>" + "-Dtest_shell_path=${test_shell_path_genex}" + "-Dtest_shell_path2=${test_shell_path2_genex}" -Dif_1=$<IF:1,a,b> -Dif_2=$<IF:0,a,b> -Dif_3=$<IF:$<EQUAL:10,30>,a,b> diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 5571c3d..e1b1f93 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -19,6 +19,7 @@ else() endif() check(test_imported_fallback "1") +check(test_imported_fallback_genex "1") check(test_alias_file_exe "1") check(test_alias_file_lib "1") diff --git a/Tests/GeneratorExpression/check-part4.cmake b/Tests/GeneratorExpression/check-part4.cmake index a7e0944..28f3699 100644 --- a/Tests/GeneratorExpression/check-part4.cmake +++ b/Tests/GeneratorExpression/check-part4.cmake @@ -16,8 +16,13 @@ else() check(test_shell_path [[/shell/path]]) endif() if(WIN32) - if(CMAKE_GENERATOR STREQUAL "MSYS Makefiles" AND NOT msys1_prefix) - check(test_shell_path2 [[/c/shell/path:/d/another/path]]) + if(CMAKE_GENERATOR STREQUAL "MSYS Makefiles") + if(msys1_prefix) + # The comparison was done at generate time with the STREQUAL genex. + check(test_shell_path2 [[1]]) + else() + check(test_shell_path2 [[/c/shell/path:/d/another/path]]) + endif() elseif(CMAKE_GENERATOR STREQUAL "Unix Makefiles") check(test_shell_path2 [[c:/shell/path;d:/another/path]]) else() diff --git a/Tests/PositionIndependentTargets/.gitattributes b/Tests/PositionIndependentTargets/.gitattributes index 61b2751..ed36631 100644 --- a/Tests/PositionIndependentTargets/.gitattributes +++ b/Tests/PositionIndependentTargets/.gitattributes @@ -1,2 +1,2 @@ # Do not format a source where we want a long line preserved. -pic_test.h -format.clang-format-6.0 +pic_test.h -format.clang-format diff --git a/Tests/QtAutogen/Complex/calwidget.cpp b/Tests/QtAutogen/Complex/calwidget.cpp index f58b182..202ed49 100644 --- a/Tests/QtAutogen/Complex/calwidget.cpp +++ b/Tests/QtAutogen/Complex/calwidget.cpp @@ -433,4 +433,4 @@ QComboBox* Window::createColorComboBox() return comboBox; } -//#include "moc_calwidget.cpp" +// #include "moc_calwidget.cpp" diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake index fe57d56..024c647 100644 --- a/Tests/RunCMake/AutoExportDll/AutoExport.cmake +++ b/Tests/RunCMake/AutoExportDll/AutoExport.cmake @@ -7,7 +7,7 @@ set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1) add_library(autoexport SHARED hello.cxx world.cxx foo.c $<TARGET_OBJECTS:objlib>) add_library(autoexport3 SHARED cppCLI.cxx) if(MSVC AND NOT MSVC_VERSION VERSION_LESS 1600 - AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") + AND NOT CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64") set_property(TARGET autoexport3 PROPERTY COMMON_LANGUAGE_RUNTIME "") endif() @@ -17,7 +17,7 @@ if(MSVC) add_library(autoexport_for_exec SHARED hello2.c) target_link_libraries(autoexport_for_exec say) if(NOT MSVC_VERSION VERSION_LESS 1600 AND - NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") + NOT CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64") enable_language(ASM_MASM) target_sources(autoexport PRIVATE nop.asm) set_property(SOURCE nop.asm PROPERTY COMPILE_FLAGS /safeseh) diff --git a/Tests/RunCMake/CMP0104/CMP0104-OLD-stderr.txt b/Tests/RunCMake/CMP0104/CMP0104-OLD-stderr.txt new file mode 100644 index 0000000..66d3016 --- /dev/null +++ b/Tests/RunCMake/CMP0104/CMP0104-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0104-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0104 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0106/CMP0106-OLD-stderr.txt b/Tests/RunCMake/CMP0106/CMP0106-OLD-stderr.txt new file mode 100644 index 0000000..ef48d5c --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0106-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0106 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 3038ed8..930122c 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -200,6 +200,9 @@ if(CMAKE_GENERATOR MATCHES "Ninja") if(WIN32) add_executable(showIncludes showIncludes.c) list(APPEND Ninja_ARGS -DshowIncludes=$<TARGET_FILE:showIncludes>) + if(CMake_TEST_NO_CODEPAGE_9xx) + list(APPEND Ninja_ARGS -DCMake_TEST_NO_CODEPAGE_9xx=1) + endif() endif() add_RunCMake_test(Ninja) set(NinjaMultiConfig_ARGS @@ -299,8 +302,8 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() add_RunCMake_test(CompilerNotFound) -if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") - list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=1) +if(DEFINED CMake_TEST_OBJC) + list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=${CMake_TEST_OBJC}) endif() if(CMAKE_Fortran_COMPILER) list(APPEND CompilerTest_ARGS -DCMake_TEST_Fortran=1) @@ -351,6 +354,7 @@ add_RunCMake_test(GenEx-LINK_LIBRARY) add_RunCMake_test(GenEx-LINK_GROUP) add_RunCMake_test(GenEx-TARGET_FILE -DLINKER_SUPPORTS_PDB=${LINKER_SUPPORTS_PDB}) add_RunCMake_test(GenEx-GENEX_EVAL) +add_RunCMake_test(GenEx-TARGET_PROPERTY) add_RunCMake_test(GenEx-TARGET_RUNTIME_DLLS) add_RunCMake_test(GenEx-PATH) add_RunCMake_test(GenEx-PATH_EQUAL) @@ -361,11 +365,10 @@ if(XCODE_VERSION) set(GeneratorToolset_ARGS -DXCODE_VERSION=${XCODE_VERSION}) endif() add_RunCMake_test(GeneratorToolset) -add_RunCMake_test(GetPrerequisites) +add_RunCMake_test(GetPrerequisites -DSAMPLE_EXE=$<TARGET_FILE:exit_code>) add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(GoogleTest) # Note: does not actually depend on Google Test add_RunCMake_test(Graphviz) -add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(LinkItemValidation) add_RunCMake_test(LinkStatic) @@ -466,6 +469,15 @@ add_RunCMake_test(ctest_fixtures) add_RunCMake_test(define_property) add_RunCMake_test(file -DCYGWIN=${CYGWIN} -DMSYS=${MSYS}) add_RunCMake_test(file-CHMOD -DMSYS=${MSYS}) +foreach(var + CMake_TEST_NO_NETWORK + CMake_TEST_TLS_VERIFY_URL + ) + if(DEFINED ${var}) + list(APPEND file-DOWNLOAD_ARGS -D${var}=${${var}}) + endif() +endforeach() +add_RunCMake_test(file-DOWNLOAD) add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(find_file) add_RunCMake_test(find_library -DCYGWIN=${CYGWIN} -DMSYS=${MSYS}) @@ -502,64 +514,15 @@ if(APPLE) endif() function(add_RunCMake_test_try_compile) - if(CMAKE_VERSION VERSION_LESS 3.9.20170907 AND "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") - # Older CMake versions do not know about MSVC language standards. - # Approximate our logic from MSVC-CXX.cmake. - if ((NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.24215.1 AND - CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) OR - NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10.25017) - set(CMAKE_CXX_STANDARD_DEFAULT 14) - elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0) - set(CMAKE_CXX_STANDARD_DEFAULT "") - else() - unset(CMAKE_CXX_STANDARD_DEFAULT) - endif() - endif() - if(CMAKE_VERSION VERSION_LESS 3.18.20200813 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC") - # Older CMake versions do not know about MSVC language standards. - # Approximate our logic from MSVC-C.cmake. - if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.27) - set(CMAKE_C_STANDARD_DEFAULT 99) - else() - set(CMAKE_C_STANDARD_DEFAULT "") - endif() - endif() - if(CMAKE_VERSION VERSION_LESS 3.20.20210225 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang") - # Older CMake versions do not know about Clang MSVC compatibility mode - # standards. Approximate the logic from Clang-C.cmake. - if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0) - set(CMAKE_C_STANDARD_DEFAULT 17) - elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.5.2) - set(CMAKE_C_STANDARD_DEFAULT 11) - endif() - endif() - if(CMAKE_VERSION VERSION_LESS 3.20.6 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xIntelLLVM" AND "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") - # Older CMake versions accidentally set the default standards to empty when - # IntelLLVM targets the MSVC ABI, thus not activating standard selection. - # Approximate the logic from IntelLLVM-{C,CXX}.cmake. - if(DEFINED CMAKE_C_STANDARD_DEFAULT AND "${CMAKE_C_STANDARD_DEFAULT}" STREQUAL "") - set(CMAKE_C_STANDARD_DEFAULT 17) - endif() - if(DEFINED CMAKE_CXX_STANDARD_DEFAULT AND "${CMAKE_CXX_STANDARD_DEFAULT}" STREQUAL "") - set(CMAKE_CXX_STANDARD_DEFAULT 14) - endif() - endif() foreach( var IN ITEMS CMAKE_SYSTEM_NAME - CMAKE_C_COMPILER_ID - CMAKE_C_COMPILER_VERSION - CMAKE_C_STANDARD_DEFAULT - CMAKE_CXX_COMPILER_ID - CMAKE_CXX_COMPILER_VERSION - CMAKE_CXX_STANDARD_DEFAULT CMake_TEST_CUDA CMake_TEST_ISPC CMake_TEST_HIP + CMake_TEST_OBJC CMake_TEST_FILESYSTEM_1S - CMAKE_OBJC_STANDARD_DEFAULT - CMAKE_OBJCXX_STANDARD_DEFAULT ) if(DEFINED ${var}) list(APPEND try_compile_ARGS -D${var}=${${var}}) @@ -684,7 +647,8 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio (1[6-9]|[2-9][0-9])") endif() if(XCODE_VERSION) - add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION}) + add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION} + -DCMake_TEST_Swift=${CMake_TEST_Swift}) add_RunCMake_test(XcodeProject-Embed -DXCODE_VERSION=${XCODE_VERSION}) # This test can take a very long time due to lots of combinations. @@ -741,6 +705,7 @@ add_RunCMake_test(target_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_I set_property(TEST RunCMake.target_link_options APPEND PROPERTY LABELS "CUDA") +add_RunCMake_test(add_compile_definitions) add_RunCMake_test(target_compile_definitions) add_RunCMake_test(target_compile_features) add_RunCMake_test(target_compile_options @@ -752,11 +717,13 @@ add_RunCMake_test(target_sources) add_RunCMake_test(CheckCompilerFlag -DCMake_TEST_CUDA=${CMake_TEST_CUDA} -DCMake_TEST_ISPC=${CMake_TEST_ISPC} -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID} - -DCMake_TEST_HIP=${CMake_TEST_HIP}) + -DCMake_TEST_HIP=${CMake_TEST_HIP} + -DCMake_TEST_Swift=${CMake_TEST_Swift}) add_RunCMake_test(CheckSourceCompiles -DCMake_TEST_CUDA=${CMake_TEST_CUDA} -DCMake_TEST_ISPC=${CMake_TEST_ISPC} -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID} - -DCMake_TEST_HIP=${CMake_TEST_HIP}) + -DCMake_TEST_HIP=${CMake_TEST_HIP} + -DCMake_TEST_Swift=${CMake_TEST_Swift}) add_RunCMake_test(CheckSourceRuns -DCMake_TEST_CUDA=${CMake_TEST_CUDA} -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID} -DCMake_TEST_HIP=${CMake_TEST_HIP}) @@ -806,8 +773,11 @@ add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN} -DMSYS set_property(TEST RunCMake.install APPEND PROPERTY LABELS "ISPC") +if(DEFINED CMake_COMPILER_FORCES_NEW_DTAGS) + list(APPEND file-GET_RUNTIME_DEPENDENCIES_ARGS + -DCMake_COMPILER_FORCES_NEW_DTAGS=${CMake_COMPILER_FORCES_NEW_DTAGS}) +endif() add_RunCMake_test(file-GET_RUNTIME_DEPENDENCIES - -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMake_INSTALL_NAME_TOOL_BUG=${CMake_INSTALL_NAME_TOOL_BUG} ) @@ -896,13 +866,13 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") if(DEFINED CMake_TEST_ISPC) list(APPEND CompilerLauncher_ARGS -DCMake_TEST_ISPC=${CMake_TEST_ISPC}) endif() + if(DEFINED CMake_TEST_OBJC) + list(APPEND CompilerLauncher_ARGS -DCMake_TEST_OBJC=${CMake_TEST_OBJC}) + list(APPEND LinkerLauncher_ARGS -DCMake_TEST_OBJC=${CMake_TEST_OBJC}) + endif() if(CMAKE_Fortran_COMPILER) list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1) endif() - if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") - list(APPEND CompilerLauncher_ARGS -DCMake_TEST_OBJC=1) - list(APPEND LinkerLauncher_ARGS -DCMake_TEST_OBJC=1) - endif() add_RunCMake_test(CompilerLauncher) set_property(TEST RunCMake.CompilerLauncher APPEND PROPERTY LABELS "CUDA;HIP;ISPC") diff --git a/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt b/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt index c23ab89..f32056a 100644 --- a/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt +++ b/Tests/RunCMake/CMakePresets/NoDebug-stdout.txt @@ -1,2 +1,2 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) diff --git a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake index 1c7b836..5bd0158 100644 --- a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake @@ -1,5 +1,9 @@ include(RunCMake) +# Isolate our ctest runs from external environment. +unset(ENV{CTEST_PARALLEL_LEVEL}) +unset(ENV{CTEST_OUTPUT_ON_FAILURE}) + # Presets do not support legacy VS generator name architecture suffix. if(RunCMake_GENERATOR MATCHES "^(Visual Studio [0-9]+ [0-9]+) ") set(RunCMake_GENERATOR "${CMAKE_MATCH_1}") diff --git a/Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-stdout.txt b/Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-stdout.txt index 55bb894..da548a6 100644 --- a/Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-stdout.txt +++ b/Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-stdout.txt @@ -1,2 +1 @@ -- Configuring incomplete, errors occurred! -See also ".*/Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-build/CMakeFiles/CMakeOutput\.log". diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index df3e82a..bda260a 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -3,9 +3,6 @@ include(RunCTest) set(RunCMake_TEST_TIMEOUT 60) -unset(ENV{CTEST_PARALLEL_LEVEL}) -unset(ENV{CTEST_OUTPUT_ON_FAILURE}) - run_cmake_command(repeat-opt-bad1 ${CMAKE_CTEST_COMMAND} --repeat until-pass ) @@ -392,6 +389,14 @@ function(run_NoTests) run_cmake_command(no-tests_error ${CMAKE_CTEST_COMMAND} --no-tests=error) run_cmake_command(no-tests_bad ${CMAKE_CTEST_COMMAND} --no-tests=bad) run_cmake_command(no-tests_legacy ${CMAKE_CTEST_COMMAND}) + + run_cmake_command(no-tests_env_ignore ${CMAKE_COMMAND} -E env CTEST_NO_TESTS_ACTION=ignore ${CMAKE_CTEST_COMMAND}) + run_cmake_command(no-tests_env_error ${CMAKE_COMMAND} -E env CTEST_NO_TESTS_ACTION=error ${CMAKE_CTEST_COMMAND}) + run_cmake_command(no-tests_env_bad ${CMAKE_COMMAND} -E env CTEST_NO_TESTS_ACTION=bad ${CMAKE_CTEST_COMMAND}) + run_cmake_command(no-tests_env_empty_legacy ${CMAKE_COMMAND} -E env CTEST_NO_TESTS_ACTION= ${CMAKE_CTEST_COMMAND}) + + run_cmake_command(no-tests_env_bad_with_cli_error ${CMAKE_COMMAND} -E env CTEST_NO_TESTS_ACTION=bad ${CMAKE_CTEST_COMMAND} --no-tests=error) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/NoTestsScript.cmake" " set(CTEST_COMMAND \"${CMAKE_CTEST_COMMAND}\") set(CTEST_SOURCE_DIRECTORY \"${RunCMake_SOURCE_DIR}\") diff --git a/Tests/RunCMake/file/DOWNLOAD-tls-verify-not-set-result.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file/DOWNLOAD-tls-verify-not-set-result.txt +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-stderr.txt new file mode 100644 index 0000000..97187e6 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-stderr.txt @@ -0,0 +1 @@ +^Unknown value for CTEST_NO_TESTS_ACTION: 'bad'$ diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-result.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-stderr.txt new file mode 100644 index 0000000..eafba1c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_empty_legacy-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_empty_legacy-stderr.txt new file mode 100644 index 0000000..a7c4b11 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_empty_legacy-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_error-result.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_error-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_error-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_error-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_error-stderr.txt new file mode 100644 index 0000000..eafba1c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_error-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/CXXModules/CMakeLists.txt b/Tests/RunCMake/CXXModules/CMakeLists.txt index 708d92c..5246bef 100644 --- a/Tests/RunCMake/CXXModules/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.23) project(${RunCMake_TEST} NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake index 9ff5606..d287198 100644 --- a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake +++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake @@ -1,4 +1,4 @@ -add_library(module-header SHARED IMPORTED) +add_library(module-header INTERFACE IMPORTED) target_sources(module-header INTERFACE FILE_SET fs TYPE CXX_MODULE_HEADER_UNITS FILES diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake index 6640ae9..392149f 100644 --- a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake @@ -1,4 +1,4 @@ -add_library(module SHARED IMPORTED) +add_library(module INTERFACE IMPORTED) target_sources(module INTERFACE FILE_SET fs TYPE CXX_MODULES FILES diff --git a/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt b/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt index 8ac0fc5..a0b2572 100644 --- a/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt +++ b/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt @@ -22,6 +22,11 @@ CMake Error: by the generator ( +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. +)?( CMake Error in CMakeLists.txt: The "nodyndep" target contains C\+\+ module sources which are not supported by the generator diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index 0f32ea0..c1129ca 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -36,10 +36,20 @@ if (RunCMake_GENERATOR MATCHES "Ninja") endif () endif () +set(generator_supports_cxx_modules 0) +if (RunCMake_GENERATOR MATCHES "Ninja" AND + ninja_version VERSION_GREATER_EQUAL "1.11" AND + "cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES) + set(generator_supports_cxx_modules 1) +endif () + +if (RunCMake_GENERATOR MATCHES "Visual Studio" AND + CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.34") + set(generator_supports_cxx_modules 1) +endif () + # Test behavior when the generator does not support C++20 modules. -if (NOT RunCMake_GENERATOR MATCHES "Ninja" OR - ninja_version VERSION_LESS "1.11" OR - NOT "cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES) +if (NOT generator_supports_cxx_modules) if ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES) run_cmake(NoDyndepSupport) endif () @@ -79,6 +89,8 @@ if (RunCMake_GENERATOR MATCHES "Ninja") run_cmake(NinjaDependInfoFileSet) run_cmake(NinjaDependInfoExport) run_cmake(NinjaDependInfoBMIInstall) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + # Not supported yet. else () message(FATAL_ERROR "Please add 'DependInfo' tests for the '${RunCMake_GENERATOR}' generator.") @@ -120,7 +132,9 @@ function (run_cxx_module_test directory) if (RunCMake_CXXModules_INSTALL) run_cmake_command("examples/${test_name}-install" "${CMAKE_COMMAND}" --build . --target install --config Debug) endif () - run_cmake_command("examples/${test_name}-test" "${CMAKE_CTEST_COMMAND}" -C Debug --output-on-failure) + if (NOT RunCMake_CXXModules_NO_TEST) + run_cmake_command("examples/${test_name}-test" "${CMAKE_CTEST_COMMAND}" -C Debug --output-on-failure) + endif () endfunction () string(REPLACE "," ";" CMake_TEST_MODULE_COMPILATION "${CMake_TEST_MODULE_COMPILATION}") @@ -130,8 +144,17 @@ if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(simple) run_cxx_module_test(library library-static -DBUILD_SHARED_LIBS=OFF) run_cxx_module_test(generated) - run_cxx_module_test(public-req-private) run_cxx_module_test(deep-chain) + run_cxx_module_test(duplicate) + set(RunCMake_CXXModules_NO_TEST 1) + run_cxx_module_test(circular) + unset(RunCMake_CXXModules_NO_TEST) + run_cxx_module_test(scan_properties) +endif () + +# Tests which require collation work. +if ("collation" IN_LIST CMake_TEST_MODULE_COMPILATION) + run_cxx_module_test(public-req-private) endif () # Tests which use named modules in shared libraries. @@ -151,6 +174,7 @@ endif () # Tests which install BMIs if ("export_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) + run_cxx_module_test(export-interface-no-properties-build) run_cxx_module_test(export-interface-build) run_cxx_module_test(export-bmi-and-interface-build) endif () @@ -164,6 +188,7 @@ if ("install_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(install-bmi-and-interfaces) if ("export_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) + run_cxx_module_test(export-interface-no-properties-install) run_cxx_module_test(export-interface-install) run_cxx_module_test(export-bmi-and-interface-install) endif () diff --git a/Tests/RunCMake/CXXModules/compiler_introspection.cmake b/Tests/RunCMake/CXXModules/compiler_introspection.cmake index 7a2df3d..0e61383 100644 --- a/Tests/RunCMake/CXXModules/compiler_introspection.cmake +++ b/Tests/RunCMake/CXXModules/compiler_introspection.cmake @@ -20,6 +20,7 @@ string(APPEND info "\ set(CMAKE_CXX_COMPILE_FEATURES \"${CMAKE_CXX_COMPILE_FEATURES}\") set(CMAKE_MAKE_PROGRAM \"${CMAKE_MAKE_PROGRAM}\") set(forced_cxx_standard \"${forced_cxx_standard}\") +set(CMAKE_CXX_COMPILER_VERSION \"${CMAKE_CXX_COMPILER_VERSION}\") ") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}") diff --git a/Tests/RunCMake/file/DOWNLOAD-tls-cainfo-not-set-result.txt b/Tests/RunCMake/CXXModules/examples/circular-build-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file/DOWNLOAD-tls-cainfo-not-set-result.txt +++ b/Tests/RunCMake/CXXModules/examples/circular-build-result.txt diff --git a/Tests/RunCMake/CXXModules/examples/circular-build-stdout.txt b/Tests/RunCMake/CXXModules/examples/circular-build-stdout.txt new file mode 100644 index 0000000..ac80356 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/circular-build-stdout.txt @@ -0,0 +1 @@ +((Ninja generators)?(build stopped: dependency cycle:)|(Visual Studio generators)?(error : Cannot build the following source files because there is a cyclic dependency between them)) diff --git a/Tests/RunCMake/CXXModules/examples/circular-stderr.txt b/Tests/RunCMake/CXXModules/examples/circular-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/circular-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/circular/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/circular/CMakeLists.txt new file mode 100644 index 0000000..4d1997c --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/circular/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_circular CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(circular STATIC) +target_sources(circular + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + circular-a.cppm + circular-b.cppm) +target_compile_features(circular PUBLIC cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/examples/circular/circular-a.cppm b/Tests/RunCMake/CXXModules/examples/circular/circular-a.cppm new file mode 100644 index 0000000..eea842b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/circular/circular-a.cppm @@ -0,0 +1,6 @@ +export module a; +import b; + +export int a() { + return b(); +} diff --git a/Tests/RunCMake/CXXModules/examples/circular/circular-b.cppm b/Tests/RunCMake/CXXModules/examples/circular/circular-b.cppm new file mode 100644 index 0000000..fc6dc42 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/circular/circular-b.cppm @@ -0,0 +1,6 @@ +export module b; +import a; + +export int b() { + return a(); +} diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake index 91f3995..88d50db 100644 --- a/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake +++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake @@ -1,6 +1,6 @@ function (check_for_bmi prefix destination name) set(found 0) - foreach (ext IN ITEMS gcm ifc) + foreach (ext IN ITEMS gcm ifc pcm) if (EXISTS "${prefix}/${destination}/${name}.${ext}") set(found 1) break () diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake index 381094e..5f34fc0 100644 --- a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake +++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake @@ -1,4 +1,4 @@ -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") if (NOT EXISTS "${CMake_TEST_MODULE_COMPILATION_RULES}") message(FATAL_ERROR diff --git a/Tests/RunCMake/CXXModules/examples/duplicate-stderr.txt b/Tests/RunCMake/CXXModules/examples/duplicate-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/duplicate-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/duplicate/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/duplicate/CMakeLists.txt new file mode 100644 index 0000000..27be7a8 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/duplicate/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_duplicate CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_executable(duplicate) +target_sources(duplicate + PRIVATE + main.cxx + PRIVATE + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + duplicate.cxx) +target_compile_features(duplicate PRIVATE cxx_std_20) +target_compile_definitions(duplicate PRIVATE NDUPLICATE=1) + +add_executable(duplicate2) +target_sources(duplicate2 + PRIVATE + main.cxx + PRIVATE + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + duplicate.cxx) +target_compile_features(duplicate2 PRIVATE cxx_std_20) +target_compile_definitions(duplicate2 PRIVATE NDUPLICATE=2) + +add_test(NAME duplicate COMMAND duplicate) +set_property(TEST duplicate + PROPERTY + PASS_REGULAR_EXPRESSION "From duplicate #1") +add_test(NAME duplicate2 COMMAND duplicate2) +set_property(TEST duplicate2 + PROPERTY + PASS_REGULAR_EXPRESSION "From duplicate #2") diff --git a/Tests/RunCMake/CXXModules/examples/duplicate/duplicate.cxx b/Tests/RunCMake/CXXModules/examples/duplicate/duplicate.cxx new file mode 100644 index 0000000..c0c820b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/duplicate/duplicate.cxx @@ -0,0 +1,11 @@ +module; + +#include <iostream> + +export module duplicate; + +export int from_import() +{ + std::cerr << "From duplicate #" << NDUPLICATE << std::endl; + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/duplicate/main.cxx b/Tests/RunCMake/CXXModules/examples/duplicate/main.cxx new file mode 100644 index 0000000..c2c0636 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/duplicate/main.cxx @@ -0,0 +1,6 @@ +import duplicate; + +int main(int argc, char* argv[]) +{ + return from_import(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx index e0b1872..8dfc41b 100644 --- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx @@ -1,6 +1,8 @@ export module importable; +extern "C++" { int forwarding(); +} export int from_import() { diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt index b814b3b..2e37da2 100644 --- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") find_package(export_bmi_and_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx index e0b1872..8dfc41b 100644 --- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx @@ -1,6 +1,8 @@ export module importable; +extern "C++" { int forwarding(); +} export int from_import() { diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt index db0484d..1adccb3 100644 --- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") find_package(export_bmi_and_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt index 80ddaf8..8584dce 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt @@ -26,7 +26,8 @@ install(TARGETS export_interfaces FILE_SET modules DESTINATION "lib/cxx/miu") export(EXPORT CXXModules NAMESPACE CXXModules:: - FILE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-targets.cmake") + FILE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-targets.cmake" + CXX_MODULES_DIRECTORY "export_interfaces-cxx-modules") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-config.cmake" "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_interfaces-targets.cmake\") set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) @@ -46,7 +47,8 @@ endif () add_test(NAME export_interfaces_build COMMAND "${CMAKE_COMMAND}" - "-Dexpected_dir=${CMAKE_CURRENT_SOURCE_DIR}" + "-Dexpected_source_dir=${CMAKE_CURRENT_SOURCE_DIR}" + "-Dexpected_binary_dir=${CMAKE_CURRENT_BINARY_DIR}" "-Dexport_interfaces_DIR=${CMAKE_CURRENT_BINARY_DIR}" ${generator} -S "${CMAKE_CURRENT_SOURCE_DIR}/test" diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx index e0b1872..8dfc41b 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx @@ -1,6 +1,8 @@ export module importable; +extern "C++" { int forwarding(); +} export int from_import() { diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt index 6145210..9949969 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") find_package(export_interfaces REQUIRED) @@ -19,14 +19,14 @@ endif () get_property(file_set_files TARGET CXXModules::export_interfaces PROPERTY CXX_MODULE_SET_modules) -if (NOT file_set_files STREQUAL "${expected_dir}/importable.cxx") +if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx") message(FATAL_ERROR "Incorrect exported file set paths in CXXModules::export_interfaces`: `${file_set_files}`") endif () -get_property(imported_modules_set TARGET CXXModules::export_interfaces - PROPERTY IMPORTED_CXX_MODULES_DEBUG SET) -if (imported_modules_set) +get_property(imported_modules TARGET CXXModules::export_interfaces + PROPERTY IMPORTED_CXX_MODULES_DEBUG) +if (NOT imported_modules MATCHES "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/CMakeFiles/export_interfaces.dir(/Debug)?/importable.(gcm|pcm|ifc)") message(FATAL_ERROR - "Unexpected C++ modules specified.") + "Incorrect exported modules in CXXModules::export_interfaces`: `${imported_modules}`\n`importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/CMakeFiles/export_interfaces.dir(/Debug)?/importable.(gcm|pcm|ifc)`") endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt index 1dfb6da..b5c6224 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt @@ -27,7 +27,8 @@ install(TARGETS export_interfaces install(EXPORT CXXModules NAMESPACE CXXModules:: DESTINATION "lib/cmake/export_interfaces" - FILE "export_interfaces-targets.cmake") + FILE "export_interfaces-targets.cmake" + CXX_MODULES_DIRECTORY "export_interfaces-cxx-modules") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-config.cmake" "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_interfaces-targets.cmake\") set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) @@ -49,7 +50,8 @@ endif () add_test(NAME export_interfaces_build COMMAND "${CMAKE_COMMAND}" - "-Dexpected_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu" + "-Dexpected_source_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu" + "-Dexpected_binary_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/bmi" "-Dexport_interfaces_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_interfaces" ${generator} -S "${CMAKE_CURRENT_SOURCE_DIR}/test" diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx index e0b1872..8dfc41b 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx @@ -1,6 +1,8 @@ export module importable; +extern "C++" { int forwarding(); +} export int from_import() { diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt index 6145210..7079256 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") find_package(export_interfaces REQUIRED) @@ -19,14 +19,14 @@ endif () get_property(file_set_files TARGET CXXModules::export_interfaces PROPERTY CXX_MODULE_SET_modules) -if (NOT file_set_files STREQUAL "${expected_dir}/importable.cxx") +if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx") message(FATAL_ERROR "Incorrect exported file set paths in CXXModules::export_interfaces`: `${file_set_files}`") endif () -get_property(imported_modules_set TARGET CXXModules::export_interfaces - PROPERTY IMPORTED_CXX_MODULES_DEBUG SET) -if (imported_modules_set) +get_property(imported_modules TARGET CXXModules::export_interfaces + PROPERTY IMPORTED_CXX_MODULES_DEBUG) +if (NOT imported_modules STREQUAL "importable=${expected_source_dir}/importable.cxx") message(FATAL_ERROR - "Unexpected C++ modules specified.") + "Incorrect exported modules in CXXModules::export_interfaces`: `${imported_modules}`") endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/CMakeLists.txt new file mode 100644 index 0000000..7633bec --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_interfaces_no_properties CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_interfaces_no_properties STATIC) +target_sources(export_interfaces_no_properties + PRIVATE + forward.cxx + PRIVATE + FILE_SET modules_private TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + private.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(export_interfaces_no_properties PUBLIC cxx_std_20) + +install(TARGETS export_interfaces_no_properties + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu") +export(EXPORT CXXModules + NAMESPACE CXXModules:: + FILE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces_no_properties-targets.cmake") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces_no_properties-config.cmake" + "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_interfaces_no_properties-targets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) +") + +set(generator + -G "${CMAKE_GENERATOR}") +if (CMAKE_GENERATOR_TOOLSET) + list(APPEND generator + -T "${CMAKE_GENERATOR_TOOLSET}") +endif () +if (CMAKE_GENERATOR_PLATFORM) + list(APPEND generator + -A "${CMAKE_GENERATOR_PLATFORM}") +endif () + +add_test(NAME export_interfaces_build + COMMAND + "${CMAKE_COMMAND}" + "-Dexpected_dir=${CMAKE_CURRENT_SOURCE_DIR}" + "-Dexport_interfaces_no_properties_DIR=${CMAKE_CURRENT_BINARY_DIR}" + ${generator} + -S "${CMAKE_CURRENT_SOURCE_DIR}/test" + -B "${CMAKE_CURRENT_BINARY_DIR}/test") diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/importable.cxx new file mode 100644 index 0000000..8dfc41b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/importable.cxx @@ -0,0 +1,10 @@ +export module importable; + +extern "C++" { +int forwarding(); +} + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/private.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/private.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int from_private() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt new file mode 100644 index 0000000..9cdc80a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_library NONE) + +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") + +find_package(export_interfaces_no_properties REQUIRED) + +if (NOT TARGET CXXModules::export_interfaces_no_properties) + message(FATAL_ERROR + "Missing imported target") +endif () + +get_property(file_sets TARGET CXXModules::export_interfaces_no_properties + PROPERTY INTERFACE_CXX_MODULE_SETS) +if (NOT file_sets STREQUAL "modules") + message(FATAL_ERROR + "Incorrect exported file sets in `CXXModules::export_interfaces_no_properties`: `${file_sets}`") +endif () + +get_property(file_set_files TARGET CXXModules::export_interfaces_no_properties + PROPERTY CXX_MODULE_SET_modules) +if (NOT file_set_files STREQUAL "${expected_dir}/importable.cxx") + message(FATAL_ERROR + "Incorrect exported file set paths in CXXModules::export_interfaces_no_properties`: `${file_set_files}`") +endif () + +get_property(imported_modules_set TARGET CXXModules::export_interfaces_no_properties + PROPERTY IMPORTED_CXX_MODULES_DEBUG SET) +if (imported_modules_set) + message(FATAL_ERROR + "Unexpected C++ modules specified.") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/CMakeLists.txt new file mode 100644 index 0000000..75f2440 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_interfaces_no_properties STATIC) +target_sources(export_interfaces_no_properties + PRIVATE + forward.cxx + PRIVATE + FILE_SET modules_private TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + private.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(export_interfaces_no_properties PUBLIC cxx_std_20) + +install(TARGETS export_interfaces_no_properties + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu") +install(EXPORT CXXModules + NAMESPACE CXXModules:: + DESTINATION "lib/cmake/export_interfaces_no_properties" + FILE "export_interfaces_no_properties-targets.cmake") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces_no_properties-config.cmake" + "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_interfaces_no_properties-targets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) +") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces_no_properties-config.cmake" + DESTINATION "lib/cmake/export_interfaces_no_properties") + +set(generator + -G "${CMAKE_GENERATOR}") +if (CMAKE_GENERATOR_TOOLSET) + list(APPEND generator + -T "${CMAKE_GENERATOR_TOOLSET}") +endif () +if (CMAKE_GENERATOR_PLATFORM) + list(APPEND generator + -A "${CMAKE_GENERATOR_PLATFORM}") +endif () + +add_test(NAME export_interfaces_build + COMMAND + "${CMAKE_COMMAND}" + "-Dexpected_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu" + "-Dexport_interfaces_no_properties_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_interfaces_no_properties" + ${generator} + -S "${CMAKE_CURRENT_SOURCE_DIR}/test" + -B "${CMAKE_CURRENT_BINARY_DIR}/test") diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/importable.cxx new file mode 100644 index 0000000..8dfc41b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/importable.cxx @@ -0,0 +1,10 @@ +export module importable; + +extern "C++" { +int forwarding(); +} + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/private.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/private.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int from_private() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt new file mode 100644 index 0000000..9cdc80a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_library NONE) + +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") + +find_package(export_interfaces_no_properties REQUIRED) + +if (NOT TARGET CXXModules::export_interfaces_no_properties) + message(FATAL_ERROR + "Missing imported target") +endif () + +get_property(file_sets TARGET CXXModules::export_interfaces_no_properties + PROPERTY INTERFACE_CXX_MODULE_SETS) +if (NOT file_sets STREQUAL "modules") + message(FATAL_ERROR + "Incorrect exported file sets in `CXXModules::export_interfaces_no_properties`: `${file_sets}`") +endif () + +get_property(file_set_files TARGET CXXModules::export_interfaces_no_properties + PROPERTY CXX_MODULE_SET_modules) +if (NOT file_set_files STREQUAL "${expected_dir}/importable.cxx") + message(FATAL_ERROR + "Incorrect exported file set paths in CXXModules::export_interfaces_no_properties`: `${file_set_files}`") +endif () + +get_property(imported_modules_set TARGET CXXModules::export_interfaces_no_properties + PROPERTY IMPORTED_CXX_MODULES_DEBUG SET) +if (imported_modules_set) + message(FATAL_ERROR + "Unexpected C++ modules specified.") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx b/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx index b872ae9..3b3d313 100644 --- a/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx +++ b/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx @@ -1,5 +1,5 @@ export module importable; -import : internal_partition; +import :internal_partition; #include "internal-partitions_export.h" diff --git a/Tests/RunCMake/CXXModules/examples/internal-partitions/partition.cxx b/Tests/RunCMake/CXXModules/examples/internal-partitions/partition.cxx index b15f53c..c828612 100644 --- a/Tests/RunCMake/CXXModules/examples/internal-partitions/partition.cxx +++ b/Tests/RunCMake/CXXModules/examples/internal-partitions/partition.cxx @@ -1,4 +1,4 @@ -module importable : internal_partition; +module importable:internal_partition; int from_partition() { diff --git a/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx b/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx index d0ac2f4..fbd5f90 100644 --- a/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx +++ b/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx @@ -1,5 +1,5 @@ export module importable; -export import : partition; +export import :partition; #include "partitions_export.h" diff --git a/Tests/RunCMake/CXXModules/examples/partitions/partition.cxx b/Tests/RunCMake/CXXModules/examples/partitions/partition.cxx index a47a4fd..20131cf 100644 --- a/Tests/RunCMake/CXXModules/examples/partitions/partition.cxx +++ b/Tests/RunCMake/CXXModules/examples/partitions/partition.cxx @@ -1,4 +1,4 @@ -export module importable : partition; +export module importable:partition; #include "partitions_export.h" diff --git a/Tests/RunCMake/CXXModules/examples/scan_properties-stderr.txt b/Tests/RunCMake/CXXModules/examples/scan_properties-stderr.txt new file mode 100644 index 0000000..2cb5957 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/scan_properties-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:25 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/scan_properties/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/scan_properties/CMakeLists.txt new file mode 100644 index 0000000..f2f1c38 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/scan_properties/CMakeLists.txt @@ -0,0 +1,61 @@ +cmake_minimum_required(VERSION 3.24) +project(scan_properties CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +set(scanning_control 1) +if (CMAKE_GENERATOR MATCHES "Visual Studio") + set(scanning_control 0) +endif () + +# To detect that not-to-be scanned sources are not scanned, add a `-D` to the +# scan flags so that the files can detect whether scanning happened and error +# if not. +string(APPEND CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG + " -DCMAKE_SCANNED_THIS_SOURCE") +string(APPEND CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE + " -DCMAKE_SCANNED_THIS_SOURCE") + +set_property(SOURCE always_scan.cxx + PROPERTY CXX_SCAN_FOR_MODULES 1) +set_property(SOURCE never_scan.cxx + PROPERTY CXX_SCAN_FOR_MODULES 0) + +add_executable(scans_everything) +target_sources(scans_everything + PRIVATE + main.cxx + join.cxx + always_scan.cxx + never_scan.cxx + PRIVATE + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + module.cxx) +target_compile_features(scans_everything PRIVATE cxx_std_20) +target_compile_definitions(scans_everything PRIVATE SCAN_AT_TARGET_LEVEL=1) +target_compile_definitions(scans_everything PRIVATE "SCANNING_CONTROL=${scanning_control}") + +set(CMAKE_CXX_SCAN_FOR_MODULES 0) + +add_executable(no_scan_everything) +target_sources(no_scan_everything + PRIVATE + main.cxx + join.cxx + always_scan.cxx + never_scan.cxx + PRIVATE + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + module.cxx) +target_compile_features(no_scan_everything PRIVATE cxx_std_20) +target_compile_definitions(no_scan_everything PRIVATE SCAN_AT_TARGET_LEVEL=0) +target_compile_definitions(no_scan_everything PRIVATE "SCANNING_CONTROL=${scanning_control}") + +add_test(NAME scanned COMMAND scans_everything) +add_test(NAME unscanned COMMAND no_scan_everything) diff --git a/Tests/RunCMake/CXXModules/examples/scan_properties/always_scan.cxx b/Tests/RunCMake/CXXModules/examples/scan_properties/always_scan.cxx new file mode 100644 index 0000000..c3d449e --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/scan_properties/always_scan.cxx @@ -0,0 +1,12 @@ +#if SCANNING_CONTROL +# ifndef CMAKE_SCANNED_THIS_SOURCE +# error "This file should have been scanned" +# endif +#endif + +import M; + +int scanned_file() +{ + return from_module(); +} diff --git a/Tests/RunCMake/CXXModules/examples/scan_properties/join.cxx b/Tests/RunCMake/CXXModules/examples/scan_properties/join.cxx new file mode 100644 index 0000000..4ba23a6 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/scan_properties/join.cxx @@ -0,0 +1,19 @@ +#if SCANNING_CONTROL +# if SCAN_AT_TARGET_LEVEL +# ifndef CMAKE_SCANNED_THIS_SOURCE +# error "This file should have been scanned" +# endif +# else +# ifdef CMAKE_SCANNED_THIS_SOURCE +# error "This file should not have been scanned" +# endif +# endif +#endif + +int scanned_file(); +int never_scan(); + +int join() +{ + return scanned_file() + never_scan(); +} diff --git a/Tests/RunCMake/CXXModules/examples/scan_properties/main.cxx b/Tests/RunCMake/CXXModules/examples/scan_properties/main.cxx new file mode 100644 index 0000000..2c7ec3e --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/scan_properties/main.cxx @@ -0,0 +1,18 @@ +#if SCANNING_CONTROL +# if SCAN_AT_TARGET_LEVEL +# ifndef CMAKE_SCANNED_THIS_SOURCE +# error "This file should have been scanned" +# endif +# else +# ifdef CMAKE_SCANNED_THIS_SOURCE +# error "This file should not have been scanned" +# endif +# endif +#endif + +int join(); + +int main(int argc, char** argv) +{ + return join(); +} diff --git a/Tests/RunCMake/CXXModules/examples/scan_properties/module.cxx b/Tests/RunCMake/CXXModules/examples/scan_properties/module.cxx new file mode 100644 index 0000000..fe84261 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/scan_properties/module.cxx @@ -0,0 +1,12 @@ +#if SCANNING_CONTROL +# ifndef CMAKE_SCANNED_THIS_SOURCE +# error "This file should have been scanned" +# endif +#endif + +export module M; + +export int from_module() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/scan_properties/never_scan.cxx b/Tests/RunCMake/CXXModules/examples/scan_properties/never_scan.cxx new file mode 100644 index 0000000..b47510b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/scan_properties/never_scan.cxx @@ -0,0 +1,10 @@ +#if SCANNING_CONTROL +# ifdef CMAKE_SCANNED_THIS_SOURCE +# error "This file should not have been scanned" +# endif +#endif + +int never_scan() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/sources/module-internal-part-impl.cxx b/Tests/RunCMake/CXXModules/sources/module-internal-part-impl.cxx index be77b0d..cab19ec 100644 --- a/Tests/RunCMake/CXXModules/sources/module-internal-part-impl.cxx +++ b/Tests/RunCMake/CXXModules/sources/module-internal-part-impl.cxx @@ -1,6 +1,6 @@ #ifdef _MSC_VER // Only MSVC supports this pattern. -module M : internal_part; +module M:internal_part; #else module M; #endif diff --git a/Tests/RunCMake/CXXModules/sources/module-internal-part.cxx b/Tests/RunCMake/CXXModules/sources/module-internal-part.cxx index fa82afb..0dc749f 100644 --- a/Tests/RunCMake/CXXModules/sources/module-internal-part.cxx +++ b/Tests/RunCMake/CXXModules/sources/module-internal-part.cxx @@ -1,3 +1,3 @@ -module M : internal_part; +module M:internal_part; int i(); diff --git a/Tests/RunCMake/CXXModules/sources/module-part-impl.cxx b/Tests/RunCMake/CXXModules/sources/module-part-impl.cxx index 46d5d9f..f3b6ba8 100644 --- a/Tests/RunCMake/CXXModules/sources/module-part-impl.cxx +++ b/Tests/RunCMake/CXXModules/sources/module-part-impl.cxx @@ -1,11 +1,11 @@ #ifdef _MSC_VER // Only MSVC supports this pattern. -module M : part; +module M:part; #else module M; #endif -import M : internal_part; +import M:internal_part; int p() { diff --git a/Tests/RunCMake/CXXModules/sources/module-part.cxx b/Tests/RunCMake/CXXModules/sources/module-part.cxx index 137c16f..307781b 100644 --- a/Tests/RunCMake/CXXModules/sources/module-part.cxx +++ b/Tests/RunCMake/CXXModules/sources/module-part.cxx @@ -1,3 +1,3 @@ -export module M : part; +export module M:part; int p(); diff --git a/Tests/RunCMake/CXXModules/sources/module.cxx b/Tests/RunCMake/CXXModules/sources/module.cxx index a631354..37eedeb 100644 --- a/Tests/RunCMake/CXXModules/sources/module.cxx +++ b/Tests/RunCMake/CXXModules/sources/module.cxx @@ -1,5 +1,5 @@ export module M; -export import M : part; -import M : internal_part; +export import M:part; +import M:internal_part; int f(); diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagSwift.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagSwift.cmake new file mode 100644 index 0000000..23b3006 --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagSwift.cmake @@ -0,0 +1,21 @@ +enable_language (Swift) +include(CheckCompilerFlag) + +set(Swift 1) + +# test that the check uses an isolated locale +set(_env_LC_ALL "${LC_ALL}") +set(ENV{LC_ALL} "BAD") + +check_compiler_flag(Swift "-foo-as-blarpy" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid Swift compile flag didn't fail.") +endif() + +check_compiler_flag(Swift "-parseable-output" SHOULD_WORK) +if(NOT SHOULD_WORK) + message(SEND_ERROR "Swift compiler flag '-parseable-output' check failed") +endif() + +# Reset locale +set(ENV{LC_ALL} ${_env_LC_ALL}) diff --git a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake index b0e025c..81429a6 100644 --- a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake @@ -32,3 +32,7 @@ endif() if(APPLE) run_cmake(HeaderpadWorkaround) endif() + +if(CMake_TEST_Swift) + run_cmake(CheckCompilerFlagSwift) +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesSwift.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesSwift.cmake new file mode 100644 index 0000000..767fa69 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesSwift.cmake @@ -0,0 +1,15 @@ +enable_language(Swift) +include(CheckSourceCompiles) + +set(Swift 1) # test that this is tolerated + +check_source_compiles(Swift "baz()" SHOULD_FAIL) + +if(SHOULD_FAIL) + message(SEND_ERROR "invalid Swift source didn't fail.") +endif() + +check_source_compiles(Swift "print(\"Hello, CMake\")" SHOULD_BUILD) +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test failed for valid Swift source.") +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake index df77d3d..2ed3e36 100644 --- a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake @@ -31,3 +31,7 @@ endif() if(CMake_TEST_HIP) run_cmake(CheckSourceCompilesHIP) endif() + +if(CMake_TEST_Swift) + run_cmake(CheckSourceCompilesSwift) +endif() diff --git a/Tests/RunCMake/ClangTidy/ExportFixesDir-Build-check.cmake b/Tests/RunCMake/ClangTidy/ExportFixesDir-Build-check.cmake new file mode 100644 index 0000000..97ec52b --- /dev/null +++ b/Tests/RunCMake/ClangTidy/ExportFixesDir-Build-check.cmake @@ -0,0 +1,35 @@ +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/main.c.obj.yaml" + ) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/extra.c.obj.yaml" + ) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/main.c.obj.yaml" + ) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/extra.c.obj.yaml" + ) +else() + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/main.c.obj.yaml" + ) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/extra.c.obj.yaml" + ) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/main.c.obj.yaml" + ) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/extra.c.obj.yaml" + ) +endif() diff --git a/Tests/RunCMake/ClangTidy/ExportFixesDir.cmake b/Tests/RunCMake/ClangTidy/ExportFixesDir.cmake new file mode 100644 index 0000000..2b278da --- /dev/null +++ b/Tests/RunCMake/ClangTidy/ExportFixesDir.cmake @@ -0,0 +1,6 @@ +enable_language(C) +set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -some -args) +set(CMAKE_C_CLANG_TIDY_EXPORT_FIXES_DIR clang-tidy) +set(files ${CMAKE_CURRENT_SOURCE_DIR}/main.c ${CMAKE_CURRENT_SOURCE_DIR}/extra.c) +add_executable(main ${files}) +add_subdirectory(export_fixes_subdir) diff --git a/Tests/RunCMake/ClangTidy/ExportFixesDir2-Build-check.cmake b/Tests/RunCMake/ClangTidy/ExportFixesDir2-Build-check.cmake new file mode 100644 index 0000000..f65d33c --- /dev/null +++ b/Tests/RunCMake/ClangTidy/ExportFixesDir2-Build-check.cmake @@ -0,0 +1,35 @@ +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/main.c.obj.yaml" + ) + assert_no_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/extra.c.obj.yaml" + ) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/main.c.obj.yaml" + ) + assert_no_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/extra.c.obj.yaml" + ) +else() + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/main.c.obj.yaml" + ) + assert_no_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/extra.c.obj.yaml" + ) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/main.c.obj.yaml" + ) + assert_no_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/extra.c.obj.yaml" + ) +endif() diff --git a/Tests/RunCMake/ClangTidy/ExportFixesDir2-check.cmake b/Tests/RunCMake/ClangTidy/ExportFixesDir2-check.cmake new file mode 100644 index 0000000..f65d33c --- /dev/null +++ b/Tests/RunCMake/ClangTidy/ExportFixesDir2-check.cmake @@ -0,0 +1,35 @@ +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/main.c.obj.yaml" + ) + assert_no_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/Debug/extra.c.obj.yaml" + ) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/main.c.obj.yaml" + ) + assert_no_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/Debug/__/extra.c.obj.yaml" + ) +else() + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/main.c.obj.yaml" + ) + assert_no_file_exists( + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/clang-tidy/CMakeFiles/main.dir/extra.c.obj.yaml" + ) + assert_any_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/main.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/main.c.obj.yaml" + ) + assert_no_file_exists( + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/extra.c.o.yaml" + "${RunCMake_TEST_BINARY_DIR}/export_fixes_subdir/clang-tidy/export_fixes_subdir/CMakeFiles/subdir.dir/__/extra.c.obj.yaml" + ) +endif() diff --git a/Tests/RunCMake/ClangTidy/ExportFixesDir2.cmake b/Tests/RunCMake/ClangTidy/ExportFixesDir2.cmake new file mode 100644 index 0000000..c81c49a --- /dev/null +++ b/Tests/RunCMake/ClangTidy/ExportFixesDir2.cmake @@ -0,0 +1,6 @@ +enable_language(C) +set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -some -args) +set(CMAKE_C_CLANG_TIDY_EXPORT_FIXES_DIR clang-tidy) +set(files ${CMAKE_CURRENT_SOURCE_DIR}/main.c) +add_executable(main ${files}) +add_subdirectory(export_fixes_subdir) diff --git a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake index 5e3fbc4..01dbb61 100644 --- a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake +++ b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake @@ -30,3 +30,55 @@ if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") endif() run_tidy(C-bad) run_tidy(compdb) + +function(any_file_exists varname) + foreach(filename IN LISTS ARGN) + if(EXISTS "${filename}") + set("${varname}" 1 PARENT_SCOPE) + return() + endif() + endforeach() + set("${varname}" 0 PARENT_SCOPE) +endfunction() + +function(assert_any_file_exists) + any_file_exists(exists ${ARGN}) + if(NOT exists) + string(APPEND RunCMake_TEST_FAILED "Expected one of the following files to exist but they do not:\n") + foreach(filename IN LISTS ARGN) + string(APPEND RunCMake_TEST_FAILED " ${filename}\n") + endforeach() + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) + endif() +endfunction() + +function(assert_no_file_exists) + any_file_exists(exists ${ARGN}) + if(exists) + string(APPEND RunCMake_TEST_FAILED "Expected none of the following files to exist but one of them does:\n") + foreach(filename IN LISTS ARGN) + string(APPEND RunCMake_TEST_FAILED " ${filename}\n") + endforeach() + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) + endif() +endfunction() + +function(run_tidy_export_fixes) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExportFixesDir-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(ExportFixesDir) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(ExportFixesDir-Build ${CMAKE_COMMAND} --build . --config Debug) + unset(RunCMake_TEST_OUTPUT_MERGE) + + run_cmake(ExportFixesDir2) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(ExportFixesDir2-Build ${CMAKE_COMMAND} --build . --config Debug) + unset(RunCMake_TEST_OUTPUT_MERGE) +endfunction() +run_tidy_export_fixes() diff --git a/Tests/RunCMake/ClangTidy/export_fixes_subdir/CMakeLists.txt b/Tests/RunCMake/ClangTidy/export_fixes_subdir/CMakeLists.txt new file mode 100644 index 0000000..af2db88 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/export_fixes_subdir/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(subdir ${files}) diff --git a/Tests/RunCMake/ClangTidy/extra.c b/Tests/RunCMake/ClangTidy/extra.c new file mode 100644 index 0000000..d235550 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/extra.c @@ -0,0 +1,3 @@ +void extra(void) +{ +} diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir/initial-cache.txt b/Tests/RunCMake/CommandLine/C_buildsrcdir/initial-cache.txt index adc125b..ce1cce3 100644 --- a/Tests/RunCMake/CommandLine/C_buildsrcdir/initial-cache.txt +++ b/Tests/RunCMake/CommandLine/C_buildsrcdir/initial-cache.txt @@ -1,3 +1,5 @@ +set(CMAKE_MINIMUM_REQUIRED_VERSION "" CACHE STRING "") + # Used to verify that the values match what is passed via -S and -B, and are retained in cache. set(INITIAL_SOURCE_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "defined in initial.cmake") set(INITIAL_BINARY_DIR "${CMAKE_BINARY_DIR}" CACHE PATH "defined in initial.cmake") diff --git a/Tests/RunCMake/CommandLine/E___run_co_compile-tidy-remove-fixes-check.cmake b/Tests/RunCMake/CommandLine/E___run_co_compile-tidy-remove-fixes-check.cmake new file mode 100644 index 0000000..d638fda --- /dev/null +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-tidy-remove-fixes-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS "${RunCMake_BINARY_DIR}/tidy-fixes.yaml") + string(APPEND RunCMake_TEST_FAILED "Expected ${RunCMake_BINARY_DIR}/tidy-fixes.yaml not to exist but it does") +endif() diff --git a/Tests/RunCMake/CommandLine/E___run_co_compile-tidy-remove-fixes-prep.cmake b/Tests/RunCMake/CommandLine/E___run_co_compile-tidy-remove-fixes-prep.cmake new file mode 100644 index 0000000..1e89ffe --- /dev/null +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-tidy-remove-fixes-prep.cmake @@ -0,0 +1 @@ +file(TOUCH "${RunCMake_BINARY_DIR}/tidy-fixes.yaml") diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index 1452c9b..597dbd4 100644 --- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -1 +1 @@ -^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":4}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"tls":(true|false),"version":{.*}}$ +^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":5}]},{"kind":"configureLog","version":\[{"major":1,"minor":0}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"tls":(true|false),"version":{.*}}$ diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt b/Tests/RunCMake/CommandLine/E_copy-t-argument-target-is-file-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt +++ b/Tests/RunCMake/CommandLine/E_copy-t-argument-target-is-file-result.txt diff --git a/Tests/RunCMake/CommandLine/E_copy-t-argument-target-is-file-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-t-argument-target-is-file-stderr.txt new file mode 100644 index 0000000..9504216 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-t-argument-target-is-file-stderr.txt @@ -0,0 +1 @@ +^Error: Target \(for copy command\).* is not a directory.$ diff --git a/Tests/RunCMake/CommandLine/Envgen-bad-help-stderr.txt b/Tests/RunCMake/CommandLine/Envgen-bad-help-stderr.txt new file mode 100644 index 0000000..cdfe857 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Envgen-bad-help-stderr.txt @@ -0,0 +1 @@ +CMake Error: CMAKE_GENERATOR was set but the specified generator doesn't exist. Using CMake default. diff --git a/Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt b/Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt new file mode 100644 index 0000000..075c48c --- /dev/null +++ b/Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt @@ -0,0 +1,2 @@ +Generators.* +\* (Unix Makefiles|Visual Studio).* diff --git a/Tests/RunCMake/CommandLine/Envgen-ninja-multi-help-stdout.txt b/Tests/RunCMake/CommandLine/Envgen-ninja-multi-help-stdout.txt new file mode 100644 index 0000000..ece6e5d --- /dev/null +++ b/Tests/RunCMake/CommandLine/Envgen-ninja-multi-help-stdout.txt @@ -0,0 +1 @@ +\* Ninja Multi-Config[ ]+= Generates build-<Config>.ninja files. diff --git a/Tests/RunCMake/CommandLine/P_P_in_arbitrary_args-stdout.txt b/Tests/RunCMake/CommandLine/P_P_in_arbitrary_args-stdout.txt new file mode 100644 index 0000000..95304ab --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_P_in_arbitrary_args-stdout.txt @@ -0,0 +1,10 @@ +^-- CMAKE_ARGC='6' +-- CMAKE_ARGV1='-P' +-- CMAKE_ARGV2='[^']*/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake' +-- CMAKE_ARGV3='--' +-- CMAKE_ARGV4='-P' +-- CMAKE_ARGV5='[^']*/Tests/RunCMake/CommandLine/non_existing.cmake' +-- CMAKE_ARGV6='' +-- CMAKE_ARGV7='' +-- CMAKE_ARGV8='' +-- CMAKE_ARGV9=''$ diff --git a/Tests/RunCMake/CommandLine/P_P_in_arbitrary_args_2-stdout.txt b/Tests/RunCMake/CommandLine/P_P_in_arbitrary_args_2-stdout.txt new file mode 100644 index 0000000..ad386bd --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_P_in_arbitrary_args_2-stdout.txt @@ -0,0 +1,10 @@ +^-- CMAKE_ARGC='6' +-- CMAKE_ARGV1='-P' +-- CMAKE_ARGV2='[^']*/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake' +-- CMAKE_ARGV3='--' +-- CMAKE_ARGV4='-P' +-- CMAKE_ARGV5='-o' +-- CMAKE_ARGV6='' +-- CMAKE_ARGV7='' +-- CMAKE_ARGV8='' +-- CMAKE_ARGV9=''$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index a2eeddf..943be24 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -47,6 +47,7 @@ run_cmake_command(E___run_co_compile-no-iwyu ${CMAKE_COMMAND} -E __run_co_compil run_cmake_command(E___run_co_compile-bad-iwyu ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist -- command-does-not-exist) run_cmake_command(E___run_co_compile-no--- ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist command-does-not-exist) run_cmake_command(E___run_co_compile-no-cc ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist --) +run_cmake_command(E___run_co_compile-tidy-remove-fixes ${CMAKE_COMMAND} -E __run_co_compile "--tidy=${CMAKE_COMMAND}\\;-E\\;true\\;--export-fixes=${RunCMake_BINARY_DIR}/tidy-fixes.yaml" -- ${CMAKE_COMMAND} -E true) run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G) run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator) @@ -54,10 +55,14 @@ run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) run_cmake_command(P_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_args.cmake" relative/path "${RunCMake_SOURCE_DIR}") run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO -S -B --fresh --version) +run_cmake_command(P_P_in_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -P "${RunCMake_SOURCE_DIR}/non_existing.cmake") +run_cmake_command(P_P_in_arbitrary_args_2 ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -P -o) run_cmake_command(P_fresh ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_fresh.cmake" --fresh) run_cmake_command(build-no-dir ${CMAKE_COMMAND} --build) +run_cmake_command(build-no-dir2 + ${CMAKE_COMMAND} --build --target=invalid) run_cmake_command(build-no-cache ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}) run_cmake_command(build-unknown-command-short @@ -349,6 +354,13 @@ function(run_EnvironmentGenerator) run_cmake_command(Envgen-bad ${CMAKE_COMMAND} -G) unset(ENV{CMAKE_GENERATOR}) + # Honor CMAKE_GENERATOR env var in --help output + set(ENV{CMAKE_GENERATOR} "Ninja Multi-Config") + run_cmake_command(Envgen-ninja-multi-help ${CMAKE_COMMAND} --help) + set(ENV{CMAKE_GENERATOR} "NoSuchGenerator") + run_cmake_command(Envgen-bad-help ${CMAKE_COMMAND} --help) + unset(ENV{CMAKE_GENERATOR}) + if(RunCMake_GENERATOR MATCHES "Visual Studio.*") set(ENV{CMAKE_GENERATOR} "${RunCMake_GENERATOR}") run_cmake_command(Envgen ${CMAKE_COMMAND} ${source_dir}) @@ -567,6 +579,12 @@ run_cmake_command(E_copy-three-source-files-target-is-file ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}/f1.txt) run_cmake_command(E_copy-two-good-and-one-bad-source-files-target-is-directory ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/not_existing_file.bad ${in}/f3.txt ${out}) +run_cmake_command(E_copy-t-argument + ${CMAKE_COMMAND} -E copy ${in}/f1.txt -t ${out} ${in}/f3.txt) +run_cmake_command(E_copy-t-argument-target-is-file + ${CMAKE_COMMAND} -E copy ${in}/f1.txt -t ${out}/f1.txt ${in}/f3.txt) +run_cmake_command(E_copy-t-argument-no-source-files + ${CMAKE_COMMAND} -E copy -t ${out}) run_cmake_command(E_copy_if_different-one-source-directory-target-is-directory ${CMAKE_COMMAND} -E copy_if_different ${in}/f1.txt ${out}) run_cmake_command(E_copy_if_different-three-source-files-target-is-directory @@ -577,6 +595,15 @@ unset(in) unset(out) set(in ${RunCMake_SOURCE_DIR}/copy_input) +set(out ${RunCMake_BINARY_DIR}/copy_directory_different_output) +file(REMOVE_RECURSE "${out}") +file(MAKE_DIRECTORY ${out}) +run_cmake_command(E_copy_directory_if_different + ${CMAKE_COMMAND} -E copy_directory_if_different ${in} ${out}) +unset(in) +unset(out) + +set(in ${RunCMake_SOURCE_DIR}/copy_input) set(out ${RunCMake_BINARY_DIR}/copy_directory_output) set(outfile ${out}/file_for_test.txt) file(REMOVE_RECURSE "${out}") @@ -940,6 +967,7 @@ unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS --trace) run_cmake(trace) +run_cmake(trace-try_compile) unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS --trace-expand) @@ -952,6 +980,7 @@ unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS --trace-redirect=${RunCMake_BINARY_DIR}/redirected.trace) run_cmake(trace-redirect) +run_cmake(trace-try_compile-redirect) unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS --trace-redirect=/no/such/file.txt) diff --git a/Tests/RunCMake/file/DOWNLOAD-no-save-hash-result.txt b/Tests/RunCMake/CommandLine/build-no-dir2-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file/DOWNLOAD-no-save-hash-result.txt +++ b/Tests/RunCMake/CommandLine/build-no-dir2-result.txt diff --git a/Tests/RunCMake/CommandLine/build-no-dir2-stderr.txt b/Tests/RunCMake/CommandLine/build-no-dir2-stderr.txt new file mode 100644 index 0000000..4811bea --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-no-dir2-stderr.txt @@ -0,0 +1 @@ +^Usage: cmake --build <dir> +\[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes b/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes index d9a4db4..9c22288 100644 --- a/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes +++ b/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes @@ -1,2 +1,2 @@ # Do not format a source encoded in UTF-16. -test_UTF-16LE.h -format.clang-format-6.0 +test_UTF-16LE.h -format.clang-format diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test.c b/Tests/RunCMake/CommandLine/cmake_depends/test.c index 92c056f..5b42255 100644 --- a/Tests/RunCMake/CommandLine/cmake_depends/test.c +++ b/Tests/RunCMake/CommandLine/cmake_depends/test.c @@ -1,2 +1,3 @@ #include "test.h" + #include "test_UTF-16LE.h" diff --git a/Tests/RunCMake/CommandLine/compare_files/.gitattributes b/Tests/RunCMake/CommandLine/compare_files/.gitattributes index 91d5c10..d03da96 100644 --- a/Tests/RunCMake/CommandLine/compare_files/.gitattributes +++ b/Tests/RunCMake/CommandLine/compare_files/.gitattributes @@ -1,2 +1,2 @@ -crlf eol=crlf -lf eol=lf +crlf -text -whitespace +lf -text diff --git a/Tests/RunCMake/CommandLine/compare_files/crlf b/Tests/RunCMake/CommandLine/compare_files/crlf index a29bdeb..495181c 100644 --- a/Tests/RunCMake/CommandLine/compare_files/crlf +++ b/Tests/RunCMake/CommandLine/compare_files/crlf @@ -1 +1 @@ -line1 +line1
diff --git a/Tests/RunCMake/CommandLine/trace-try_compile-redirect-check.cmake b/Tests/RunCMake/CommandLine/trace-try_compile-redirect-check.cmake new file mode 100644 index 0000000..94a7c95 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-try_compile-redirect-check.cmake @@ -0,0 +1,13 @@ +file(READ ${RunCMake_SOURCE_DIR}/trace-try_compile-stderr.txt expected_content) +string(REGEX REPLACE "\n+$" "" expected_content "${expected_content}") + +file(READ ${RunCMake_BINARY_DIR}/redirected.trace actual_content) +string(REGEX REPLACE "\r\n" "\n" actual_content "${actual_content}") +string(REGEX REPLACE "\n+$" "" actual_content "${actual_content}") +if(NOT "${actual_content}" MATCHES "${expected_content}") + set(RunCMake_TEST_FAILED + "Trace file content does not match that expected." + "Expected to match:\n${expected_content}\n" + "Actual content:\n${actual_content}\n" + ) +endif() diff --git a/Tests/RunCMake/CommandLine/trace-try_compile-redirect.cmake b/Tests/RunCMake/CommandLine/trace-try_compile-redirect.cmake new file mode 100644 index 0000000..982cb89 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-try_compile-redirect.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 3.24) +project(test C) diff --git a/Tests/RunCMake/CommandLine/trace-try_compile-stderr.txt b/Tests/RunCMake/CommandLine/trace-try_compile-stderr.txt new file mode 100644 index 0000000..1674b8f --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-try_compile-stderr.txt @@ -0,0 +1,4 @@ +.*Modules/CMakeDetermineCompilerABI.cmake\([0-9]+\): try_compile\([^)]+\) +.*Tests/RunCMake/CommandLine/trace-try_compile(-redirect)?-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+/CMakeLists.txt\([0-9]+\): cmake_minimum_required.* +.*Tests/RunCMake/CommandLine/trace-try_compile(-redirect)?-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+/CMakeLists.txt\([0-9]+\): project\(CMAKE_TRY_COMPILE.* +.*Tests/RunCMake/CommandLine/trace-try_compile(-redirect)?-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+/CMakeLists.txt\([0-9]+\): add_executable\(cmTC_.* diff --git a/Tests/RunCMake/CommandLine/trace-try_compile.cmake b/Tests/RunCMake/CommandLine/trace-try_compile.cmake new file mode 100644 index 0000000..982cb89 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-try_compile.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 3.24) +project(test C) diff --git a/Tests/RunCMake/CompileDefinitions/RemoveLeadingMinusD.cmake b/Tests/RunCMake/CompileDefinitions/RemoveLeadingMinusD.cmake new file mode 100644 index 0000000..3db6cff1f --- /dev/null +++ b/Tests/RunCMake/CompileDefinitions/RemoveLeadingMinusD.cmake @@ -0,0 +1,11 @@ + +enable_language(C) + +set_property(SOURCE foo.c PROPERTY COMPILE_DEFINITIONS -DDEF0 "$<1:-DDEF1>") + +add_library(lib1 foo.c) +set_property(TARGET lib1 PROPERTY COMPILE_DEFINITIONS -DDEF2 "$<1:-DDEF3>") +set_property(TARGET lib1 PROPERTY INTERFACE_COMPILE_DEFINITIONS -DDEF4 "$<1:-DDEF5>") + +add_library(lib2 foo.c) +target_link_libraries(lib2 PRIVATE lib1) diff --git a/Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake b/Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake index 233fe34..eebcd22 100644 --- a/Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake @@ -1,3 +1,16 @@ include(RunCMake) run_cmake(SetEmpty) + + +macro(run_cmake_build test) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test} ${CMAKE_COMMAND} --build . --config Release) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +run_cmake(RemoveLeadingMinusD) +run_cmake_build(RemoveLeadingMinusD) diff --git a/Tests/RunCMake/CompileDefinitions/foo.c b/Tests/RunCMake/CompileDefinitions/foo.c new file mode 100644 index 0000000..74a86e1 --- /dev/null +++ b/Tests/RunCMake/CompileDefinitions/foo.c @@ -0,0 +1,4 @@ + +void foo() +{ +} diff --git a/Tests/RunCMake/Configure/CopyFileABI-stdout.txt b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt index 6a856a4..2176554 100644 --- a/Tests/RunCMake/Configure/CopyFileABI-stdout.txt +++ b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt @@ -1,4 +1,4 @@ -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done.* --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) diff --git a/Tests/RunCMake/Configure/ErrorLogs-stderr.txt b/Tests/RunCMake/Configure/ErrorLogs-stderr.txt deleted file mode 100644 index 4eee45d..0000000 --- a/Tests/RunCMake/Configure/ErrorLogs-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at ErrorLogs.cmake:3 \(message\): - Some error! -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Configure/ErrorLogs-stdout.txt b/Tests/RunCMake/Configure/ErrorLogs-stdout.txt deleted file mode 100644 index c467b62..0000000 --- a/Tests/RunCMake/Configure/ErrorLogs-stdout.txt +++ /dev/null @@ -1,3 +0,0 @@ --- Configuring incomplete, errors occurred! -See also ".*/Tests/RunCMake/Configure/ErrorLogs-build/CMakeFiles/CMakeOutput\.log"\. -See also ".*/Tests/RunCMake/Configure/ErrorLogs-build/CMakeFiles/CMakeError\.log"\. diff --git a/Tests/RunCMake/Configure/ErrorLogs.cmake b/Tests/RunCMake/Configure/ErrorLogs.cmake deleted file mode 100644 index e8cf062..0000000 --- a/Tests/RunCMake/Configure/ErrorLogs.cmake +++ /dev/null @@ -1,3 +0,0 @@ -file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Some detailed error information!\n") -message(SEND_ERROR "Some error!") diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake index 750fa3c..df6849e 100644 --- a/Tests/RunCMake/Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake @@ -3,7 +3,6 @@ include(RunCMake) run_cmake(ContinueAfterError) run_cmake(CopyFileABI) run_cmake(CustomTargetAfterError) -run_cmake(ErrorLogs) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RerunCMake-build) diff --git a/Tests/RunCMake/ExportImport/BuildInstallInterfaceGenex-export.cmake b/Tests/RunCMake/ExportImport/BuildInstallInterfaceGenex-export.cmake new file mode 100644 index 0000000..94076bb --- /dev/null +++ b/Tests/RunCMake/ExportImport/BuildInstallInterfaceGenex-export.cmake @@ -0,0 +1,14 @@ +enable_language(C) + +add_library(mainlib STATIC foo.c) +target_compile_definitions(mainlib INTERFACE + $<BUILD_LOCAL_INTERFACE:BUILD_LOCAL_INTERFACE> + $<BUILD_INTERFACE:BUILD_INTERFACE> + $<INSTALL_INTERFACE:INSTALL_INTERFACE> + ) +add_library(locallib STATIC locallib.c) +target_link_libraries(locallib PRIVATE mainlib) + +install(TARGETS mainlib EXPORT export) +install(EXPORT export DESTINATION lib/cmake/install FILE install-config.cmake NAMESPACE install::) +export(EXPORT export FILE build-config.cmake NAMESPACE build::) diff --git a/Tests/RunCMake/ExportImport/BuildInstallInterfaceGenex-import.cmake b/Tests/RunCMake/ExportImport/BuildInstallInterfaceGenex-import.cmake new file mode 100644 index 0000000..3fe5fae --- /dev/null +++ b/Tests/RunCMake/ExportImport/BuildInstallInterfaceGenex-import.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +find_package(build REQUIRED) +find_package(install REQUIRED) + +add_library(buildlib STATIC buildlib.c) +target_link_libraries(buildlib PRIVATE build::mainlib) +add_library(installlib STATIC installlib.c) +target_link_libraries(installlib PRIVATE install::mainlib) diff --git a/Tests/RunCMake/ExportImport/RunCMakeTest.cmake b/Tests/RunCMake/ExportImport/RunCMakeTest.cmake index d07fca2..b730047 100644 --- a/Tests/RunCMake/ExportImport/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExportImport/RunCMakeTest.cmake @@ -22,3 +22,28 @@ function(run_ExportImport_test case) endfunction() run_ExportImport_test(SharedDep) + +function(run_ExportImportBuildInstall_test case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-export-build) + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + run_cmake(${case}-export) + unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${case}-export-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${case}-export-install ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -P cmake_install.cmake) + unset(RunCMake_TEST_NO_CLEAN) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-import-build) + run_cmake_with_options(${case}-import + -Dbuild_DIR=${RunCMake_BINARY_DIR}/${case}-export-build + -Dinstall_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/install + ) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${case}-import-build ${CMAKE_COMMAND} --build . --config Debug) + unset(RunCMake_TEST_NO_CLEAN) +endfunction() + +run_ExportImportBuildInstall_test(BuildInstallInterfaceGenex) diff --git a/Tests/RunCMake/ExportImport/buildlib.c b/Tests/RunCMake/ExportImport/buildlib.c new file mode 100644 index 0000000..ac19310 --- /dev/null +++ b/Tests/RunCMake/ExportImport/buildlib.c @@ -0,0 +1,8 @@ +#if !(!defined(BUILD_LOCAL_INTERFACE) && defined(BUILD_INTERFACE) && \ + !defined(INSTALL_INTERFACE)) +# error "Incorrect compile definitions" +#endif + +void buildlib(void) +{ +} diff --git a/Tests/RunCMake/ExportImport/installlib.c b/Tests/RunCMake/ExportImport/installlib.c new file mode 100644 index 0000000..00d503c --- /dev/null +++ b/Tests/RunCMake/ExportImport/installlib.c @@ -0,0 +1,8 @@ +#if !(!defined(BUILD_LOCAL_INTERFACE) && !defined(BUILD_INTERFACE) && \ + defined(INSTALL_INTERFACE)) +# error "Incorrect compile definitions" +#endif + +void installlib(void) +{ +} diff --git a/Tests/RunCMake/ExportImport/locallib.c b/Tests/RunCMake/ExportImport/locallib.c new file mode 100644 index 0000000..f9e3d8d --- /dev/null +++ b/Tests/RunCMake/ExportImport/locallib.c @@ -0,0 +1,8 @@ +#if !(defined(BUILD_LOCAL_INTERFACE) && defined(BUILD_INTERFACE) && \ + !defined(INSTALL_INTERFACE)) +# error "Incorrect compile definitions" +#endif + +void locallib(void) +{ +} diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake index 961b73a..c768d18 100644 --- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake +++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake @@ -65,6 +65,7 @@ function(run_object object) endfunction() run_object(codemodel-v2) +run_object(configureLog-v1) run_object(cache-v2) run_object(cmakeFiles-v1) run_object(toolchains-v1) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index b7623de..fda18b5 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -12,7 +12,7 @@ def read_codemodel_json_data(filename): def check_objects(o, g): assert is_list(o) assert len(o) == 1 - check_index_object(o[0], "codemodel", 2, 4, check_object_codemodel(g)) + check_index_object(o[0], "codemodel", 2, 5, check_object_codemodel(g)) def check_backtrace(t, b, backtrace): btg = t["backtraceGraph"] @@ -291,10 +291,30 @@ def check_target(c): assert matches(obj["paths"]["build"], expected["build"]) assert matches(obj["paths"]["source"], expected["source"]) + def check_file_set(actual, expected): + assert is_dict(actual) + expected_keys = ["name", "type", "visibility", "baseDirectories"] + + assert is_string(actual["name"], expected["name"]) + assert is_string(actual["type"], expected["type"]) + assert is_string(actual["visibility"], expected["visibility"]) + + check_list_match(lambda a, e: matches(a, e), actual["baseDirectories"], + expected["baseDirectories"], + check_exception=lambda a, e: "File set base directory (check): %s" % a, + missing_exception=lambda e: "File set base directory (missing): %s" % e, + extra_exception=lambda a: "File set base directory (extra): %s" % a) + + assert sorted(actual.keys()) == sorted(expected_keys) + def check_source(actual, expected): assert is_dict(actual) expected_keys = ["path"] + if expected["fileSetName"] is not None: + expected_keys.append("fileSetIndex") + assert is_string(obj["fileSets"][actual["fileSetIndex"]]["name"], expected["fileSetName"]) + if expected["compileGroupLanguage"] is not None: expected_keys.append("compileGroupIndex") assert is_string(obj["compileGroups"][actual["compileGroupIndex"]]["language"], expected["compileGroupLanguage"]) @@ -313,6 +333,14 @@ def check_target(c): assert sorted(actual.keys()) == sorted(expected_keys) + if expected["fileSets"] is not None: + expected_keys.append("fileSets") + check_list_match(lambda a, e: matches(a["name"], e["name"]), obj["fileSets"], + expected["fileSets"], check=check_file_set, + check_exception=lambda a, e: "File set: %s" % a["name"], + missing_exception=lambda e: "File set: %s" % e["name"], + extra_exception=lambda a: "File set: %s" % a["name"]) + check_list_match(lambda a, e: matches(a["path"], e["path"]), obj["sources"], expected["sources"], check=check_source, check_exception=lambda a, e: "Source file: %s" % a["path"], @@ -824,6 +852,7 @@ def gen_check_targets(c, g, inSource): { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/([0-9a-f]+/)?generate\\.stamp\\.rule$", "isGenerated": True, + "fileSetName": None, "sourceGroupName": "CMake Rules", "compileGroupLanguage": None, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_alias.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_alias.json index eabf739..63493c9 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_alias.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_alias.json @@ -5,10 +5,12 @@ "projectName": "Alias", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ALL_BUILD$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ALL_BUILD\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_custom.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_custom.json index a5ff686..411057c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_custom.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_custom.json @@ -5,10 +5,12 @@ "projectName": "Custom", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ALL_BUILD$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ALL_BUILD\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json index 1f443b1..bf36bfe 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json @@ -5,10 +5,12 @@ "projectName": "Cxx", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ALL_BUILD$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ALL_BUILD\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_external.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_external.json index 017335c..ebda414 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_external.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_external.json @@ -5,10 +5,12 @@ "projectName": "External", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ALL_BUILD$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ALL_BUILD\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_imported.json index 2de5b15..579a103 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_imported.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_imported.json @@ -5,10 +5,12 @@ "projectName": "Imported", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ALL_BUILD$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ALL_BUILD\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json index fa2a6e5..ec03531 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json @@ -5,10 +5,12 @@ "projectName": "Interface", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_object.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_object.json index 9d8899a..f145896 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_object.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_object.json @@ -5,10 +5,12 @@ "projectName": "Object", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ALL_BUILD$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ALL_BUILD\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json index 0d45d07..46495ac 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json @@ -5,10 +5,12 @@ "projectName": "codemodel-v2", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ALL_BUILD$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ALL_BUILD\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json index ac7c94d..a27d328 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json @@ -5,10 +5,12 @@ "projectName": "Alias", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json index 7af74c4..7cfc0f2 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json @@ -5,10 +5,12 @@ "projectName": "codemodel-v2", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json index c189623..715514d 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json @@ -5,10 +5,37 @@ "projectName": "codemodel-v2", "type": "STATIC_LIBRARY", "isGeneratorProvided": null, + "fileSets": [ + { + "name": "HEADERS", + "type": "HEADERS", + "visibility": "PUBLIC", + "baseDirectories": [".*/Tests/RunCMake/FileAPI/fileset$"] + }, + { + "name": "a", + "type": "HEADERS", + "visibility": "PRIVATE", + "baseDirectories": [".*/Tests/RunCMake/FileAPI/fileset$"] + }, + { + "name": "b", + "type": "HEADERS", + "visibility": "PUBLIC", + "baseDirectories": [".*/Tests/RunCMake/FileAPI/fileset/dir$"] + }, + { + "name": "c", + "type": "HEADERS", + "visibility": "INTERFACE", + "baseDirectories": [".*/Tests/RunCMake/FileAPI/fileset$"] + } + ], "sources": [ { "path": "^fileset/empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ @@ -29,6 +56,7 @@ { "path": "^fileset/error\\.c$", "isGenerated": null, + "fileSetName": "HEADERS", "sourceGroupName": "Header Files", "compileGroupLanguage": null, "backtrace": [ @@ -49,6 +77,7 @@ { "path": "^fileset/other\\.c$", "isGenerated": null, + "fileSetName": "HEADERS", "sourceGroupName": "Source Files", "compileGroupLanguage": null, "backtrace": [ @@ -69,6 +98,7 @@ { "path": "^fileset/h1\\.h$", "isGenerated": null, + "fileSetName": "a", "sourceGroupName": "Header Files", "compileGroupLanguage": null, "backtrace": [ @@ -89,6 +119,7 @@ { "path": "^fileset/dir/h2\\.h$", "isGenerated": null, + "fileSetName": "b", "sourceGroupName": "Header Files", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json index 75fe58c..4757a9c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json @@ -5,10 +5,19 @@ "projectName": "codemodel-v2", "type": "STATIC_LIBRARY", "isGeneratorProvided": null, + "fileSets": [ + { + "name": "HEADERS", + "type": "HEADERS", + "visibility": "INTERFACE", + "baseDirectories": [".*/Tests/RunCMake/FileAPI/fileset$"] + } + ], "sources": [ { "path": "^fileset/empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json index 0ca1962..2bfc63f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json @@ -5,10 +5,12 @@ "projectName": "codemodel-v2", "type": "STATIC_LIBRARY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json index 3392404..6342191 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json @@ -5,10 +5,12 @@ "projectName": "Object", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ @@ -29,6 +31,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(object|build/c_object_lib\\.build)/.*/empty(\\.c)?\\.o(bj)?$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "Object Libraries", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json index 1917f92..3e1b03b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json @@ -5,10 +5,12 @@ "projectName": "Object", "type": "OBJECT_LIBRARY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json index 0d4018a..f7a8db4 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json @@ -5,10 +5,12 @@ "projectName": "codemodel-v2", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json index 9a210ff..9066053 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json @@ -5,10 +5,12 @@ "projectName": "codemodel-v2", "type": "SHARED_LIBRARY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json index 5542277..46c5bfe 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json @@ -5,10 +5,12 @@ "projectName": "codemodel-v2", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json index 4b63897..df28479 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json @@ -5,10 +5,12 @@ "projectName": "codemodel-v2", "type": "STATIC_LIBRARY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json index 12ec917..4fa62e3 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json @@ -5,10 +5,12 @@ "projectName": "codemodel-v2", "type": "STATIC_LIBRARY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^subdir/empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json index ab301e9..8d52ab8 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json @@ -5,10 +5,12 @@ "projectName": "Custom", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json index 483ae79..23f8e52 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json @@ -5,10 +5,12 @@ "projectName": "Custom", "type": "UTILITY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/custom_tgt(-(Debug|Release|RelWithDebInfo|MinSizeRel))?$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -29,6 +31,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(custom/)?CMakeFiles/([0-9a-f]+/)?custom_tgt(-\\(CONFIG\\))?\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json index 837f252..b27fc5b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json @@ -5,10 +5,12 @@ "projectName": "Alias", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json index 16d074a..12b2551 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json @@ -5,10 +5,12 @@ "projectName": "Cxx", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json index 5a0f770..3251777 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json @@ -97,6 +97,7 @@ { "path": ".*cmake_pch(_[^.]+)?(\\.hxx)?\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ @@ -111,6 +112,7 @@ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ @@ -131,6 +133,7 @@ { "path": ".*/cmake_pch(_[^.]+)?\\.hxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Precompile Header File", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json index 9455748..0ac40c2 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json @@ -143,6 +143,7 @@ { "path": ".*cmake_pch(_[^.]+)?(\\.hxx)?\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ @@ -157,6 +158,7 @@ { "path": ".*cmake_pch(_[^.]+)?(\\.hxx)?\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ @@ -171,6 +173,7 @@ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ @@ -191,6 +194,7 @@ { "path": ".*/cmake_pch(_[^.]+)?\\.hxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Precompile Header File", "compileGroupLanguage": null, "backtrace": [ @@ -205,6 +209,7 @@ { "path": ".*/cmake_pch(_[^.]+)?\\.hxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Precompile Header File", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json index 9f6ffcc..86168f1 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json @@ -97,6 +97,7 @@ { "path": ".*cmake_pch(_[^.]+)?(\\.hxx)?\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ @@ -111,6 +112,7 @@ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ @@ -131,6 +133,7 @@ { "path": ".*/Debug/cmake_pch(_[^.]+)?\\.hxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Precompile Header File", "compileGroupLanguage": null, "backtrace": [ @@ -145,6 +148,7 @@ { "path": ".*/Release/cmake_pch(_[^.]+)?\\.hxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Precompile Header File", "compileGroupLanguage": null, "backtrace": [ @@ -159,6 +163,7 @@ { "path": ".*/MinSizeRel/cmake_pch(_[^.]+)?\\.hxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Precompile Header File", "compileGroupLanguage": null, "backtrace": [ @@ -173,6 +178,7 @@ { "path": ".*/RelWithDebInfo/cmake_pch(_[^.]+)?\\.hxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Precompile Header File", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json index 94ac081..f665004 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json @@ -5,10 +5,12 @@ "projectName": "Cxx", "type": "STATIC_LIBRARY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json index e8d6218..68c5dcc 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json @@ -5,10 +5,12 @@ "projectName": "Object", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ @@ -29,6 +31,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(object|build/cxx_object_lib\\.build)/.*/empty(\\.cxx)?\\.o(bj)?$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "Object Libraries", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json index 24b391b..0438a49 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json @@ -5,10 +5,12 @@ "projectName": "Object", "type": "OBJECT_LIBRARY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json index 4421c8f..bb9989e 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json @@ -5,10 +5,12 @@ "projectName": "Cxx", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json index 03f4cb9..d6d59a4 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json @@ -5,10 +5,12 @@ "projectName": "Cxx", "type": "SHARED_LIBRARY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json index d6d573f..a6bacf7 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json @@ -5,10 +5,12 @@ "projectName": "Cxx", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json index 9cb2832..fe884e0 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json @@ -5,10 +5,12 @@ "projectName": "Cxx", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json index 52c42de..d904bd9 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json @@ -5,10 +5,12 @@ "projectName": "Cxx", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json index 98298be..bced68a 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json @@ -5,10 +5,12 @@ "projectName": "Cxx", "type": "STATIC_LIBRARY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.cxx$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json index d41bbb2..4b69682 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json @@ -5,10 +5,12 @@ "projectName": "External", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPIExternalSource/empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ @@ -29,6 +31,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/generated\\.cxx$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "Generated Source Files", "compileGroupLanguage": "CXX", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json index 97d7ccd..bd698d5 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json @@ -5,10 +5,12 @@ "projectName": "Interface", "type": "INTERFACE_LIBRARY", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json index fe0524c..c0c3e79 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json @@ -5,10 +5,12 @@ "projectName": "codemodel-v2", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json index 451e8d4..45fb0a5 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json @@ -5,10 +5,12 @@ "projectName": "Imported", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json index cbd4346..74c179c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json @@ -5,10 +5,12 @@ "projectName": "Imported", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json index d92a810..6771747 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json @@ -5,10 +5,12 @@ "projectName": "Imported", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json index 1197a73..659e3fb 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json @@ -5,10 +5,12 @@ "projectName": "Imported", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json index 42564e0..7bdaffb 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json @@ -5,10 +5,12 @@ "projectName": "Imported", "type": "EXECUTABLE", "isGeneratorProvided": null, + "fileSets": null, "sources": [ { "path": "^empty\\.c$", "isGenerated": null, + "fileSetName": null, "sourceGroupName": "Source Files", "compileGroupLanguage": "C", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_alias.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_alias.json index 941c172..7462f7f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_alias.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_alias.json @@ -5,10 +5,12 @@ "projectName": "Alias", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ZERO_CHECK$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ZERO_CHECK\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_custom.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_custom.json index 98c6dd9..abc5084 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_custom.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_custom.json @@ -5,10 +5,12 @@ "projectName": "Custom", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ZERO_CHECK$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ZERO_CHECK\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_cxx.json index b72ff82..af4248c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_cxx.json @@ -5,10 +5,12 @@ "projectName": "Cxx", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ZERO_CHECK$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ZERO_CHECK\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_external.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_external.json index 9e73806..a7b8bb0 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_external.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_external.json @@ -5,10 +5,12 @@ "projectName": "External", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ZERO_CHECK$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ZERO_CHECK\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_imported.json index 7534c84..ed3da5f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_imported.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_imported.json @@ -5,10 +5,12 @@ "projectName": "Imported", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ZERO_CHECK$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ZERO_CHECK\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json index fdd4b2a..178f9ef 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json @@ -5,10 +5,12 @@ "projectName": "Interface", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_object.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_object.json index bcd7616..341647b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_object.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_object.json @@ -5,10 +5,12 @@ "projectName": "Object", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ZERO_CHECK$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ZERO_CHECK\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_top.json index b3030bd..b3827ed 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_top.json @@ -5,10 +5,12 @@ "projectName": "codemodel-v2", "type": "UTILITY", "isGeneratorProvided": true, + "fileSets": null, "sources": [ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ZERO_CHECK$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "", "compileGroupLanguage": null, "backtrace": [ @@ -23,6 +25,7 @@ { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ZERO_CHECK\\.rule$", "isGenerated": true, + "fileSetName": null, "sourceGroupName": "CMake Rules", "compileGroupLanguage": null, "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-check.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-check.cmake new file mode 100644 index 0000000..bd4081c --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-check.cmake @@ -0,0 +1,11 @@ +set(expect + query + query/client-foo + query/client-foo/query.json + reply + reply/configureLog-v1-[0-9a-f]+.json + reply/index-[0-9.T-]+.json + ) +check_api("^${expect}$") + +check_python(configureLog-v1) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-prep.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-prep.cmake new file mode 100644 index 0000000..c443487 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-prep.cmake @@ -0,0 +1,4 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query) +file(WRITE "${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query/client-foo/query.json" [[ + { "requests": [ { "kind": "configureLog", "version" : 1 } ] } +]]) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-check.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-check.cmake new file mode 100644 index 0000000..7498dd5 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-check.cmake @@ -0,0 +1,11 @@ +set(expect + query + query/client-foo + query/client-foo/configureLog-v1 + reply + reply/configureLog-v1-[0-9a-f]+.json + reply/index-[0-9.T-]+.json + ) +check_api("^${expect}$") + +check_python(configureLog-v1) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-prep.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-prep.cmake new file mode 100644 index 0000000..ad49e08 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-prep.cmake @@ -0,0 +1,2 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query) +file(WRITE "${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query/client-foo/configureLog-v1" "") diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-check.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-check.cmake new file mode 100644 index 0000000..3e34be6 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-check.cmake @@ -0,0 +1,10 @@ +set(expect + query + query/configureLog-v1 + reply + reply/configureLog-v1-[0-9a-f]+.json + reply/index-[0-9.T-]+.json + ) +check_api("^${expect}$") + +check_python(configureLog-v1) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-prep.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-prep.cmake new file mode 100644 index 0000000..6fe0037 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-prep.cmake @@ -0,0 +1,2 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query) +file(WRITE "${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query/configureLog-v1" "") diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-check.py b/Tests/RunCMake/FileAPI/configureLog-v1-check.py new file mode 100644 index 0000000..05c7893 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-check.py @@ -0,0 +1,21 @@ +from check_index import * +import os + +def check_objects(o): + assert is_list(o) + assert len(o) == 1 + check_index_object(o[0], "configureLog", 1, 0, check_object_configureLog) + +def check_object_configureLog(o): + assert sorted(o.keys()) == ["eventKindNames", "kind", "path", "version"] + # The "kind" and "version" members are handled by check_index_object. + path = o["path"] + assert matches(path, "^.*/CMakeFiles/CMakeConfigureLog\\.yaml$") + assert os.path.exists(path) + eventKindNames = o["eventKindNames"] + assert is_list(eventKindNames) + assert sorted(eventKindNames) == ["message-v1", "try_compile-v1", "try_run-v1"] + +assert is_dict(index) +assert sorted(index.keys()) == ["cmake", "objects", "reply"] +check_objects(index["objects"]) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1.cmake b/Tests/RunCMake/FileAPI/configureLog-v1.cmake new file mode 100644 index 0000000..c00af08 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1.cmake @@ -0,0 +1 @@ +enable_language(C) diff --git a/Tests/RunCMake/File_Archive/argument-validation-compression-level-1-stderr.txt b/Tests/RunCMake/File_Archive/argument-validation-compression-level-1-stderr.txt index d7bc79a..c2d4071 100644 --- a/Tests/RunCMake/File_Archive/argument-validation-compression-level-1-stderr.txt +++ b/Tests/RunCMake/File_Archive/argument-validation-compression-level-1-stderr.txt @@ -1,5 +1,5 @@ CMake Error at compression-level.cmake:39 \(file\): - file compression level 100 should be in range 0 to 9 + file compression level 100 for GZip should be in range 0 to 9 Call Stack \(most recent call first\): argument-validation-compression-level-1.cmake:8 \(check_compression_level\) CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Archive/argument-validation-compression-level-2-stderr.txt b/Tests/RunCMake/File_Archive/argument-validation-compression-level-2-stderr.txt index 0f7bd9e..d4a4402 100644 --- a/Tests/RunCMake/File_Archive/argument-validation-compression-level-2-stderr.txt +++ b/Tests/RunCMake/File_Archive/argument-validation-compression-level-2-stderr.txt @@ -1,5 +1,5 @@ CMake Error at compression-level.cmake:39 \(file\): - file compression level high should be in range 0 to 9 + file compression level high for GZip should be in range 0 to 9 Call Stack \(most recent call first\): argument-validation-compression-level-2.cmake:8 \(check_compression_level\) CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Archive/pax-zstd-compression-level.cmake b/Tests/RunCMake/File_Archive/pax-zstd-compression-level.cmake index 73fd84d..7002860 100644 --- a/Tests/RunCMake/File_Archive/pax-zstd-compression-level.cmake +++ b/Tests/RunCMake/File_Archive/pax-zstd-compression-level.cmake @@ -8,3 +8,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/compression-level.cmake) check_compression_level("1") check_compression_level("5") check_compression_level("9") +check_compression_level("12") +check_compression_level("15") +check_compression_level("19") diff --git a/Tests/RunCMake/FindBoost/CommonNotFound.cmake b/Tests/RunCMake/FindBoost/CommonNotFound.cmake index 864a549..b146d3d 100644 --- a/Tests/RunCMake/FindBoost/CommonNotFound.cmake +++ b/Tests/RunCMake/FindBoost/CommonNotFound.cmake @@ -1,2 +1,6 @@ +set(CMAKE_FIND_USE_CMAKE_PATH OFF) +set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH OFF) +set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH OFF) +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) # Make sure to use the module mode signature here to not bypass FindBoost find_package(Boost 1.80 COMPONENTS timer foobar) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake index f149d99..69ab4da 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake @@ -113,23 +113,33 @@ message(STATUS "Verifying target \"${tgt}\"") if (NOT TARGET ${tgt}) message(FATAL_ERROR "No import target for fake link options package") endif() -get_target_property(link_options ${tgt} INTERFACE_LINK_OPTIONS) -if (NOT link_options STREQUAL expected_link_options) - message(FATAL_ERROR - "Additional link options not present in INTERFACE_LINK_OPTIONS property\n" - "expected: \"${expected_link_options}\", but got \"${link_options}\"" - ) -endif() -get_target_property(inc_dirs ${tgt} INTERFACE_INCLUDE_DIRECTORIES) -set(expected_inc_dirs "/special" "/other" "/more") +# Some versions of pkg-config on Windows don't parse the Libs and Cflags +# correctly. The pkg-config that comes with Strawberry perl is one example. +# It appears to treat the dummymain part of Libs as a library and only returns +# -e. It also doesn't recognize "-isystem /other", presumably because it doesn't +# support having a space between "-isystem" and the directory after it (it does +# give us the "-isystem/more" flag). Since we can't reliably test for these, +# we don't enable these checks on Windows. +if(NOT WIN32) + get_target_property(link_options ${tgt} INTERFACE_LINK_OPTIONS) + if (NOT link_options STREQUAL expected_link_options) + message(FATAL_ERROR + "Additional link options not present in INTERFACE_LINK_OPTIONS property\n" + "expected: \"${expected_link_options}\", but got \"${link_options}\"" + ) + endif() -if (NOT inc_dirs STREQUAL expected_inc_dirs) - message(FATAL_ERROR - "Additional include directories not correctly present in INTERFACE_INCLUDE_DIRECTORIES property\n" - "expected: \"${expected_inc_dirs}\", got \"${inc_dirs}\"" - ) -endif () + get_target_property(inc_dirs ${tgt} INTERFACE_INCLUDE_DIRECTORIES) + set(expected_inc_dirs "/special" "/other" "/more") + + if (NOT inc_dirs STREQUAL expected_inc_dirs) + message(FATAL_ERROR + "Additional include directories not correctly present in INTERFACE_INCLUDE_DIRECTORIES property\n" + "expected: \"${expected_inc_dirs}\", got \"${inc_dirs}\"" + ) + endif () +endif() get_target_property(c_opts ${tgt} INTERFACE_COMPILE_OPTIONS) set(expected_c_opts "-DA-isystem/foo") # this is an invalid option, but a good testcase diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake index 2a505c6..f7a9815 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake @@ -20,14 +20,15 @@ Libs: -lcmakeinternalfakepackage # Always find the .pc file in the calls further below so that we can test that # the import target find_library() calls handle the NO...PATH options correctly -set(ENV{PKG_CONFIG_PATH} ${fakePkgDir}/lib/pkgconfig) +cmake_path(CONVERT "${fakePkgDir}/lib/pkgconfig" TO_NATIVE_PATH_LIST confPath) +set(ENV{PKG_CONFIG_PATH} "${confPath}") -pkg_check_modules(FakePackageGE REQUIRED QUIET "cmakeinternalfakepackage >= 8") +pkg_check_modules(FakePackageGE REQUIRED QUIET "cmakeinternalfakepackage>=8") if (NOT FakePackageGE_FOUND) message(FATAL_ERROR "fake package >= 8 not found") endif() -pkg_check_modules(FakePackageGE_FAIL QUIET "cmakeinternalfakepackage >= 8.10") +pkg_check_modules(FakePackageGE_FAIL QUIET "cmakeinternalfakepackage>=8.10") if (FakePackageGE_FAIL_FOUND) message(FATAL_ERROR "fake package >= 8.10 found") endif() @@ -37,17 +38,17 @@ if (NOT FakePackageLE_FOUND) message(FATAL_ERROR "fake package <= 9 not found") endif() -pkg_check_modules(FakePackageLE_FAIL QUIET "cmakeinternalfakepackage <= 8.1") +pkg_check_modules(FakePackageLE_FAIL QUIET "cmakeinternalfakepackage<=8.1") if (FakePackageLE_FAIL_FOUND) message(FATAL_ERROR "fake package <= 8.1 found") endif() -pkg_check_modules(FakePackageGT REQUIRED QUIET "cmakeinternalfakepackage > 8") +pkg_check_modules(FakePackageGT REQUIRED QUIET "cmakeinternalfakepackage>8") if (NOT FakePackageGT_FOUND) message(FATAL_ERROR "fake package > 8 not found") endif() -pkg_check_modules(FakePackageGT_FAIL QUIET "cmakeinternalfakepackage > 8.9") +pkg_check_modules(FakePackageGT_FAIL QUIET "cmakeinternalfakepackage>8.9") if (FakePackageGT_FAIL_FOUND) message(FATAL_ERROR "fake package > 8.9 found") endif() @@ -57,7 +58,7 @@ if (NOT FakePackageLT_FOUND) message(FATAL_ERROR "fake package < 9 not found") endif() -pkg_check_modules(FakePackageLT_FAIL QUIET "cmakeinternalfakepackage < 8.9") +pkg_check_modules(FakePackageLT_FAIL QUIET "cmakeinternalfakepackage<8.9") if (FakePackageLT_FAIL_FOUND) message(FATAL_ERROR "fake package < 8.9 found") endif() @@ -67,17 +68,17 @@ if (NOT FakePackageEQ_FOUND) message(FATAL_ERROR "fake package = 8.9 not found") endif() -pkg_check_modules(FakePackageEQ_FAIL QUIET "cmakeinternalfakepackage = 8.8") +pkg_check_modules(FakePackageEQ_FAIL QUIET "cmakeinternalfakepackage=8.8") if (FakePackageEQ_FAIL_FOUND) message(FATAL_ERROR "fake package = 8.8 found") endif() -pkg_check_modules(FakePackageEQ_INV QUIET "cmakeinternalfakepackage == 8.9") +pkg_check_modules(FakePackageEQ_INV QUIET "cmakeinternalfakepackage==8.9") if (FakePackageEQ_FAIL_FOUND) message(FATAL_ERROR "fake package == 8.9 found") endif() -pkg_check_modules(FakePackageLLT_INV QUIET "cmakeinternalfakepackage <<= 9") +pkg_check_modules(FakePackageLLT_INV QUIET "cmakeinternalfakepackage<<=9") if (FakePackageLLT_FAIL_FOUND) message(FATAL_ERROR "fake package <<= 9 found") endif() diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index 661ae3f..6b8e884 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -7,13 +7,18 @@ set(ENV{CMAKE_FRAMEWORK_PATH} "") run_cmake(PkgConfigDoesNotExist) -run_cmake(FindPkgConfig_CMP0126_NEW) -run_cmake(FindPkgConfig_NO_PKGCONFIG_PATH) -run_cmake(FindPkgConfig_PKGCONFIG_PATH) -run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH) -run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH) +if(NOT WIN32) + # FIXME: The Windows implementation of these tests do not work. + # They are disabled until they can be updated to a working state. + run_cmake(FindPkgConfig_CMP0126_NEW) + run_cmake(FindPkgConfig_NO_PKGCONFIG_PATH) + run_cmake(FindPkgConfig_PKGCONFIG_PATH) + run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH) + run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH) + run_cmake(FindPkgConfig_GET_MATCHING_ARGN) +endif() + run_cmake(FindPkgConfig_extract_frameworks) -run_cmake(FindPkgConfig_GET_MATCHING_ARGN) if(APPLE) run_cmake(FindPkgConfig_extract_frameworks_target) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion-stderr.txt index 013c4f2..9af0573 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion-stderr.txt +++ b/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion-stderr.txt @@ -1,5 +1,5 @@ CMake Error at OUTPUT_NAME-recursion.cmake:[0-9]+ \(add_executable\): - Target 'empty2' OUTPUT_NAME depends on itself. + Target 'empty1' OUTPUT_NAME depends on itself. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-ALIAS_GLOBAL-check.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/ALIAS_GLOBAL-check.cmake index 0fbf837..0fbf837 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-ALIAS_GLOBAL-check.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/ALIAS_GLOBAL-check.cmake diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-ALIAS_GLOBAL.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/ALIAS_GLOBAL.cmake index 212c034..212c034 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-ALIAS_GLOBAL.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/ALIAS_GLOBAL.cmake diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-result.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-result.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName-stderr.txt index 6da79b7..6da79b7 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName-stderr.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName.cmake index 5f083e2..d3f82aa 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName.cmake @@ -1,3 +1,4 @@ +enable_language(CXX) add_subdirectory(BadInvalidName1) add_subdirectory(BadInvalidName2) add_subdirectory(BadInvalidName3) @@ -6,3 +7,6 @@ add_subdirectory(BadInvalidName5) add_subdirectory(BadInvalidName6) add_subdirectory(BadInvalidName7) add_subdirectory(BadInvalidName8) + +# Suppress generator-specific targets that might pollute the stderr. +set(CMAKE_SUPPRESS_REGENERATION TRUE) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName1/CMakeLists.txt index 13e1de7..13e1de7 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName1/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName2/CMakeLists.txt index 4b78472..4b78472 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName2/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName3/CMakeLists.txt index 516a049..516a049 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName3/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName4/CMakeLists.txt index 02f2a1a..02f2a1a 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName4/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName5/CMakeLists.txt index a653583..a653583 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName5/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName6/CMakeLists.txt index 614458e..614458e 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName6/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName7/CMakeLists.txt index 8a9fe80..8a9fe80 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName7/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName8/CMakeLists.txt index b228159..b228159 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadInvalidName8/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-result.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadNonTarget-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-result.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadNonTarget-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadNonTarget-stderr.txt index d40b16b..0c9320b 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadNonTarget-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadNonTarget.cmake:7 \(include_directories\): +CMake Error at BadNonTarget.cmake:6 \(include_directories\): Error evaluating generator expression: \$<TARGET_PROPERTY:NonExistent,INCLUDE_DIRECTORIES> diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadNonTarget.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadNonTarget.cmake new file mode 100644 index 0000000..731d758 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadNonTarget.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(main "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$<TARGET_PROPERTY:NonExistent,INCLUDE_DIRECTORIES>") + +# Suppress generator-specific targets that might pollute the stderr. +set(CMAKE_SUPPRESS_REGENERATION TRUE) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-result.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-result.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference-stderr.txt index fa26861..fa26861 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-stderr.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference-stderr.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference.cmake index 5a99f7a..ee8b9ec 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference.cmake @@ -1,6 +1,10 @@ +enable_language(CXX) add_subdirectory(BadSelfReference1) add_subdirectory(BadSelfReference2) add_subdirectory(BadSelfReference3) add_subdirectory(BadSelfReference4) add_subdirectory(BadSelfReference5) add_subdirectory(BadSelfReference6) + +# Suppress generator-specific targets that might pollute the stderr. +set(CMAKE_SUPPRESS_REGENERATION TRUE) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference1/CMakeLists.txt index 30c27f5..30c27f5 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference1/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference2/CMakeLists.txt index c2322f4..c2322f4 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference2/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference3/CMakeLists.txt index 3e6c30a..3e6c30a 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference3/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference4/CMakeLists.txt index f79727a..f79727a 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference4/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference5/CMakeLists.txt index c0badbf..c0badbf 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference5/CMakeLists.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference6/CMakeLists.txt index fcb6b3c..fcb6b3c 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/BadSelfReference6/CMakeLists.txt diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt new file mode 100644 index 0000000..26a73f9 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.3) +if(RunCMake_TEST STREQUAL "LOCATION") + cmake_minimum_required(VERSION 2.8.12) # Leave CMP0026 unset. +endif() +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES-check.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/INCLUDE_DIRECTORIES-check.cmake index ecf7bfe..ecf7bfe 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES-check.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/INCLUDE_DIRECTORIES-check.cmake diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/INCLUDE_DIRECTORIES.cmake index e9855be..e9855be 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/INCLUDE_DIRECTORIES.cmake diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION-stderr.txt index a4c8dcd..a4c8dcd 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION-stderr.txt diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION.cmake index 8929cdb..8929cdb 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION.cmake diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle1-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle1-stderr.txt index 8bff68e..8bff68e 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle1-stderr.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle1.cmake index 4b60214..775e5a0 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle1.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library(empty1 empty.cpp) add_library(empty2 empty.cpp) @@ -6,3 +6,6 @@ target_link_libraries(empty1 LINK_PUBLIC $<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2> ) + +# Suppress generator-specific targets that might pollute the stderr. +set(CMAKE_SUPPRESS_REGENERATION TRUE) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle2-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle2-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle2-stderr.txt index 044b77c..044b77c 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle2-stderr.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle2.cmake index 557eac1..fc14b48 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle2.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library(empty1 empty.cpp) add_library(empty2 empty.cpp) @@ -6,3 +6,6 @@ target_link_libraries(empty1 LINK_PUBLIC $<$<STREQUAL:$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>,/foo/bar>:empty2> ) + +# Suppress generator-specific targets that might pollute the stderr. +set(CMAKE_SUPPRESS_REGENERATION TRUE) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle3-result.txt index 573541a..573541a 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle3-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle3.cmake index 0f921d4..e084502 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle3.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library(empty1 empty.cpp) add_library(empty2 empty.cpp) @@ -8,3 +8,6 @@ target_link_libraries(empty1 INTERFACE $<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2> ) + +# Suppress generator-specific targets that might pollute the stderr. +set(CMAKE_SUPPRESS_REGENERATION TRUE) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle4-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle4-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle4-stderr.txt index d56b199..d56b199 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle4-stderr.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle4.cmake index ab6d0b2..42290de 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle4.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library(empty1 empty.cpp) add_library(empty2 empty.cpp) @@ -12,3 +12,6 @@ target_link_libraries(empty1 add_library(empty3 empty.cpp) target_link_libraries(empty3 empty1) + +# Suppress generator-specific targets that might pollute the stderr. +set(CMAKE_SUPPRESS_REGENERATION TRUE) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle5-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle5-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle5-stderr.txt index cf4e6d7..cf4e6d7 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle5-stderr.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle5.cmake index dc180e3..9597176 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle5.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library(empty1 INTERFACE IMPORTED) add_library(empty2 INTERFACE IMPORTED) @@ -8,3 +8,6 @@ set_property(TARGET empty1 PROPERTY INTERFACE_LINK_LIBRARIES add_library(empty3 empty.cpp) target_link_libraries(empty3 empty1) + +# Suppress generator-specific targets that might pollute the stderr. +set(CMAKE_SUPPRESS_REGENERATION TRUE) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle6-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle6-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle6-stderr.txt index 93cb573..93cb573 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle6-stderr.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle6.cmake index 91252d0..94a5419 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LinkImplementationCycle6.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library(empty1 SHARED empty.cpp) add_library(empty2 SHARED empty.cpp) @@ -12,3 +12,6 @@ target_link_libraries(empty1 add_library(empty3 SHARED empty.cpp) target_link_libraries(empty3 empty1) + +# Suppress generator-specific targets that might pollute the stderr. +set(CMAKE_SUPPRESS_REGENERATION TRUE) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake index 4294e9f..b613ad1 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake @@ -1,11 +1,22 @@ include(RunCMake) -run_cmake(BadSelfReference) -run_cmake(BadNonTarget) +run_cmake(ALIAS_GLOBAL) run_cmake(BadInvalidName) +run_cmake(BadNonTarget) +run_cmake(BadSelfReference) +run_cmake(INCLUDE_DIRECTORIES) run_cmake(LinkImplementationCycle1) run_cmake(LinkImplementationCycle2) run_cmake(LinkImplementationCycle3) run_cmake(LinkImplementationCycle4) run_cmake(LinkImplementationCycle5) run_cmake(LinkImplementationCycle6) +run_cmake(LOCATION) +run_cmake(SOURCES) + +block() + run_cmake(Scope) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Scope-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Scope-build ${CMAKE_COMMAND} --build . --config Debug) +endblock() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/SOURCES-check.cmake index c1a0f5b..c1a0f5b 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/SOURCES-check.cmake diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/SOURCES.cmake index dee7ead..dee7ead 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/SOURCES.cmake diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope-build-stdout.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope-build-stdout.txt new file mode 100644 index 0000000..fefad22 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope-build-stdout.txt @@ -0,0 +1,6 @@ +.*iface scope1: 'SCOPED_A_1;SCOPED_B_1' +.*iface scope2: 'SCOPED_A_2' +.*iface scope2 in scope1: 'SCOPED_A_2' +.*custom scope1: 'SCOPED_A_1;SCOPED_B_1' +.*custom scope2: 'SCOPED_A_2' +.*custom scope2 in scope1: 'SCOPED_A_1' diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope.c b/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope.c new file mode 100644 index 0000000..a4bec6f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope.c @@ -0,0 +1,12 @@ +#ifndef SCOPED_A_1 +# error "SCOPED_A_1 not defined" +#endif +#ifndef SCOPED_B_1 +# error "SCOPED_B_1 not defined" +#endif +#ifndef SCOPED_A_2 +# error "SCOPED_A_2 not defined" +#endif +void Scope(void) +{ +} diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope.cmake new file mode 100644 index 0000000..48a878a --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope.cmake @@ -0,0 +1,19 @@ +enable_language(C) + +add_subdirectory(Scope1) +add_subdirectory(Scope2) + +add_library(Scope Scope.c) +target_link_libraries(Scope PRIVATE + scope1_iface + scope2_iface + ) + +add_custom_target(Custom ALL VERBATIM + COMMAND ${CMAKE_COMMAND} -E echo "iface scope1: '$<TARGET_PROPERTY:scope1_iface,INTERFACE_COMPILE_DEFINITIONS>'" + COMMAND ${CMAKE_COMMAND} -E echo "iface scope2: '$<TARGET_PROPERTY:scope2_iface,INTERFACE_COMPILE_DEFINITIONS>'" + COMMAND ${CMAKE_COMMAND} -E echo "iface scope2 in scope1: '$<TARGET_GENEX_EVAL:scope1_iface,$<TARGET_PROPERTY:scope2_iface,INTERFACE_COMPILE_DEFINITIONS>>'" + COMMAND ${CMAKE_COMMAND} -E echo "custom scope1: '$<TARGET_GENEX_EVAL:scope1_iface,$<TARGET_PROPERTY:scope1_iface,CUSTOM_PROP>>'" + COMMAND ${CMAKE_COMMAND} -E echo "custom scope2: '$<TARGET_GENEX_EVAL:scope2_iface,$<TARGET_PROPERTY:scope2_iface,CUSTOM_PROP>>'" + COMMAND ${CMAKE_COMMAND} -E echo "custom scope2 in scope1: '$<TARGET_GENEX_EVAL:scope1_iface,$<TARGET_PROPERTY:scope2_iface,CUSTOM_PROP>>'" + ) diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope1/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope1/CMakeLists.txt new file mode 100644 index 0000000..d546267 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope1/CMakeLists.txt @@ -0,0 +1,15 @@ +add_library(scopedA INTERFACE IMPORTED) +set_property(TARGET scopedA PROPERTY INTERFACE_COMPILE_DEFINITIONS "SCOPED_A_1") + +add_library(scopedB INTERFACE IMPORTED) +set_property(TARGET scopedB PROPERTY INTERFACE_COMPILE_DEFINITIONS "SCOPED_B_1") + +add_library(scope1_iface INTERFACE) +set_property(TARGET scope1_iface PROPERTY INTERFACE_COMPILE_DEFINITIONS + "$<TARGET_PROPERTY:scopedA,INTERFACE_COMPILE_DEFINITIONS>" + "$<TARGET_PROPERTY:scopedB,INTERFACE_COMPILE_DEFINITIONS>" + ) +set_property(TARGET scope1_iface PROPERTY CUSTOM_PROP + "$<TARGET_PROPERTY:scopedA,INTERFACE_COMPILE_DEFINITIONS>" + "$<TARGET_PROPERTY:scopedB,INTERFACE_COMPILE_DEFINITIONS>" + ) diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope2/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope2/CMakeLists.txt new file mode 100644 index 0000000..a6d7e6b --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/Scope2/CMakeLists.txt @@ -0,0 +1,10 @@ +add_library(scopedA INTERFACE IMPORTED) +set_property(TARGET scopedA PROPERTY INTERFACE_COMPILE_DEFINITIONS "SCOPED_A_2") + +add_library(scope2_iface INTERFACE) +set_property(TARGET scope2_iface PROPERTY INTERFACE_COMPILE_DEFINITIONS + "$<TARGET_PROPERTY:scopedA,INTERFACE_COMPILE_DEFINITIONS>" + ) +set_property(TARGET scope2_iface PROPERTY CUSTOM_PROP + "$<TARGET_PROPERTY:scopedA,INTERFACE_COMPILE_DEFINITIONS>" + ) diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty.c index e69de29..e69de29 100644 --- a/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty.c diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty.cpp diff --git a/Tests/RunCMake/GeneratorExpression/empty2.c b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty2.c index e69de29..e69de29 100644 --- a/Tests/RunCMake/GeneratorExpression/empty2.c +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty2.c diff --git a/Tests/RunCMake/GeneratorExpression/empty3.c b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty3.c index e69de29..e69de29 100644 --- a/Tests/RunCMake/GeneratorExpression/empty3.c +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty3.c diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/main.cpp b/Tests/RunCMake/GenEx-TARGET_PROPERTY/main.cpp index f8b643a..f8b643a 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/main.cpp +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/main.cpp diff --git a/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes b/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes index d9b566e..883a7f1 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes +++ b/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes @@ -1,2 +1,2 @@ # Exclude reference content from formatting. -* -format.clang-format-6.0 +* -format.clang-format diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt index 130de2b..b61ccd2 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -25,4 +25,13 @@ CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + +CMake Warning at BadCONFIG.cmake:1 \(add_custom_target\): + Warning evaluating generator expression: + + \$<CONFIG:Release,Foo-Second> + + The config name of "Foo-Second" is invalid +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake index 1735ab7..4d7a357 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake @@ -2,4 +2,5 @@ add_custom_target(check ALL COMMAND check $<CONFIG:.> $<CONFIG:Foo-Bar> $<$<CONFIG:Foo-Nested>:foo> + $<$<CONFIG:Release,Foo-Second>:foo> VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index edeb6bd..2d545d9 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -12,7 +12,6 @@ run_cmake(BadTargetTypeInterface) run_cmake(BadTargetTypeObject) run_cmake(BadInstallPrefix) run_cmake(BadSHELL_PATH) -run_cmake(BadCONFIG) run_cmake(CMP0044-WARN) run_cmake(NonValidTarget-C_COMPILER_ID) run_cmake(NonValidTarget-CXX_COMPILER_ID) @@ -22,10 +21,6 @@ run_cmake(NonValidTarget-CXX_COMPILER_VERSION) run_cmake(NonValidTarget-Fortran_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_PROPERTY) run_cmake(NonValidTarget-TARGET_POLICY) -run_cmake(TARGET_PROPERTY-INCLUDE_DIRECTORIES) -run_cmake(TARGET_PROPERTY-LOCATION) -run_cmake(TARGET_PROPERTY-SOURCES) -run_cmake(TARGET_PROPERTY-ALIAS_GLOBAL) run_cmake(LINK_ONLY-not-linking) run_cmake(TARGET_EXISTS-no-arg) run_cmake(TARGET_EXISTS-empty-arg) diff --git a/Tests/RunCMake/GeneratorInstance/DefaultInstance-stdout.txt b/Tests/RunCMake/GeneratorInstance/DefaultInstance-stdout.txt new file mode 100644 index 0000000..078d96e --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/DefaultInstance-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_VS_VERSION_BUILD_NUMBER='[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' diff --git a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake index 9761f0c..5c5ec56 100644 --- a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake +++ b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake @@ -12,3 +12,5 @@ elseif(NOT IS_DIRECTORY "${CMAKE_GENERATOR_INSTANCE}") "which is not an existing directory.") endif() file(WRITE "${CMAKE_BINARY_DIR}/instance.txt" "${CMAKE_GENERATOR_INSTANCE}") + +message(STATUS "CMAKE_VS_VERSION_BUILD_NUMBER='${CMAKE_VS_VERSION_BUILD_NUMBER}'") diff --git a/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake b/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake index d1bc9b1..9cc05d0 100644 --- a/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake +++ b/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake @@ -10,7 +10,9 @@ endfunction() # Should not throw any errors # Regular executable -get_prerequisites(${CMAKE_COMMAND} cmake_prereqs 1 1 "" "") +if(SAMPLE_EXE) + get_prerequisites("${SAMPLE_EXE}" cmake_prereqs 1 1 "" "") +endif() # Shell script check_script(${CMAKE_CURRENT_LIST_DIR}/script.sh) # Batch script diff --git a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake index a635e38..5550c02 100644 --- a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake +++ b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake @@ -1,4 +1,4 @@ include(RunCMake) run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake) -run_cmake_command(ExecutableScripts ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ExecutableScripts.cmake) +run_cmake_command(ExecutableScripts ${CMAKE_COMMAND} -DSAMPLE_EXE=${SAMPLE_EXE} -P ${RunCMake_SOURCE_DIR}/ExecutableScripts.cmake) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-skip-test-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-skip-test-stdout.txt index 8d7527c..18f133a 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-skip-test-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-skip-test-stdout.txt @@ -1,10 +1,13 @@ Test project .* *Start +[0-9]+: skip_test\.test1 *[0-9]+/[0-9]+ +Test +#[0-9]+: skip_test\.test1 \.+\*\*\*Skipped +[0-9.]+ sec + *Start +[0-9]+: skip_test\.test1 + *[0-9]+/[0-9]+ +Test +#[0-9]+: skip_test\.test1 \.+\*\*\*Skipped +[0-9.]+ sec -100% tests passed, 0 tests failed out of 1 +100% tests passed, 0 tests failed out of 2 Total Test time \(real\) = +[0-9.]+ sec The following tests did not run: [ 0-9]+- skip_test\.test1 \(Skipped\) +[ 0-9]+- skip_test\.test1 \(Skipped\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake index 221d6ad..2ed43fc 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake @@ -78,3 +78,7 @@ xcode_sign_adhoc(skip_test) gtest_discover_tests( skip_test ) + +gtest_add_tests( + TARGET skip_test +) diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake index 695f562..b494cef 100644 --- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -1,5 +1,9 @@ include(RunCMake) +# Isolate our ctest runs from external environment. +unset(ENV{CTEST_PARALLEL_LEVEL}) +unset(ENV{CTEST_OUTPUT_ON_FAILURE}) + if(RunCMake_GENERATOR STREQUAL "Borland Makefiles" OR RunCMake_GENERATOR STREQUAL "Watcom WMake") set(fs_delay 3) diff --git a/Tests/RunCMake/GoogleTest/skip_test.cpp b/Tests/RunCMake/GoogleTest/skip_test.cpp index 2bc9fe1..919b1b3 100644 --- a/Tests/RunCMake/GoogleTest/skip_test.cpp +++ b/Tests/RunCMake/GoogleTest/skip_test.cpp @@ -1,6 +1,13 @@ #include <iostream> #include <string> +/* Having this as comment lets gtest_add_tests recognizes the test we fake + here without requiring googletest +TEST_F( skip_test, test1 ) +{ +} +*/ + int main(int argc, char** argv) { // Note: GoogleTest.cmake doesn't actually depend on Google Test as such; diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index b94466c..9214e90 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -46,8 +46,17 @@ if(WIN32) if(RunCMake_MAKE_PROGRAM) set(maybe_MAKE_PROGRAM "-DRunCMake_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}") endif() - run_cmake_script(ShowIncludes-54936 -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) - run_cmake_script(ShowIncludes-65001 -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + run_cmake_script(ShowIncludes-437-English -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + run_cmake_script(ShowIncludes-437-French -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + run_cmake_script(ShowIncludes-437-German -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + run_cmake_script(ShowIncludes-437-Italian -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + run_cmake_script(ShowIncludes-54936-Chinese -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + run_cmake_script(ShowIncludes-65001-Chinese -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + run_cmake_script(ShowIncludes-65001-French -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + run_cmake_script(ShowIncludes-65001-Japanese -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + if(NOT CMake_TEST_NO_CODEPAGE_9xx) + run_cmake_script(ShowIncludes-932-Japanese -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + endif() unset(maybe_MAKE_PROGRAM) endif() diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-English-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-English-check.cmake new file mode 100644 index 0000000..9338709 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-English-check.cmake @@ -0,0 +1,3 @@ +# 'cl /showIncludes' prefix with 'VSLANG=1033' and 'chcp 437'. +set(expect "Note: including file: ") +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-English-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-437-English-stdout.txt new file mode 100644 index 0000000..bda7eab --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-English-stdout.txt @@ -0,0 +1 @@ +-- showIncludes='Note: including file: ' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-English.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-English.cmake new file mode 100644 index 0000000..194b637 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-English.cmake @@ -0,0 +1,3 @@ +set(CODEPAGE 437) +set(VSLANG 1033) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-French-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-French-check.cmake new file mode 100644 index 0000000..64b0498 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-French-check.cmake @@ -0,0 +1,3 @@ +# 'cl /showIncludes' prefix with 'VSLANG=1036' and 'chcp 437'. +string(ASCII 82 101 109 97 114 113 117 101 255 58 32 105 110 99 108 117 115 105 111 110 32 100 117 32 102 105 99 104 105 101 114 255 58 32 32 expect) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-French-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-437-French-stdout.txt new file mode 100644 index 0000000..1a830f1 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-French-stdout.txt @@ -0,0 +1 @@ +-- showIncludes='Remarque : inclusion du fichier : ' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-French.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-French.cmake new file mode 100644 index 0000000..9fe4055 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-French.cmake @@ -0,0 +1,3 @@ +set(CODEPAGE 437) +set(VSLANG 1036) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-German-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-German-check.cmake new file mode 100644 index 0000000..c1418e3 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-German-check.cmake @@ -0,0 +1,3 @@ +# 'cl /showIncludes' prefix with 'VSLANG=1031' and 'chcp 437'. +set(expect "Hinweis: Einlesen der Datei: ") +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-German-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-437-German-stdout.txt new file mode 100644 index 0000000..9b9875e --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-German-stdout.txt @@ -0,0 +1 @@ +-- showIncludes='Hinweis: Einlesen der Datei: ' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-German.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-German.cmake new file mode 100644 index 0000000..882a23c --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-German.cmake @@ -0,0 +1,3 @@ +set(CODEPAGE 437) +set(VSLANG 1031) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-Italian-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-Italian-check.cmake new file mode 100644 index 0000000..014ce7f --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-Italian-check.cmake @@ -0,0 +1,3 @@ +# 'cl /showIncludes' prefix with 'VSLANG=1040' and 'chcp 437'. +set(expect "Nota: file incluso ") +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-Italian-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-437-Italian-stdout.txt new file mode 100644 index 0000000..9dd03a5 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-Italian-stdout.txt @@ -0,0 +1 @@ +-- showIncludes='Nota: file incluso ' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-Italian.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-Italian.cmake new file mode 100644 index 0000000..be04271 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-Italian.cmake @@ -0,0 +1,3 @@ +set(CODEPAGE 437) +set(VSLANG 1040) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-54936-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-54936-Chinese-check.cmake index 40bb68f..c5744b7 100644 --- a/Tests/RunCMake/Ninja/ShowIncludes-54936-check.cmake +++ b/Tests/RunCMake/Ninja/ShowIncludes-54936-Chinese-check.cmake @@ -1,3 +1,3 @@ # 'cl /showIncludes' prefix with 'VSLANG=2052' and 'chcp 54936'. -string(ASCII 215 162 210 226 58 32 176 252 186 172 206 196 188 254 58 expect) +string(ASCII 215 162 210 226 58 32 176 252 186 172 206 196 188 254 58 32 32 expect) include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-54936-Chinese-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-54936-Chinese-stdout.txt new file mode 100644 index 0000000..b9ac962 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-54936-Chinese-stdout.txt @@ -0,0 +1 @@ +-- showIncludes='注意: 包含文件: ' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-54936.cmake b/Tests/RunCMake/Ninja/ShowIncludes-54936-Chinese.cmake index 07b4192..77a4014 100644 --- a/Tests/RunCMake/Ninja/ShowIncludes-54936.cmake +++ b/Tests/RunCMake/Ninja/ShowIncludes-54936-Chinese.cmake @@ -1,2 +1,3 @@ set(CODEPAGE 54936) +set(VSLANG 2052) include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-54936-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-54936-stdout.txt deleted file mode 100644 index 42a2f35..0000000 --- a/Tests/RunCMake/Ninja/ShowIncludes-54936-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- showIncludes='注意: 包含文件:' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-65001-Chinese-check.cmake index c73b734..6f61d3c 100644 --- a/Tests/RunCMake/Ninja/ShowIncludes-65001-check.cmake +++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-Chinese-check.cmake @@ -1,3 +1,3 @@ # 'cl /showIncludes' prefix with 'VSLANG=2052' and 'chcp 65001'. -string(ASCII 230 179 168 230 132 143 58 32 229 140 133 229 144 171 230 150 135 228 187 182 58 expect) +string(ASCII 230 179 168 230 132 143 58 32 229 140 133 229 144 171 230 150 135 228 187 182 58 32 32 expect) include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-Chinese-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-65001-Chinese-stdout.txt new file mode 100644 index 0000000..b9ac962 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-Chinese-stdout.txt @@ -0,0 +1 @@ +-- showIncludes='注意: 包含文件: ' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001.cmake b/Tests/RunCMake/Ninja/ShowIncludes-65001-Chinese.cmake index 0eebd61..0e61c4a 100644 --- a/Tests/RunCMake/Ninja/ShowIncludes-65001.cmake +++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-Chinese.cmake @@ -1,2 +1,3 @@ set(CODEPAGE 65001) +set(VSLANG 2052) include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-French-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-65001-French-check.cmake new file mode 100644 index 0000000..133cbe6 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-French-check.cmake @@ -0,0 +1,3 @@ +# 'cl /showIncludes' prefix with 'VSLANG=1036' and 'chcp 65001'. +string(ASCII 82 101 109 97 114 113 117 101 194 160 58 32 105 110 99 108 117 115 105 111 110 32 100 117 32 102 105 99 104 105 101 114 194 160 58 32 32 expect) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-French-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-65001-French-stdout.txt new file mode 100644 index 0000000..1a830f1 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-French-stdout.txt @@ -0,0 +1 @@ +-- showIncludes='Remarque : inclusion du fichier : ' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-French.cmake b/Tests/RunCMake/Ninja/ShowIncludes-65001-French.cmake new file mode 100644 index 0000000..49927f6 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-French.cmake @@ -0,0 +1,3 @@ +set(CODEPAGE 65001) +set(VSLANG 1036) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-Japanese-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-65001-Japanese-check.cmake new file mode 100644 index 0000000..852bae7 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-Japanese-check.cmake @@ -0,0 +1,3 @@ +# 'cl /showIncludes' prefix with 'VSLANG=1041' and 'chcp 65001'. +string(ASCII 227 131 161 227 131 162 58 32 227 130 164 227 131 179 227 130 175 227 131 171 227 131 188 227 131 137 32 227 131 149 227 130 161 227 130 164 227 131 171 58 32 32 expect) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-Japanese-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-65001-Japanese-stdout.txt new file mode 100644 index 0000000..4640616 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-Japanese-stdout.txt @@ -0,0 +1 @@ +-- showIncludes='メモ: インクルード ファイル: ' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-Japanese.cmake b/Tests/RunCMake/Ninja/ShowIncludes-65001-Japanese.cmake new file mode 100644 index 0000000..59cc84e --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-Japanese.cmake @@ -0,0 +1,3 @@ +set(CODEPAGE 65001) +set(VSLANG 1041) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-65001-stdout.txt deleted file mode 100644 index 42a2f35..0000000 --- a/Tests/RunCMake/Ninja/ShowIncludes-65001-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- showIncludes='注意: 包含文件:' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-932-Japanese-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-932-Japanese-check.cmake new file mode 100644 index 0000000..10fa194 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-932-Japanese-check.cmake @@ -0,0 +1,3 @@ +# 'cl /showIncludes' prefix with 'VSLANG=1041' and 'chcp 932'. +string(ASCII 131 129 131 130 58 32 131 67 131 147 131 78 131 139 129 91 131 104 32 131 116 131 64 131 67 131 139 58 32 32 expect) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-932-Japanese-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-932-Japanese-stdout.txt new file mode 100644 index 0000000..4640616 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-932-Japanese-stdout.txt @@ -0,0 +1 @@ +-- showIncludes='メモ: インクルード ファイル: ' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-932-Japanese.cmake b/Tests/RunCMake/Ninja/ShowIncludes-932-Japanese.cmake new file mode 100644 index 0000000..ed8203c --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-932-Japanese.cmake @@ -0,0 +1,3 @@ +set(CODEPAGE 932) +set(VSLANG 1041) +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-cmake.cmake b/Tests/RunCMake/Ninja/ShowIncludes-cmake.cmake index 672a89f..5ed9970 100644 --- a/Tests/RunCMake/Ninja/ShowIncludes-cmake.cmake +++ b/Tests/RunCMake/Ninja/ShowIncludes-cmake.cmake @@ -1,6 +1,10 @@ # Set the console code page. execute_process(COMMAND cmd /c chcp "${CODEPAGE}") +if(VSLANG) + set(ENV{VSLANG} "${VSLANG}") +endif() + if(RunCMake_MAKE_PROGRAM) set(maybe_MAKE_PROGRAM "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}") endif() diff --git a/Tests/RunCMake/Ninja/ShowIncludes.cmake b/Tests/RunCMake/Ninja/ShowIncludes.cmake index b9f89fe..a75c9bc 100644 --- a/Tests/RunCMake/Ninja/ShowIncludes.cmake +++ b/Tests/RunCMake/Ninja/ShowIncludes.cmake @@ -15,7 +15,7 @@ endif() # Run cmake in a new Window to isolate its console code page. execute_process(COMMAND cmd /c start /min /wait "" - ${CMAKE_COMMAND} -DCODEPAGE=${CODEPAGE} ${maybe_MAKE_PROGRAM} -P ${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-cmake.cmake) + ${CMAKE_COMMAND} -DCODEPAGE=${CODEPAGE} -DVSLANG=${VSLANG} ${maybe_MAKE_PROGRAM} -P ${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-cmake.cmake) # Print our internal UTF-8 representation of the showIncludes prefix. file(READ "${CMAKE_CURRENT_BINARY_DIR}/showIncludes.txt" showIncludes_txt) diff --git a/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake index a1ae6ac..30b24bf 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake @@ -7,7 +7,8 @@ set(expected_compile_commands ]*Debug[^ ]*", "file": "[^ -]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)" +]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)", + "output": "(CMakeFiles/exe\.dir/Debug/main\.c\.o|CMakeFiles\\\\exe\.dir\\\\Debug\\\\main\.c\.obj)" }, { "directory": "[^ @@ -16,7 +17,8 @@ set(expected_compile_commands ]*Release[^ ]*", "file": "[^ -]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)" +]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)", + "output": "(CMakeFiles/exe\.dir/Release/main\.c\.o|CMakeFiles\\\\exe\.dir\\\\Release\\\\main\.c\.obj)" } ]$]==]) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt index 8877451..8c1c301 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-config-ninja-stdout.txt @@ -1,4 +1,4 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: [^ ]*/Tests/RunCMake/NinjaMultiConfig/Simple-build diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt index 8877451..8c1c301 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-reconfigure-noconfig-ninja-stdout.txt @@ -1,4 +1,4 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: [^ ]*/Tests/RunCMake/NinjaMultiConfig/Simple-build diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index ba9cc3b..54d7eb5 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -33,18 +33,18 @@ function(run_cmake test) set(platform_name msys) endif() - foreach(o IN ITEMS out err) - if(RunCMake-std${o}-file AND EXISTS ${top_src}/${RunCMake-std${o}-file}) - file(READ ${top_src}/${RunCMake-std${o}-file} expect_std${o}) - string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") - elseif(EXISTS ${top_src}/${test}-std${o}-${platform_name}.txt) - file(READ ${top_src}/${test}-std${o}-${platform_name}.txt expect_std${o}) - string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") - elseif(EXISTS ${top_src}/${test}-std${o}.txt) - file(READ ${top_src}/${test}-std${o}.txt expect_std${o}) - string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") + foreach(o IN ITEMS stdout stderr config) + if(RunCMake-${o}-file AND EXISTS ${top_src}/${RunCMake-${o}-file}) + file(READ ${top_src}/${RunCMake-${o}-file} expect_${o}) + string(REGEX REPLACE "\n+$" "" expect_${o} "${expect_${o}}") + elseif(EXISTS ${top_src}/${test}-${o}-${platform_name}.txt) + file(READ ${top_src}/${test}-${o}-${platform_name}.txt expect_${o}) + string(REGEX REPLACE "\n+$" "" expect_${o} "${expect_${o}}") + elseif(EXISTS ${top_src}/${test}-${o}.txt) + file(READ ${top_src}/${test}-${o}.txt expect_${o}) + string(REGEX REPLACE "\n+$" "" expect_${o} "${expect_${o}}") else() - unset(expect_std${o}) + unset(expect_${o}) endif() endforeach() if (NOT expect_stderr) @@ -144,6 +144,12 @@ function(run_cmake test) if(NOT "${actual_result}" MATCHES "${expect_result}") string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n") endif() + set(config_file "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}/CMakeFiles/CMakeConfigureLog.yaml") + if(EXISTS "${config_file}") + file(READ "${config_file}" actual_config) + else() + set(actual_config "") + endif() # Special case: remove ninja no-op line from stderr, but not stdout. # Test cases that look for it should use RunCMake_TEST_OUTPUT_MERGE. @@ -155,6 +161,7 @@ function(run_cmake test) "|BullseyeCoverage" "|[a-z]+\\([0-9]+\\) malloc:" "|clang[^:]*: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled:" + "|icp?x: remark: Note that use of .-g. without any optimization-level option will turn off most compiler optimizations" "|lld-link: warning: procedure symbol record for .* refers to PDB item index [0-9A-Fa-fx]+ which is not a valid function ID record" "|Error kstat returned" "|Hit xcodebuild bug" @@ -179,17 +186,13 @@ function(run_cmake test) "|[^\n]*Bullseye Testing Technology" ")[^\n]*\n)+" ) - foreach(o IN ITEMS out err) - string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}") - string(REGEX REPLACE "${ignore_line_regex}" "\\1" actual_std${o} "${actual_std${o}}") - string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") - set(expect_${o} "") - if(DEFINED expect_std${o}) - if(NOT "${actual_std${o}}" MATCHES "${expect_std${o}}") - string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o} - " expect-${o}> ${expect_std${o}}") - set(expect_${o} "Expected std${o} to match:\n${expect_${o}}\n") - string(APPEND msg "std${o} does not match that expected.\n") + foreach(o IN ITEMS stdout stderr config) + string(REGEX REPLACE "\r\n" "\n" actual_${o} "${actual_${o}}") + string(REGEX REPLACE "${ignore_line_regex}" "\\1" actual_${o} "${actual_${o}}") + string(REGEX REPLACE "\n+$" "" actual_${o} "${actual_${o}}") + if(DEFINED expect_${o}) + if(NOT "${actual_${o}}" MATCHES "${expect_${o}}") + string(APPEND msg "${o} does not match that expected.\n") endif() endif() endforeach() @@ -214,15 +217,17 @@ function(run_cmake test) string(APPEND msg "Command was:\n command> ${command}\n") endif() if(msg) - string(REGEX REPLACE "\n" "\n actual-out> " actual_out " actual-out> ${actual_stdout}") - string(REGEX REPLACE "\n" "\n actual-err> " actual_err " actual-err> ${actual_stderr}") - message(SEND_ERROR "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - FAILED:\n" - "${msg}" - "${expect_out}" - "Actual stdout:\n${actual_out}\n" - "${expect_err}" - "Actual stderr:\n${actual_err}\n" - ) + foreach(o IN ITEMS stdout stderr config) + if(DEFINED expect_${o}) + string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o} " expect-${o}> ${expect_${o}}") + string(APPEND msg "Expected ${o} to match:\n${expect_${o}}\n") + endif() + if(NOT o STREQUAL "config" OR DEFINED expect_${o}) + string(REGEX REPLACE "\n" "\n actual-${o}> " actual_${o} " actual-${o}> ${actual_${o}}") + string(APPEND msg "Actual ${o}:\n${actual_${o}}\n") + endif() + endforeach() + message(SEND_ERROR "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - FAILED:\n${msg}") else() message(STATUS "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - PASSED") endif() diff --git a/Tests/RunCMake/RunCTest.cmake b/Tests/RunCMake/RunCTest.cmake index 59db395..d46f6ad 100644 --- a/Tests/RunCMake/RunCTest.cmake +++ b/Tests/RunCMake/RunCTest.cmake @@ -1,5 +1,10 @@ include(RunCMake) +# Isolate our ctest runs from external environment. +unset(ENV{CTEST_PARALLEL_LEVEL}) +unset(ENV{CTEST_OUTPUT_ON_FAILURE}) +unset(ENV{CTEST_NO_TESTS_ACTION}) + function(run_ctest CASE_NAME) configure_file(${RunCMake_SOURCE_DIR}/test.cmake.in ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake @ONLY) diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt b/Tests/RunCMake/Swift/IncrementalSwift-second-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt +++ b/Tests/RunCMake/Swift/IncrementalSwift-second-result.txt diff --git a/Tests/RunCMake/Swift/IncrementalSwift-second-stderr.txt b/Tests/RunCMake/Swift/IncrementalSwift-second-stderr.txt new file mode 100644 index 0000000..7a882f8 --- /dev/null +++ b/Tests/RunCMake/Swift/IncrementalSwift-second-stderr.txt @@ -0,0 +1,2 @@ +ninja explain: A.swiftmodule is dirty +ninja explain: libB.a is dirty diff --git a/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt b/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt new file mode 100644 index 0000000..bb08a49 --- /dev/null +++ b/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt @@ -0,0 +1,3 @@ +.*Linking Swift static library libA.a +.*Linking Swift static library libB.a +FAILED: libB.a CMakeFiles/B.dir/b.swift.o B.swiftmodule diff --git a/Tests/RunCMake/Swift/IncrementalSwift.cmake b/Tests/RunCMake/Swift/IncrementalSwift.cmake new file mode 100644 index 0000000..092269f --- /dev/null +++ b/Tests/RunCMake/Swift/IncrementalSwift.cmake @@ -0,0 +1,22 @@ +enable_language(Swift) + +# Write initial files to build directory +# The files are generated into the build directory to avoid dirtying the source +# directory. This is done because the source files are changed during the test +# to ensure correct incremental build behavior. +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/a.swift + "let number: Int = 32\n" + "public func callA() -> Int { return number }\n") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/b.swift + "import A\n" + "public func callB() -> Int { return callA() + 1 }\n") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/exec.swift + "import B\n" + "print(callB())\n") + +add_library(A STATIC ${CMAKE_CURRENT_BINARY_DIR}/a.swift) +add_library(B STATIC ${CMAKE_CURRENT_BINARY_DIR}/b.swift) +target_link_libraries(B PRIVATE A) + +add_executable(exec ${CMAKE_CURRENT_BINARY_DIR}/exec.swift) +target_link_libraries(exec PRIVATE B) diff --git a/Tests/RunCMake/Swift/NoWorkToDo-nowork-stdout.txt b/Tests/RunCMake/Swift/NoWorkToDo-nowork-stdout.txt new file mode 100644 index 0000000..60a9228 --- /dev/null +++ b/Tests/RunCMake/Swift/NoWorkToDo-nowork-stdout.txt @@ -0,0 +1 @@ +^ninja: no work to do diff --git a/Tests/RunCMake/Swift/NoWorkToDo.cmake b/Tests/RunCMake/Swift/NoWorkToDo.cmake new file mode 100644 index 0000000..51c2ff3 --- /dev/null +++ b/Tests/RunCMake/Swift/NoWorkToDo.cmake @@ -0,0 +1,5 @@ +enable_language(Swift) +add_executable(hello1 hello.swift) +set_target_properties(hello1 PROPERTIES ENABLE_EXPORTS TRUE) + +add_executable(hello2 hello.swift) diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake index 21d5a25..5537c01 100644 --- a/Tests/RunCMake/Swift/RunCMakeTest.cmake +++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake @@ -14,6 +14,37 @@ elseif(RunCMake_GENERATOR STREQUAL Ninja) run_cmake(SwiftMultiArch) unset(RunCMake_TEST_OPTIONS) endif() + + # Test that a second build with no changes does nothing. + block() + run_cmake(NoWorkToDo) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoWorkToDo-build) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(NoWorkToDo-build ${CMAKE_COMMAND} --build .) + run_cmake_command(NoWorkToDo-nowork ${CMAKE_COMMAND} --build . -- -d explain) + endblock() + + # Test that intermediate static libraries are rebuilt when the public + # interface of their dependency changes + block() + set(IncrementalSwift_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/IncrementalSwift-build) + set(IncrementalSwift_TEST_NO_CLEAN 1) + set(IncrementalSwift_TEST_OUTPUT_MERGE 1) + # Since files are modified during test, the files are created in the cmake + # file into the build directory + run_cmake(IncrementalSwift) + run_cmake_command(IncrementalSwift-first ${CMAKE_COMMAND} --build ${IncrementalSwift_TEST_BINARY_DIR}) + + # Modify public interface of libA requiring rebuild of libB + file(WRITE ${IncrementalSwift_TEST_BINARY_DIR}/a.swift + "public func callA() -> Float { return 32.0 }\n") + + # Note: We still expect this to fail, but instead of failure at link time, + # it should fail while re-compiling libB because the function changed + run_cmake_command(IncrementalSwift-second ${CMAKE_COMMAND} --build ${IncrementalSwift_TEST_BINARY_DIR} -- -d explain) + endblock() + endif() elseif(RunCMake_GENERATOR STREQUAL "Ninja Multi-Config") if(CMAKE_Swift_COMPILER) diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt b/Tests/RunCMake/Swift/hello.swift index e69de29..e69de29 100644 --- a/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt +++ b/Tests/RunCMake/Swift/hello.swift diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget.cmake deleted file mode 100644 index 97d81e9..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories("$<TARGET_PROPERTY:NonExistent,INCLUDE_DIRECTORIES>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt deleted file mode 100644 index c3922d6..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ - -cmake_minimum_required(VERSION 3.3) -project(${RunCMake_TEST} CXX) - -# MSVC creates extra targets which pollute the stderr unless we set this. -set(CMAKE_SUPPRESS_REGENERATION TRUE) - -include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index f027e94..ed74896 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -89,3 +89,10 @@ run_cmake(VsDotnetTargetFramework) run_cmake(VsDotnetTargetFrameworkVersion) run_cmake(VsNoCompileBatching) run_cmake(DebugInformationFormat) +run_cmake(VsCLREmpty) +run_cmake(VsCLRPure) +run_cmake(VsCLRSafe) + +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.20) + run_cmake(VsCLRNetcore) +endif() diff --git a/Tests/RunCMake/VS10Project/VsCLREmpty-check.cmake b/Tests/RunCMake/VS10Project/VsCLREmpty-check.cmake new file mode 100644 index 0000000..990da46 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCLREmpty-check.cmake @@ -0,0 +1,24 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(propertyFound FALSE) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<CompileAsManaged>(.*)</CompileAsManaged>$") + set(propertyFound TRUE) + set(expectedValue "true") + set(actualValue ${CMAKE_MATCH_1}) + if(NOT (${actualValue} STREQUAL ${expectedValue})) + set(RunCMake_TEST_FAILED "CompileAsManaged \"${actualValue}\" differs from expected value \"${expectedValue}\".") + return() + endif() + endif() +endforeach() + +if(NOT propertyFound) + set(RunCMake_TEST_FAILED "Property CompileAsManaged not found in project file.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsCLREmpty.cmake b/Tests/RunCMake/VS10Project/VsCLREmpty.cmake new file mode 100644 index 0000000..a622f26 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCLREmpty.cmake @@ -0,0 +1,6 @@ +enable_language(CXX) + +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + COMMON_LANGUAGE_RUNTIME "") diff --git a/Tests/RunCMake/VS10Project/VsCLRNetcore-check.cmake b/Tests/RunCMake/VS10Project/VsCLRNetcore-check.cmake new file mode 100644 index 0000000..a5058d7 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCLRNetcore-check.cmake @@ -0,0 +1,24 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(propertyFound FALSE) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<CLRSupport>(.*)</CLRSupport>$") + set(propertyFound TRUE) + set(expectedValue "NetCore") + set(actualValue ${CMAKE_MATCH_1}) + if(NOT (${actualValue} STREQUAL ${expectedValue})) + set(RunCMake_TEST_FAILED "CLRSupport \"${actualValue}\" differs from expected value \"${expectedValue}\".") + return() + endif() + endif() +endforeach() + +if(NOT propertyFound) + set(RunCMake_TEST_FAILED "Property CLRSupport not found in project file.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsCLRNetcore.cmake b/Tests/RunCMake/VS10Project/VsCLRNetcore.cmake new file mode 100644 index 0000000..c5ec2bc --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCLRNetcore.cmake @@ -0,0 +1,6 @@ +enable_language(CXX) + +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + COMMON_LANGUAGE_RUNTIME "netcore") diff --git a/Tests/RunCMake/VS10Project/VsCLRPure-check.cmake b/Tests/RunCMake/VS10Project/VsCLRPure-check.cmake new file mode 100644 index 0000000..8ae73eb --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCLRPure-check.cmake @@ -0,0 +1,24 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(propertyFound FALSE) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<CompileAsManaged>(.*)</CompileAsManaged>$") + set(propertyFound TRUE) + set(expectedValue "Pure") + set(actualValue ${CMAKE_MATCH_1}) + if(NOT (${actualValue} STREQUAL ${expectedValue})) + set(RunCMake_TEST_FAILED "CompileAsManaged \"${actualValue}\" differs from expected value \"${expectedValue}\".") + return() + endif() + endif() +endforeach() + +if(NOT propertyFound) + set(RunCMake_TEST_FAILED "Property CompileAsManaged not found in project file.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsCLRPure.cmake b/Tests/RunCMake/VS10Project/VsCLRPure.cmake new file mode 100644 index 0000000..f919a1c --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCLRPure.cmake @@ -0,0 +1,6 @@ +enable_language(CXX) + +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + COMMON_LANGUAGE_RUNTIME "pure") diff --git a/Tests/RunCMake/VS10Project/VsCLRSafe-check.cmake b/Tests/RunCMake/VS10Project/VsCLRSafe-check.cmake new file mode 100644 index 0000000..ebb1f71 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCLRSafe-check.cmake @@ -0,0 +1,24 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(propertyFound FALSE) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<CompileAsManaged>(.*)</CompileAsManaged>$") + set(propertyFound TRUE) + set(expectedValue "Safe") + set(actualValue ${CMAKE_MATCH_1}) + if(NOT (${actualValue} STREQUAL ${expectedValue})) + set(RunCMake_TEST_FAILED "CompileAsManaged \"${actualValue}\" differs from expected value \"${expectedValue}\".") + return() + endif() + endif() +endforeach() + +if(NOT propertyFound) + set(RunCMake_TEST_FAILED "Property CompileAsManaged not found in project file.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsCLRSafe.cmake b/Tests/RunCMake/VS10Project/VsCLRSafe.cmake new file mode 100644 index 0000000..5f114bf --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCLRSafe.cmake @@ -0,0 +1,6 @@ +enable_language(CXX) + +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + COMMON_LANGUAGE_RUNTIME "safe") diff --git a/Tests/RunCMake/VSSolution/CMP0143-NEW-check.cmake b/Tests/RunCMake/VSSolution/CMP0143-NEW-check.cmake new file mode 100644 index 0000000..6dd042b --- /dev/null +++ b/Tests/RunCMake/VSSolution/CMP0143-NEW-check.cmake @@ -0,0 +1,6 @@ +getProjectNames(projects) + +list(FIND projects "CMakePredefinedTargets" found) + if(found EQUAL "-1") + error("CMakePredefinedTargets should be defined when CMP0143 is NEW!") +endif() diff --git a/Tests/RunCMake/VSSolution/CMP0143-NEW.cmake b/Tests/RunCMake/VSSolution/CMP0143-NEW.cmake new file mode 100644 index 0000000..dd67b16 --- /dev/null +++ b/Tests/RunCMake/VSSolution/CMP0143-NEW.cmake @@ -0,0 +1 @@ +add_custom_target(TestStartup) diff --git a/Tests/RunCMake/VSSolution/CMP0143-OLD-check.cmake b/Tests/RunCMake/VSSolution/CMP0143-OLD-check.cmake new file mode 100644 index 0000000..2d9829c --- /dev/null +++ b/Tests/RunCMake/VSSolution/CMP0143-OLD-check.cmake @@ -0,0 +1,6 @@ +getProjectNames(projects) + +list(FIND projects "CMakePredefinedTargets" found) + if(NOT (found EQUAL "-1")) + error("CMakePredefinedTargets should not be defined when CMP0143 is OLD!") +endif() diff --git a/Tests/RunCMake/VSSolution/CMP0143-OLD.cmake b/Tests/RunCMake/VSSolution/CMP0143-OLD.cmake new file mode 100644 index 0000000..dd67b16 --- /dev/null +++ b/Tests/RunCMake/VSSolution/CMP0143-OLD.cmake @@ -0,0 +1 @@ +add_custom_target(TestStartup) diff --git a/Tests/RunCMake/VSSolution/CMP0143-WARN-check.cmake b/Tests/RunCMake/VSSolution/CMP0143-WARN-check.cmake new file mode 100644 index 0000000..2d9829c --- /dev/null +++ b/Tests/RunCMake/VSSolution/CMP0143-WARN-check.cmake @@ -0,0 +1,6 @@ +getProjectNames(projects) + +list(FIND projects "CMakePredefinedTargets" found) + if(NOT (found EQUAL "-1")) + error("CMakePredefinedTargets should not be defined when CMP0143 is OLD!") +endif() diff --git a/Tests/RunCMake/VSSolution/CMP0143-WARN.cmake b/Tests/RunCMake/VSSolution/CMP0143-WARN.cmake new file mode 100644 index 0000000..dd67b16 --- /dev/null +++ b/Tests/RunCMake/VSSolution/CMP0143-WARN.cmake @@ -0,0 +1 @@ +add_custom_target(TestStartup) diff --git a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake index c25833d..134821d 100644 --- a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake +++ b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake @@ -15,4 +15,7 @@ run_cmake(AddPackageToDefault) if(NOT NO_USE_FOLDERS) run_cmake(StartupProjectUseFolders) + run_cmake(CMP0143-WARN) + run_cmake_with_options(CMP0143-OLD "-DCMAKE_POLICY_DEFAULT_CMP0143=OLD") + run_cmake_with_options(CMP0143-NEW "-DCMAKE_POLICY_DEFAULT_CMP0143=NEW") endif() diff --git a/Tests/RunCMake/VsDotnetSdk/App.xaml b/Tests/RunCMake/VsDotnetSdk/App.xaml new file mode 100644 index 0000000..156e0fc --- /dev/null +++ b/Tests/RunCMake/VsDotnetSdk/App.xaml @@ -0,0 +1,9 @@ +<Application x:Class="Example.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Example" + StartupUri="MainWindow.xaml"> + <Application.Resources> + + </Application.Resources> +</Application> diff --git a/Tests/RunCMake/VsDotnetSdk/App.xaml.cs b/Tests/RunCMake/VsDotnetSdk/App.xaml.cs new file mode 100644 index 0000000..df2669e --- /dev/null +++ b/Tests/RunCMake/VsDotnetSdk/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Example +{ + /// <summary> + /// Interaction logic for App.xaml + /// </summary> + public partial class App : Application + { + } +} diff --git a/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml b/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml new file mode 100644 index 0000000..9a8597d --- /dev/null +++ b/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml @@ -0,0 +1,12 @@ +<Window x:Class="Example.MainWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:Example" + mc:Ignorable="d" + Title="MainWindow" Height="350" Width="525"> + <Grid> + + </Grid> +</Window> diff --git a/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml.cs b/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml.cs new file mode 100644 index 0000000..7d059ed --- /dev/null +++ b/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Example +{ + /// <summary> + /// Interaction logic for MainWindow.xaml + /// </summary> + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/Tests/RunCMake/VsDotnetSdk/Resources.Designer.cs b/Tests/RunCMake/VsDotnetSdk/Resources.Designer.cs new file mode 100644 index 0000000..58ac7d0 --- /dev/null +++ b/Tests/RunCMake/VsDotnetSdk/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Tests/RunCMake/VsDotnetSdk/Resources.resx b/Tests/RunCMake/VsDotnetSdk/Resources.resx new file mode 100644 index 0000000..ea9cbcd --- /dev/null +++ b/Tests/RunCMake/VsDotnetSdk/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> diff --git a/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake b/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake index 22e2bb3..34259b7 100644 --- a/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake +++ b/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(VsDotnetSdkCustomCommandsSource) run_cmake(VsDotnetSdkStartupObject) run_cmake(VsDotnetSdkDefines) run_cmake(DotnetSdkVariables) +run_cmake(VsDotnetSdkXamlFiles) function(run_VsDotnetSdk) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VsDotnetSdk-build) diff --git a/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles-check.cmake b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles-check.cmake new file mode 100644 index 0000000..3e2c6de --- /dev/null +++ b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles-check.cmake @@ -0,0 +1,56 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/dotNetSdkWpfApp.csproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(inAppDefinition FALSE) +set(inPageDefinition FALSE) +set(inResourceDefinition FALSE) +set(xamlAppDefinitionSet FALSE) +set(xamlPageSet FALSE) +set(resourcesSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(NOT inAppDefinition AND line MATCHES "^ *<ApplicationDefinition[^>]*>") + set(inAppDefinition TRUE) + elseif(inAppDefinition AND line MATCHES "^ *<Link>([^<>]+)</Link>$") + if("${CMAKE_MATCH_1}" STREQUAL "App.xaml") + message(STATUS "dotNetSdkWpfApp.csproj has app definition set") + set(xamlAppDefinitionSet TRUE) + set(inAppDefinition FALSE) + endif() + elseif(NOT inPageDefinition AND line MATCHES "^ *<Page[^>]*>") + set(inPageDefinition TRUE) + elseif(inPageDefinition AND line MATCHES "^ *<Link>([^<>]+)</Link>$") + if("${CMAKE_MATCH_1}" STREQUAL "MainWindow.xaml") + message(STATUS "dotNetSdkWpfApp.csproj has main window page set") + set(xamlPageSet TRUE) + set(inPageDefinition FALSE) + endif() + elseif(NOT inResourceDefinition AND line MATCHES "^ *<EmbeddedResource[^>]*>") + set(inResourceDefinition TRUE) + elseif(inResourceDefinition AND line MATCHES "^ *<Link>([^<>]+)</Link>$") + if("${CMAKE_MATCH_1}" STREQUAL "Resources.resx") + message(STATUS "dotNetSdkWpfApp.csproj has embedded resources set") + set(resourcesSet TRUE) + set(inResourceDefinition FALSE) + endif() + endif() +endforeach() + +if(NOT xamlAppDefinitionSet) + set(RunCMake_TEST_FAILED "Xaml App definition not set correctly.") + return() +endif() + +if(NOT xamlPageSet) + set(RunCMake_TEST_FAILED "Xaml Page not set correctly.") + return() +endif() + +if(NOT resourcesSet) + set(RunCMake_TEST_FAILED "resources not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles.cmake b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles.cmake new file mode 100644 index 0000000..8faf3a7 --- /dev/null +++ b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles.cmake @@ -0,0 +1,48 @@ +enable_language(CSharp) + +if(NOT CMAKE_CSharp_COMPILER) + return() +endif() + +include(CSharpUtilities) + +add_executable(dotNetSdkWpfApp) +target_sources(dotNetSdkWpfApp + PRIVATE + App.xaml + App.xaml.cs + MainWindow.xaml + MainWindow.xaml.cs + Resources.Designer.cs + Resources.resx) + +csharp_set_xaml_cs_properties( + App.xaml + App.xaml.cs + MainWindow.xaml + MainWindow.xaml.cs) + +csharp_set_designer_cs_properties( + Resources.Designer.cs + Resources.resx) + +set_target_properties(dotNetSdkWpfApp + PROPERTIES + DOTNET_SDK "Microsoft.NET.Sdk" + DOTNET_TARGET_FRAMEWORK "net5.0") + +set_property(SOURCE App.xaml PROPERTY VS_XAML_TYPE "ApplicationDefinition") + +set_property(TARGET dotNetSdkWpfApp PROPERTY VS_DOTNET_REFERENCES + "Microsoft.CSharp" + "PresentationCore" + "PresentationFramework" + "System" + "System.Core" + "System.Data" + "System.Data.DataSetExtensions" + "System.Net.Http" + "System.Xaml" + "System.Xml" + "System.Xml.Linq" + "WindowsBase") diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS-check.cmake new file mode 100644 index 0000000..576be11 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS-check.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "RemoveHeadersOnCopy" TRUE) +findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS.cmake new file mode 100644 index 0000000..839f842 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedAppExtensions.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS-check.cmake new file mode 100644 index 0000000..576be11 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS-check.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "RemoveHeadersOnCopy" TRUE) +findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS.cmake new file mode 100644 index 0000000..839f842 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedAppExtensions.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions.cmake new file mode 100644 index 0000000..91d207b --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions.cmake @@ -0,0 +1,22 @@ +add_executable(app_extensionkit_extension main.m) +set_target_properties(app_extensionkit_extension PROPERTIES + LINKER_LANGUAGE CXX + BUNDLE YES + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" + XCODE_ATTRIBUTE_GENERATE_INFOPLIST_FILE "YES" + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/ExtensionKit.Info.plist.in" + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app.app_extensionkit_extension" + XCODE_PRODUCT_TYPE "com.apple.product-type.extensionkit-extension" + XCODE_EXPLICIT_FILE_TYPE "wrapper.extensionkit-extension" +) + +add_executable(app MACOSX_BUNDLE main.m) +add_dependencies(app app_extension) +set_target_properties(app PROPERTIES + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_EMBED_EXTENSIONKIT_EXTENSIONS app_extension + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app" +) diff --git a/Tests/RunCMake/XcodeProject-Embed/ExtensionKit.Info.plist.in b/Tests/RunCMake/XcodeProject-Embed/ExtensionKit.Info.plist.in new file mode 100644 index 0000000..573aa22 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/ExtensionKit.Info.plist.in @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>EXAppExtensionAttributes</key> + <dict> + <key>EXExtensionPointIdentifier</key> + <string>com.apple.background-asset-downloader-extension</string> + <key>EXPrincipalClass</key> + <string>BackgroundDownloadHandler</string> + </dict> +</dict> +</plist> diff --git a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake index f3a6918..a7bccee 100644 --- a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake @@ -64,6 +64,25 @@ function(TestAppExtension platform) ) endfunction() +function(TestExtensionKitExtension platform) + set(testName EmbedExtensionKitExtensions-${platform}) + if(NOT platform STREQUAL "macOS") + set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=${platform}) + endif() + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(${testName}) + run_cmake_command(${testName}-build + ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} + --config Debug + --target app + ) +endfunction() + # Isolate device tests from host architecture selection. unset(ENV{CMAKE_OSX_ARCHITECTURES}) @@ -74,3 +93,11 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 8) TestAppExtension(macOS) TestAppExtension(iOS) endif() + +if(XCODE_VERSION VERSION_GREATER_EQUAL 14.1) + # The various flag on/off combinations are tested by the EmbedFrameworks... + # tests, so we don't duplicate all the combinations here. We only verify the + # defaults, which is to remove headers on copy, but not code sign. + TestAppExtension(macOS) + TestAppExtension(iOS) +endif() diff --git a/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake b/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake index 4fe42ac..59e3f4b 100644 --- a/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake +++ b/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake @@ -7,6 +7,8 @@ endif() set(found_inherited_GCC_PREPROCESSOR_DEFINITIONS 1) set(found_inherited_OTHER_CFLAGS 1) set(found_inherited_OTHER_LDFLAGS 1) +set(found_inherited_OTHER_SWIFT_FLAGS 1) +set(found_inherited_SWIFT_ACTIVE_COMPILATION_CONDITIONS 1) file(STRINGS "${xcProjectFile}" lines) foreach(line IN LISTS lines) @@ -32,6 +34,20 @@ foreach(line IN LISTS lines) endif() endif() + if(line MATCHES [[OTHER_SWIFT_FLAGS]]) + if(NOT line MATCHES [["\$\(inherited\)"]]) + string(APPEND relevant_lines " ${line}\n") + set(found_inherited_OTHER_SWIFT_FLAGS 0) + endif() + endif() + + if(line MATCHES [[SWIFT_ACTIVE_COMPILATION_CONDITIONS]]) + if(NOT line MATCHES [["\$\(inherited\)"]]) + string(APPEND relevant_lines " ${line}\n") + set(found_inherited_SWIFT_ACTIVE_COMPILATION_CONDITIONS 0) + endif() + endif() + endforeach() if(NOT found_inherited_GCC_PREPROCESSOR_DEFINITIONS) @@ -43,6 +59,14 @@ endif() if(NOT found_inherited_OTHER_LDFLAGS) string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for OTHER_LDFLAGS in\n ${xcProjectFile}\n") endif() +if(CMake_TEST_Swift) + if(NOT found_inherited_OTHER_SWIFT_FLAGS) + string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for OTHER_SWIFT_FLAGS in\n ${xcProjectFile}\n") + endif() + if(NOT found_inherited_SWIFT_ACTIVE_COMPILATION_CONDITIONS) + string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for SWIFT_ACTIVE_COMPILATION_CONDITIONS in\n ${xcProjectFile}\n") + endif() +endif() if(RunCMake_TEST_FAILED) string(APPEND RunCMake_TEST_FAILED "Relevant lines include\n${relevant_lines}") diff --git a/Tests/RunCMake/XcodeProject/InheritedParameters.cmake b/Tests/RunCMake/XcodeProject/InheritedParameters.cmake index 5b8ec71..e2cc2a7 100644 --- a/Tests/RunCMake/XcodeProject/InheritedParameters.cmake +++ b/Tests/RunCMake/XcodeProject/InheritedParameters.cmake @@ -1,4 +1,9 @@ enable_language(C) +if(CMake_TEST_Swift) + enable_language(Swift) + string(APPEND CMAKE_Swift_FLAGS " -DSWIFTFLAG") + add_executable(swift_inherit_test dummy_main.swift) +endif() add_compile_definitions(TEST_INHERITTEST) string(APPEND CMAKE_C_FLAGS " -DTESTFLAG=\\\"TEST_INHERITTEST\\\"") diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 573d5f7..3910127 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -13,7 +13,7 @@ run_cmake(ExplicitCMakeLists) run_cmake(ImplicitCMakeLists) run_cmake(InterfaceLibSources) run_cmake_with_options(SearchPaths -DCMAKE_CONFIGURATION_TYPES=Debug) -run_cmake(InheritedParameters) +run_cmake_with_options(InheritedParameters -DCMake_TEST_Swift=${CMake_TEST_Swift}) run_cmake(XcodeFileType) run_cmake(XcodeAttributeLocation) diff --git a/Tests/RunCMake/add_compile_definitions/CMakeLists.txt b/Tests/RunCMake/add_compile_definitions/CMakeLists.txt new file mode 100644 index 0000000..14ef56e --- /dev/null +++ b/Tests/RunCMake/add_compile_definitions/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.11) + +project(${RunCMake_TEST} LANGUAGES NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_compile_definitions/RunCMakeTest.cmake b/Tests/RunCMake/add_compile_definitions/RunCMakeTest.cmake new file mode 100644 index 0000000..27d77ef --- /dev/null +++ b/Tests/RunCMake/add_compile_definitions/RunCMakeTest.cmake @@ -0,0 +1,13 @@ +include(RunCMake) + +macro(run_cmake_build test) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test} ${CMAKE_COMMAND} --build . --config Release) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +run_cmake(remove_leading_minusD) +run_cmake_build(remove_leading_minusD) diff --git a/Tests/RunCMake/add_compile_definitions/foo.c b/Tests/RunCMake/add_compile_definitions/foo.c new file mode 100644 index 0000000..74a86e1 --- /dev/null +++ b/Tests/RunCMake/add_compile_definitions/foo.c @@ -0,0 +1,4 @@ + +void foo() +{ +} diff --git a/Tests/RunCMake/add_compile_definitions/remove_leading_minusD.cmake b/Tests/RunCMake/add_compile_definitions/remove_leading_minusD.cmake new file mode 100644 index 0000000..0d94340 --- /dev/null +++ b/Tests/RunCMake/add_compile_definitions/remove_leading_minusD.cmake @@ -0,0 +1,6 @@ + +enable_language(C) + +add_compile_definitions(-DDEF0 "$<1:-DDEF1>") + +add_library(lib1 foo.c) diff --git a/Tests/RunCMake/add_custom_command/CommentGenex-build-stdout.txt b/Tests/RunCMake/add_custom_command/CommentGenex-build-stdout.txt new file mode 100644 index 0000000..bf49657 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/CommentGenex-build-stdout.txt @@ -0,0 +1 @@ +lorem ipsum, 01 diff --git a/Tests/RunCMake/add_custom_command/CommentGenex.cmake b/Tests/RunCMake/add_custom_command/CommentGenex.cmake new file mode 100644 index 0000000..f517392 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/CommentGenex.cmake @@ -0,0 +1,9 @@ +add_custom_target(helper) +set_property(TARGET helper PROPERTY MY_TEXT "lorem ipsum") +add_custom_command( + OUTPUT out.txt + COMMAND ${CMAKE_COMMAND} -E echo true + COMMENT "$<TARGET_PROPERTY:helper,MY_TEXT>$<COMMA> $<STREQUAL:foo,bar>$<EQUAL:42,42>" +) +set_property(SOURCE out.txt PROPERTY SYMBOLIC 1) +add_custom_target(main ALL DEPENDS out.txt) diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake index ad6b258..6c677c0 100644 --- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -60,3 +60,12 @@ function(test_genex name) endfunction() test_genex(TargetGenexEvent) + +if(NOT RunCMake_GENERATOR STREQUAL "Xcode") + block() + run_cmake(CommentGenex) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CommentGenex-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(CommentGenex-build ${CMAKE_COMMAND} --build .) + endblock() +endif() diff --git a/Tests/RunCMake/add_custom_target/CommentGenex-build-stdout.txt b/Tests/RunCMake/add_custom_target/CommentGenex-build-stdout.txt new file mode 100644 index 0000000..bf49657 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/CommentGenex-build-stdout.txt @@ -0,0 +1 @@ +lorem ipsum, 01 diff --git a/Tests/RunCMake/add_custom_target/CommentGenex.cmake b/Tests/RunCMake/add_custom_target/CommentGenex.cmake new file mode 100644 index 0000000..6e6706e --- /dev/null +++ b/Tests/RunCMake/add_custom_target/CommentGenex.cmake @@ -0,0 +1,6 @@ +add_custom_target(helper) +set_property(TARGET helper PROPERTY MY_TEXT "lorem ipsum") +add_custom_target(main ALL + COMMAND ${CMAKE_COMMAND} -E true + COMMENT "$<TARGET_PROPERTY:helper,MY_TEXT>$<COMMA> $<STREQUAL:foo,bar>$<EQUAL:42,42>" +) diff --git a/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake index 22a9ed4..f43779b 100644 --- a/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake @@ -23,3 +23,12 @@ function(run_TargetOrder) run_cmake_command(TargetOrder-build ${CMAKE_COMMAND} --build . -- ${build_flags}) endfunction() run_TargetOrder() + +if(NOT RunCMake_GENERATOR STREQUAL "Xcode") + block() + run_cmake(CommentGenex) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CommentGenex-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(CommentGenex-build ${CMAKE_COMMAND} --build .) + endblock() +endif() diff --git a/Tests/RunCMake/alias_targets/duplicate-target-CMP0107-OLD-stderr.txt b/Tests/RunCMake/alias_targets/duplicate-target-CMP0107-OLD-stderr.txt new file mode 100644 index 0000000..f5247ca --- /dev/null +++ b/Tests/RunCMake/alias_targets/duplicate-target-CMP0107-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at duplicate-target-CMP0107-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0107 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/configure_file/RerunCMake-rerun-stdout.txt b/Tests/RunCMake/configure_file/RerunCMake-rerun-stdout.txt index 34c873c..9f4f24e 100644 --- a/Tests/RunCMake/configure_file/RerunCMake-rerun-stdout.txt +++ b/Tests/RunCMake/configure_file/RerunCMake-rerun-stdout.txt @@ -1,3 +1,3 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: .*/Tests/RunCMake/configure_file/RerunCMake-build diff --git a/Tests/RunCMake/configure_file/RerunCMake-stdout.txt b/Tests/RunCMake/configure_file/RerunCMake-stdout.txt index 34c873c..9f4f24e 100644 --- a/Tests/RunCMake/configure_file/RerunCMake-stdout.txt +++ b/Tests/RunCMake/configure_file/RerunCMake-stdout.txt @@ -1,3 +1,3 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: .*/Tests/RunCMake/configure_file/RerunCMake-build diff --git a/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake b/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake index 365c9e8..4716c41 100644 --- a/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake @@ -1,9 +1,5 @@ include(RunCTest) -# Isolate our ctest runs from external environment. -unset(ENV{CTEST_PARALLEL_LEVEL}) -unset(ENV{CTEST_OUTPUT_ON_FAILURE}) - set(CASE_SOURCE_DIR "${RunCMake_SOURCE_DIR}") set(RunCTest_VERBOSE_FLAG "-VV") diff --git a/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake b/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake index 1754203..1c2ad89 100644 --- a/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake @@ -1,9 +1,5 @@ include(RunCTest) -# Isolate our ctest runs from external environment. -unset(ENV{CTEST_PARALLEL_LEVEL}) -unset(ENV{CTEST_OUTPUT_ON_FAILURE}) - function(run_ctest_test CASE_NAME) set(CASE_CTEST_FIXTURES_ARGS "${ARGN}") run_ctest(${CASE_NAME}) diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake index cb8f696..3f6501e 100644 --- a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake @@ -4,8 +4,6 @@ set(SITE test-site) set(BUILDNAME test-build) set(COVERAGE_COMMAND "") -unset(ENV{CTEST_PARALLEL_LEVEL}) - function(run_mc_test CASE_NAME CHECKER_COMMAND) run_ctest(${CASE_NAME} ${ARGN}) endfunction() diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 74ae99c..242a059 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -1,9 +1,6 @@ include(RunCTest) set(RunCMake_TEST_TIMEOUT 60) -unset(ENV{CTEST_PARALLEL_LEVEL}) -unset(ENV{CTEST_OUTPUT_ON_FAILURE}) - set(CASE_CTEST_TEST_ARGS "") set(CASE_CTEST_TEST_LOAD "") diff --git a/Tests/RunCMake/export/Repeat-CMP0103-OLD-stderr.txt b/Tests/RunCMake/export/Repeat-CMP0103-OLD-stderr.txt new file mode 100644 index 0000000..1183f86 --- /dev/null +++ b/Tests/RunCMake/export/Repeat-CMP0103-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at Repeat-CMP0103-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0103 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file-DOWNLOAD/CMakeLists.txt b/Tests/RunCMake/file-DOWNLOAD/CMakeLists.txt new file mode 100644 index 0000000..9a66cde --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.13) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH-stdout.txt new file mode 100644 index 0000000..bd1727a --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH-stdout.txt @@ -0,0 +1,8 @@ +-- status='0;"No error"' +-- status='0;"skipping download as file already exists with expected MD5 sum"' +-- status='0;"skipping download as file already exists with expected MD5 hash"' +-- status='0;"skipping download as file already exists with expected SHA1 hash"' +-- status='0;"skipping download as file already exists with expected SHA224 hash"' +-- status='0;"skipping download as file already exists with expected SHA256 hash"' +-- status='0;"skipping download as file already exists with expected SHA384 hash"' +-- status='0;"skipping download as file already exists with expected SHA512 hash"' diff --git a/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH.cmake b/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH.cmake new file mode 100644 index 0000000..dc7f8ff --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH.cmake @@ -0,0 +1,13 @@ +include(common.cmake) + +# Actually download the file and verify its hash. +file_download(EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92) + +# Verify that the local file already exists with expected hash. +file_download(EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92) +file_download(EXPECTED_HASH MD5=dbd330d52f4dbd60115d4191904ded92) +file_download(EXPECTED_HASH SHA1=67eee17f79d9ac557284fc0b8ad19f25723fb578) +file_download(EXPECTED_HASH SHA224=ba283726bbb602776818b463943189afd91836cb7ee5dd6e2c7b5ae4) +file_download(EXPECTED_HASH SHA256=cf3334b1275071e1da6e8c396ccb72cf1b2388d8c937526f3af26230affb9423) +file_download(EXPECTED_HASH SHA384=43a5d13978d97c660db44481aee0604cb4ff6ca0775cd5c2cd68cd8000e107e507c4caf6c228941231041e282ffb8950) +file_download(EXPECTED_HASH SHA512=6984e0909a1018030ccaa418e3be1654223cdccff0fe6adc745f9aea7e377f178be53b9fc7d54a6f81c2b62ef9ddcd38ba1978fedf4c5e7139baaf355eefad5b) diff --git a/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake b/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake new file mode 100644 index 0000000..d757eea --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake @@ -0,0 +1,31 @@ +include(RunCMake) + +# We do not contact any real URLs, but do try a bogus one. +# Remove any proxy configuration that may change behavior. +unset(ENV{http_proxy}) +unset(ENV{https_proxy}) + +run_cmake(hash-mismatch) +run_cmake(unused-argument) +run_cmake(httpheader-not-set) +run_cmake(netrc-bad) +run_cmake(tls-cainfo-not-set) +run_cmake(tls-verify-not-set) +run_cmake(pass-not-set) +run_cmake(no-save-hash) + +run_cmake(basic) +run_cmake(EXPECTED_HASH) +run_cmake(file-without-path) +run_cmake(no-file) +run_cmake(range) +run_cmake(SHOW_PROGRESS) + +if(NOT CMake_TEST_NO_NETWORK) + run_cmake(bad-hostname) +endif() + +if(CMake_TEST_TLS_VERIFY_URL) + run_cmake(TLS_VERIFY-bad) + run_cmake_with_options(TLS_VERIFY-good -Durl=${CMake_TEST_TLS_VERIFY_URL}) +endif() diff --git a/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS-stdout.txt new file mode 100644 index 0000000..e0a4982 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS-stdout.txt @@ -0,0 +1,2 @@ +-- \[download 100% complete\] +-- status='0;"No error"' diff --git a/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS.cmake b/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS.cmake new file mode 100644 index 0000000..ccabced --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS.cmake @@ -0,0 +1,3 @@ +include(common.cmake) + +file_download(SHOW_PROGRESS) diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt new file mode 100644 index 0000000..8f5d437 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt @@ -0,0 +1 @@ +-- (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error") diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake new file mode 100644 index 0000000..333f990 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake @@ -0,0 +1,6 @@ +file(DOWNLOAD https://expired.badssl.com TLS_VERIFY 1 STATUS status LOG log) +message(STATUS "${status}") +list(GET status 0 code) +if(NOT code MATCHES "^(35|60)$") + message("${log}") +endif() diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good-stdout.txt new file mode 100644 index 0000000..348bb17 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good-stdout.txt @@ -0,0 +1 @@ +-- 0;"No error" diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good.cmake b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good.cmake new file mode 100644 index 0000000..279eb69 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good.cmake @@ -0,0 +1,6 @@ +file(DOWNLOAD ${url} TLS_VERIFY 1 STATUS status LOG log) +message(STATUS "${status}") +list(GET status 0 code) +if(NOT code EQUAL 0) + message("${log}") +endif() diff --git a/Tests/RunCMake/file-DOWNLOAD/bad-hostname-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/bad-hostname-stdout.txt new file mode 100644 index 0000000..12278e0 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/bad-hostname-stdout.txt @@ -0,0 +1 @@ +-- status='6;"Couldn't resolve host name"' diff --git a/Tests/RunCMake/file-DOWNLOAD/bad-hostname.cmake b/Tests/RunCMake/file-DOWNLOAD/bad-hostname.cmake new file mode 100644 index 0000000..d3b7a28 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/bad-hostname.cmake @@ -0,0 +1,9 @@ +include(common.cmake) + +# Do not use any proxy for lookup of an invalid site. +# DNS failure by proxy looks different than DNS failure without proxy. +set(ENV{no_proxy} "$ENV{no_proxy},badhostname.invalid") + +set(url "badhostname.invalid") + +file_download() diff --git a/Tests/RunCMake/file-DOWNLOAD/basic-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/basic-stdout.txt new file mode 100644 index 0000000..701e995 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/basic-stdout.txt @@ -0,0 +1 @@ +-- status='0;"No error"' diff --git a/Tests/RunCMake/file-DOWNLOAD/basic.cmake b/Tests/RunCMake/file-DOWNLOAD/basic.cmake new file mode 100644 index 0000000..1fd931c --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/basic.cmake @@ -0,0 +1,3 @@ +include(common.cmake) + +file_download() diff --git a/Tests/RunCMake/file-DOWNLOAD/common.cmake b/Tests/RunCMake/file-DOWNLOAD/common.cmake new file mode 100644 index 0000000..6aa2fe6 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/common.cmake @@ -0,0 +1,15 @@ +if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") + set(slash /) +endif() +set(url "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/input.png") +set(file ${CMAKE_CURRENT_BINARY_DIR}/output.png) + +function(file_download) + file(DOWNLOAD "${url}" + ${file} # leave unquoted + TIMEOUT 30 + STATUS status + ${ARGN} + ) + message(STATUS "status='${status}'") +endfunction() diff --git a/Tests/RunCMake/file-DOWNLOAD/file-without-path-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/file-without-path-stdout.txt new file mode 100644 index 0000000..701e995 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/file-without-path-stdout.txt @@ -0,0 +1 @@ +-- status='0;"No error"' diff --git a/Tests/RunCMake/file-DOWNLOAD/file-without-path.cmake b/Tests/RunCMake/file-DOWNLOAD/file-without-path.cmake new file mode 100644 index 0000000..a628423 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/file-without-path.cmake @@ -0,0 +1,10 @@ +include(common.cmake) + +set(file_orig "${file}") +cmake_path(GET file_orig FILENAME file) + +file_download() + +if(NOT EXISTS "${file_orig}") + message(FATAL_ERROR "file not downloaded to expected path:\n ${file_orig}") +endif() diff --git a/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set-result.txt b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set-result.txt +++ b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-result.txt diff --git a/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-stderr.txt new file mode 100644 index 0000000..6682794 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at hash-mismatch.cmake:[0-9]+ \(file\): + file DOWNLOAD HASH mismatch + + for file: \[.*/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-build/output.png\] + expected hash: \[0123456789abcdef0123456789abcdef01234567\] + actual hash: \[67eee17f79d9ac557284fc0b8ad19f25723fb578\] + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +status='1;HASH mismatch: expected: 0123456789abcdef0123456789abcdef01234567 actual: 67eee17f79d9ac557284fc0b8ad19f25723fb578'$ diff --git a/Tests/RunCMake/file-DOWNLOAD/hash-mismatch.cmake b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch.cmake new file mode 100644 index 0000000..e3f91e3 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch.cmake @@ -0,0 +1,8 @@ +include(common.cmake) + +file(DOWNLOAD ${url} ${file} + EXPECTED_HASH SHA1=0123456789abcdef0123456789abcdef01234567 + TIMEOUT 30 + STATUS status + ) +message("status='${status}'") diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt +++ b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-result.txt diff --git a/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-stderr.txt index 247923b..3ac5082 100644 --- a/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set-stderr.txt +++ b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at DOWNLOAD-httpheader-not-set.cmake:[0-9]+ \(file\): +^CMake Error at httpheader-not-set.cmake:[0-9]+ \(file\): file DOWNLOAD missing string for HTTPHEADER. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set.cmake b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set.cmake index 6efc958..6efc958 100644 --- a/Tests/RunCMake/file/DOWNLOAD-httpheader-not-set.cmake +++ b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set.cmake diff --git a/Tests/RunCMake/file-DOWNLOAD/input.png b/Tests/RunCMake/file-DOWNLOAD/input.png Binary files differnew file mode 100644 index 0000000..9ab565a --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/input.png diff --git a/Tests/RunCMake/Configure/ErrorLogs-result.txt b/Tests/RunCMake/file-DOWNLOAD/netrc-bad-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/Configure/ErrorLogs-result.txt +++ b/Tests/RunCMake/file-DOWNLOAD/netrc-bad-result.txt diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/netrc-bad-stderr.txt index 96ce62a..61d7c99 100644 --- a/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt +++ b/Tests/RunCMake/file-DOWNLOAD/netrc-bad-stderr.txt @@ -1,19 +1,19 @@ -^CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): +^CMake Error at netrc-bad\.cmake:[0-9]+ \(file\): file DOWNLOAD missing level value for NETRC\. Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): +CMake Error at netrc-bad\.cmake:[0-9]+ \(file\): file DOWNLOAD missing file value for NETRC_FILE\. Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): +CMake Error at netrc-bad\.cmake:[0-9]+ \(file\): file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: INVALID Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): +CMake Error at netrc-bad\.cmake:[0-9]+ \(file\): file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: FALSE Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake b/Tests/RunCMake/file-DOWNLOAD/netrc-bad.cmake index 6a62df9..c62238a 100644 --- a/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake +++ b/Tests/RunCMake/file-DOWNLOAD/netrc-bad.cmake @@ -5,11 +5,11 @@ file(DOWNLOAD "" "" NETRC) file(DOWNLOAD "" "" NETRC_FILE) set(CMAKE_NETRC FALSE) file(DOWNLOAD - "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-netrc-bad.txt" + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/netrc-bad.txt" "${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt" NETRC INVALID ) file(DOWNLOAD - "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-netrc-bad.txt" + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/netrc-bad.txt" "${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt" ) diff --git a/Tests/RunCMake/file/DOWNLOAD-no-save-hash.txt b/Tests/RunCMake/file-DOWNLOAD/netrc-bad.txt index e69de29..e69de29 100644 --- a/Tests/RunCMake/file/DOWNLOAD-no-save-hash.txt +++ b/Tests/RunCMake/file-DOWNLOAD/netrc-bad.txt diff --git a/Tests/RunCMake/file-DOWNLOAD/no-file-arg.cmake b/Tests/RunCMake/file-DOWNLOAD/no-file-arg.cmake new file mode 100644 index 0000000..6520940 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/no-file-arg.cmake @@ -0,0 +1,11 @@ +include(common.cmake) + +set(file "") + +file_download() + +set(file "${CMAKE_CURRENT_BINARY_DIR}/input.png") + +if(NOT EXISTS "${file}") + message(FATAL_ERROR "file not downloaded to expected path:\n ${file}") +endif() diff --git a/Tests/RunCMake/file-DOWNLOAD/no-file-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/no-file-stdout.txt new file mode 100644 index 0000000..701e995 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/no-file-stdout.txt @@ -0,0 +1 @@ +-- status='0;"No error"' diff --git a/Tests/RunCMake/file-DOWNLOAD/no-file.cmake b/Tests/RunCMake/file-DOWNLOAD/no-file.cmake new file mode 100644 index 0000000..dc234b2 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/no-file.cmake @@ -0,0 +1,11 @@ +include(common.cmake) + +# Test downloading without saving to a file. +set(file "") +file_download() + +foreach(name input.png output.png TIMEOUT) + if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${name}") + message(FATAL_ERROR "file incorrectly saved to:\n ${CMAKE_CURRENT_BINARY_DIR}/${name}") + endif() +endforeach() diff --git a/Tests/RunCMake/file-DOWNLOAD/no-save-hash-result.txt b/Tests/RunCMake/file-DOWNLOAD/no-save-hash-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/no-save-hash-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-no-save-hash-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/no-save-hash-stderr.txt index b0f0d19..8f2f885 100644 --- a/Tests/RunCMake/file/DOWNLOAD-no-save-hash-stderr.txt +++ b/Tests/RunCMake/file-DOWNLOAD/no-save-hash-stderr.txt @@ -1,4 +1,5 @@ -^CMake Error at DOWNLOAD-no-save-hash\.cmake:[0-9]+ \(file\): +^CMake Error at common\.cmake:[0-9]+ \(file\): file DOWNLOAD cannot calculate hash if file is not saved\. Call Stack \(most recent call first\): + no-save-hash.cmake:[0-9]+ \(file_download\) CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file-DOWNLOAD/no-save-hash.cmake b/Tests/RunCMake/file-DOWNLOAD/no-save-hash.cmake new file mode 100644 index 0000000..7fdc397 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/no-save-hash.cmake @@ -0,0 +1,5 @@ +include(common.cmake) + +# Test downloading without saving to a file. +set(file "") +file_download(EXPECTED_HASH MD5=55555555555555555555555555555555) diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt b/Tests/RunCMake/file-DOWNLOAD/no-save-hash.txt index e69de29..e69de29 100644 --- a/Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt +++ b/Tests/RunCMake/file-DOWNLOAD/no-save-hash.txt diff --git a/Tests/RunCMake/file-DOWNLOAD/pass-not-set-result.txt b/Tests/RunCMake/file-DOWNLOAD/pass-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/pass-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/pass-not-set-stderr.txt index 2fa2731..23997c5 100644 --- a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt +++ b/Tests/RunCMake/file-DOWNLOAD/pass-not-set-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at DOWNLOAD-pass-not-set.cmake:[0-9]+ \(file\): +^CMake Error at pass-not-set.cmake:[0-9]+ \(file\): file DOWNLOAD missing string for USERPWD. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake b/Tests/RunCMake/file-DOWNLOAD/pass-not-set.cmake index 61eff6d..61eff6d 100644 --- a/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake +++ b/Tests/RunCMake/file-DOWNLOAD/pass-not-set.cmake diff --git a/Tests/RunCMake/file-DOWNLOAD/range-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/range-stdout.txt new file mode 100644 index 0000000..e2ed7aa --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/range-stdout.txt @@ -0,0 +1,4 @@ +-- status='0;"No error"' +-- status='0;"No error"' +-- status='0;"No error"' +-- status='0;"No error"' diff --git a/Tests/RunCMake/file-DOWNLOAD/range.cmake b/Tests/RunCMake/file-DOWNLOAD/range.cmake new file mode 100644 index 0000000..f77bb28 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/range.cmake @@ -0,0 +1,15 @@ +include(common.cmake) + +set(file ${CMAKE_CURRENT_BINARY_DIR}/output1.png) +file_download(RANGE_START 0 EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92) + +set(file ${CMAKE_CURRENT_BINARY_DIR}/output2.png) +file_download(RANGE_END 50 EXPECTED_MD5 8592e5665b839b5d23825dc84c135b61) + +set(file ${CMAKE_CURRENT_BINARY_DIR}/output3.png) +file_download(RANGE_START 10 RANGE_END 50 EXPECTED_MD5 36cd52681e6c6c8fef85fcd9e86fc30d) + +set(file ${CMAKE_CURRENT_BINARY_DIR}/output4.png) +file_download(RANGE_START 0 RANGE_END 50 + RANGE_START 60 RANGE_END 100 + EXPECTED_MD5 c5c9e74e82d493dd901eecccd659cebc) diff --git a/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-result.txt b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-tls-cainfo-not-set-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-stderr.txt index 1552baa..d9fa7b7 100644 --- a/Tests/RunCMake/file/DOWNLOAD-tls-cainfo-not-set-stderr.txt +++ b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at DOWNLOAD-tls-cainfo-not-set.cmake:[0-9]+ \(file\): +^CMake Error at tls-cainfo-not-set.cmake:[0-9]+ \(file\): file DOWNLOAD missing file value for TLS_CAINFO. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-tls-cainfo-not-set.cmake b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set.cmake index b476425..b476425 100644 --- a/Tests/RunCMake/file/DOWNLOAD-tls-cainfo-not-set.cmake +++ b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set.cmake diff --git a/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-result.txt b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-tls-verify-not-set-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-stderr.txt index 2f46c0c..c048ea9 100644 --- a/Tests/RunCMake/file/DOWNLOAD-tls-verify-not-set-stderr.txt +++ b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at DOWNLOAD-tls-verify-not-set.cmake:[0-9]+ \(file\): +^CMake Error at tls-verify-not-set.cmake:[0-9]+ \(file\): file DOWNLOAD missing bool value for TLS_VERIFY. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-tls-verify-not-set.cmake b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set.cmake index 919368c..919368c 100644 --- a/Tests/RunCMake/file/DOWNLOAD-tls-verify-not-set.cmake +++ b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set.cmake diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt b/Tests/RunCMake/file-DOWNLOAD/unused-argument-result.txt index e69de29..e69de29 100644 --- a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt +++ b/Tests/RunCMake/file-DOWNLOAD/unused-argument-result.txt diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/unused-argument-stderr.txt index 82a78c9..f7cfc4f 100644 --- a/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt +++ b/Tests/RunCMake/file-DOWNLOAD/unused-argument-stderr.txt @@ -1,5 +1,6 @@ -^CMake Warning \(dev\) at DOWNLOAD-unused-argument.cmake:[0-9]+ \(file\): +^CMake Warning \(dev\) at common.cmake:[0-9]+ \(file\): Unexpected argument: JUNK Call Stack \(most recent call first\): + unused-argument.cmake:[0-9]+ \(file_download\) CMakeLists.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/file-DOWNLOAD/unused-argument.cmake b/Tests/RunCMake/file-DOWNLOAD/unused-argument.cmake new file mode 100644 index 0000000..6f7f597 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/unused-argument.cmake @@ -0,0 +1,3 @@ +include(common.cmake) + +file_download(JUNK) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake index 07679b7..43b406b 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake @@ -4,10 +4,8 @@ include(RunCMake) # Function to build and install a project. function(run_install_test case) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) - set(RunCMake_TEST_NO_CLEAN 1) - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(${case}) + set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config Debug) # Check "all" components. set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-all) @@ -61,8 +59,9 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") set(ENV{LDFLAGS} "${new_ldflags}") endif() - if(NOT CMAKE_C_COMPILER_ID MATCHES "^XL") + if(NOT CMake_COMPILER_FORCES_NEW_DTAGS) run_install_test(linux) + run_install_test(linux-parent-rpath-propagation) run_install_test(file-filter) endif() run_install_test(linux-unresolved) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-parent-rpath-propagation.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-parent-rpath-propagation.cmake new file mode 100644 index 0000000..7e9b7a5 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-parent-rpath-propagation.cmake @@ -0,0 +1,54 @@ +enable_language(C) +cmake_policy(SET CMP0095 NEW) + +# Force linker to set RPATH instead of RUNPATH +add_link_options("-Wl,--disable-new-dtags") + +# bin/exe (RPATH = "lib1:lib2:lib3") +# ^ +# | +# lib1/libone.so (RPATH erased) +# ^ +# | +# lib2/libtwo.so (RPATH erased) +# ^ +# | +# lib3/libthree.so (RPATH erased) +# GET_RUNTIME_DEPENDENCIES(bin/exe) should resolve all three libraries + +set(TEST_SOURCE_DIR "linux/parent-rpath-propagation") + +add_library(three SHARED "${TEST_SOURCE_DIR}/three.c") + +add_library(two SHARED "${TEST_SOURCE_DIR}/two.c") +target_link_libraries(two PUBLIC three) + +add_library(one SHARED "${TEST_SOURCE_DIR}/one.c") +target_link_libraries(one PUBLIC two) + +add_executable(exe "${TEST_SOURCE_DIR}/main.c") +target_link_libraries(exe PUBLIC one) + +set_property(TARGET exe PROPERTY INSTALL_RPATH + $ORIGIN/../lib1 + $ORIGIN/../lib2 + $ORIGIN/../lib3 +) + +install(TARGETS exe DESTINATION bin) +install(TARGETS one DESTINATION lib1) +install(TARGETS two DESTINATION lib2) +install(TARGETS three DESTINATION lib3) + +install(CODE [[ + file(GET_RUNTIME_DEPENDENCIES + EXECUTABLES + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:exe>" + PRE_INCLUDE_REGEXES + "^lib(one|two|three)\\.so$" + "^libc\\.so" + PRE_EXCLUDE_REGEXES ".*" + POST_INCLUDE_REGEXES "^.*/lib(one|two|three)\\.so$" + POST_EXCLUDE_REGEXES ".*" + ) + ]]) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/main.c b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/main.c new file mode 100644 index 0000000..12aba5d --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/main.c @@ -0,0 +1,12 @@ +extern void one(void); +extern void two(void); +extern void three(void); + +int main(void) +{ + one(); + two(); + three(); + + return 0; +} diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/one.c b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/one.c new file mode 100644 index 0000000..9998da8 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/one.c @@ -0,0 +1,7 @@ +extern void two(void); +extern void three(void); + +void one(void) +{ + two(); +} diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/three.c b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/three.c new file mode 100644 index 0000000..0be5f47 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/three.c @@ -0,0 +1,3 @@ +void three(void) +{ +} diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/two.c b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/two.c new file mode 100644 index 0000000..370baf7 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux/parent-rpath-propagation/two.c @@ -0,0 +1,6 @@ +extern void three(void); + +void two(void) +{ + three(); +} diff --git a/Tests/RunCMake/file/COPY_FILE-file-INPUT_MAY_BE_RECENT.cmake b/Tests/RunCMake/file/COPY_FILE-file-INPUT_MAY_BE_RECENT.cmake new file mode 100644 index 0000000..88bf448 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-INPUT_MAY_BE_RECENT.cmake @@ -0,0 +1,10 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "") +file(COPY_FILE "${oldname}" "${newname}" INPUT_MAY_BE_RECENT) +if(NOT EXISTS "${oldname}") + message(FATAL_ERROR "The old name does not exist:\n ${oldname}") +endif() +if(NOT EXISTS "${newname}") + message(FATAL_ERROR "The new name does not exist:\n ${newname}") +endif() diff --git a/Tests/RunCMake/file/COPY_FILE-input-missing-result.txt b/Tests/RunCMake/file/COPY_FILE-input-missing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-input-missing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/COPY_FILE-input-missing-stderr.txt b/Tests/RunCMake/file/COPY_FILE-input-missing-stderr.txt new file mode 100644 index 0000000..989925d --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-input-missing-stderr.txt @@ -0,0 +1,14 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/COPY_FILE-input-missing.cmake:[0-9]+ \(file\): + file COPY_FILE failed to copy + + [^ +]*/Tests/RunCMake/file/COPY_FILE-input-missing-build/input-missing + + to + + [^ +]*/Tests/RunCMake/file/COPY_FILE-input-missing-build/output + + because: [^ +]+ \(input\)$ diff --git a/Tests/RunCMake/file/COPY_FILE-input-missing.cmake b/Tests/RunCMake/file/COPY_FILE-input-missing.cmake new file mode 100644 index 0000000..2d2c55e --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-input-missing.cmake @@ -0,0 +1,3 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input-missing") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(COPY_FILE "${oldname}" "${newname}") diff --git a/Tests/RunCMake/file/COPY_FILE-output-missing-result.txt b/Tests/RunCMake/file/COPY_FILE-output-missing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-output-missing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/COPY_FILE-output-missing-stderr.txt b/Tests/RunCMake/file/COPY_FILE-output-missing-stderr.txt new file mode 100644 index 0000000..0e7d9f7 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-output-missing-stderr.txt @@ -0,0 +1,14 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/COPY_FILE-output-missing.cmake:[0-9]+ \(file\): + file COPY_FILE failed to copy + + [^ +]*/Tests/RunCMake/file/COPY_FILE-output-missing-build/input + + to + + [^ +]*/Tests/RunCMake/file/COPY_FILE-output-missing-build/output-missing/output + + because: [^ +]+ \(output\)$ diff --git a/Tests/RunCMake/file/COPY_FILE-output-missing.cmake b/Tests/RunCMake/file/COPY_FILE-output-missing.cmake new file mode 100644 index 0000000..22133e7 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-output-missing.cmake @@ -0,0 +1,4 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output-missing/output") +file(WRITE "${oldname}" "") +file(COPY_FILE "${oldname}" "${newname}") diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt deleted file mode 100644 index 406e315..0000000 --- a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt +++ /dev/null @@ -1,12 +0,0 @@ -^CMake Error at DOWNLOAD-hash-mismatch.cmake:[0-9]+ \(file\): - file DOWNLOAD HASH mismatch - - for file: \[.*/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-build/hash-mismatch.txt\] - expected hash: \[0123456789abcdef0123456789abcdef01234567\] - actual hash: \[da39a3ee5e6b4b0d3255bfef95601890afd80709\] - status: \[0;"No error"\] - -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) -+ -status='1;HASH mismatch: expected: 0123456789abcdef0123456789abcdef01234567 actual: da39a3ee5e6b4b0d3255bfef95601890afd80709'$ diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake deleted file mode 100644 index a91b217..0000000 --- a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake +++ /dev/null @@ -1,10 +0,0 @@ -if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") - set(slash /) -endif() -file(DOWNLOAD - "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-hash-mismatch.txt" - ${CMAKE_CURRENT_BINARY_DIR}/hash-mismatch.txt - EXPECTED_HASH SHA1=0123456789abcdef0123456789abcdef01234567 - STATUS status - ) -message("status='${status}'") diff --git a/Tests/RunCMake/file/DOWNLOAD-no-save-hash.cmake b/Tests/RunCMake/file/DOWNLOAD-no-save-hash.cmake deleted file mode 100644 index ce959a7..0000000 --- a/Tests/RunCMake/file/DOWNLOAD-no-save-hash.cmake +++ /dev/null @@ -1,8 +0,0 @@ -if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") - set(slash /) -endif() -file(DOWNLOAD - "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-no-save-md5.txt" - EXPECTED_HASH MD5=55555555555555555555555555555555 - STATUS status - ) diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake b/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake deleted file mode 100644 index 2fa5482..0000000 --- a/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake +++ /dev/null @@ -1,8 +0,0 @@ -if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") - set(slash /) -endif() -file(DOWNLOAD - "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-unused-argument.txt" - "${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt" - JUNK - ) diff --git a/Tests/RunCMake/file/MAKE_DIRECTORY-fail-result.txt b/Tests/RunCMake/file/MAKE_DIRECTORY-fail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/MAKE_DIRECTORY-fail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/MAKE_DIRECTORY-fail-stderr.txt b/Tests/RunCMake/file/MAKE_DIRECTORY-fail-stderr.txt new file mode 100644 index 0000000..95fccdf --- /dev/null +++ b/Tests/RunCMake/file/MAKE_DIRECTORY-fail-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at [^ +]*/MAKE_DIRECTORY-fail.cmake:[0-9]+ \(file\): + file failed to create directory: + + [^ +]*/Tests/RunCMake/file/MAKE_DIRECTORY-fail-build/file/directory + + because: [^ +]+$ diff --git a/Tests/RunCMake/file/MAKE_DIRECTORY-fail.cmake b/Tests/RunCMake/file/MAKE_DIRECTORY-fail.cmake new file mode 100644 index 0000000..57a68e5 --- /dev/null +++ b/Tests/RunCMake/file/MAKE_DIRECTORY-fail.cmake @@ -0,0 +1,2 @@ +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/file" "") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/file/directory") diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index db88956..c75e062 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -4,14 +4,6 @@ run_cmake(CREATE_LINK) run_cmake(CREATE_LINK-COPY_ON_ERROR) run_cmake(CREATE_LINK-noarg) run_cmake(CREATE_LINK-noexist) -run_cmake(DOWNLOAD-hash-mismatch) -run_cmake(DOWNLOAD-unused-argument) -run_cmake(DOWNLOAD-httpheader-not-set) -run_cmake(DOWNLOAD-netrc-bad) -run_cmake(DOWNLOAD-tls-cainfo-not-set) -run_cmake(DOWNLOAD-tls-verify-not-set) -run_cmake(DOWNLOAD-pass-not-set) -run_cmake(DOWNLOAD-no-save-hash) run_cmake(TOUCH) run_cmake(TOUCH-error-in-source-directory) run_cmake(TOUCH-error-missing-directory) @@ -59,12 +51,17 @@ run_cmake_script(COPY_FILE-dirlink-to-file-fail) run_cmake_script(COPY_FILE-file-to-file) run_cmake_script(COPY_FILE-file-to-dir-capture) run_cmake_script(COPY_FILE-file-to-dir-fail) +run_cmake_script(COPY_FILE-file-INPUT_MAY_BE_RECENT) run_cmake_script(COPY_FILE-file-ONLY_IF_DIFFERENT-capture) run_cmake_script(COPY_FILE-file-ONLY_IF_DIFFERENT-fail) run_cmake_script(COPY_FILE-file-ONLY_IF_DIFFERENT-no-overwrite) run_cmake_script(COPY_FILE-link-to-file) run_cmake_script(COPY_FILE-arg-missing) run_cmake_script(COPY_FILE-arg-unknown) +run_cmake_script(COPY_FILE-input-missing) +run_cmake_script(COPY_FILE-output-missing) + +run_cmake_script(MAKE_DIRECTORY-fail) run_cmake_script(RENAME-file-replace) run_cmake_script(RENAME-file-to-file) diff --git a/Tests/RunCMake/find_dependency/RunCMakeTest.cmake b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake index a72d189..6a53133 100644 --- a/Tests/RunCMake/find_dependency/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) # Success tests run_cmake(realistic) run_cmake(basic) +run_cmake(transitive) # Failure tests run_cmake(invalid-arg) diff --git a/Tests/RunCMake/find_dependency/transitive-stdout.txt b/Tests/RunCMake/find_dependency/transitive-stdout.txt new file mode 100644 index 0000000..6fe40e9 --- /dev/null +++ b/Tests/RunCMake/find_dependency/transitive-stdout.txt @@ -0,0 +1,9 @@ +-- begin +-- Loading E with components: '' +-- Loading A with components: 'A1' +-- Loading B with components: 'B1' +-- Loading A with components: '' +-- Loading C with components: '' +-- Loading D with components: '' +-- Loading B with components: '' +-- end diff --git a/Tests/RunCMake/find_dependency/transitive.cmake b/Tests/RunCMake/find_dependency/transitive.cmake new file mode 100644 index 0000000..5a07f96 --- /dev/null +++ b/Tests/RunCMake/find_dependency/transitive.cmake @@ -0,0 +1,3 @@ +message(STATUS "begin") +find_package(E REQUIRED NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_SOURCE_DIR}/transitive) +message(STATUS "end") diff --git a/Tests/RunCMake/find_dependency/transitive/AConfig.cmake b/Tests/RunCMake/find_dependency/transitive/AConfig.cmake new file mode 100644 index 0000000..b2bf294 --- /dev/null +++ b/Tests/RunCMake/find_dependency/transitive/AConfig.cmake @@ -0,0 +1 @@ +message(STATUS "Loading A with components: '${A_FIND_COMPONENTS}'") diff --git a/Tests/RunCMake/find_dependency/transitive/BConfig.cmake b/Tests/RunCMake/find_dependency/transitive/BConfig.cmake new file mode 100644 index 0000000..42c2ecd --- /dev/null +++ b/Tests/RunCMake/find_dependency/transitive/BConfig.cmake @@ -0,0 +1,3 @@ +message(STATUS "Loading B with components: '${B_FIND_COMPONENTS}'") +include(CMakeFindDependencyMacro) +find_dependency(A NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_LIST_DIR}) diff --git a/Tests/RunCMake/find_dependency/transitive/CConfig.cmake b/Tests/RunCMake/find_dependency/transitive/CConfig.cmake new file mode 100644 index 0000000..645aedc --- /dev/null +++ b/Tests/RunCMake/find_dependency/transitive/CConfig.cmake @@ -0,0 +1,3 @@ +message(STATUS "Loading C with components: '${C_FIND_COMPONENTS}'") +include(CMakeFindDependencyMacro) +find_dependency(A NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_LIST_DIR}) diff --git a/Tests/RunCMake/find_dependency/transitive/DConfig.cmake b/Tests/RunCMake/find_dependency/transitive/DConfig.cmake new file mode 100644 index 0000000..488c85b --- /dev/null +++ b/Tests/RunCMake/find_dependency/transitive/DConfig.cmake @@ -0,0 +1,5 @@ +message(STATUS "Loading D with components: '${D_FIND_COMPONENTS}'") +include(CMakeFindDependencyMacro) +find_dependency(A COMPONENTS A1 NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_LIST_DIR}) +find_dependency(B NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_LIST_DIR}) +find_dependency(C NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_LIST_DIR}) diff --git a/Tests/RunCMake/find_dependency/transitive/EConfig.cmake b/Tests/RunCMake/find_dependency/transitive/EConfig.cmake new file mode 100644 index 0000000..c8d31de --- /dev/null +++ b/Tests/RunCMake/find_dependency/transitive/EConfig.cmake @@ -0,0 +1,6 @@ +message(STATUS "Loading E with components: '${E_FIND_COMPONENTS}'") +include(CMakeFindDependencyMacro) +find_dependency(A COMPONENTS A1 NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_LIST_DIR}) +find_dependency(B COMPONENTS B1 NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_LIST_DIR}) +find_dependency(C NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_LIST_DIR}) +find_dependency(D NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_LIST_DIR}) diff --git a/Tests/RunCMake/if/IsDirectoryLong.cmake b/Tests/RunCMake/if/IsDirectoryLong.cmake index e6939ac..41f1818 100644 --- a/Tests/RunCMake/if/IsDirectoryLong.cmake +++ b/Tests/RunCMake/if/IsDirectoryLong.cmake @@ -8,3 +8,6 @@ if(IS_DIRECTORY "${d}/") else() message(STATUS "Directory path with length ${dl} correctly does not exist.") endif() +if(IS_DIRECTORY "") + message(FATAL_ERROR "IS_DIRECTORY \"\" should not exist") +endif() diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake index de9cb57..efee116 100644 --- a/Tests/RunCMake/if/RunCMakeTest.cmake +++ b/Tests/RunCMake/if/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) run_cmake(InvalidArgument1) +run_cmake(exists) run_cmake(IsDirectory) run_cmake(IsDirectoryLong) run_cmake(duplicate-deep-else) diff --git a/Tests/RunCMake/if/exists.cmake b/Tests/RunCMake/if/exists.cmake new file mode 100644 index 0000000..2e5c0ee --- /dev/null +++ b/Tests/RunCMake/if/exists.cmake @@ -0,0 +1,3 @@ +if(EXISTS "") + message(FATAL_ERROR "EXISTS \"\" should not exist") +endif() diff --git a/Tests/RunCMake/message/ConfigureLog-config.txt b/Tests/RunCMake/message/ConfigureLog-config.txt new file mode 100644 index 0000000..49c12de --- /dev/null +++ b/Tests/RunCMake/message/ConfigureLog-config.txt @@ -0,0 +1,30 @@ +^ +--- +events: + - + kind: "message-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(message\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + message: | + Message 0 + - + kind: "message-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(message\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Check 1" + message: | + Message 1 + - + kind: "message-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(message\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Check 2" + - "Check 1" + message: | + Message 2 +\.\.\.$ diff --git a/Tests/RunCMake/message/ConfigureLog-stdout.txt b/Tests/RunCMake/message/ConfigureLog-stdout.txt new file mode 100644 index 0000000..ba32642 --- /dev/null +++ b/Tests/RunCMake/message/ConfigureLog-stdout.txt @@ -0,0 +1,4 @@ +-- Check 1 +-- Check 2 +-- Check 2 - passed +-- Check 1 - passed diff --git a/Tests/RunCMake/message/ConfigureLog.cmake b/Tests/RunCMake/message/ConfigureLog.cmake new file mode 100644 index 0000000..6f2c1b0 --- /dev/null +++ b/Tests/RunCMake/message/ConfigureLog.cmake @@ -0,0 +1,7 @@ +message(CONFIGURE_LOG "Message 0") +message(CHECK_START "Check 1") +message(CONFIGURE_LOG "Message 1") +message(CHECK_START "Check 2") +message(CONFIGURE_LOG "Message 2") +message(CHECK_PASS "passed") +message(CHECK_PASS "passed") diff --git a/Tests/RunCMake/message/ConfigureLogScript-config.txt b/Tests/RunCMake/message/ConfigureLogScript-config.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/message/ConfigureLogScript-config.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/message/ConfigureLogScript-stdout.txt b/Tests/RunCMake/message/ConfigureLogScript-stdout.txt new file mode 100644 index 0000000..ba32642 --- /dev/null +++ b/Tests/RunCMake/message/ConfigureLogScript-stdout.txt @@ -0,0 +1,4 @@ +-- Check 1 +-- Check 2 +-- Check 2 - passed +-- Check 1 - passed diff --git a/Tests/RunCMake/message/ConfigureLogScript.cmake b/Tests/RunCMake/message/ConfigureLogScript.cmake new file mode 100644 index 0000000..e1cd21b --- /dev/null +++ b/Tests/RunCMake/message/ConfigureLogScript.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/ConfigureLog.cmake") diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 1233838..c54e8f2 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -1,7 +1,9 @@ include(RunCMake) +run_cmake_script(ConfigureLogScript) run_cmake_script(newline) +run_cmake(ConfigureLog) run_cmake(defaultmessage) run_cmake(nomessage) run_cmake(message-internal-warning) diff --git a/Tests/RunCMake/project/CMP0048-OLD-VERSION-stderr.txt b/Tests/RunCMake/project/CMP0048-OLD-VERSION-stderr.txt index 3a13d32..c11215a 100644 --- a/Tests/RunCMake/project/CMP0048-OLD-VERSION-stderr.txt +++ b/Tests/RunCMake/project/CMP0048-OLD-VERSION-stderr.txt @@ -1,4 +1,4 @@ CMake Error at CMP0048-OLD-VERSION.cmake:1 \(project\): VERSION not allowed unless CMP0048 is set to NEW Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/CMP0048-OLD-stderr.txt b/Tests/RunCMake/project/CMP0048-OLD-stderr.txt index 1fa70f8..695fb70 100644 --- a/Tests/RunCMake/project/CMP0048-OLD-stderr.txt +++ b/Tests/RunCMake/project/CMP0048-OLD-stderr.txt @@ -7,4 +7,4 @@ specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/CMP0048-WARN-stderr.txt b/Tests/RunCMake/project/CMP0048-WARN-stderr.txt index 6d29ad2..d9be5d3 100644 --- a/Tests/RunCMake/project/CMP0048-WARN-stderr.txt +++ b/Tests/RunCMake/project/CMP0048-WARN-stderr.txt @@ -8,5 +8,5 @@ CMake Warning \(dev\) at CMP0048-WARN.cmake:3 \(project\): PROJECT_VERSION MyProject_VERSION_TWEAK Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/project/CMakeLists.txt b/Tests/RunCMake/project/CMakeLists.txt index 4b3de84..fdcaee9 100644 --- a/Tests/RunCMake/project/CMakeLists.txt +++ b/Tests/RunCMake/project/CMakeLists.txt @@ -1,3 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +if(NOT "x${RunCMake_TEST}" STREQUAL "xNoMinimumRequired") + cmake_minimum_required(VERSION 2.8.12) +endif() project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/project/LanguagesTwice-stderr.txt b/Tests/RunCMake/project/LanguagesTwice-stderr.txt index 9c69dd0..6edca2f 100644 --- a/Tests/RunCMake/project/LanguagesTwice-stderr.txt +++ b/Tests/RunCMake/project/LanguagesTwice-stderr.txt @@ -1,4 +1,4 @@ CMake Error at LanguagesTwice.cmake:1 \(project\): LANGUAGES may be specified at most once. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/NoMinimumRequired-stderr.txt b/Tests/RunCMake/project/NoMinimumRequired-stderr.txt new file mode 100644 index 0000000..83e2ac9 --- /dev/null +++ b/Tests/RunCMake/project/NoMinimumRequired-stderr.txt @@ -0,0 +1,5 @@ +CMake Warning \(dev\) at CMakeLists\.txt:[0-9]+ \(project\): + cmake_minimum_required\(\) should be called prior to this top-level project\(\) + call\. Please see the cmake-commands\(7\) manual for usage documentation of + both commands\. +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/project/NoMinimumRequired.cmake b/Tests/RunCMake/project/NoMinimumRequired.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/project/NoMinimumRequired.cmake diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 6d9f52f..0f3716f 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -52,3 +52,5 @@ run_cmake(CMP0048-NEW) run_cmake(CMP0096-WARN) run_cmake(CMP0096-OLD) run_cmake(CMP0096-NEW) + +run_cmake(NoMinimumRequired) diff --git a/Tests/RunCMake/project/VersionInvalid-stderr.txt b/Tests/RunCMake/project/VersionInvalid-stderr.txt index 48358d1..e13a382 100644 --- a/Tests/RunCMake/project/VersionInvalid-stderr.txt +++ b/Tests/RunCMake/project/VersionInvalid-stderr.txt @@ -1,4 +1,4 @@ CMake Error at VersionInvalid.cmake:2 \(project\): VERSION "NONE" format invalid. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt b/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt index 576ac69..63cbf63 100644 --- a/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt +++ b/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt @@ -2,4 +2,4 @@ CMake Error at VersionMissingLanguages.cmake:2 \(project\): project with VERSION, DESCRIPTION or HOMEPAGE_URL must use LANGUAGES before language names. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/VersionTwice-stderr.txt b/Tests/RunCMake/project/VersionTwice-stderr.txt index ec07ead..dc05533 100644 --- a/Tests/RunCMake/project/VersionTwice-stderr.txt +++ b/Tests/RunCMake/project/VersionTwice-stderr.txt @@ -1,4 +1,4 @@ CMake Error at VersionTwice.cmake:2 \(project\): VERSION may be specified at most once. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project_injected/RunCMakeTest.cmake b/Tests/RunCMake/project_injected/RunCMakeTest.cmake index ba1a003..cf63e12 100644 --- a/Tests/RunCMake/project_injected/RunCMakeTest.cmake +++ b/Tests/RunCMake/project_injected/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) set(RunCMake_TEST_OPTIONS + -DCMAKE_MINIMUM_REQUIRED_VERSION:STATIC= # Simulate a previous CMake run that used `project(... VERSION ...)` # in a non-injected call site. -DCMAKE_PROJECT_VERSION:STATIC=1.2.3 diff --git a/Tests/RunCMake/pseudo_tidy.c b/Tests/RunCMake/pseudo_tidy.c index a43133b..f227c06 100644 --- a/Tests/RunCMake/pseudo_tidy.c +++ b/Tests/RunCMake/pseudo_tidy.c @@ -1,8 +1,13 @@ +#ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +#endif + #include <stdio.h> #include <string.h> int main(int argc, char* argv[]) { + FILE* f; int i; for (i = 1; i < argc; ++i) { if (strcmp(argv[i], "-p") == 0) { @@ -20,6 +25,14 @@ int main(int argc, char* argv[]) fprintf(stderr, "stderr from bad command line arg '-bad'\n"); return 1; } + if (strncmp(argv[i], "--export-fixes=", 15) == 0) { + f = fopen(argv[i] + 15, "w"); + if (!f) { + fprintf(stderr, "Error opening %s for writing\n", argv[i] + 15); + return 1; + } + fclose(f); + } if (argv[i][0] != '-') { fprintf(stdout, "%s:0:0: warning: message [checker]\n", argv[i]); break; diff --git a/Tests/RunCMake/showIncludes.c b/Tests/RunCMake/showIncludes.c index 23b3845..4ea2bcc 100644 --- a/Tests/RunCMake/showIncludes.c +++ b/Tests/RunCMake/showIncludes.c @@ -1,33 +1,94 @@ +#ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +#endif + #if defined(_MSC_VER) && _MSC_VER >= 1928 # pragma warning(disable : 5105) /* macro expansion warning in windows.h */ #endif #include <windows.h> #include <stdio.h> +#include <stdlib.h> int main() { /* 'cl /showIncludes' encodes output in the console output code page. */ unsigned int cp = GetConsoleOutputCP(); + + /* 'cl /showIncludes' prints output in the VS language. */ + const char* vslang = getenv("VSLANG"); + if (!vslang) { + fprintf(stderr, "VSLANG is not set.\n"); + return 1; + } + printf("Console output code page: %u\n", cp); printf("Console input code page: %u\n", GetConsoleCP()); printf("ANSI code page: %u\n", GetACP()); printf("OEM code page: %u\n", GetOEMCP()); + printf("VSLANG: %s\n", vslang); + + if (strcmp(vslang, "1031") == 0) { + if (cp == 437 || cp == 65001) { + printf("Hinweis: Einlesen der Datei: C:\\foo.h\n"); + return 0; + } + } - if (cp == 54936 || cp == 936) { - /* VSLANG=2052 */ - printf("\xd7\xa2\xd2\xe2: " - "\xb0\xfc\xba\xac\xce\xc4\xbc\xfe:\n"); - return 0; + if (strcmp(vslang, "1033") == 0) { + if (cp == 437 || cp == 65001) { + printf("Note: including file: C:\\foo.h\n"); + return 0; + } } - if (cp == 65001) { - /* VSLANG=2052 */ - printf("\xe6\xb3\xa8\xe6\x84\x8f: " - "\xe5\x8c\x85\xe5\x90\xab\xe6\x96\x87\xe4\xbb\xb6:\n"); - return 0; + if (strcmp(vslang, "1036") == 0) { + if (cp == 437 || cp == 863) { + printf("Remarque\xff: inclusion du fichier\xff: C:\\foo.h\n"); + return 0; + } + if (cp == 65001) { + printf("Remarque\xc2\xa0: inclusion du fichier\xc2\xa0: C:\\foo.h\n"); + return 0; + } + } + + if (strcmp(vslang, "1040") == 0) { + if (cp == 437 || cp == 65001) { + printf("Nota: file incluso C:\\foo.h\n"); + return 0; + } + } + + if (strcmp(vslang, "1041") == 0) { + if (cp == 932) { + printf("\x83\x81\x83\x82: " + "\x83\x43\x83\x93\x83\x4e\x83\x8b\x81\x5b\x83\x68 " + "\x83\x74\x83\x40\x83\x43\x83\x8b: C:\\foo.h\n"); + return 0; + } + if (cp == 65001) { + printf("\xe3\x83\xa1\xe3\x83\xa2: \xe3\x82\xa4\xe3\x83\xb3" + "\xe3\x82\xaf\xe3\x83\xab\xe3\x83\xbc\xe3\x83\x89 " + "\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab: C:\\foo.h\n"); + return 0; + } + } + + if (strcmp(vslang, "2052") == 0) { + if (cp == 54936 || cp == 936) { + printf("\xd7\xa2\xd2\xe2: " + "\xb0\xfc\xba\xac\xce\xc4\xbc\xfe: C:\\foo.h\n"); + return 0; + } + + if (cp == 65001) { + printf("\xe6\xb3\xa8\xe6\x84\x8f: " + "\xe5\x8c\x85\xe5\x90\xab\xe6\x96\x87\xe4\xbb\xb6: C:\\foo.h\n"); + return 0; + } } - fprintf(stderr, "No example showIncludes for console's output code page.\n"); + fprintf(stderr, "No example showIncludes for this code page and VSLANG.\n"); return 1; } diff --git a/Tests/RunCMake/string/Timestamp-stderr.txt b/Tests/RunCMake/string/Timestamp-stderr.txt index f162f52..c57bba6 100644 --- a/Tests/RunCMake/string/Timestamp-stderr.txt +++ b/Tests/RunCMake/string/Timestamp-stderr.txt @@ -1 +1 @@ -RESULT=2005-08-07 23:19:49.000000 Sunday=Sun August=Aug 05 day=219 wd=0 week=32 w_iso=31 %I=11 epoch=1123456789 +^RESULT=2005-08-07 23:19:49.000000 Sunday=Sun August=Aug 05 day=219 wd=0 week=32 w_iso=31 %I=11 epoch=1123456789 TZ=GMT tz=\+0000$ diff --git a/Tests/RunCMake/string/Timestamp.cmake b/Tests/RunCMake/string/Timestamp.cmake index 531a237..3d68b1a 100644 --- a/Tests/RunCMake/string/Timestamp.cmake +++ b/Tests/RunCMake/string/Timestamp.cmake @@ -1,3 +1,3 @@ set(ENV{SOURCE_DATE_EPOCH} "1123456789") -string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S.%f %A=%a %B=%b %y day=%j wd=%w week=%U w_iso=%V %%I=%I epoch=%s" UTC) +string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S.%f %A=%a %B=%b %y day=%j wd=%w week=%U w_iso=%V %%I=%I epoch=%s TZ=%Z tz=%z" UTC) message("RESULT=${RESULT}") diff --git a/Tests/RunCMake/target_compile_definitions/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_definitions/RunCMakeTest.cmake index a419cc9..4dd01db 100644 --- a/Tests/RunCMake/target_compile_definitions/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_compile_definitions/RunCMakeTest.cmake @@ -2,3 +2,16 @@ include(RunCMake) run_cmake(empty_keyword_args) run_cmake(unknown_imported_target) + + +macro(run_cmake_build test) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test} ${CMAKE_COMMAND} --build . --config Release) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +run_cmake(remove_leading_minusD) +run_cmake_build(remove_leading_minusD) diff --git a/Tests/RunCMake/target_compile_definitions/foo.c b/Tests/RunCMake/target_compile_definitions/foo.c new file mode 100644 index 0000000..74a86e1 --- /dev/null +++ b/Tests/RunCMake/target_compile_definitions/foo.c @@ -0,0 +1,4 @@ + +void foo() +{ +} diff --git a/Tests/RunCMake/target_compile_definitions/remove_leading_minusD.cmake b/Tests/RunCMake/target_compile_definitions/remove_leading_minusD.cmake new file mode 100644 index 0000000..53c03c1 --- /dev/null +++ b/Tests/RunCMake/target_compile_definitions/remove_leading_minusD.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(lib1 foo.c) +target_compile_definitions(lib1 PRIVATE -DDEF0 "$<1:-DDEF1>") +target_compile_definitions(lib1 PUBLIC -DDEF2 "$<1:-DDEF3>") + +add_library(lib2 foo.c) +target_link_libraries(lib2 PRIVATE lib1) diff --git a/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake index f726759..d703839 100644 --- a/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) run_cmake(empty_keyword_args) +run_cmake(bad_keyword) if (CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang") macro(run_cmake_target test subtest target) diff --git a/Tests/RunCMake/target_compile_options/bad_keyword-result.txt b/Tests/RunCMake/target_compile_options/bad_keyword-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_compile_options/bad_keyword-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_compile_options/bad_keyword-stderr.txt b/Tests/RunCMake/target_compile_options/bad_keyword-stderr.txt new file mode 100644 index 0000000..e22013e --- /dev/null +++ b/Tests/RunCMake/target_compile_options/bad_keyword-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at bad_keyword\.cmake:[0-9]+ \(target_compile_options\): + target_compile_options called with invalid arguments diff --git a/Tests/RunCMake/target_compile_options/bad_keyword.cmake b/Tests/RunCMake/target_compile_options/bad_keyword.cmake new file mode 100644 index 0000000..b7e6fca --- /dev/null +++ b/Tests/RunCMake/target_compile_options/bad_keyword.cmake @@ -0,0 +1,5 @@ +add_library(iface INTERFACE) + +# SYSTEM is a recognized keyword for the base class used to implement the +# command. Verify that we don't allow it. +target_compile_options(iface SYSTEM PRIVATE) diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link-stderr.txt new file mode 100644 index 0000000..07e9a9f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0108-OLD-self-link.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0108 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake index 5ade637..1a76e10 100644 --- a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET UNKNOWN) diff --git a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake index 332441c..17b37aa 100644 --- a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake +++ b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET a TYPE UNKNOWN) diff --git a/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake b/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake index 72056ae..74795c2 100644 --- a/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake +++ b/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake @@ -1,5 +1,9 @@ include(RunCMake) +# Isolate our ctest runs from external environment. +unset(ENV{CTEST_PARALLEL_LEVEL}) +unset(ENV{CTEST_OUTPUT_ON_FAILURE}) + function(run_TID) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TID-build) diff --git a/Tests/RunCMake/try_compile/CMP0128-common.cmake b/Tests/RunCMake/try_compile/CMP0128-common.cmake index 0b8a12b..64b1a77 100644 --- a/Tests/RunCMake/try_compile/CMP0128-common.cmake +++ b/Tests/RunCMake/try_compile/CMP0128-common.cmake @@ -1,10 +1,6 @@ cmake_policy(SET CMP0067 NEW) enable_language(CXX) -# Isolate the one try_compile below in the error log. -set(CMakeError_log "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log") -file(REMOVE "${CMakeError_log}") - # Add our own -std= flag to the try_compile check. set(CMAKE_REQUIRED_FLAGS -std=c++11) @@ -24,8 +20,21 @@ int main() } " SRC_COMPILED) if(NOT SRC_COMPILED) - if(EXISTS "${CMakeError_log}") - file(READ "${CMakeError_log}" err_log) + message("Check failed to compile:") + set(configure_log "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeConfigureLog.yaml") + if(EXISTS "${configure_log}") + file(READ "${configure_log}" log_content) + else() + set(log_content "") + endif() + if(log_content MATCHES [[( - + kind: "try_compile-v1"( ++ [^ +]+)+ + checks: + - "Performing Test SRC_COMPILED"( ++ [^ +]+)+)]]) + message("${configure_log} contains:\n${CMAKE_MATCH_1}") endif() - message("${err_log}") endif() diff --git a/Tests/RunCMake/try_compile/ConfigureLog-bad.c b/Tests/RunCMake/try_compile/ConfigureLog-bad.c new file mode 100644 index 0000000..6508ead --- /dev/null +++ b/Tests/RunCMake/try_compile/ConfigureLog-bad.c @@ -0,0 +1 @@ +#error "This does not compile!" diff --git a/Tests/RunCMake/try_compile/ConfigureLog-config.txt b/Tests/RunCMake/try_compile/ConfigureLog-config.txt new file mode 100644 index 0000000..ef5c73e --- /dev/null +++ b/Tests/RunCMake/try_compile/ConfigureLog-config.txt @@ -0,0 +1,79 @@ +^ +--- +events:( + - + kind: "message-v1" + backtrace:( + - "[^"]+")+ + message: \|( ++ [^ +]*)*)+ + - + kind: "try_compile-v1" + backtrace: + - "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)" + - "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)" + - "ConfigureLog.cmake:[0-9]+ \(enable_language\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Detecting C compiler ABI info" + directories: + source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + cmakeVariables:( + CMAKE_[^ +]*)+ + buildResult: + variable: "CMAKE_C_ABI_COMPILED" + cached: true + stdout: \|.* + exitCode: 0( + - + kind: "message-v1" + backtrace:( + - "[^"]+")+ + message: \|( ++ [^ +]*)*)* + - + kind: "try_compile-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(try_compile\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + description: "Source that should not compile\." + directories: + source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + cmakeVariables: + ABCDEFGHIJKLMNOPQRSTUVWXYZ: "Upper case"( + CMAKE_[^ +]*)+ + "WITH SPACE": "Space" + _-0123456789: "Other chars" + abcdefghijklmnopqrstuvwxyz: "Lower case" + buildResult: + variable: "COMPILE_RESULT" + cached: true + stdout: \|.* + exitCode: [1-9][0-9]* + - + kind: "try_compile-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(try_compile\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Check 2" + - "Check 1" + description: "Source that should compile\." + directories: + source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + cmakeVariables:( + CMAKE_[^ +]*)+ + buildResult: + variable: "COMPILE_RESULT" + cached: true + stdout: \|.* + exitCode: 0 +\.\.\.$ diff --git a/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt b/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt new file mode 100644 index 0000000..ba32642 --- /dev/null +++ b/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt @@ -0,0 +1,4 @@ +-- Check 1 +-- Check 2 +-- Check 2 - passed +-- Check 1 - passed diff --git a/Tests/RunCMake/try_compile/ConfigureLog-test.c b/Tests/RunCMake/try_compile/ConfigureLog-test.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/try_compile/ConfigureLog-test.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/try_compile/ConfigureLog.cmake b/Tests/RunCMake/try_compile/ConfigureLog.cmake new file mode 100644 index 0000000..a897719 --- /dev/null +++ b/Tests/RunCMake/try_compile/ConfigureLog.cmake @@ -0,0 +1,38 @@ +enable_language(C) + +set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES + ABCDEFGHIJKLMNOPQRSTUVWXYZ + abcdefghijklmnopqrstuvwxyz + _-0123456789 + "WITH SPACE" + ) +set(ABCDEFGHIJKLMNOPQRSTUVWXYZ "Upper case") +set(abcdefghijklmnopqrstuvwxyz "Lower case") +set(_-0123456789 "Other chars") +set("WITH SPACE" "Space") + +try_compile(COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-bad.c + LOG_DESCRIPTION "Source that should not compile." + ) + +unset(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES) + +try_compile(COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c + NO_LOG + ) + +message(CHECK_START "Check 1") +message(CHECK_START "Check 2") +try_compile(COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c + LOG_DESCRIPTION "Source that should compile." + ) +if (COMPILE_RESULT) + message(CHECK_PASS "passed") + message(CHECK_PASS "passed") +else() + message(CHECK_FAIL "failed") + message(CHECK_FAIL "failed") +endif() diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt index b1344bd..b03e0b3 100644 --- a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt +++ b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt @@ -7,3 +7,11 @@ CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\): COPY_FILE_ERROR must be followed by a variable name Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\): + Error after keyword "LOG_DESCRIPTION": + + empty string not allowed + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake index fda4f10..f0052c5 100644 --- a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake +++ b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake @@ -5,3 +5,6 @@ try_compile(RESULT ${try_compile_bindir_or_SOURCES} try_compile(RESULT ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c COPY_FILE "x" COPY_FILE_ERROR "") +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + LOG_DESCRIPTION "") diff --git a/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt index 72e0a01..91dfa6d 100644 --- a/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt +++ b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt @@ -1 +1 @@ -.*Linking ISPC static library* +(Linking ISPC static library|[ \/]libcmTC_[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\.a|out:([A-Za-z]+[\/])?cmTC_[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\.lib) diff --git a/Tests/RunCMake/try_compile/Inspect-config.txt b/Tests/RunCMake/try_compile/Inspect-config.txt new file mode 100644 index 0000000..44bd443 --- /dev/null +++ b/Tests/RunCMake/try_compile/Inspect-config.txt @@ -0,0 +1,65 @@ +^ +--- +events:( + - + kind: "message-v1" + backtrace:( + - "[^"]+")+ + message: \|( ++ [^ +]*)*)+ + - + kind: "try_compile-v1" + backtrace: + - "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)" + - "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)" + - "Inspect.cmake:[0-9]+ \(enable_language\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Detecting C compiler ABI info" + directories: + source: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + binary: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + cmakeVariables:( + CMAKE_[^ +]*)+ + buildResult: + variable: "CMAKE_C_ABI_COMPILED" + cached: true + stdout: \|.* + exitCode: 0( + - + kind: "message-v1" + backtrace:( + - "[^"]+")+ + message: \|( ++ [^ +]*)*)+ + - + kind: "try_compile-v1" + backtrace: + - "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)" + - "[^"]*/Modules/CMakeTestCXXCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)" + - "Inspect.cmake:[0-9]+ \(enable_language\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Detecting CXX compiler ABI info" + directories: + source: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + binary: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + cmakeVariables:( + CMAKE_[^ +]*)+ + buildResult: + variable: "CMAKE_CXX_ABI_COMPILED" + cached: true + stdout: \|.* + exitCode: 0( + - + kind: "message-v1" + backtrace:( + - "[^"]+")+ + message: \|( ++ [^ +]*)*)* +\.\.\.$ diff --git a/Tests/RunCMake/try_compile/Inspect.cmake b/Tests/RunCMake/try_compile/Inspect.cmake index added41..2977d02 100644 --- a/Tests/RunCMake/try_compile/Inspect.cmake +++ b/Tests/RunCMake/try_compile/Inspect.cmake @@ -1,4 +1,25 @@ +enable_language(C) enable_language(CXX) -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" " -set(CMAKE_CXX_EXTENSIONS_DEFAULT \"${CMAKE_CXX_EXTENSIONS_DEFAULT}\") -") +if(CMake_TEST_OBJC) + enable_language(OBJC) + enable_language(OBJCXX) +endif() + +set(info "") +foreach(var + CMAKE_C_COMPILER_ID + CMAKE_C_COMPILER_VERSION + CMAKE_C_STANDARD_DEFAULT + CMAKE_CXX_COMPILER_ID + CMAKE_CXX_COMPILER_VERSION + CMAKE_CXX_STANDARD_DEFAULT + CMAKE_CXX_EXTENSIONS_DEFAULT + CMAKE_OBJC_STANDARD_DEFAULT + CMAKE_OBJCXX_STANDARD_DEFAULT + ) + if(DEFINED ${var}) + string(APPEND info "set(${var} \"${${var}}\")\n") + endif() +endforeach() + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}") diff --git a/Tests/RunCMake/try_compile/NoLogDescription-result.txt b/Tests/RunCMake/try_compile/NoLogDescription-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/NoLogDescription-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt b/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt new file mode 100644 index 0000000..9005bcd --- /dev/null +++ b/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at NoLogDescription.cmake:[0-9]+ \(try_compile\): + Error after keyword "LOG_DESCRIPTION": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoLogDescription.cmake b/Tests/RunCMake/try_compile/NoLogDescription.cmake new file mode 100644 index 0000000..904763f --- /dev/null +++ b/Tests/RunCMake/try_compile/NoLogDescription.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + LOG_DESCRIPTION) diff --git a/Tests/RunCMake/try_compile/RerunCMake-rerun-ninja-no-console-stdout.txt b/Tests/RunCMake/try_compile/RerunCMake-rerun-ninja-no-console-stdout.txt index b0438f5..a5ca781 100644 --- a/Tests/RunCMake/try_compile/RerunCMake-rerun-ninja-no-console-stdout.txt +++ b/Tests/RunCMake/try_compile/RerunCMake-rerun-ninja-no-console-stdout.txt @@ -1,5 +1,5 @@ Running CMake on RerunCMake FALSE --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build diff --git a/Tests/RunCMake/try_compile/RerunCMake-rerun-stdout.txt b/Tests/RunCMake/try_compile/RerunCMake-rerun-stdout.txt index 9c78b26..e37d210 100644 --- a/Tests/RunCMake/try_compile/RerunCMake-rerun-stdout.txt +++ b/Tests/RunCMake/try_compile/RerunCMake-rerun-stdout.txt @@ -1,3 +1,3 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build diff --git a/Tests/RunCMake/try_compile/RerunCMake-stdout.txt b/Tests/RunCMake/try_compile/RerunCMake-stdout.txt index 9c78b26..e37d210 100644 --- a/Tests/RunCMake/try_compile/RerunCMake-stdout.txt +++ b/Tests/RunCMake/try_compile/RerunCMake-stdout.txt @@ -1,3 +1,3 @@ --- Configuring done --- Generating done +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) -- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 7245471..29c0538 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -1,5 +1,21 @@ include(RunCMake) +# Detect information from the toolchain: +# - CMAKE_C_COMPILER_ID +# - CMAKE_C_COMPILER_VERSION +# - CMAKE_C_STANDARD_DEFAULT +# - CMAKE_CXX_COMPILER_ID +# - CMAKE_CXX_COMPILER_VERSION +# - CMAKE_CXX_STANDARD_DEFAULT +# - CMAKE_CXX_EXTENSIONS_DEFAULT +# - CMAKE_OBJC_STANDARD_DEFAULT +# - CMAKE_OBJCXX_STANDARD_DEFAULT +run_cmake_with_options(Inspect + -DCMake_TEST_OBJC=${CMake_TEST_OBJC} + ) +include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake") + +run_cmake(ConfigureLog) run_cmake(NoArgs) run_cmake(OneArg) run_cmake(TwoArgs) @@ -29,6 +45,8 @@ run_cmake(ProjectCopyFile) run_cmake(NonSourceCopyFile) run_cmake(NonSourceCompileDefinitions) +run_cmake(Verbose) + set(RunCMake_TEST_OPTIONS --debug-trycompile) run_cmake(PlatformVariables) run_cmake(WarnDeprecated) @@ -88,12 +106,6 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") unset(RunCMake_TEST_NO_CLEAN) endif() -# Lookup CMAKE_CXX_EXTENSIONS_DEFAULT. -# FIXME: Someday we could move this to the top of the file and use it in -# place of some of the values passed by 'Tests/RunCMake/CMakeLists.txt'. -run_cmake(Inspect) -include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake") - # FIXME: Support more compilers and default standard levels. if (DEFINED CMAKE_CXX_STANDARD_DEFAULT AND DEFINED CMAKE_CXX_EXTENSIONS_DEFAULT AND ( diff --git a/Tests/RunCMake/try_compile/SourceFromBadName-config.txt b/Tests/RunCMake/try_compile/SourceFromBadName-config.txt new file mode 100644 index 0000000..cb76565 --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadName-config.txt @@ -0,0 +1,11 @@ +^ +--- +events:( + - + kind: "message-v1" + backtrace:( + - "[^"]+")+ + message: \|( ++ [^ +]*)*)+ +\.\.\.$ diff --git a/Tests/RunCMake/try_compile/Verbose.c b/Tests/RunCMake/try_compile/Verbose.c new file mode 100644 index 0000000..5953879 --- /dev/null +++ b/Tests/RunCMake/try_compile/Verbose.c @@ -0,0 +1,7 @@ +#ifndef EXAMPLE_DEFINITION +# error "EXAMPLE_DEFINITION not defined." +#endif +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/try_compile/Verbose.cmake b/Tests/RunCMake/try_compile/Verbose.cmake new file mode 100644 index 0000000..3f2a7dd --- /dev/null +++ b/Tests/RunCMake/try_compile/Verbose.cmake @@ -0,0 +1,15 @@ +enable_language(C) + +try_compile(COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Verbose.c + COMPILE_DEFINITIONS -DEXAMPLE_DEFINITION + OUTPUT_VARIABLE out + ) +string(REPLACE "\n" "\n " out " ${out}") +if(NOT COMPILE_RESULT) + message(FATAL_ERROR "try_compile failed:\n${out}") +endif() +if(NOT out MATCHES "EXAMPLE_DEFINITION" + AND NOT CMAKE_GENERATOR MATCHES "NMake|Borland") + message(FATAL_ERROR "try_compile output does not contain EXAMPLE_DEFINITION:\n${out}") +endif() diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake index 3158e32..0e4cc20 100644 --- a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake +++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake @@ -12,6 +12,7 @@ run_cmake(NoCopyFile) run_cmake(NoCopyFile2) run_cmake(NoCopyFileError) run_cmake(NoCStandard) +run_cmake(NoLogDescription) run_cmake(NoOutputVariable) run_cmake(NoOutputVariable2) run_cmake(BadLinkLibraries) diff --git a/Tests/RunCMake/try_run/ConfigureLog-bad.c b/Tests/RunCMake/try_run/ConfigureLog-bad.c new file mode 100644 index 0000000..6508ead --- /dev/null +++ b/Tests/RunCMake/try_run/ConfigureLog-bad.c @@ -0,0 +1 @@ +#error "This does not compile!" diff --git a/Tests/RunCMake/try_run/ConfigureLog-config.txt b/Tests/RunCMake/try_run/ConfigureLog-config.txt new file mode 100644 index 0000000..e1d5fa7 --- /dev/null +++ b/Tests/RunCMake/try_run/ConfigureLog-config.txt @@ -0,0 +1,134 @@ +^ +--- +events:( + - + kind: "message-v1" + backtrace:( + - "[^"]+")+ + message: \|( ++ [^ +]*)*)+ + - + kind: "try_compile-v1" + backtrace: + - "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)" + - "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)" + - "CMakeLists.txt:[0-9]+ \(project\)" + checks: + - "Detecting C compiler ABI info" + directories: + source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + cmakeVariables:( + CMAKE_[^ +]*)+ + buildResult: + variable: "CMAKE_C_ABI_COMPILED" + cached: true + stdout: \|.* + exitCode: 0( + - + kind: "message-v1" + backtrace:( + - "[^"]+")+ + message: \|( ++ [^ +]*)*)* + - + kind: "try_run-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(try_run\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + description: "Source that should not compile\." + directories: + source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + cmakeVariables:( + CMAKE_[^ +]*)+ + buildResult: + variable: "COMPILE_RESULT" + cached: true + stdout: \|.* + exitCode: [1-9][0-9]* + runResult: + variable: "RUN_RESULT" + cached: true + - + kind: "try_run-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(try_run\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Check 1" + description: "Source that should compile\." + directories: + source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + cmakeVariables:( + CMAKE_[^ +]*)+ + buildResult: + variable: "COMPILE_RESULT" + cached: true + stdout: \|.* + exitCode: 0 + runResult: + variable: "RUN_RESULT" + cached: true + stdout: \| + Output on stdout! + stderr: \| + Output, with backslash '\\\\', on stderr! + exitCode: 12 + - + kind: "try_run-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(try_run\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Check 2" + - "Check 1" + directories: + source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + cmakeVariables:( + CMAKE_[^ +]*)+ + buildResult: + variable: "COMPILE_RESULT" + cached: true + stdout: \|.* + exitCode: 0 + runResult: + variable: "RUN_RESULT" + cached: true + stdout: \| + Output, with backslash '\\\\', on stderr! + Output on stdout! + exitCode: 12 + - + kind: "try_run-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(try_run\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + directories: + source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+" + cmakeVariables:( + CMAKE_[^ +]*)+ + buildResult: + variable: "COMPILE_RESULT" + cached: true + stdout: \|.* + exitCode: 0 + runResult: + variable: "RUN_RESULT" + cached: true + stdout: \| + Output on stdout! + stderr: \| + Output, with backslash '\\\\', on stderr! + exitCode: 12 +\.\.\.$ diff --git a/Tests/RunCMake/try_run/ConfigureLog-stdout.txt b/Tests/RunCMake/try_run/ConfigureLog-stdout.txt new file mode 100644 index 0000000..ba32642 --- /dev/null +++ b/Tests/RunCMake/try_run/ConfigureLog-stdout.txt @@ -0,0 +1,4 @@ +-- Check 1 +-- Check 2 +-- Check 2 - passed +-- Check 1 - passed diff --git a/Tests/RunCMake/try_run/ConfigureLog-test.c b/Tests/RunCMake/try_run/ConfigureLog-test.c new file mode 100644 index 0000000..6a8f125 --- /dev/null +++ b/Tests/RunCMake/try_run/ConfigureLog-test.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +int main() +{ + fprintf(stderr, "Output, with backslash '\\', on stderr!\n"); + fflush(stderr); /* make output deterministic even if stderr is buffered */ + fprintf(stdout, "Output on stdout!\n"); + return 12; +} diff --git a/Tests/RunCMake/try_run/ConfigureLog.cmake b/Tests/RunCMake/try_run/ConfigureLog.cmake new file mode 100644 index 0000000..6635d73 --- /dev/null +++ b/Tests/RunCMake/try_run/ConfigureLog.cmake @@ -0,0 +1,34 @@ +try_run(RUN_RESULT COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-bad.c + LOG_DESCRIPTION "Source that should not compile." + ) + +try_run(RUN_RESULT COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c + NO_LOG + ) + +message(CHECK_START "Check 1") +try_run(RUN_RESULT COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c + LOG_DESCRIPTION "Source that should compile." + ) + +message(CHECK_START "Check 2") +try_run(RUN_RESULT COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c + RUN_OUTPUT_VARIABLE RUN_OUTPUT + ) +if (RUN_RESULT) + message(CHECK_PASS "passed") + message(CHECK_PASS "passed") +else() + message(CHECK_FAIL "failed") + message(CHECK_FAIL "failed") +endif() + +try_run(RUN_RESULT COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c + RUN_OUTPUT_STDOUT_VARIABLE RUN_STDOUT + RUN_OUTPUT_STDERR_VARIABLE RUN_STDERR + ) diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake index dbea089..62e3caf 100644 --- a/Tests/RunCMake/try_run/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) run_cmake(BinDirEmpty) run_cmake(BinDirRelative) run_cmake(NoOutputVariable) +run_cmake(ConfigureLog) set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=old_signature.cmake) include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake) diff --git a/Tests/StringFileTest/StringFile.cxx b/Tests/StringFileTest/StringFile.cxx index c890e8e..073e30c 100644 --- a/Tests/StringFileTest/StringFile.cxx +++ b/Tests/StringFileTest/StringFile.cxx @@ -3,7 +3,7 @@ #include "OutputFile.h" -int main(int, char* []) +int main(int, char*[]) { int res = 0; diff --git a/Tests/SwiftMixLib/CMakeLists.txt b/Tests/SwiftMixLib/CMakeLists.txt index 40d3498..a52fc94 100644 --- a/Tests/SwiftMixLib/CMakeLists.txt +++ b/Tests/SwiftMixLib/CMakeLists.txt @@ -4,3 +4,6 @@ project(SwiftMixLib C CXX Swift) add_library(SwiftMixedLib lib.c lib.cpp lib.swift) add_executable(Swifty main.swift) target_link_libraries(Swifty PUBLIC SwiftMixedLib) + +add_executable(c_main main.c) +target_link_libraries(c_main PUBLIC SwiftMixedLib) diff --git a/Tests/SwiftMixLib/main.c b/Tests/SwiftMixLib/main.c new file mode 100644 index 0000000..6ecf984 --- /dev/null +++ b/Tests/SwiftMixLib/main.c @@ -0,0 +1,3 @@ +int main(int argc, char* argv[]) +{ +} diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt index fa8687d..13cf2b1 100644 --- a/Tests/SwiftOnly/CMakeLists.txt +++ b/Tests/SwiftOnly/CMakeLists.txt @@ -43,3 +43,14 @@ target_link_libraries(N PUBLIC # Dummy to make sure generation works with such targets. add_library(SwiftIface INTERFACE) target_link_libraries(SwiftOnly PRIVATE SwiftIface) + +# @_alwaysEmitIntoClient ensures that the function body is inserted into the +# swiftmodule instead of as a symbol in the binary itself. I'm doing this to +# avoid having to link the executable. There are some flags required in order to +# link an executable into a library that I didn't see CMake emitting for Swift +# on macOS. AEIC is the easiest workaround that still tests this functionality. +# Unfortunately, AEIC was only added recently (~Swift 5.2), so we need to check +# that it is available before using it. +if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 5.2) + add_subdirectory("SwiftPlugin") +endif() diff --git a/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt b/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt new file mode 100644 index 0000000..4069f16 --- /dev/null +++ b/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(main main.swift) +set_target_properties(main PROPERTIES ENABLE_EXPORTS TRUE) + +add_library(plugin plugin.swift) +target_link_libraries(plugin PRIVATE main) diff --git a/Tests/SwiftOnly/SwiftPlugin/main.swift b/Tests/SwiftOnly/SwiftPlugin/main.swift new file mode 100644 index 0000000..f5aac51 --- /dev/null +++ b/Tests/SwiftOnly/SwiftPlugin/main.swift @@ -0,0 +1,4 @@ +@_alwaysEmitIntoClient +public func exported() -> Int { 32 } + +print(exported()) diff --git a/Tests/SwiftOnly/SwiftPlugin/plugin.swift b/Tests/SwiftOnly/SwiftPlugin/plugin.swift new file mode 100644 index 0000000..e84f248 --- /dev/null +++ b/Tests/SwiftOnly/SwiftPlugin/plugin.swift @@ -0,0 +1,3 @@ +import main + +public func importing() -> Int { main.exported() + 1 } diff --git a/Tests/SystemInformation/CMakeLists.txt b/Tests/SystemInformation/CMakeLists.txt index db54612..9a2c4eb 100644 --- a/Tests/SystemInformation/CMakeLists.txt +++ b/Tests/SystemInformation/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 3.0) project(SystemInformation) -include_directories("This does not exists") +include_directories("This does not exist") get_directory_property(incl INCLUDE_DIRECTORIES) set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${SystemInformation_BINARY_DIR};${SystemInformation_SOURCE_DIR}") diff --git a/Tests/SystemInformation/DumpInformation.cxx b/Tests/SystemInformation/DumpInformation.cxx index 4328675..913e4c4 100644 --- a/Tests/SystemInformation/DumpInformation.cxx +++ b/Tests/SystemInformation/DumpInformation.cxx @@ -53,7 +53,7 @@ void cmDumpInformationPrintFile(const char* name, FILE* fout) } } -int main(int, char* []) +int main(int, char*[]) { const char* files[] = { DumpInformation_BINARY_DIR "/SystemInformation.out", @@ -63,13 +63,9 @@ int main(int, char* []) DumpInformation_BINARY_DIR "/OtherProperties.txt", DumpInformation_BINARY_DIR "/../../Source/cmConfigure.h", DumpInformation_BINARY_DIR "/../../CMakeCache.txt", - DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeOutput.log", - DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeError.log", DumpInformation_BINARY_DIR "/../../Bootstrap.cmk/cmake_bootstrap.log", DumpInformation_BINARY_DIR "/../../Source/cmsys/Configure.hxx", DumpInformation_BINARY_DIR "/../../Source/cmsys/Configure.h", - DumpInformation_BINARY_DIR "/CMakeFiles/CMakeOutput.log", - DumpInformation_BINARY_DIR "/CMakeFiles/CMakeError.log", 0 }; diff --git a/Tests/UseSWIG/BasicPerl/CMakeLists.txt b/Tests/UseSWIG/BasicPerl/CMakeLists.txt index 671d529..1151739 100644 --- a/Tests/UseSWIG/BasicPerl/CMakeLists.txt +++ b/Tests/UseSWIG/BasicPerl/CMakeLists.txt @@ -4,7 +4,9 @@ project(TestBasicPerl CXX) include(CTest) -set(language "perl") +if(NOT DEFINED language) + set(language "perl") +endif() include (../BasicConfiguration.cmake) diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt index c76e8a0..7c4925e 100644 --- a/Tests/UseSWIG/CMakeLists.txt +++ b/Tests/UseSWIG/CMakeLists.txt @@ -20,6 +20,16 @@ add_test(NAME UseSWIG.LegacyPerl COMMAND --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) +add_test(NAME UseSWIG.LegacyPerl5 COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/LegacyPerl" + "${CMake_BINARY_DIR}/Tests/UseSWIG/LegacyPerl5" + ${build_generator_args} + --build-project TestLegacyPerl + --build-options ${build_options} -Dlanguage=perl5 + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) include(CheckLanguage) check_language(CSharp) @@ -66,6 +76,16 @@ add_test(NAME UseSWIG.BasicPerl COMMAND --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) +add_test(NAME UseSWIG.BasicPerl5 COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/BasicPerl" + "${CMake_BINARY_DIR}/Tests/UseSWIG/BasicPerl5" + ${build_generator_args} + --build-project TestBasicPerl + --build-options ${build_options} -Dlanguage=perl5 + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) if(SWIG_FOUND AND NOT SWIG_VERSION VERSION_LESS "4.0.2" AND CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode|Visual Studio (1[1-9]|[2-9][0-9])") add_test(NAME UseSWIG.Depfile.BasicPython COMMAND @@ -89,6 +109,16 @@ if(SWIG_FOUND AND NOT SWIG_VERSION VERSION_LESS "4.0.2" --build-options ${build_options} -DSWIG_USE_SWIG_DEPENDENCIES=ON --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + add_test(NAME UseSWIG.Depfile.BasicPerl5 COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/BasicPerl" + "${CMake_BINARY_DIR}/Tests/UseSWIG/BasicPerl5.Depfile" + ${build_generator_args} + --build-project TestBasicPerl + --build-options ${build_options} -DSWIG_USE_SWIG_DEPENDENCIES=ON -Dlanguage=perl5 + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) endif() if (CMake_TEST_UseSWIG_Fortran) diff --git a/Tests/UseSWIG/LegacyPerl/CMakeLists.txt b/Tests/UseSWIG/LegacyPerl/CMakeLists.txt index 90d92f4..be0b465 100644 --- a/Tests/UseSWIG/LegacyPerl/CMakeLists.txt +++ b/Tests/UseSWIG/LegacyPerl/CMakeLists.txt @@ -4,7 +4,9 @@ project(TestLegacyPerl CXX) include(CTest) -set(language "perl") +if(NOT DEFINED language) + set(language "perl") +endif() include (../LegacyConfiguration.cmake) diff --git a/Tests/VSMARMASM/CMakeLists.txt b/Tests/VSMARMASM/CMakeLists.txt new file mode 100644 index 0000000..85740de --- /dev/null +++ b/Tests/VSMARMASM/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.25) # Enable CMP0141 +project(VSMARMASM C ASM_MARMASM) +add_executable(VSMARMASM main.c foo.asm) +target_compile_options(VSMARMASM PRIVATE + "$<$<COMPILE_LANGUAGE:ASM_MARMASM>:SHELL:-predefine \"zero SETA 0\">" + ) diff --git a/Tests/VSMARMASM/foo.asm b/Tests/VSMARMASM/foo.asm new file mode 100644 index 0000000..44656ef --- /dev/null +++ b/Tests/VSMARMASM/foo.asm @@ -0,0 +1,10 @@ + AREA |.text|, CODE + + EXPORT foo + +foo PROC + mov w0, #zero + ret + ENDP + + END diff --git a/Tests/VSMARMASM/main.c b/Tests/VSMARMASM/main.c new file mode 100644 index 0000000..18ddb78 --- /dev/null +++ b/Tests/VSMARMASM/main.c @@ -0,0 +1,5 @@ +extern int foo(void); +int main(void) +{ + return foo(); +} diff --git a/Tests/VSMASM/CMakeLists.txt b/Tests/VSMASM/CMakeLists.txt index 603a43b..49bd24a 100644 --- a/Tests/VSMASM/CMakeLists.txt +++ b/Tests/VSMASM/CMakeLists.txt @@ -8,3 +8,5 @@ else() endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) add_executable(VSMASM main.c foo.asm) +target_compile_definitions(VSMASM PUBLIC DEF_FOO) +target_compile_options(VSMASM PUBLIC -DDEF_BAR) diff --git a/Tests/VSMASM/foo.asm b/Tests/VSMASM/foo.asm index 51cb969..97bdd1a 100644 --- a/Tests/VSMASM/foo.asm +++ b/Tests/VSMASM/foo.asm @@ -1,3 +1,9 @@ +ifndef DEF_FOO +.err <DEF_FOO incorrectly not defined> +endif +ifndef DEF_BAR +.err <DEF_BAR incorrectly not defined> +endif ifndef TESTx64 .386 .model flat, c diff --git a/Tests/VSNASM/CMakeLists.txt b/Tests/VSNASM/CMakeLists.txt index 821d022..a038ddd 100644 --- a/Tests/VSNASM/CMakeLists.txt +++ b/Tests/VSNASM/CMakeLists.txt @@ -18,3 +18,5 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm" "${BAR_ASM_CONTENTS}") include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) add_executable(VSNASM main.c foo.asm "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm") +target_compile_definitions(VSNASM PRIVATE DEF_FOO) +target_compile_options(VSNASM PRIVATE "$<$<COMPILE_LANGUAGE:ASM_NASM>:-t>") diff --git a/Tests/VSNASM/foo.asm b/Tests/VSNASM/foo.asm index aba0673..cbfe14b 100644 --- a/Tests/VSNASM/foo.asm +++ b/Tests/VSNASM/foo.asm @@ -1,7 +1,11 @@ +%ifndef DEF_FOO +%error "DEF_FOO incorrectly not defined" +%endif section .text %ifdef TEST2x64 global foo %else global _foo %endif -%include "foo-proc.asm" +;TASM compatibility mode allows 'include' instead of '%include' +include "foo-proc.asm" diff --git a/Tests/VSWinStorePhone/Direct3DApp1/.gitattributes b/Tests/VSWinStorePhone/Direct3DApp1/.gitattributes index 78a5469..601c97b 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/.gitattributes +++ b/Tests/VSWinStorePhone/Direct3DApp1/.gitattributes @@ -1 +1 @@ -Direct3DApp1.cpp -format.clang-format-6.0 +Direct3DApp1.cpp -format.clang-format diff --git a/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h b/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h index 56bd398..ccbbcda 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h +++ b/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h @@ -52,13 +52,19 @@ public: // Update(). property float Total { - float get() { return m_total; } + float get() + { + return m_total; + } } // Duration in seconds between the previous two calls to Update(). property float Delta { - float get() { return m_delta; } + float get() + { + return m_delta; + } } private: diff --git a/Tests/Wrapping/Wrap.c b/Tests/Wrapping/Wrap.c index e8fb8a5..30ac173 100644 --- a/Tests/Wrapping/Wrap.c +++ b/Tests/Wrapping/Wrap.c @@ -1,7 +1,8 @@ #include <stdio.h> #ifdef __CLASSIC_C__ -int main(argc, argv) int argc; +int main(argc, argv) +int argc; char** argv; #else int main(int argc, const char* argv[]) |