diff options
Diffstat (limited to 'Tests')
780 files changed, 7339 insertions, 927 deletions
diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index 1b7e57d..8f6b355 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -24,6 +24,12 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND elseif("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") list(APPEND C_FLAGS -arch arm64) endif() + if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + # Just in case the user is passing -flto, we need to pass -fno-lto to + # clang when generating the assembly file, or else clang will generate + # LLVM IR instead of assembly. + list(APPEND C_FLAGS -fno-lto) + endif() # Clang on OS X, and perhaps other compilers, do not support -g # for both generating and assembling, so drop it from generating. list(REMOVE_ITEM C_FLAGS -g) diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 1d45162..612d4b4 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -47,12 +47,10 @@ if(WIN32) list(APPEND CMakeLib_TESTS testVisualStudioSlnParser.cxx ) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testVisualStudioSlnParser.h.in - ${CMAKE_CURRENT_BINARY_DIR}/testVisualStudioSlnParser.h @ONLY) + configure_file(testVisualStudioSlnParser.h.in testVisualStudioSlnParser.h @ONLY) endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testXMLParser.h.in - ${CMAKE_CURRENT_BINARY_DIR}/testXMLParser.h @ONLY) +configure_file(testXMLParser.h.in testXMLParser.h @ONLY) create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS}) add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS}) diff --git a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt index 4bef6c5..b4bc921 100644 --- a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt +++ b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt @@ -1,6 +1,6 @@ -foreach (_retval 0 1) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY) -endforeach () +foreach(_retval IN ITEMS 0 1) + configure_file(memtester.cxx.in ret${_retval}.cxx @ONLY) +endforeach() include_directories(${CMake_SOURCE_DIR}/Source ${CMake_BINARY_DIR}/Source) diff --git a/Tests/CMakeLib/testArgumentParser.cxx b/Tests/CMakeLib/testArgumentParser.cxx index 965690c..e044794 100644 --- a/Tests/CMakeLib/testArgumentParser.cxx +++ b/Tests/CMakeLib/testArgumentParser.cxx @@ -1,57 +1,182 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ +#include <functional> #include <initializer_list> #include <iostream> +#include <map> #include <string> +#include <utility> #include <vector> +#include <cm/optional> #include <cm/string_view> #include <cmext/string_view> #include "cmArgumentParser.h" +#include "cmArgumentParserTypes.h" namespace { -struct Result +struct Result : public ArgumentParser::ParseResult { bool Option1 = false; bool Option2 = false; std::string String1; - std::string String2; + cm::optional<std::string> String2; + cm::optional<std::string> String3; + ArgumentParser::Maybe<std::string> String4; + ArgumentParser::NonEmpty<std::string> String5; + ArgumentParser::NonEmpty<std::string> String6; - std::vector<std::string> List1; - std::vector<std::string> List2; - std::vector<std::string> List3; + ArgumentParser::NonEmpty<std::vector<std::string>> List1; + ArgumentParser::NonEmpty<std::vector<std::string>> List2; + cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> List3; + cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> List4; + cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> List5; + cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> List6; std::vector<std::vector<std::string>> Multi1; std::vector<std::vector<std::string>> Multi2; - std::vector<std::vector<std::string>> Multi3; + cm::optional<std::vector<std::vector<std::string>>> Multi3; + cm::optional<std::vector<std::vector<std::string>>> Multi4; + + cm::optional<std::string> Pos0; + cm::optional<std::string> Pos1; + cm::optional<std::string> Pos2; + + bool Func0_ = false; + ArgumentParser::Continue Func0(cm::string_view) + { + Func0_ = true; + return ArgumentParser::Continue::No; + } + + std::string Func1_; + ArgumentParser::Continue Func1(cm::string_view arg) + { + Func1_ = std::string(arg); + return ArgumentParser::Continue::No; + } + + std::map<std::string, std::vector<std::string>> Func2_; + ArgumentParser::Continue Func2(cm::string_view key, cm::string_view arg) + { + Func2_[std::string(key)].emplace_back(arg); + return key == "FUNC_2b" ? ArgumentParser::Continue::Yes + : ArgumentParser::Continue::No; + } + + std::vector<std::string> Func3_; + ArgumentParser::Continue Func3(cm::string_view arg) + { + Func3_.emplace_back(arg); + return ArgumentParser::Continue::Yes; + } + + std::map<std::string, std::vector<std::string>> Func4_; + ArgumentParser::Continue Func4(cm::string_view key, cm::string_view arg) + { + Func4_[std::string(key)].emplace_back(arg); + return key == "FUNC_4b" ? ArgumentParser::Continue::Yes + : ArgumentParser::Continue::No; + } + + ArgumentParser::Maybe<std::string> UnboundMaybe{ 'u', 'n', 'b', 'o', + 'u', 'n', 'd' }; + ArgumentParser::MaybeEmpty<std::vector<std::string>> UnboundMaybeEmpty{ + 1, "unbound" + }; + ArgumentParser::NonEmpty<std::vector<std::string>> UnboundNonEmpty{ + 1, "unbound" + }; + ArgumentParser::NonEmpty<std::string> UnboundNonEmptyStr{ 'u', 'n', 'b', 'o', + 'u', 'n', 'd' }; + + std::vector<cm::string_view> ParsedKeywords; }; std::initializer_list<cm::string_view> const args = { /* clang-format off */ + "pos0", // position index 0 "OPTION_1", // option + "pos2", // position index 2, ignored because after keyword + // "OPTION_2", // option that is not present "STRING_1", // string arg missing value - "STRING_2", "foo", "bar", // string arg + unparsed value + "STRING_2", "foo", "bar", // string arg + unparsed value, presence captured + // "STRING_3", // string arg that is not present + "STRING_4", // string arg allowed to be missing value + "STRING_5", "foo", // string arg that is not empty + "STRING_6", "", // string arg that is empty "LIST_1", // list arg missing values "LIST_2", "foo", "bar", // list arg with 2 elems "LIST_3", "bar", // list arg ... "LIST_3", "foo", // ... with continuation + "LIST_4", // list arg missing values, presence captured + // "LIST_5", // list arg that is not present + "LIST_6", // list arg allowed to be empty "MULTI_2", // multi list with 0 lists "MULTI_3", "foo", "bar", // multi list with first list with two elems "MULTI_3", "bar", "foo", // multi list with second list with two elems + // "MULTI_4", // multi list arg that is not present + "FUNC_0", // callback arg missing value + "FUNC_1", "foo", "ign1", // callback with one arg + unparsed value + "FUNC_2a", "foo", "ign2", // callback with keyword-dependent arg count + "FUNC_2b", "bar", "zot", // callback with keyword-dependent arg count + "FUNC_3", "foo", "bar", // callback with list arg ... + "FUNC_4a", "foo", "ign4", // callback with keyword-dependent arg count + "FUNC_4b", "bar", "zot", // callback with keyword-dependent arg count /* clang-format on */ }; bool verifyResult(Result const& result, - std::vector<std::string> const& unparsedArguments, - std::vector<std::string> const& keywordsMissingValue) + std::vector<std::string> const& unparsedArguments) { static std::vector<std::string> const foobar = { "foo", "bar" }; static std::vector<std::string> const barfoo = { "bar", "foo" }; - static std::vector<std::string> const missing = { "STRING_1", "LIST_1" }; + static std::vector<std::string> const unbound = { "unbound" }; + static std::vector<cm::string_view> const parsedKeywords = { + /* clang-format off */ + "OPTION_1", + "STRING_1", + "STRING_2", + "STRING_4", + "STRING_5", + "STRING_6", + "LIST_1", + "LIST_2", + "LIST_3", + "LIST_3", + "LIST_4", + "LIST_6", + "MULTI_2", + "MULTI_3", + "MULTI_3", + "FUNC_0", + "FUNC_1", + "FUNC_2a", + "FUNC_2b", + "FUNC_3", + "FUNC_4a", + "FUNC_4b", + /* clang-format on */ + }; + static std::map<std::string, std::vector<std::string>> const func2map = { + { "FUNC_2a", { "foo" } }, { "FUNC_2b", { "bar", "zot" } } + }; + static std::map<std::string, std::vector<std::string>> const func4map = { + { "FUNC_4a", { "foo" } }, { "FUNC_4b", { "bar", "zot" } } + }; + static std::map<cm::string_view, std::string> const keywordErrors = { + { "STRING_1"_s, " missing required value\n" }, + { "STRING_6"_s, " empty string not allowed\n" }, + { "LIST_1"_s, " missing required value\n" }, + { "LIST_4"_s, " missing required value\n" }, + { "FUNC_0"_s, " missing required value\n" } + }; + static std::vector<std::string> const unparsed = { "pos2", "bar", "ign1", + "ign2", "ign4" }; #define ASSERT_TRUE(x) \ do { \ @@ -61,26 +186,63 @@ bool verifyResult(Result const& result, } \ } while (false) + ASSERT_TRUE(!result); + ASSERT_TRUE(result.Option1); ASSERT_TRUE(!result.Option2); ASSERT_TRUE(result.String1.empty()); - ASSERT_TRUE(result.String2 == "foo"); + ASSERT_TRUE(result.String2); + ASSERT_TRUE(*result.String2 == "foo"); + ASSERT_TRUE(!result.String3); + ASSERT_TRUE(result.String4.empty()); + ASSERT_TRUE(result.String5 == "foo"); + ASSERT_TRUE(result.String6.empty()); ASSERT_TRUE(result.List1.empty()); ASSERT_TRUE(result.List2 == foobar); - ASSERT_TRUE(result.List3 == barfoo); + ASSERT_TRUE(result.List3); + ASSERT_TRUE(*result.List3 == barfoo); + ASSERT_TRUE(result.List4); + ASSERT_TRUE(result.List4->empty()); + ASSERT_TRUE(!result.List5); + ASSERT_TRUE(result.List6); + ASSERT_TRUE(result.List6->empty()); ASSERT_TRUE(result.Multi1.empty()); ASSERT_TRUE(result.Multi2.size() == 1); ASSERT_TRUE(result.Multi2[0].empty()); - ASSERT_TRUE(result.Multi3.size() == 2); - ASSERT_TRUE(result.Multi3[0] == foobar); - ASSERT_TRUE(result.Multi3[1] == barfoo); + ASSERT_TRUE(result.Multi3); + ASSERT_TRUE((*result.Multi3).size() == 2); + ASSERT_TRUE((*result.Multi3)[0] == foobar); + ASSERT_TRUE((*result.Multi3)[1] == barfoo); + ASSERT_TRUE(!result.Multi4); + + ASSERT_TRUE(result.Pos0 == "pos0"); + ASSERT_TRUE(!result.Pos1); + ASSERT_TRUE(!result.Pos2); + + ASSERT_TRUE(result.Func0_ == false); + ASSERT_TRUE(result.Func1_ == "foo"); + ASSERT_TRUE(result.Func2_ == func2map); + ASSERT_TRUE(result.Func3_ == foobar); + ASSERT_TRUE(result.Func4_ == func4map); + + ASSERT_TRUE(unparsedArguments == unparsed); - ASSERT_TRUE(unparsedArguments.size() == 1); - ASSERT_TRUE(unparsedArguments[0] == "bar"); - ASSERT_TRUE(keywordsMissingValue == missing); + ASSERT_TRUE(result.UnboundMaybe == "unbound"); + ASSERT_TRUE(result.UnboundMaybeEmpty == unbound); + ASSERT_TRUE(result.UnboundNonEmpty == unbound); + ASSERT_TRUE(result.UnboundNonEmptyStr == "unbound"); + + ASSERT_TRUE(result.ParsedKeywords == parsedKeywords); + + ASSERT_TRUE(result.GetKeywordErrors().size() == keywordErrors.size()); + for (auto const& ke : result.GetKeywordErrors()) { + auto const ki = keywordErrors.find(ke.first); + ASSERT_TRUE(ki != keywordErrors.end()); + ASSERT_TRUE(ke.second == ki->second); + } return true; } @@ -89,45 +251,116 @@ bool testArgumentParserDynamic() { Result result; std::vector<std::string> unparsedArguments; - std::vector<std::string> keywordsMissingValue; - - cmArgumentParser<void>{} - .Bind("OPTION_1"_s, result.Option1) - .Bind("OPTION_2"_s, result.Option2) - .Bind("STRING_1"_s, result.String1) - .Bind("STRING_2"_s, result.String2) - .Bind("LIST_1"_s, result.List1) - .Bind("LIST_2"_s, result.List2) - .Bind("LIST_3"_s, result.List3) - .Bind("MULTI_1"_s, result.Multi1) - .Bind("MULTI_2"_s, result.Multi2) - .Bind("MULTI_3"_s, result.Multi3) - .Parse(args, &unparsedArguments, &keywordsMissingValue); - - return verifyResult(result, unparsedArguments, keywordsMissingValue); + + std::function<ArgumentParser::Continue(cm::string_view, cm::string_view)> + func4 = [&result](cm::string_view key, + cm::string_view arg) -> ArgumentParser::Continue { + return result.Func4(key, arg); + }; + + static_cast<ArgumentParser::ParseResult&>(result) = + cmArgumentParser<void>{} + .Bind(0, result.Pos0) + .Bind(1, result.Pos1) + .Bind(2, result.Pos2) + .Bind("OPTION_1"_s, result.Option1) + .Bind("OPTION_2"_s, result.Option2) + .Bind("STRING_1"_s, result.String1) + .Bind("STRING_2"_s, result.String2) + .Bind("STRING_3"_s, result.String3) + .Bind("STRING_4"_s, result.String4) + .Bind("STRING_5"_s, result.String5) + .Bind("STRING_6"_s, result.String6) + .Bind("LIST_1"_s, result.List1) + .Bind("LIST_2"_s, result.List2) + .Bind("LIST_3"_s, result.List3) + .Bind("LIST_4"_s, result.List4) + .Bind("LIST_5"_s, result.List5) + .Bind("LIST_6"_s, result.List6) + .Bind("MULTI_1"_s, result.Multi1) + .Bind("MULTI_2"_s, result.Multi2) + .Bind("MULTI_3"_s, result.Multi3) + .Bind("MULTI_4"_s, result.Multi4) + .Bind("FUNC_0"_s, + [&result](cm::string_view arg) -> ArgumentParser::Continue { + return result.Func0(arg); + }) + .Bind("FUNC_1"_s, + [&result](cm::string_view arg) -> ArgumentParser::Continue { + return result.Func1(arg); + }) + .Bind("FUNC_2a"_s, + [&result](cm::string_view key, cm::string_view arg) + -> ArgumentParser::Continue { return result.Func2(key, arg); }) + .Bind("FUNC_2b"_s, + [&result](cm::string_view key, cm::string_view arg) + -> ArgumentParser::Continue { return result.Func2(key, arg); }) + .Bind("FUNC_3"_s, + [&result](cm::string_view arg) -> ArgumentParser::Continue { + return result.Func3(arg); + }) + .Bind("FUNC_4a"_s, func4) + .Bind("FUNC_4b"_s, func4) + .BindParsedKeywords(result.ParsedKeywords) + .Parse(args, &unparsedArguments); + + return verifyResult(result, unparsedArguments); } +static auto const parserStaticFunc4 = + [](Result& result, cm::string_view key, + cm::string_view arg) -> ArgumentParser::Continue { + return result.Func4(key, arg); +}; +static auto const parserStatic = // + cmArgumentParser<Result>{} + .Bind(0, &Result::Pos0) + .Bind(1, &Result::Pos1) + .Bind(2, &Result::Pos2) + .Bind("OPTION_1"_s, &Result::Option1) + .Bind("OPTION_2"_s, &Result::Option2) + .Bind("STRING_1"_s, &Result::String1) + .Bind("STRING_2"_s, &Result::String2) + .Bind("STRING_3"_s, &Result::String3) + .Bind("STRING_4"_s, &Result::String4) + .Bind("STRING_5"_s, &Result::String5) + .Bind("STRING_6"_s, &Result::String6) + .Bind("LIST_1"_s, &Result::List1) + .Bind("LIST_2"_s, &Result::List2) + .Bind("LIST_3"_s, &Result::List3) + .Bind("LIST_4"_s, &Result::List4) + .Bind("LIST_5"_s, &Result::List5) + .Bind("LIST_6"_s, &Result::List6) + .Bind("MULTI_1"_s, &Result::Multi1) + .Bind("MULTI_2"_s, &Result::Multi2) + .Bind("MULTI_3"_s, &Result::Multi3) + .Bind("MULTI_4"_s, &Result::Multi4) + .Bind("FUNC_0"_s, &Result::Func0) + .Bind("FUNC_1"_s, &Result::Func1) + .Bind("FUNC_2a"_s, &Result::Func2) + .Bind("FUNC_2b"_s, &Result::Func2) + .Bind("FUNC_3"_s, + [](Result& result, cm::string_view arg) -> ArgumentParser::Continue { + return result.Func3(arg); + }) + .Bind("FUNC_4a"_s, parserStaticFunc4) + .Bind("FUNC_4b"_s, parserStaticFunc4) + .BindParsedKeywords(&Result::ParsedKeywords) + /* keep semicolon on own line */; + bool testArgumentParserStatic() { - static auto const parser = // - cmArgumentParser<Result>{} - .Bind("OPTION_1"_s, &Result::Option1) - .Bind("OPTION_2"_s, &Result::Option2) - .Bind("STRING_1"_s, &Result::String1) - .Bind("STRING_2"_s, &Result::String2) - .Bind("LIST_1"_s, &Result::List1) - .Bind("LIST_2"_s, &Result::List2) - .Bind("LIST_3"_s, &Result::List3) - .Bind("MULTI_1"_s, &Result::Multi1) - .Bind("MULTI_2"_s, &Result::Multi2) - .Bind("MULTI_3"_s, &Result::Multi3); - std::vector<std::string> unparsedArguments; - std::vector<std::string> keywordsMissingValue; - Result const result = - parser.Parse(args, &unparsedArguments, &keywordsMissingValue); + Result const result = parserStatic.Parse(args, &unparsedArguments); + return verifyResult(result, unparsedArguments); +} - return verifyResult(result, unparsedArguments, keywordsMissingValue); +bool testArgumentParserStaticBool() +{ + std::vector<std::string> unparsedArguments; + Result result; + ASSERT_TRUE(parserStatic.Parse(result, args, &unparsedArguments) == false); + return verifyResult(result, unparsedArguments); } } // namespace @@ -144,5 +377,10 @@ int testArgumentParser(int /*unused*/, char* /*unused*/ []) return -1; } + if (!testArgumentParserStaticBool()) { + std::cout << "While executing testArgumentParserStaticBool().\n"; + return -1; + } + return 0; } diff --git a/Tests/CMakeLib/testCMExtEnumSet.cxx b/Tests/CMakeLib/testCMExtEnumSet.cxx index 64c437b..dbb0a54 100644 --- a/Tests/CMakeLib/testCMExtEnumSet.cxx +++ b/Tests/CMakeLib/testCMExtEnumSet.cxx @@ -191,6 +191,15 @@ void testEdition() ++failed; } } + { + cm::enum_set<Test> testSet1; + cm::enum_set<Test> testSet2{ Test::A, Test::C, Test::B }; + + testSet1 = { Test::A, Test::C, Test::B }; + if (testSet1.size() != 3 || testSet1 != testSet2) { + ++failed; + } + } } } diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx index c2706c1..1e6b611 100644 --- a/Tests/CMakeLib/testStringAlgorithms.cxx +++ b/Tests/CMakeLib/testStringAlgorithms.cxx @@ -227,6 +227,41 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ []) } // ---------------------------------------------------------------------- + // Test cmStrToLongLong + { + long long value; + assert_ok(cmStrToLongLong("1", &value) && value == 1, + "cmStrToLongLong parses a positive decimal integer."); + assert_ok(cmStrToLongLong(" 1", &value) && value == 1, + "cmStrToLongLong parses a decimal integer after whitespace."); + + assert_ok(cmStrToLongLong("-1", &value) && value == -1, + "cmStrToLongLong parses a negative decimal integer."); + assert_ok( + cmStrToLongLong(" -1", &value) && value == -1, + "cmStrToLongLong parses a negative decimal integer after whitespace."); + + assert_ok(!cmStrToLongLong("1x", &value), + "cmStrToLongLong rejects trailing content."); + } + + // ---------------------------------------------------------------------- + // Test cmStrToULongLong + { + unsigned long long value; + assert_ok(cmStrToULongLong("1", &value) && value == 1, + "cmStrToULongLong parses a decimal integer."); + assert_ok(cmStrToULongLong(" 1", &value) && value == 1, + "cmStrToULongLong parses a decimal integer after whitespace."); + assert_ok(!cmStrToULongLong("-1", &value), + "cmStrToULongLong rejects a negative number."); + assert_ok(!cmStrToULongLong(" -1", &value), + "cmStrToULongLong rejects a negative number after whitespace."); + assert_ok(!cmStrToULongLong("1x", &value), + "cmStrToULongLong rejects trailing content."); + } + + // ---------------------------------------------------------------------- // Test cmStrLen { constexpr auto len = cmStrLen("Hello world!"); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 3e3447f..a58c7e9 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -89,7 +89,7 @@ if(BUILD_TESTING) endif() endif() - set(MAKE_IS_GNU ) + set(MAKE_IS_GNU) if(CMAKE_MAKE_PROGRAM MATCHES make) execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) @@ -101,7 +101,7 @@ if(BUILD_TESTING) endif() # some old versions of make simply cannot handle spaces in paths - if (MAKE_IS_GNU OR + if(MAKE_IS_GNU OR CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland|Ninja") set(MAKE_SUPPORTS_SPACES 1) @@ -181,7 +181,7 @@ if(BUILD_TESTING) ERROR_VARIABLE my_err) string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}") list(LENGTH sdk_list sdk_list_len) - if (${sdk_list_len} GREATER 1) + if(${sdk_list_len} GREATER 1) list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name endif() @@ -205,7 +205,7 @@ if(BUILD_TESTING) select_wince_sdk(reg_wince wince_sdk) set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") set(reg_nasm "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]") - foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm) + foreach(reg IN ITEMS vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm) get_filename_component(r "${reg_${reg}}" ABSOLUTE) if(IS_DIRECTORY "${r}" AND NOT "${r}" STREQUAL "/registry") set(${reg} 1) @@ -227,7 +227,7 @@ if(BUILD_TESTING) set(vs_versions vs15) endif() endif() - foreach(info ${vs_versions}) + foreach(info IN LISTS vs_versions) cmake_host_system_information(RESULT found QUERY "${info_${info}}") if(found) set(${info} 1) @@ -287,12 +287,12 @@ if(BUILD_TESTING) "Should the long tests be run (such as Bootstrap)." ON) mark_as_advanced(CMAKE_RUN_LONG_TESTS) - if (CMAKE_RUN_LONG_TESTS) + if(CMAKE_RUN_LONG_TESTS) option(CTEST_TEST_CTEST "Should the tests that run a full sub ctest process be run?" OFF) mark_as_advanced(CTEST_TEST_CTEST) - endif () + endif() option(CTEST_TEST_CPACK "Should the tests that use '--build-target package' be run?" @@ -367,9 +367,9 @@ if(BUILD_TESTING) if(CMake_TEST_RESOURCES) ADD_TEST_MACRO(VSResource VSResource) - if (CMAKE_GENERATOR MATCHES "Ninja") + if(CMAKE_GENERATOR MATCHES "Ninja") add_test_macro(VSResourceNinjaForceRSP VSResourceNinjaForceRSP) - endif () + endif() endif() if(_isMultiConfig) set(MSManifest_CTEST_OPTIONS -C $<CONFIGURATION>) @@ -394,6 +394,9 @@ if(BUILD_TESTING) if(CMake_TEST_XCODE_SWIFT) ADD_TEST_MACRO(SwiftMix SwiftMix) endif() + if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 5.1) + ADD_TEST_MACRO(SwiftMixLib Swifty) + endif() endif() if(CMAKE_Fortran_COMPILER) ADD_TEST_MACRO(FortranOnly FortranOnly) @@ -431,7 +434,7 @@ if(BUILD_TESTING) if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") ADD_TEST_MACRO(CSharpOnly CSharpOnly) - if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + if(NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") ADD_TEST_MACRO(CSharpLinkToCxx CSharpLinkToCxx) ADD_TEST_MACRO(CSharpLinkFromCxx CSharpLinkFromCxx) endif() @@ -499,7 +502,7 @@ if(BUILD_TESTING) endif() ADD_TEST_MACRO(SourcesProperty SourcesProperty) ADD_TEST_MACRO(SourceFileProperty SourceFileProperty) - if (NOT CMAKE_GENERATOR STREQUAL "Xcode") + if(NOT CMAKE_GENERATOR STREQUAL "Xcode") ADD_TEST_MACRO(SourceFileIncludeDirProperty SourceFileIncludeDirProperty) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "LCC" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" @@ -618,6 +621,11 @@ if(BUILD_TESTING) set(Module.CheckIPOSupported-CXX_BUILD_OPTIONS -DCMake_TEST_IPO_WORKS_CXX=${CMake_TEST_IPO_WORKS_CXX}) ADD_TEST_MACRO(Module.CheckIPOSupported-CXX CheckIPOSupported-CXX) + if(CMake_TEST_CUDA) + ADD_TEST_MACRO(Module.CheckIPOSupported-CUDA CheckIPOSupported-CUDA) + set_property(TEST Module.CheckIPOSupported-CUDA APPEND PROPERTY LABELS "CUDA") + endif() + if(CMAKE_Fortran_COMPILER) set(Module.CheckIPOSupported-Fortran_BUILD_OPTIONS -DCMake_TEST_IPO_WORKS_Fortran=${CMake_TEST_IPO_WORKS_Fortran}) ADD_TEST_MACRO(Module.CheckIPOSupported-Fortran CheckIPOSupported-Fortran) @@ -641,11 +649,11 @@ if(BUILD_TESTING) ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader) - if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC") + if(APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC") include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-fPIE run_pic_test) else() - if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" + if(CMAKE_CXX_COMPILER_ID MATCHES "PGI" OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(run_pic_test 0) @@ -654,7 +662,7 @@ if(BUILD_TESTING) endif() endif() - if (run_pic_test) + if(run_pic_test) ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets) endif() @@ -725,13 +733,15 @@ if(BUILD_TESTING) # mainly it tests that cmake doesn't crash when generating these project files. if(CMAKE_GENERATOR MATCHES "^(Unix Makefiles|Ninja)$" AND NOT "${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - foreach(extraGenerator + foreach( + extraGenerator + IN ITEMS "CodeBlocks" "CodeLite" "Eclipse CDT4" "Kate" "Sublime Text 2" - ) + ) string(REPLACE " " "" extraGeneratorTestName "Simple_${extraGenerator}Generator") add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND} --build-and-test @@ -786,7 +796,7 @@ if(BUILD_TESTING) --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo" --test-command foo ) - set_tests_properties ( SubProject-Stage2 PROPERTIES DEPENDS SubProject) + set_tests_properties(SubProject-Stage2 PROPERTIES DEPENDS SubProject) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject") endif() @@ -1056,8 +1066,11 @@ if(BUILD_TESTING) endif() endif() if(NSIS_MAKENSIS_EXECUTABLE) - set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} - -DCPACK_BINARY_NSIS:BOOL=ON) + execute_process(COMMAND ${NSIS_MAKENSIS_EXECUTABLE} "-VERSION" ERROR_QUIET OUTPUT_QUIET RESULT_VARIABLE NSIS_OK) + if("${NSIS_OK}" STREQUAL "0") + set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} + -DCPACK_BINARY_NSIS:BOOL=ON) + endif() endif() add_test(CPackComponents ${CMAKE_CTEST_COMMAND} @@ -1119,7 +1132,7 @@ if(BUILD_TESTING) set(CPACK_GENERATOR_STRING_${CPackGen} ${CPackGen}) endif() set(CPackRun_CPackGen "-DCPackGen=${CPACK_GENERATOR_STRING_${CPackGen}}") - foreach(CPackComponentWay ${CWAYLST}) + foreach(CPackComponentWay IN LISTS CWAYLST) set(CPackRun_CPackComponentWay "-DCPackComponentWay=${CPackComponentWay}") add_test(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} @@ -1153,7 +1166,6 @@ if(BUILD_TESTING) "components-source" "components-shlibdeps1" "components-depend1" - "components-depend2" "compression") # Run additional tests if dpkg-shlibdeps is available (and is new enough version) find_program(SHLIBDEPS_EXECUTABLE NAMES dpkg-shlibdeps) @@ -1173,6 +1185,11 @@ if(BUILD_TESTING) list(APPEND DEB_CONFIGURATIONS_TO_TEST "shlibdeps-with-private-lib-failure" "shlibdeps-with-private-lib-success") endif() + # Check if distro has symbols or shlibs data + file(GLOB SHLIBS_FILES_EXIST "/var/lib/dpkg/info/*.shlibs" "/var/lib/dpkg/info/*.symbols") + if(SHLIBS_FILES_EXIST) + list(APPEND DEB_CONFIGURATIONS_TO_TEST "components-depend2") + endif() endif() set(CPackGen "DEB") @@ -1338,7 +1355,7 @@ if(BUILD_TESTING) --test-command complex) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig") # because of the registry write these tests depend on each other - set_tests_properties ( complex PROPERTIES DEPENDS complexOneConfig) + set_tests_properties(complex PROPERTIES DEPENDS complexOneConfig) add_test(Environment ${CMAKE_CTEST_COMMAND} --build-and-test @@ -1421,63 +1438,66 @@ if(BUILD_TESTING) endif() # test for Find modules, simple cases - foreach(_mod IN ITEMS - ALSA - Boost - BLAS - BZip2 - CURL - Cups - Doxygen - DevIL - EnvModules - EXPAT - Fontconfig - Freetype - GDAL - GIF - Git - GLEW - GLUT - GnuTLS - GSL - GTK2 - Iconv - ICU - Intl - Jasper - JNI - JPEG - JsonCpp - LAPACK - LibArchive - LibLZMA - LibRHash - Libinput - LibUV - LibXml2 - LibXslt - LTTngUST - ODBC - OpenACC - OpenAL - OpenCL - OpenGL - OpenMP - OpenSSL - MPI - PNG - Patch - PostgreSQL - Protobuf - SDL - SQLite3 - TIFF - Vulkan - X11 - XalanC - XercesC - ) + foreach( + _mod + IN ITEMS + ALSA + BLAS + Boost + BZip2 + Cups + CURL + DevIL + Doxygen + EnvModules + EXPAT + Fontconfig + Freetype + GDAL + GIF + Git + GLEW + GLUT + GnuTLS + GSL + GTK2 + Iconv + ICU + Intl + Jasper + JNI + JPEG + JsonCpp + LAPACK + LibArchive + Libinput + LibLZMA + LibRHash + LibUV + LibXml2 + LibXslt + LTTngUST + MPI + ODBC + OpenACC + OpenAL + OpenCL + OpenGL + OpenMP + OpenSP + OpenSSL + Patch + PNG + PostgreSQL + Protobuf + SDL + SQLite3 + TIFF + Vulkan + X11 + XalanC + XercesC + ) if(CMake_TEST_Find${_mod}) add_subdirectory(Find${_mod}) endif() @@ -1523,7 +1543,7 @@ if(BUILD_TESTING) # CMake_TEST_FindMatlab_MCR_ROOT_DIR: indicates an optional root directory for the MCR, required on Linux if(CMake_TEST_FindMatlab OR CMake_TEST_FindMatlab_ROOT_DIR OR CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR) - set(FindMatlab_additional_test_options ) + set(FindMatlab_additional_test_options) if(CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR) set(FindMatlab_additional_test_options -DIS_MCR=TRUE) endif() @@ -1557,7 +1577,7 @@ if(BUILD_TESTING) endif() set(ExternalProject_BUILD_OPTIONS "") - foreach(vcs CVS SVN GIT HG) + foreach(vcs IN ITEMS CVS SVN GIT HG) if(DEFINED CMake_TEST_ExternalProject_${vcs}) list(APPEND ExternalProject_BUILD_OPTIONS -DEP_TEST_${vcs}=${CMake_TEST_ExternalProject_${vcs}}) endif() @@ -1656,7 +1676,8 @@ if(BUILD_TESTING) RUN_SERIAL 1 TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT} WORKING_DIRECTORY ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate - DEPENDS ExternalProjectUpdateSetup ) + DEPENDS ExternalProjectUpdateSetup + ) execute_process( COMMAND ${CMAKE_COMMAND} @@ -1711,7 +1732,7 @@ if(BUILD_TESTING) function(add_tutorial_test step_name use_mymath tutorial_arg pass_regex) set(tutorial_test_name Tutorial${step_name}) set(tutorial_build_dir "${CMake_BINARY_DIR}/Tests/Tutorial/${step_name}") - if (use_mymath) + if(use_mymath) set(tutorial_build_options "") else() set(tutorial_test_name ${tutorial_test_name}_MYMATH) @@ -1735,7 +1756,7 @@ if(BUILD_TESTING) if(NOT CMake_TEST_EXTERNAL_CMAKE) foreach(STP RANGE 2 12) - if (STP EQUAL 6) + if(STP EQUAL 8) set(pass_regex ".*using log and exp") else() set(pass_regex "The square root of 25 is 5") @@ -1994,11 +2015,11 @@ if(BUILD_TESTING) --test-command Exec2 ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder") - set_tests_properties ( qtwrapping PROPERTIES DEPENDS wrapping) - set_tests_properties ( testdriver1 PROPERTIES DEPENDS qtwrapping) - set_tests_properties ( testdriver2 PROPERTIES DEPENDS testdriver1) - set_tests_properties ( testdriver3 PROPERTIES DEPENDS testdriver2) - set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1) + set_tests_properties(qtwrapping PROPERTIES DEPENDS wrapping) + set_tests_properties(testdriver1 PROPERTIES DEPENDS qtwrapping) + set_tests_properties(testdriver2 PROPERTIES DEPENDS testdriver1) + set_tests_properties(testdriver3 PROPERTIES DEPENDS testdriver2) + set_tests_properties(linkorder2 PROPERTIES DEPENDS linkorder1) # Test static linking on toolchains known to support it. if((CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC") @@ -2030,9 +2051,9 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj" ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces") - endif () + endif() - if (WIN32) + if(WIN32) add_test(SubDir ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDir" @@ -2044,7 +2065,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj" ) - else () + else() add_test(SubDir ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDir" @@ -2056,7 +2077,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o" ) - endif () + endif() list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir") if(MSVC OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_SIMULATE_ID STREQUAL "MSVC")) @@ -2067,6 +2088,15 @@ if(BUILD_TESTING) if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM") ADD_TEST_MACRO(PrecompiledHeader foo) endif() + + set(MSVCDebugInformationFormat_BUILD_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) + if(CMAKE_Fortran_COMPILER) + list(APPEND MSVCDebugInformationFormat_BUILD_OPTIONS -DCMake_TEST_Fortran=1) + endif() + ADD_TEST_MACRO(MSVCDebugInformationFormat) + set_property(TEST MSVCDebugInformationFormat APPEND + PROPERTY LABELS "CUDA") + set(MSVCRuntimeLibrary_BUILD_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) ADD_TEST_MACRO(MSVCRuntimeLibrary) set_property(TEST MSVCRuntimeLibrary APPEND @@ -2080,7 +2110,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(ModuleDefinition example_exe) endif() - if (CMAKE_C_COMPILER_ID MATCHES "Watcom" AND WIN32) + if(CMAKE_C_COMPILER_ID MATCHES "Watcom" AND WIN32) ADD_TEST_MACRO(WatcomRuntimeLibrary) endif() @@ -2116,7 +2146,7 @@ if(BUILD_TESTING) 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_GENERATOR_PLATFORM STREQUAL "ARM64") + AND (NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") ) ADD_TEST_MACRO(VSMASM VSMASM) endif() @@ -2128,7 +2158,7 @@ if(BUILD_TESTING) if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio 9 " AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v90" - AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx) ADD_TEST_MACRO(VSManagedCustomCommand) endif() @@ -2157,7 +2187,7 @@ if(BUILD_TESTING) # The test (and tested property) works with .sln files, so it's skipped when: # * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file set(_last_test "") - foreach(config ${CMAKE_CONFIGURATION_TYPES}) + foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES) add_test(NAME VSExcludeFromDefaultBuild-${config} COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VSExcludeFromDefaultBuild" @@ -2295,7 +2325,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(VSNASM VSNASM) endif() - if (CMake_TEST_GreenHillsMULTI) + if(CMake_TEST_GreenHillsMULTI) macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts) separate_arguments(_ghs_build_opts UNIX_COMMAND ${build_opts}) separate_arguments(_ghs_toolset_extra UNIX_COMMAND ${ghs_toolset_extra}) @@ -2356,7 +2386,7 @@ if(BUILD_TESTING) set(ghs_config_name "__default__") endif() # test integrity build - if (NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity")) + if(NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity")) add_test_GhsMulti(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "") add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "") add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "") @@ -2438,8 +2468,8 @@ if(BUILD_TESTING) add_test_VSAndroid(vs17 "Visual Studio 17 2022" "ARM") endif() - if (APPLE) - if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + if(APPLE) + if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(BundleTestInstallDir "${CMake_BINARY_DIR}/Tests/BundleTest/InstallDirectory") add_test(BundleTest ${CMAKE_CTEST_COMMAND} @@ -2475,8 +2505,8 @@ if(BUILD_TESTING) add_subdirectory(ObjC) add_subdirectory(ObjCXX) - endif () - endif () + endif() + endif() if(APPLE AND CTEST_TEST_CPACK) add_test(BundleGeneratorTest ${CMAKE_CTEST_COMMAND} @@ -2666,7 +2696,10 @@ if(BUILD_TESTING) endif() if(NOT DEFINED CMake_TEST_CTestUpdate_HG AND HG_EXECUTABLE AND (UNIX OR NOT "${HG_EXECUTABLE}" MATCHES "cygwin")) - set(CMake_TEST_CTestUpdate_HG 1) + execute_process(COMMAND "${HG_EXECUTABLE}" --version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE HG_RV) + if(HG_RV EQUAL 0) + set(CMake_TEST_CTestUpdate_HG 1) + endif() endif() if(CMake_TEST_CTestUpdate_HG) if(NOT HG_EXECUTABLE) @@ -3194,24 +3227,24 @@ if(BUILD_TESTING) --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log" ) - if (CMAKE_TESTS_CDASH_SERVER) + if(CMAKE_TESTS_CDASH_SERVER) set(regex "^([^:]+)://([^/]+)(.*)$") - if ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") + if("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") set(protocol "${CMAKE_MATCH_1}") set(server "${CMAKE_MATCH_2}") set(path "${CMAKE_MATCH_3}") - else () + else() set(protocol "http") set(server "open.cdash.org") set(path "") message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...") message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]") - endif () - endif () + endif() + endif() - if (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER) + if(CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER) configure_file("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES) add_test(CTestTest ${CMAKE_CTEST_COMMAND} @@ -3253,19 +3286,19 @@ if(BUILD_TESTING) # these tests take a long time, make sure they have it # if timeouts have not already been set get_test_property(CTestTest TIMEOUT PREVIOUS_TIMEOUT) - if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - set_tests_properties ( CTestTest + if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) + set_tests_properties(CTestTest PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) - endif () + endif() if(NOT CMake_TEST_EXTERNAL_CMAKE) get_test_property(CTestTest2 TIMEOUT PREVIOUS_TIMEOUT) if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - set_tests_properties ( CTestTest2 + set_tests_properties(CTestTest2 PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) endif() endif() - endif () + endif() if(CMake_TEST_EXTERNAL_CMAKE) set(CMAKE_SKIP_BOOTSTRAP_TEST 1) @@ -3301,10 +3334,9 @@ if(BUILD_TESTING) # provide more time for the bootstrap test get_test_property(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT) - if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - set_tests_properties ( BootstrapTest - PROPERTIES TIMEOUT 5400) - endif () + if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) + set_tests_properties(BootstrapTest PROPERTIES TIMEOUT 5400) + endif() endif() if(CMAKE_Fortran_COMPILER) @@ -3368,56 +3400,70 @@ if(BUILD_TESTING) set(JavaExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) ADD_TEST_MACRO(JavaExportImport JavaExportImport) - get_filename_component(JNIPATH ${Java_JAVAC_EXECUTABLE} PATH) + get_filename_component(JAVACPATH ${Java_JAVAC_EXECUTABLE} REALPATH) + get_filename_component(JNIPATH ${JAVACPATH} PATH) find_file(JNI_H jni.h "${JNIPATH}/../include" "${JNIPATH}/../java/include") if(JNI_H AND EXISTS "${JNI_H}") # in case jni.h is a broken symlink file(READ "${JNI_H}" JNI_FILE) if("${JNI_FILE}" MATCHES "JDK1_2") - add_test(NAME Java.Jar COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Java" - "${CMake_BINARY_DIR}/Tests/JavaJar" - ${build_generator_args} - --build-project hello - --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJar/" - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJar") - # For next tests, java tool must have same architecture as toolchain - math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8") execute_process( COMMAND "${Java_JAVA_EXECUTABLE}" -version OUTPUT_VARIABLE _version ERROR_VARIABLE _version RESULT_VARIABLE _result ) - if(_result EQUAL 0 AND _version MATCHES "${_object_mode}-Bit") - ## next test is valid only if Java version is less than 1.10 - if ("${Java_VERSION}" VERSION_LESS 1.10) - add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/JavaJavah" - "${CMake_BINARY_DIR}/Tests/JavaJavah" - ${build_generator_args} - --build-project helloJavah - --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/" - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah") + + # E2K has broken Java RVM before 3.5.2 + if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "e2k" AND _result EQUAL 0) + string(REGEX MATCH "RVM ([0-9.]+)" RVMVER "${_version}") + # Consider empty match a broken version too + if("${CMAKE_MATCH_1}" VERSION_LESS "3.5.2") + set(BROKEN_RVM TRUE) endif() - ## next test is valid only if Java is, at least, version 1.8 - if (NOT "${Java_VERSION}" VERSION_LESS 1.8) - add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders" - "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders" - ${build_generator_args} - --build-project helloJavaNativeHeaders - --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/" - --build-target install - --build-options - "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/Install" - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders") + endif() + + if(NOT BROKEN_RVM) + add_test(NAME Java.Jar COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Java" + "${CMake_BINARY_DIR}/Tests/JavaJar" + ${build_generator_args} + --build-project hello + --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJar/" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJar") + + # For next tests, java tool must have same architecture as toolchain + math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8") + if(_result EQUAL 0 AND _version MATCHES "${_object_mode}-Bit") + ## next test is valid only if Java version is less than 1.10 + if("${Java_VERSION}" VERSION_LESS 1.10) + add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/JavaJavah" + "${CMake_BINARY_DIR}/Tests/JavaJavah" + ${build_generator_args} + --build-project helloJavah + --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah") + endif() + ## next test is valid only if Java is, at least, version 1.8 + if(NOT "${Java_VERSION}" VERSION_LESS 1.8) + add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders" + "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders" + ${build_generator_args} + --build-project helloJavaNativeHeaders + --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/" + --build-target install + --build-options + "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/Install" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders") + endif() endif() endif() endif() @@ -3479,18 +3525,18 @@ if(BUILD_TESTING) endif() if(CMAKE_TEST_PLPLOT_DIR) - add_test(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake ) + add_test(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake) set_tests_properties ( plplot PROPERTIES TIMEOUT 5400) endif() if(CMAKE_TEST_CHICKEN_DIR) - add_test(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake ) - set_tests_properties ( Chicken PROPERTIES TIMEOUT 5400) + add_test(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake) + set_tests_properties(Chicken PROPERTIES TIMEOUT 5400) endif() if(CMAKE_TEST_KDELIBS_ALPHA_1_DIR) - add_test(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake ) - set_tests_properties ( KDELibsAlpha1 PROPERTIES TIMEOUT 5400) + add_test(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake) + set_tests_properties(KDELibsAlpha1 PROPERTIES TIMEOUT 5400) endif() # Define a set of "contract" tests, each activated by a cache entry @@ -3500,11 +3546,7 @@ if(BUILD_TESTING) # The directory should also contain a Configure.cmake file that # sets "CMake_TEST_CONTRACT_<project>_<var>" variables to configure # the code below. - foreach(project - PLplot - Trilinos - VTK - ) + foreach(project IN ITEMS PLplot Trilinos VTK) if(CMake_TEST_CONTRACT_${project}) include(Contracts/${project}/Configure.cmake) ADD_TEST_MACRO(Contracts.${project} ${CMake_TEST_CONTRACT_${project}_RUN_TEST}) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 49a4041..0907d03 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -56,6 +56,15 @@ macro(check_version_string MODULE_NAME VERSION_VAR) if (NOT _exclude_pos EQUAL -1) message(STATUS "excluding check of ${VERSION_VAR}='${${VERSION_VAR}}' due to local configuration") elseif (${MODULE_NAME}_FOUND) + + unset(SKIP_CHECK) + if(${MODULE_NAME} STREQUAL "HG") + execute_process(COMMAND "${HG_EXECUTABLE}" --version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE HG_RV) + if(NOT HG_RV EQUAL 0) + message(WARNING "Broken HG executable detected, skipping") + set(SKIP_CHECK TRUE) + endif() + endif() if (DEFINED ${VERSION_VAR}) message(STATUS "${VERSION_VAR}='${${VERSION_VAR}}'") if (NOT ${VERSION_VAR} MATCHES "^[0-9]") @@ -71,7 +80,9 @@ macro(check_version_string MODULE_NAME VERSION_VAR) message(SEND_ERROR "unexpected: ${VERSION_VAR} is NOT VERSION_GREATER 0") endif() else() - message(SEND_ERROR "${MODULE_NAME}_FOUND is set but version number variable ${VERSION_VAR} is NOT DEFINED") + if(NOT SKIP_CHECK) + message(SEND_ERROR "${MODULE_NAME}_FOUND is set but version number variable ${VERSION_VAR} is NOT DEFINED") + endif() endif() endif () endmacro() diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index 63c234a..7acfcd9 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -13,72 +13,84 @@ set(linux64_gcc_text " /usr/lib/gcc/x86_64-linux-gnu/4.3.3/collect2 --eh-frame-h set(linux64_gcc_libs "gcc;gcc_s;c;gcc;gcc_s") set(linux64_gcc_dirs "/usr/lib/gcc/x86_64-linux-gnu/4.3.3;/usr/lib;/lib;/usr/lib/x86_64-linux-gnu") list(APPEND platforms linux64_gcc) +list(APPEND langs C) # g++ dummy.cxx -v set(linux64_g++_text " /usr/lib/gcc/x86_64-linux-gnu/4.3.3/collect2 --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../.. -L/usr/lib/x86_64-linux-gnu /tmp/ccalRBlq.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crtn.o") set(linux64_g++_libs "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") set(linux64_g++_dirs "/usr/lib/gcc/x86_64-linux-gnu/4.3.3;/usr/lib;/lib;/usr/lib/x86_64-linux-gnu") list(APPEND platforms linux64_g++) +list(APPEND langs CXX) # f95 dummy.f -v set(linux64_f95_text " /usr/lib/gcc/x86_64-linux-gnu/4.3.3/collect2 --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../.. -L/usr/lib/x86_64-linux-gnu /tmp/ccAVcN7N.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crtn.o") set(linux64_f95_libs "gfortranbegin;gfortran;m;gcc_s;gcc;c;gcc_s;gcc") set(linux64_f95_dirs "/usr/lib/gcc/x86_64-linux-gnu/4.3.3;/usr/lib;/lib;/usr/lib/x86_64-linux-gnu") list(APPEND platforms linux64_f95) +list(APPEND langs Fortran) # suncc dummy.c '-#' set(linux64_suncc_text "/usr/bin/ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/sun/sunstudio12/prod/lib/amd64/crti.o /opt/sun/sunstudio12/prod/lib/amd64/crt1x.o /opt/sun/sunstudio12/prod/lib/amd64/values-xa.o dummy.o -Y \"/opt/sun/sunstudio12/prod/lib/amd64:/lib64:/usr/lib64\" -Qy -lc /opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a /opt/sun/sunstudio12/prod/lib/amd64/crtn.o") set(linux64_suncc_libs "c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a") set(linux64_suncc_dirs "/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64") list(APPEND platforms linux64_suncc) +list(APPEND langs C) # sunCC dummy.cxx -v set(linux64_sunCC_text "/opt/sun/sunstudio12/prod/lib/amd64/ld -u __1cH__CimplKcplus_init6F_v_ --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -R/opt/sun/sunstudio12/lib/rw7/amd64:/opt/sun/sunstudio12/lib/amd64:/opt/sun/sunstudio12/rtlibs/amd64:/opt/sun/lib/rtlibs/amd64:/opt/SUNWspro/lib/amd64:/lib64:/usr/lib64 -o a.out /opt/sun/sunstudio12/prod/lib/amd64/crti.o /opt/sun/sunstudio12/prod/lib/amd64/CCrti.o /opt/sun/sunstudio12/prod/lib/amd64/crt1x.o -Y P,/opt/sun/sunstudio12/lib/rw7/amd64:/opt/sun/sunstudio12/lib/amd64:/opt/sun/sunstudio12/rtlibs/amd64:/opt/sun/sunstudio12/prod/lib/rw7/amd64:/opt/sun/sunstudio12/prod/lib/amd64:/lib64:/usr/lib64 dummy.o -lCstd -lCrun -lm -lc /opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a /opt/sun/sunstudio12/prod/lib/amd64/CCrtn.o /opt/sun/sunstudio12/prod/lib/amd64/crtn.o >&/tmp/ld.04973.2.err") set(linux64_sunCC_libs "Cstd;Crun;m;c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a") set(linux64_sunCC_dirs "/opt/sun/sunstudio12/lib/rw7/amd64;/opt/sun/sunstudio12/lib/amd64;/opt/sun/sunstudio12/rtlibs/amd64;/opt/sun/sunstudio12/prod/lib/rw7/amd64;/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64") list(APPEND platforms linux64_sunCC) +list(APPEND langs CXX) # sunf90 dummy.f -v set(linux64_sunf90_text "/usr/bin/ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -R/opt/sun/sunstudio12/lib/amd64:/opt/sun/sunstudio12/rtlibs/amd64:/opt/sun/lib/rtlibs/amd64 -o a.out /opt/sun/sunstudio12/prod/lib/amd64/crti.o /opt/sun/sunstudio12/prod/lib/amd64/crt1x.o /opt/sun/sunstudio12/prod/lib/amd64/values-xi.o -Y P,/opt/sun/sunstudio12/lib/amd64:/opt/sun/sunstudio12/rtlibs/amd64:/opt/sun/sunstudio12/prod/lib/amd64:/lib64:/usr/lib64 dummy.o -lfui -lfai -lfsu -Bdynamic -lmtsk -lpthread -lm -lc /opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a /opt/sun/sunstudio12/prod/lib/amd64/crtn.o") set(linux64_sunf90_libs "fui;fai;fsu;mtsk;pthread;m;c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a") set(linux64_sunf90_dirs "/opt/sun/sunstudio12/lib/amd64;/opt/sun/sunstudio12/rtlibs/amd64;/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64") list(APPEND platforms linux64_sunf90) +list(APPEND langs Fortran) # icc dummy.c -v set(linux64_icc_text "ld /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o --eh-frame-hdr -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /tmp/iccBP8OfN.o -L/opt/compiler/intel/compiler/11.0/lib/intel64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.. -L/lib64 -L/lib -L/usr/lib64 -L/usr/lib -Bstatic -limf -lsvml -Bdynamic -lm -Bstatic -lipgo -ldecimal -lirc -Bdynamic -lgcc_s -lgcc -Bstatic -lirc -Bdynamic -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o") set(linux64_icc_libs "imf;svml;m;ipgo;decimal;irc;gcc_s;gcc;irc;c;gcc_s;gcc;irc_s;dl;c") set(linux64_icc_dirs "/opt/compiler/intel/compiler/11.0/lib/intel64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2;/usr/lib64;/lib64;/usr/x86_64-suse-linux/lib;/lib;/usr/lib") list(APPEND platforms linux64_icc) +list(APPEND langs C) # icxx dummy.cxx -v set(linux64_icxx_text "ld /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o --eh-frame-hdr -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /tmp/icpc270GoT.o -L/opt/compiler/intel/compiler/11.0/lib/intel64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.. -L/lib64 -L/lib -L/usr/lib64 -L/usr/lib -Bstatic -limf -lsvml -Bdynamic -lm -Bstatic -lipgo -ldecimal -Bdynamic -lstdc++ -Bstatic -lirc -Bdynamic -lgcc_s -lgcc -Bstatic -lirc -Bdynamic -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o") set(linux64_icxx_libs "imf;svml;m;ipgo;decimal;stdc++;irc;gcc_s;gcc;irc;c;gcc_s;gcc;irc_s;dl;c") set(linux64_icxx_dirs "/opt/compiler/intel/compiler/11.0/lib/intel64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2;/usr/lib64;/lib64;/usr/x86_64-suse-linux/lib;/lib;/usr/lib") list(APPEND platforms linux64_icxx) +list(APPEND langs CXX) # ifort dummy.f -v set(linux64_ifort_text "ld --eh-frame-hdr -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out -L/opt/compiler/intel/compiler/11.0/lib/intel64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.. -L/lib64 -L/lib -L/usr/lib64 -L/usr/lib /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o /opt/compiler/intel/compiler/11.0/lib/intel64/for_main.o dum.cxx -Bstatic -lifport -lifcore -limf -lsvml -Bdynamic -lm -Bstatic -lipgo -lirc -Bdynamic -lpthread -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o") set(linux64_ifort_libs "ifport;ifcore;imf;svml;m;ipgo;irc;pthread;c;gcc_s;gcc;irc_s;dl;c") set(linux64_ifort_dirs "/opt/compiler/intel/compiler/11.0/lib/intel64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2;/usr/lib64;/lib64;/usr/x86_64-suse-linux/lib;/lib;/usr/lib") list(APPEND platforms linux64_ifort) +list(APPEND langs Fortran) # pgcc dummy.c -v set(linux64_pgcc_text "/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /opt/compiler/pgi/linux86-64/8.0-3/lib/trace_init.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/compiler/pgi/linux86-64/8.0-3/lib/pgi.ld -L/opt/compiler/pgi/linux86-64/8.0-3/lib -L/usr/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 /tmp/pgcc7OscXa5ur7Zk.o -rpath /opt/compiler/pgi/linux86-64/8.0-3/lib -lnspgc -lpgc -lm -lgcc -lc -lgcc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/crtn.o") set(linux64_pgcc_libs "nspgc;pgc;m;gcc;c;gcc") set(linux64_pgcc_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2") list(APPEND platforms linux64_pgcc) +list(APPEND langs C) # pgCC dummy.cxx -v set(linux64_pgCC_text "/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /opt/compiler/pgi/linux86-64/8.0-3/lib/trace_init.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/compiler/pgi/linux86-64/8.0-3/lib/pgi.ld -L/opt/compiler/pgi/linux86-64/8.0-3/lib -L/usr/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 /tmp/pgCCFhjcDt1fs1Ki.o -rpath /opt/compiler/pgi/linux86-64/8.0-3/lib -lstd -lC -lnspgc -lpgc -lm -lgcc -lc -lgcc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/crtn.o") set(linux64_pgCC_libs "std;C;nspgc;pgc;m;gcc;c;gcc") set(linux64_pgCC_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2") list(APPEND platforms linux64_pgCC) +list(APPEND langs CXX) # pgf90 dummy.f -v set(linux64_pgf90_text "/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /opt/compiler/pgi/linux86-64/8.0-3/lib/trace_init.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o /opt/compiler/pgi/linux86-64/8.0-3/lib/f90main.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/compiler/pgi/linux86-64/8.0-3/lib/pgi.ld -L/opt/compiler/pgi/linux86-64/8.0-3/lib -L/usr/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 /tmp/pgf90QOIc_eB9xY5h.o -rpath /opt/compiler/pgi/linux86-64/8.0-3/lib -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lnspgc -lpgc -lrt -lpthread -lm -lgcc -lc -lgcc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/crtn.o") set(linux64_pgf90_libs "pgf90;pgf90_rpm1;pgf902;pgf90rtl;pgftnrtl;nspgc;pgc;rt;pthread;m;gcc;c;gcc") set(linux64_pgf90_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2") list(APPEND platforms linux64_pgf90) +list(APPEND langs Fortran) # nagfor dummy.f -Wl,-v set(linux64_nagfor_text " /usr/libexec/gcc/x86_64-redhat-linux/4.4.5/collect2 --no-add-needed --eh-frame-hdr --build-id -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../.. /usr/local/NAG/lib/f90_init.o /usr/local/NAG/lib/quickfit.o dummy.o -rpath /usr/local/NAG/lib /usr/local/NAG/lib/libf53.so /usr/local/NAG/lib/libf53.a -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crtn.o") @@ -86,6 +98,7 @@ set(linux64_nagfor_libs "/usr/local/NAG/lib/f90_init.o;/usr/local/NAG/lib/quickf set(linux64_nagfor_dirs "/usr/lib/gcc/x86_64-redhat-linux/4.4.5;/usr/lib64;/lib64;/usr/lib") set(linux64_nagfor_obj_regex "^/usr/local/NAG/lib") list(APPEND platforms linux64_nagfor) +list(APPEND langs Fortran) # absoft dummy.f -X -v set(linux64_absoft_text "collect2 version 4.4.5 (x86-64 Linux/ELF) @@ -93,6 +106,7 @@ set(linux64_absoft_text "collect2 version 4.4.5 (x86-64 Linux/ELF) set(linux64_absoft_libs "af90math;afio;amisc;absoftmain;af77math;m;mv;pthread;gcc;gcc_s;c;gcc;gcc_s") set(linux64_absoft_dirs "/opt/absoft11.1/lib64;/usr/lib/gcc/x86_64-linux-gnu/4.4.5;/usr/lib;/lib") list(APPEND platforms linux64_absoft) +list(APPEND langs Fortran) # gcc dummy.c -v # in strange path set(linux64_test1_text " @@ -101,12 +115,14 @@ ${linux64_gcc_text}") set(linux64_test1_libs "${linux64_gcc_libs}") set(linux64_test1_dirs "${linux64_gcc_dirs}") list(APPEND platforms linux64_test1) +list(APPEND langs C) # sunCC dummy.cxx -v # extra slashes set(linux64_test2_text "/usr/bin/ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/sun/sunstudio12/prod/lib/amd64//crti.o /opt/sun/sunstudio12/prod/lib/amd64/crt1x.o /opt/sun/sunstudio12/prod/lib/amd64/values-xa.o dummy.o -Y \"/opt/sun/sunstudio12/prod/lib//amd64:/lib64:/usr//lib64\" -Qy -lc /opt/sun/sunstudio12/prod/lib/amd64//libc_supp.a /opt/sun/sunstudio12/prod/lib/amd64/crtn.o") set(linux64_test2_libs "c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a") set(linux64_test2_dirs "/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64") list(APPEND platforms linux64_test2) +list(APPEND langs CXX) # -specs=redhat-hardened-ld set(linux64_test3_text "COLLECT_GCC_OPTIONS='-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' '-v' '-O2' '-g' '-pipe' '-Wall' '-Werror=format-security' '-fexceptions' '-fstack-protector-strong' '--param' 'ssp-buffer-size=4' '-grecord-gcc-switches' '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' '-m64' '-mtune=generic' '-I' '/usr/lib64/gfortran/modules' '-o' 'a.out' '-rdynamic' '-shared-libgcc' '-march=x86-64' '-pie' @@ -114,12 +130,14 @@ set(linux64_test3_text "COLLECT_GCC_OPTIONS='-specs=/usr/lib/rpm/redhat/redhat-h set(linux64_test3_libs "gfortran;m;gcc_s;gcc;quadmath;m;gcc_s;gcc;c;gcc_s;gcc") set(linux64_test3_dirs "/usr/lib/gcc/x86_64-redhat-linux/5.1.1;/usr/lib64;/lib64;/usr/lib") list(APPEND platforms linux64_test3) +list(APPEND langs Fortran) # clang -fsanitize=memory set(linux64_clang_sanitize_memory_text [[ "/usr/bin/ld" --hash-style=both --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../.. -L/usr/lib/llvm-3.8/bin/../lib -L/lib -L/usr/lib -whole-archive /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/lib/linux/libclang_rt.msan-x86_64.a -no-whole-archive --dynamic-list=/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/lib/linux/libclang_rt.msan-x86_64.a.syms /tmp/dummy-27898d.o --no-as-needed -lpthread -lrt -lm -ldl -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crtn.o]]) set(linux64_clang_sanitize_memory_libs "pthread;rt;m;dl;gcc;gcc_s;c;gcc;gcc_s") set(linux64_clang_sanitize_memory_dirs "/usr/lib/gcc/x86_64-linux-gnu/5.4.0;/usr/lib/x86_64-linux-gnu;/lib/x86_64-linux-gnu;/lib64;/usr/lib;/usr/lib/llvm-3.8/lib;/lib") list(APPEND platforms linux64_clang_sanitize_memory) +list(APPEND langs C) #----------------------------------------------------------------------------- # Mac @@ -144,12 +162,14 @@ set(mac_i686_gcc_Wlv_libs "gcc") set(mac_i686_gcc_Wlv_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") set(mac_i686_gcc_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") list(APPEND platforms mac_i686_gcc_Wlv) +list(APPEND langs C) # gcc -arch i686 dummy.c -v set(mac_i686_gcc_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccnhXAGL.o -lSystem -lgcc -lSystem") set(mac_i686_gcc_libs "gcc") set(mac_i686_gcc_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib") list(APPEND platforms mac_i686_gcc) +list(APPEND langs C) # g++ -arch i686 dummy.cxx -v -Wl,-v set(mac_i686_g++_Wlv_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccEXXICh.o -lstdc++ -lSystem -lgcc -lSystem @@ -171,12 +191,14 @@ set(mac_i686_g++_Wlv_libs "stdc++;gcc") set(mac_i686_g++_Wlv_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") set(mac_i686_g++_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") list(APPEND platforms mac_i686_g++_Wlv) +list(APPEND langs CXX) # g++ -arch i686 dummy.cxx -v set(mac_i686_g++_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccEXXICh.o -lstdc++ -lSystem -lgcc -lSystem") set(mac_i686_g++_libs "stdc++;gcc") set(mac_i686_g++_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib") list(APPEND platforms mac_i686_g++) +list(APPEND langs CXX) # gfortran dummy.f -v -Wl,-v set(mac_i686_gfortran_Wlv_text " /usr/local/libexec/gcc/i386-apple-darwin9.7.0/4.4.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1 -L/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1/../../.. /var/tmp//cc9zXNax.o -v -lgfortranbegin -lgfortran -lgcc_s.10.5 -lgcc -lSystem @@ -195,12 +217,14 @@ set(mac_i686_gfortran_Wlv_libs "gfortranbegin;gfortran;gcc_s.10.5;gcc") set(mac_i686_gfortran_Wlv_dirs "/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1;/usr/local/lib;/usr/lib") set(mac_i686_gfortran_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") list(APPEND platforms mac_i686_gfortran_Wlv) +list(APPEND langs Fortran) # gfortran dummy.f -v set(mac_i686_gfortran_text " /usr/libexec/gcc/i386-apple-darwin9.7.0/4.4.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1 -L/usr/lib/gcc -L/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1/../../.. /var/tmp//ccgqbX5P.o -lgfortranbegin -lgfortran -lgcc_s.10.5 -lgcc -lSystem") set(mac_i686_gfortran_libs "gfortranbegin;gfortran;gcc_s.10.5;gcc") set(mac_i686_gfortran_dirs "/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1;/usr/lib/gcc;/usr/lib") list(APPEND platforms mac_i686_gfortran) +list(APPEND langs Fortran) # gcc -arch ppc dummy.c -v -Wl,-v set(mac_ppc_gcc_Wlv_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//cclziQY4.o -v -lgcc -lSystemStubs -lSystem @@ -222,12 +246,14 @@ set(mac_ppc_gcc_Wlv_libs "gcc") set(mac_ppc_gcc_Wlv_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") set(mac_ppc_gcc_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") list(APPEND platforms mac_ppc_gcc_Wlv) +list(APPEND langs C) # gcc -arch ppc dummy.c -v set(mac_ppc_gcc_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccdcolsP.o -lgcc -lSystemStubs -lSystem") set(mac_ppc_gcc_libs "gcc") set(mac_ppc_gcc_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib") list(APPEND platforms mac_ppc_gcc) +list(APPEND langs C) # g++ -arch ppc dummy.cxx -v -Wl,-v set(mac_ppc_g++_Wlv_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccaFTkwq.o -v -lstdc++ -lgcc -lSystemStubs -lSystem @@ -249,12 +275,14 @@ set(mac_ppc_g++_Wlv_libs "stdc++;gcc") set(mac_ppc_g++_Wlv_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") set(mac_ppc_g++_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") list(APPEND platforms mac_ppc_g++_Wlv) +list(APPEND langs CXX) # g++ -arch ppc dummy.cxx -v set(mac_ppc_g++_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccbjB6Lj.o -lstdc++ -lgcc -lSystemStubs -lSystem") set(mac_ppc_g++_libs "stdc++;gcc") set(mac_ppc_g++_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib") list(APPEND platforms mac_ppc_g++) +list(APPEND langs CXX) # absoft dummy.f -X -v set(mac_absoft_text "collect2 version 4.2.1 (Apple Inc. build 5664) (i686 Darwin) @@ -263,12 +291,14 @@ set(mac_absoft_text "collect2 version 4.2.1 (Apple Inc. build 5664) (i686 Darwin set(mac_absoft_libs "af90math;afio;amisc;absoftmain;af77math;m;mv;gcc") set(mac_absoft_dirs "/Applications/Absoft11.1/lib;/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib") list(APPEND platforms mac_absoft) +list(APPEND langs Fortran) # Xcode 8.3: clang++ dummy.cpp -v set(mac_clang_v_text " \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld\" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.12.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -o a.out /var/folders/hc/95l7dhnx459c57g4yg_6yd8c0000gp/T/dummy-384ea1.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/lib/darwin/libclang_rt.osx.a") set(mac_clang_v_libs "c++") set(mac_clang_v_dirs "") list(APPEND platforms mac_clang_v) +list(APPEND langs CXX) #----------------------------------------------------------------------------- # Sun @@ -278,24 +308,28 @@ set(sun_cc_text "/usr/ccs/bin/ld /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/pro set(sun_cc_libs "c") set(sun_cc_dirs "/opt/SUNWspro/prod/lib/v8plus;/opt/SUNWspro/prod/lib;/usr/ccs/lib;/lib;/usr/lib") list(APPEND platforms sun_cc) +list(APPEND langs C) # CC dummy.cxx -v set(sun_CC_text "/usr/ccs/bin/ld -u __1cH__CimplKcplus_init6F_v_ -zld32=-S/opt/SUNWspro/prod/lib/libldstab_ws.so -zld64=-S/opt/SUNWspro/prod/lib/v9/libldstab_ws.so -zld32=-S/opt/SUNWspro/prod/lib/libCCexcept.so.1 -zld64=-S/opt/SUNWspro/prod/lib/v9/libCCexcept.so.1 -R/opt/SUNWspro/lib/rw7:/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib:/usr/ccs/lib:/lib:/usr/lib -o a.out /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/CCrti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/misalign.o /opt/SUNWspro/prod/lib/values-xa.o -Y P,/opt/SUNWspro/lib/rw7:/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/prod/lib/rw7:/opt/SUNWspro/prod/lib/v8plus:/opt/SUNWspro/lib:/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib dummy.o -lCstd -lCrun -lm -lc /opt/SUNWspro/prod/lib/CCrtn.o /opt/SUNWspro/prod/lib/crtn.o >&/tmp/ld.14846.2.err") set(sun_CC_libs "Cstd;Crun;m;c") set(sun_CC_dirs "/opt/SUNWspro/lib/rw7;/opt/SUNWspro/lib/v8plus;/opt/SUNWspro/prod/lib/rw7;/opt/SUNWspro/prod/lib/v8plus;/opt/SUNWspro/lib;/opt/SUNWspro/prod/lib;/usr/ccs/lib;/lib;/usr/lib") list(APPEND platforms sun_CC) +list(APPEND langs CXX) # f77 dummy.f -v set(sun_f77_text "/usr/ccs/bin/ld -t -R/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib -o a.out /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/misalign.o /opt/SUNWspro/prod/lib/values-xi.o -Y P,/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/prod/lib/v8plus:/opt/SUNWspro/lib:/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib dummy.o -lf77compat -zallextract -lompstubs -zdefaultextract -lfui -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai -lfminvai -lfmaxvai -lfsu -lsunmath -lm -lc /opt/SUNWspro/prod/lib/crtn.o") set(sun_f77_libs "f77compat;-zallextract;ompstubs;-zdefaultextract;fui;fai;fai2;fsumai;fprodai;fminlai;fmaxlai;fminvai;fmaxvai;fsu;sunmath;m;c") set(sun_f77_dirs "/opt/SUNWspro/lib/v8plus;/opt/SUNWspro/prod/lib/v8plus;/opt/SUNWspro/lib;/opt/SUNWspro/prod/lib;/usr/ccs/lib;/lib;/usr/lib") list(APPEND platforms sun_f77) +list(APPEND langs Fortran) # f90 dummy.f -v set(sun_f90_text "/usr/ccs/bin/ld -t -R/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib -o a.out /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/misalign.o /opt/SUNWspro/prod/lib/values-xi.o -Y P,/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/prod/lib/v8plus:/opt/SUNWspro/lib:/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib dummy.o -zallextract -lompstubs -zdefaultextract -lfui -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai -lfminvai -lfmaxvai -lfsu -lsunmath -lm -lc /opt/SUNWspro/prod/lib/crtn.o") set(sun_f90_libs "-zallextract;ompstubs;-zdefaultextract;fui;fai;fai2;fsumai;fprodai;fminlai;fmaxlai;fminvai;fmaxvai;fsu;sunmath;m;c") set(sun_f90_dirs "/opt/SUNWspro/lib/v8plus;/opt/SUNWspro/prod/lib/v8plus;/opt/SUNWspro/lib;/opt/SUNWspro/prod/lib;/usr/ccs/lib;/lib;/usr/lib") list(APPEND platforms sun_f90) +list(APPEND langs Fortran) #----------------------------------------------------------------------------- # AIX @@ -305,12 +339,14 @@ set(aix_xlc_32_text "/bin/ld -b32 /lib/crt0.o -bpT:0x10000000 -bpD:0x20000000 du set(aix_xlc_32_libs "xlopt;xl;c") set(aix_xlc_32_dirs "/usr/vac/lib") list(APPEND platforms aix_xlc_32) +list(APPEND langs C) # xlc -q64 dummy.c -V set(aix_xlc_64_text "/bin/ld -b64 /lib/crt0_64.o -bpT:0x100000000 -bpD:0x110000000 dummy.o -L/usr/vac/lib -lxlopt -lxl -lc") set(aix_xlc_64_libs "xlopt;xl;c") set(aix_xlc_64_dirs "/usr/vac/lib") list(APPEND platforms aix_xlc_64) +list(APPEND langs C) # xlC -q32 dummy.cxx -V set(aix_xlC_32_text " @@ -319,6 +355,7 @@ set(aix_xlC_32_text " set(aix_xlC_32_libs "xlopt;xl;C;m;c") set(aix_xlC_32_dirs "/usr/vac/lib;/usr/vacpp/lib") list(APPEND platforms aix_xlC_32) +list(APPEND langs CXX) # xlC -q64 dummy.cxx -V set(aix_xlC_64_text " @@ -327,36 +364,42 @@ set(aix_xlC_64_text " set(aix_xlC_64_libs "xlopt;xl;C;m;c") set(aix_xlC_64_dirs "/usr/vac/lib;/usr/vacpp/lib") list(APPEND platforms aix_xlC_64) +list(APPEND langs CXX) # xlf -q32 dummy.f -V set(aix_xlf_32_text "/bin/ld -b32 /lib/crt0.o -bpT:0x10000000 -bpD:0x20000000 -bh:4 -bh:4 -bh:4 -bh:4 dummy.o -lxlf90 -L/usr/lpp/xlf/lib -lxlopt -lxlf -lxlomp_ser -lm -lc") set(aix_xlf_32_libs "xlf90;xlopt;xlf;xlomp_ser;m;c") set(aix_xlf_32_dirs "/usr/lpp/xlf/lib") list(APPEND platforms aix_xlf_32) +list(APPEND langs Fortran) # xlf -q64 dummy.f -V set(aix_xlf_64_text "/bin/ld -b64 /lib/crt0_64.o -bpT:0x100000000 -bpD:0x110000000 -bh:4 -bh:4 -bh:4 -bh:4 dummy.o -lxlf90 -L/usr/lpp/xlf/lib -lxlopt -lxlf -lxlomp_ser -lm -lc") set(aix_xlf_64_libs "xlf90;xlopt;xlf;xlomp_ser;m;c") set(aix_xlf_64_dirs "/usr/lpp/xlf/lib") list(APPEND platforms aix_xlf_64) +list(APPEND langs Fortran) # xlf90 -q32 dummy.f -V set(aix_xlf90_32_text "/bin/ld -b32 /lib/crt0.o -bpT:0x10000000 -bpD:0x20000000 -bh:4 dummy.o -lxlf90 -L/usr/lpp/xlf/lib -lxlopt -lxlf -lxlomp_ser -lm -lc") set(aix_xlf90_32_libs "xlf90;xlopt;xlf;xlomp_ser;m;c") set(aix_xlf90_32_dirs "/usr/lpp/xlf/lib") list(APPEND platforms aix_xlf90_32) +list(APPEND langs Fortran) # xlf90 -q64 dummy.f -V set(aix_xlf90_64_text "/bin/ld -b64 /lib/crt0_64.o -bpT:0x100000000 -bpD:0x110000000 -bh:4 dummy.o -lxlf90 -L/usr/lpp/xlf/lib -lxlopt -lxlf -lxlomp_ser -lm -lc") set(aix_xlf90_64_libs "xlf90;xlopt;xlf;xlomp_ser;m;c") set(aix_xlf90_64_dirs "/usr/lpp/xlf/lib") list(APPEND platforms aix_xlf90_64) +list(APPEND langs Fortran) # g++ dummy.c -v set(aix_g++_text " /prefix/libexec/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/collect2 -bpT:0x10000000 -bpD:0x20000000 -btextro /lib/crt0.o /prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/crtcxa.o /prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/crtdbase.o -L/prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0 -L/prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/../../.. /tmp//ccKROJ1f.o -lstdc++ -lm -lgcc_s /prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/libgcc.a -lc -lgcc_s /prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/libgcc.a") set(aix_g++_libs "stdc++;m;gcc_s;/prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/libgcc.a;c;gcc_s;/prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/libgcc.a") set(aix_g++_dirs "/prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0;/prefix/lib") list(APPEND platforms aix_g++) +list(APPEND langs CXX) #----------------------------------------------------------------------------- # HP @@ -367,6 +410,7 @@ set(hp_cc_old_text "cc: LPATH is /usr/lib/pa1.1:/usr/lib:/opt/langtools/lib: set(hp_cc_old_libs "c") set(hp_cc_old_dirs "/usr/lib/pa1.1;/usr/lib;/opt/langtools/lib") list(APPEND platforms hp_cc_old) +list(APPEND langs C) # aCC dummy.cxx -v set(hp_aCC_old_text "LPATH=/usr/lib/pa1.1:/usr/lib:/opt/langtools/lib @@ -374,6 +418,7 @@ set(hp_aCC_old_text "LPATH=/usr/lib/pa1.1:/usr/lib:/opt/langtools/lib set(hp_aCC_old_libs "std;stream;Csup;m;cl;c") set(hp_aCC_old_dirs "/usr/lib/pa1.1;/usr/lib;/opt/langtools/lib;/opt/aCC/lib") list(APPEND platforms hp_aCC_old) +list(APPEND langs CXX) # cc dummy.c -v set(hp_cc_32_text "LPATH=/usr/lib/hpux32:/opt/langtools/lib/hpux32 @@ -381,6 +426,7 @@ set(hp_cc_32_text "LPATH=/usr/lib/hpux32:/opt/langtools/lib/hpux32 set(hp_cc_32_libs "c") set(hp_cc_32_dirs "/usr/lib/hpux32;/opt/langtools/lib/hpux32") list(APPEND platforms hp_cc_32) +list(APPEND langs C) # cc +DD64 dummy.c -v set(hp_cc_64_text "LPATH=/usr/lib/hpux64:/opt/langtools/lib/hpux64 @@ -388,6 +434,7 @@ set(hp_cc_64_text "LPATH=/usr/lib/hpux64:/opt/langtools/lib/hpux64 set(hp_cc_64_libs "c") set(hp_cc_64_dirs "/usr/lib/hpux64;/opt/langtools/lib/hpux64") list(APPEND platforms hp_cc_64) +list(APPEND langs C) # aCC dummy.cxx -v set(hp_aCC_32_text "LPATH=/usr/lib/hpux32:/opt/langtools/lib/hpux32 @@ -395,6 +442,7 @@ set(hp_aCC_32_text "LPATH=/usr/lib/hpux32:/opt/langtools/lib/hpux32 set(hp_aCC_32_libs "std_v2;Csup;m;unwind;Csup;c;dl") set(hp_aCC_32_dirs "/usr/lib/hpux32;/opt/langtools/lib/hpux32;/opt/aCC/lib/hpux32") list(APPEND platforms hp_aCC_32) +list(APPEND langs CXX) # aCC +DD64 dummy.cxx -v set(hp_aCC_64_text "LPATH=/usr/lib/hpux64:/opt/langtools/lib/hpux64 @@ -402,6 +450,7 @@ set(hp_aCC_64_text "LPATH=/usr/lib/hpux64:/opt/langtools/lib/hpux64 set(hp_aCC_64_libs "std_v2;Csup;m;unwind;Csup;c;dl") set(hp_aCC_64_dirs "/usr/lib/hpux64;/opt/langtools/lib/hpux64;/opt/aCC/lib/hpux64") list(APPEND platforms hp_aCC_64) +list(APPEND langs CXX) # f90 dummy.f -v set(hp_f90_32_text "LPATH is: /usr/lib/hpux32/:/opt/langtools/lib/hpux32/ @@ -409,6 +458,7 @@ set(hp_f90_32_text "LPATH is: /usr/lib/hpux32/:/opt/langtools/lib/hpux32/ set(hp_f90_32_libs "-l:libF90.a;-l:libIO77.a;m;c;unwind;uca") set(hp_f90_32_dirs "/usr/lib/hpux32;/opt/langtools/lib/hpux32") list(APPEND platforms hp_f90_32) +list(APPEND langs Fortran) # f90 +DD64 dummy.f -v set(hp_f90_64_text "LPATH is: /usr/lib/hpux64/:/opt/langtools/lib/hpux64/ @@ -416,6 +466,7 @@ set(hp_f90_64_text "LPATH is: /usr/lib/hpux64/:/opt/langtools/lib/hpux64/ set(hp_f90_64_libs "-l:libF90.a;-l:libIO77.a;m;c;unwind;uca") set(hp_f90_64_dirs "/usr/lib/hpux64;/opt/langtools/lib/hpux64") list(APPEND platforms hp_f90_64) +list(APPEND langs Fortran) #----------------------------------------------------------------------------- # Cygwin @@ -425,12 +476,14 @@ set(cygwin_gcc_text " /usr/lib/gcc/i686-pc-cygwin/3.4.4/collect2.exe -Bdynamic - set(cygwin_gcc_libs "gcc;cygwin;user32;kernel32;advapi32;shell32;gcc") set(cygwin_gcc_dirs "/usr/lib/gcc/i686-pc-cygwin/3.4.4;/usr/lib") list(APPEND platforms cygwin_gcc) +list(APPEND langs C) # g++ dummy.cxx -v set(cygwin_g++_text " /usr/lib/gcc/i686-pc-cygwin/3.4.4/collect2.exe -Bdynamic --dll-search-prefix=cyg /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../crt0.o -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../.. /home/user/AppData/Local/Temp/ccsvcDO6.o -lstdc++ -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc") set(cygwin_g++_libs "stdc++;gcc;cygwin;user32;kernel32;advapi32;shell32;gcc") set(cygwin_g++_dirs "/usr/lib/gcc/i686-pc-cygwin/3.4.4;/usr/lib") list(APPEND platforms cygwin_g++) +list(APPEND langs CXX) # gfortran dummy.f -v set(cygwin_gfortran_text "Configured with: ... LD=/opt/gcc-tools/bin/ld.exe @@ -439,6 +492,7 @@ set(cygwin_gfortran_text "Configured with: ... LD=/opt/gcc-tools/bin/ld.exe set(cygwin_gfortran_libs "gfortranbegin;gfortran;gcc_s;gcc_s;gcc;cygwin;user32;kernel32;advapi32;shell32;gcc_s;gcc_s;gcc") set(cygwin_gfortran_dirs "/usr/lib/gcc/i686-pc-cygwin/4.3.2;/usr/lib") list(APPEND platforms cygwin_gfortran) +list(APPEND langs Fortran) #----------------------------------------------------------------------------- # MSYS @@ -448,18 +502,21 @@ set(msys_gcc_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe set(msys_gcc_libs "mingw32;gcc;moldname;mingwex;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex") set(msys_gcc_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib") list(APPEND platforms msys_gcc) +list(APPEND langs C) # g++ dummy.cxx -v set(msys_g++_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic /some-mingw/lib/crt2.o C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5 -LC:/some-mingw/bin/../lib/gcc -L/some-mingw/lib -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/../../.. C:/home/user/AppData/Local/Temp/cci5hYPk.o -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtend.o") set(msys_g++_libs "stdc++;mingw32;gcc;moldname;mingwex;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex") set(msys_g++_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib") list(APPEND platforms msys_g++) +list(APPEND langs CXX) # g77 dummy.f -v set(msys_g77_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic /some-mingw/lib/crt2.o C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5 -LC:/some-mingw/bin/../lib/gcc -L/some-mingw/lib -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/../../.. C:/home/user/AppData/Local/Temp/ccabRxQ1.o -lfrtbegin -lg2c -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtend.o") set(msys_g77_libs "frtbegin;g2c;mingw32;gcc;moldname;mingwex;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex") set(msys_g77_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib") list(APPEND platforms msys_g77) +list(APPEND langs Fortran) #----------------------------------------------------------------------------- # MSYS2-runtime @@ -469,18 +526,21 @@ set(msys2rt_gcc_text " /usr/lib/gcc/i686-pc-msys/6.4.0/collect2.exe -Bdynamic -- set(msys2rt_gcc_libs "msys-2.0;user32;kernel32;advapi32;shell32") set(msys2rt_gcc_dirs "/usr/lib/gcc/i686-pc-msys/6.4.0;/usr/lib") list(APPEND platforms msysrt_gcc) +list(APPEND langs C) # g++ dummy.cxx -v set(msys2rt_g++_text " /usr/lib/gcc/i686-pc-msys/6.4.0/collect2.exe -Bdynamic --dll-search-prefix=msys- /usr/lib/gcc/i686-pc-msys/6.4.0/../../../crt0.o -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0/../../.. /home/user/AppData/Local/Temp/ccsvcDO6.o -lstdc++ -lgcc -lmsys-2.0 -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc") set(msys2rt_g++_libs "stdc++;msys-2.0;user32;kernel32;advapi32;shell32") set(msys2rt_g++_dirs "/usr/lib/gcc/i686-pc-msys/6.4.0;/usr/lib") list(APPEND platforms msysrt_g++) +list(APPEND langs CXX) # g77 dummy.f -v set(msys2rt_g77_text "Configured with: ... LD=/opt/gcc-tools/bin/ld.exe /usr/lib/gcc/i686-pc-msys/6.4.0/collect2.exe -Bdynamic --dll-search-prefix=msys- -u ___register_frame_info -u ___deregister_frame_info /usr/lib/gcc/i686-pc-msys/6.4.0/../../../crt0.o /usr/lib/gcc/i686-pc-msys/6.4.0/crtbegin.o -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0/../../.. /home/user/AppData/Local/Temp/ccqRWKWg.o -lgfortranbegin -lgfortran -lgcc_s -lgcc_s -lgcc -lmsys-2.0 -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc_s -lgcc_s -lgcc /usr/lib/gcc/i686-pc-msys/6.4.0/crtend.o") set(msys2rt_g77_libs "stdc++;msys-2.0;user32;kernel32;advapi32;shell32") set(msys2rt_g77_dirs "/usr/lib/gcc/i686-pc-msys/6.4.0;/usr/lib") list(APPEND platforms msysrt_g77) +list(APPEND langs Fortran) #----------------------------------------------------------------------------- # MSYS2-mingw @@ -490,18 +550,21 @@ set(msys2_gcc_text " C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/c set(msys2_gcc_libs "mingw32;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;mingw32;gcc;moldname;mingwex") set(msys2_gcc_dirs "C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0;C:/msys64/mingw64/lib/gcc;C:/msys64/mingw64/x86_64-w64-mingw32/lib;C:/msys64/mingw64/lib") list(APPEND platforms msys2_gcc) +list(APPEND langs C) # g++ dummy.cxx -v set(msys2_g++_text " C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/collect2.exe -plugin C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/liblto_plugin-0.dll -plugin-opt=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:/msys64/tmp/ccJQgvbN.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep -Bdynamic C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtbegin.o -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0 -LC:/msys64/mingw64/bin/../lib/gcc -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../.. C:/msys64/tmp/ccqPpuVS.o -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtend.o") set(msys2_g++_libs "stdc++;mingw32;gcc_s;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;mingw32;gcc_s;gcc;moldname;mingwex") set(msys2_g++_dirs "C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0;C:/msys64/mingw64/lib/gcc;C:/msys64/mingw64/x86_64-w64-mingw32/lib;C:/msys64/mingw64/lib") list(APPEND platforms msys2_g++) +list(APPEND langs CXX) # gfortran dummy.f90 -v set(msys2_gfortran_text " C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/collect2.exe -plugin C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/liblto_plugin-0.dll -plugin-opt=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:/msys64/tmp/cczOKIDy.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lquadmath -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep -Bdynamic C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtbegin.o -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0 -LC:/msys64/mingw64/bin/../lib/gcc -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../.. C:/msys64/tmp/ccyXuCgD.o -lgfortran -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lquadmath -lm -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtend.o") set(msys2_gfortran_libs "gfortran;mingw32;gcc_s;gcc;moldname;mingwex;quadmath;m;mingw32;gcc_s;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;mingw32;gcc_s;gcc;moldname;mingwex") set(msys2_gfortran_dirs "C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0;C:/msys64/mingw64/lib/gcc;C:/msys64/mingw64/x86_64-w64-mingw32/lib;C:/msys64/mingw64/lib") list(APPEND platforms msys2_gfortran) +list(APPEND langs Fortran) #----------------------------------------------------------------------------- # MSVC from NVIDIA CUDA @@ -510,6 +573,18 @@ set(nvcc_msvc_text [[cuda-fake-ld cl.exe -nologo "tmp/a_dlink.obj" "tmp/CMakeCUD set(nvcc_msvc_libs "cudadevrt.lib;cudart_static.lib") set(nvcc_msvc_dirs "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64") list(APPEND platforms nvcc_msvc) +list(APPEND langs CUDA) + +#----------------------------------------------------------------------------- +# MSVC from NVIDIA CUDA custom compiler + +set(nvcc_msvc_cl_text [[cuda-fake-ld cl -nologo "tmp/a_dlink.obj" "tmp/CMakeCUDACompilerId.obj" -link -INCREMENTAL:NO "/LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/bin/../lib/x64" cudadevrt.lib cudart_static.lib -Fe"a.exe"]]) +set(nvcc_msvc_cl_libs "cudadevrt.lib;cudart_static.lib") +set(nvcc_msvc_cl_dirs "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64") +set(nvcc_msvc_cl_compiler_id NVIDIA) +set(nvcc_msvc_cl_compiler_sim_id MSVC) +list(APPEND platforms nvcc_msvc_cl) +list(APPEND langs CUDA) #----------------------------------------------------------------------------- # PGI on Windows @@ -527,6 +602,7 @@ set(windows_pgf95_startfile "pgimain[mx][xpt]+[.]obj") set(windows_pgf95_libs "libpgmp;pg;libpgf90rtl;libpgf90;libpgf90_rpm1;libpgf902;libpgf90rtl;libpgftnrtl;libpgc14;libnspgc;legacy_stdio_definitions;oldnames") set(windows_pgf95_dirs "X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64;X:/NOT-PROGRAM-FILES/PGICE/win64/17.4/lib") list(APPEND platforms windows_pgf95) +list(APPEND langs Fortran) # pgf77 dummy.f77 -v set(windows_pgf77_text [[Writing to file C:\temp\pgf776eC42buYRoCNJk.lnk @@ -537,6 +613,7 @@ set(windows_pgf77_startfile "pgimain[mx][xpt]+[.]obj") set(windows_pgf77_libs "libpgmp;libpgftnrtl;libpgc14;libnspgc;legacy_stdio_definitions;oldnames") set(windows_pgf77_dirs "X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64;X:/NOT-PROGRAM-FILES/PGICE/win64/17.4/lib") list(APPEND platforms windows_pgf77) +list(APPEND langs Fortran) # pgcc dummy.c -v set(windows_pgcc_text [[Writing to file C:\temp\pgcc6esqW26_ZNKyL.lnk @@ -547,6 +624,7 @@ set(windows_pgcc_startfile "pgimain[mx][xpt]+[.]obj") set(windows_pgcc_libs "libpgmp;libpgc14;libnspgc;legacy_stdio_definitions;oldnames") set(windows_pgcc_dirs "X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64;X:/NOT-PROGRAM-FILES/PGICE/win64/17.4/lib") list(APPEND platforms windows_pgcc) +list(APPEND langs C) endif() @@ -554,13 +632,20 @@ endif() # Test parsing for all above examples. set(CMAKE_LINKER "not-a-linker[]().*+^$?") -foreach(p IN LISTS platforms) +foreach(p lang IN ZIP_LISTS platforms langs) if(DEFINED ${p}_startfile) set(CMAKE_LINK_STARTFILE "${${p}_startfile}") else() unset(CMAKE_LINK_STARTFILE) endif() - cmake_parse_implicit_link_info("${${p}_text}" libs dirs fwks log "${${p}_obj_regex}") + if(DEFINED ${p}_compiler_id) + set(CMAKE_${lang}_ID ${${p}_compiler_id}) + endif() + if(DEFINED ${p}_compiler_sim_id) + set(CMAKE_${lang}_SIMULATE_ID ${${p}_compiler_sim_id}) + endif() + + cmake_parse_implicit_link_info("${${p}_text}" libs dirs fwks log "${${p}_obj_regex}" LANGUAGE ${lang}) foreach(v libs dirs fwks) if(DEFINED "${p}_${v}" AND NOT "${${v}}" STREQUAL "${${p}_${v}}") diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in index a36f374..7c7a3e5 100644 --- a/Tests/CTestCoverageCollectGCOV/test.cmake.in +++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in @@ -34,9 +34,10 @@ set(expected_out # then back to relative to get them in canonical form (or maybe this is a bug # in how the tarball is generated?) function(to_relative_paths real_paths paths) + file(REAL_PATH "${CTEST_BINARY_DIRECTORY}" base) foreach(file ${paths}) - file(REAL_PATH "${file}" real_path BASE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") - file(RELATIVE_PATH relative_path "${CTEST_BINARY_DIRECTORY}" "${real_path}") + file(REAL_PATH "${file}" real_path BASE_DIRECTORY "${base}") + file(RELATIVE_PATH relative_path "${base}" "${real_path}") list(APPEND local_real_paths "${relative_path}") message(DEBUG "${file} -> ${real_path} -> ${relative_path}") endforeach() diff --git a/Tests/CTestTestFdSetSize/sleep.c b/Tests/CTestTestFdSetSize/sleep.c index 2fb6490..d55cec6 100644 --- a/Tests/CTestTestFdSetSize/sleep.c +++ b/Tests/CTestTestFdSetSize/sleep.c @@ -1,7 +1,11 @@ #if defined(_WIN32) # include <windows.h> -#else +#elif _XOPEN_SOURCE >= 500 || defined(_ALL_SOURCE) # include <unistd.h> +#else +# include <time.h> + +# include <sys/select.h> #endif /* sleeps for 0.1 second */ @@ -9,8 +13,14 @@ int main(int argc, char** argv) { #if defined(_WIN32) Sleep(100); -#else +#elif _XOPEN_SOURCE >= 500 || defined(_ALL_SOURCE) usleep(100 * 1000); +#else + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = 100 * 1000; + + select(0, NULL, NULL, NULL, &tv); #endif return 0; } diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 0f8ec8e..467b41a 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -73,7 +73,7 @@ function(check_updates build) string(REGEX REPLACE "${rev_regex}" "\\1" element "${r}") set(element_${element} 1) endforeach() - foreach(element ${rev_elements}) + foreach(element IN LISTS rev_elements) if(NOT element_${element}) list(APPEND MISSING "global <${element}> element") endif() @@ -85,7 +85,7 @@ function(check_updates build) if(MISSING) # List the missing entries string(APPEND MSG "Update.xml is missing expected entries:\n") - foreach(f ${MISSING}) + foreach(f IN LISTS MISSING) string(APPEND MSG " ${f}\n") endforeach() else() @@ -97,7 +97,7 @@ function(check_updates build) if(EXTRA) # List the extra entries string(APPEND MSG "Update.xml has extra unexpected entries:\n") - foreach(f ${EXTRA}) + foreach(f IN LISTS EXTRA) string(APPEND MSG " ${f}\n") endforeach() else() diff --git a/Tests/CTestUpdateP4.cmake.in b/Tests/CTestUpdateP4.cmake.in index 8a99e67..2ac01e2 100644 --- a/Tests/CTestUpdateP4.cmake.in +++ b/Tests/CTestUpdateP4.cmake.in @@ -109,7 +109,7 @@ list(APPEND P4CMD ${P4_CLIENT}) message("Adding files to repository") file(GLOB_RECURSE files ${TOP}/user-source/*) -foreach(filename ${files}) +foreach(filename IN LISTS files) run_child( WORKING_DIRECTORY ${TOP}/user-source COMMAND ${P4CMD} add ${filename} @@ -140,14 +140,14 @@ run_child( # Make changes in the working tree. message("Changing content...") update_content(user-source files_added files_removed dirs_added) -foreach(filename ${files_added}) +foreach(filename IN LISTS files_added) message("add: ${filename}") run_child( WORKING_DIRECTORY ${TOP}/user-source COMMAND ${P4CMD} add ${TOP}/user-source/${filename} ) endforeach() -foreach(filename ${files_removed}) +foreach(filename IN LISTS files_removed) run_child( WORKING_DIRECTORY ${TOP}/user-source COMMAND ${P4CMD} delete ${TOP}/user-source/${filename} diff --git a/Tests/CheckSwift.cmake b/Tests/CheckSwift.cmake index fcbae7e..099c298 100644 --- a/Tests/CheckSwift.cmake +++ b/Tests/CheckSwift.cmake @@ -14,6 +14,7 @@ if(NOT DEFINED CMAKE_Swift_COMPILER) project(CheckSwift Swift) file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" \"set(CMAKE_Swift_COMPILER \\\"\${CMAKE_Swift_COMPILER}\\\")\\n\" + \"set(CMAKE_Swift_COMPILER_VERSION \\\"\${CMAKE_Swift_COMPILER_VERSION}\\\")\\n\" \"set(CMAKE_Swift_FLAGS \\\"\${CMAKE_Swift_FLAGS}\\\")\\n\") ") @@ -54,6 +55,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" message(STATUS "${_desc} - ${CMAKE_Swift_COMPILER}") set(CMAKE_Swift_COMPILER "${CMAKE_Swift_COMPILER}" CACHE FILEPATH "Swift compiler") + set(CMAKE_Swift_COMPILER_VERSION "${CMAKE_Swift_COMPILER_VERSION}" CACHE FILEPATH "Swift compiler version") set(CMAKE_Swift_FLAGS "${CMAKE_Swift_FLAGS}" CACHE STRING "Swift flags") mark_as_advanced(CMAKE_Swift_COMPILER) diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index c6d1e8a..f3d3a73 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -356,6 +356,7 @@ else() HAVE_CXX_STD_17=$<COMPILE_FEATURES:cxx_std_17> HAVE_CXX_STD_20=$<COMPILE_FEATURES:cxx_std_20> HAVE_CXX_STD_23=$<COMPILE_FEATURES:cxx_std_23> + HAVE_CXX_STD_26=$<COMPILE_FEATURES:cxx_std_26> ) endif() diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp index 9c3910e..048f3de 100644 --- a/Tests/CompileFeatures/genex_test.cpp +++ b/Tests/CompileFeatures/genex_test.cpp @@ -27,6 +27,9 @@ # if HAVE_CXX_STD_23 && !defined(ALLOW_LATER_STANDARDS) # error HAVE_CXX_STD_23 is true with CXX_STANDARD == 11 # endif +# if HAVE_CXX_STD_26 && !defined(ALLOW_LATER_STANDARDS) +# error HAVE_CXX_STD_26 is true with CXX_STANDARD == 11 +# endif #endif #if !HAVE_OVERRIDE_CONTROL diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 5df22d2..9493a2f 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -5,6 +5,14 @@ cmake_minimum_required(VERSION 2.4) cmake_policy(SET CMP0054 NEW) project (Complex) +# Inform the test if the debug configuration is getting built. +string(APPEND CMAKE_C_FLAGS_RELEASE " -DCOMPLEX_NDEBUG") +string(APPEND CMAKE_CXX_FLAGS_RELEASE " -DCOMPLEX_NDEBUG") +string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG") +string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG") +string(APPEND CMAKE_C_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG") +string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG") + # Test that renaming a built-in works when configured multiple times. message("message") function(message) diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 49e97d5..67a1645 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -62,7 +62,7 @@ void cmPassed(const char* Message, const char* m2 = "") # error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif -#if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE) +#if defined(COMPLEX_NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE) # error Per-configuration directory-level definition not inherited. #endif diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index 5a4134d..e4fdc68 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -5,6 +5,14 @@ cmake_minimum_required(VERSION 2.4) cmake_policy(SET CMP0054 NEW) project (Complex) +# Inform the test if the debug configuration is getting built. +string(APPEND CMAKE_C_FLAGS_RELEASE " -DCOMPLEX_NDEBUG") +string(APPEND CMAKE_CXX_FLAGS_RELEASE " -DCOMPLEX_NDEBUG") +string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG") +string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG") +string(APPEND CMAKE_C_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG") +string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG") + # Try setting a new policy. The IF test is for coverage. if(POLICY CMP0003) cmake_policy(SET CMP0003 NEW) diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 54c18f4..097668b 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -62,7 +62,7 @@ void cmPassed(const char* Message, const char* m2 = "") # error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif -#if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE) +#if defined(COMPLEX_NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE) # error Per-configuration directory-level definition not inherited. #endif diff --git a/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt b/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt index 97670e3..447e137 100644 --- a/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt +++ b/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt @@ -1,3 +1,6 @@ -project(SeparableCompCXXOnly LANGUAGES CXX CUDA) +# Set CMAKE_CUDA_SEPARABLE_COMPILATION before `project` +# so we verify that compiler/linker verbose extraction +# works as required when a `dlink` is part of it set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) +project(SeparableCompCXXOnly LANGUAGES CXX CUDA) add_executable(SeparableCompCXXOnly main.cpp) diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index aa4755d..d23e929 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -7,7 +7,6 @@ endmacro () add_cuda_test_macro(CudaOnly.Architecture Architecture) add_cuda_test_macro(CudaOnly.ArchSpecial CudaOnlyArchSpecial) 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) @@ -28,6 +27,21 @@ if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") add_cuda_test_macro(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) endif() +if(NOT WIN32) + # The CUDA only ships the shared version of the toolkit libraries + # on windows + add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit) + # `isystem` behaves differently on windows with nvcc + add_cuda_test_macro(CudaOnly.ToolkitIsSystemInclude CudaOnlySystemInclude) +endif() + +add_cuda_test_macro(CudaOnly.DeviceLTO CudaOnlyDeviceLTO) + +if(MSVC) + # Tests for features that only work with MSVC + add_cuda_test_macro(CudaOnly.PDB CudaOnlyPDB) +endif() + add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -41,16 +55,6 @@ add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND set_property(TEST "CudaOnly.DontResolveDeviceSymbols" APPEND PROPERTY LABELS "CUDA") -# The CUDA only ships the shared version of the toolkit libraries -# on windows -if(NOT WIN32) - add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit) -endif() - -if(MSVC) - add_cuda_test_macro(CudaOnly.PDB CudaOnlyPDB) -endif() - add_test(NAME CudaOnly.RuntimeControls COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test diff --git a/Tests/CudaOnly/DeviceLTO/CMakeLists.txt b/Tests/CudaOnly/DeviceLTO/CMakeLists.txt new file mode 100644 index 0000000..653b35d --- /dev/null +++ b/Tests/CudaOnly/DeviceLTO/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.18) +project(DeviceLTO CUDA) + +# Goal: +# Verify that we correctly compile with device LTO +# Verify that device LTO requirements are propagated to +# the final device link line + +add_library(CUDA_dlto STATIC file1.cu file2.cu file3.cu) +add_executable(CudaOnlyDeviceLTO main.cu) + +set_target_properties(CUDA_dlto + PROPERTIES + CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES_ALL}" + CUDA_SEPARABLE_COMPILATION ON + POSITION_INDEPENDENT_CODE ON) + +set_target_properties(CudaOnlyDeviceLTO + PROPERTIES + CUDA_SEPARABLE_COMPILATION ON + CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES_ALL}" + ) + +target_link_libraries(CudaOnlyDeviceLTO PRIVATE CUDA_dlto) + +include(CheckIPOSupported) +check_ipo_supported(LANGUAGES CUDA RESULT ipo_supported) +if(ipo_supported) + set_target_properties(CUDA_dlto + PROPERTIES + INTERPROCEDURAL_OPTIMIZATION ON) + + # When non-LTO variants (i.e. virtual) are built together with LTO ones the + # linker warns about missing device LTO for the virtual architectures. + # Ignore these warnings. + target_link_options(CudaOnlyDeviceLTO PRIVATE "$<DEVICE_LINK:-w>") +endif() diff --git a/Tests/CudaOnly/DeviceLTO/file1.cu b/Tests/CudaOnly/DeviceLTO/file1.cu new file mode 100644 index 0000000..703927c --- /dev/null +++ b/Tests/CudaOnly/DeviceLTO/file1.cu @@ -0,0 +1,17 @@ +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + +extern __device__ int file2_func(int); +void __global__ kernel(int x) +{ + file2_func(x); +} + +EXPORT int launch_kernel(int x) +{ + kernel<<<1, 1>>>(x); + return x; +} diff --git a/Tests/CudaOnly/DeviceLTO/file2.cu b/Tests/CudaOnly/DeviceLTO/file2.cu new file mode 100644 index 0000000..73d6468 --- /dev/null +++ b/Tests/CudaOnly/DeviceLTO/file2.cu @@ -0,0 +1,5 @@ +extern __device__ int file3_func(int); +int __device__ file2_func(int x) +{ + return x + file3_func(x); +} diff --git a/Tests/CudaOnly/DeviceLTO/file3.cu b/Tests/CudaOnly/DeviceLTO/file3.cu new file mode 100644 index 0000000..235ac06 --- /dev/null +++ b/Tests/CudaOnly/DeviceLTO/file3.cu @@ -0,0 +1,4 @@ +int __device__ file3_func(int x) +{ + return x * x * x; +} diff --git a/Tests/CudaOnly/DeviceLTO/main.cu b/Tests/CudaOnly/DeviceLTO/main.cu new file mode 100644 index 0000000..8ef4873 --- /dev/null +++ b/Tests/CudaOnly/DeviceLTO/main.cu @@ -0,0 +1,62 @@ +#include <iostream> + +#include "cuda.h" + +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +#else +# define IMPORT +#endif + +IMPORT int launch_kernel(int x); + +int choose_cuda_device() +{ + int nDevices = 0; + cudaError_t err = cudaGetDeviceCount(&nDevices); + if (err != cudaSuccess) { + std::cerr << "Failed to retrieve the number of CUDA enabled devices" + << std::endl; + return 1; + } + for (int i = 0; i < nDevices; ++i) { + cudaDeviceProp prop; + cudaError_t err = cudaGetDeviceProperties(&prop, i); + if (err != cudaSuccess) { + std::cerr << "Could not retrieve properties from CUDA device " << i + << std::endl; + return 1; + } + std::cout << "prop.major: " << prop.major << std::endl; + err = cudaSetDevice(i); + if (err != cudaSuccess) { + std::cout << "Could not select CUDA device " << i << std::endl; + } else { + return 0; + } + } + + std::cout << "Could not find a CUDA enabled card" << std::endl; + + return 1; +} + +int main() +{ + int ret = choose_cuda_device(); + if (ret) { + return 0; + } + + cudaError_t err; + launch_kernel(1); + err = cudaGetLastError(); + if (err != cudaSuccess) { + std::cerr << "launch_kernel: kernel launch should have passed.\n " + "Error message: " + << cudaGetErrorString(err) << std::endl; + return 1; + } + + return 0; +} diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt b/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt new file mode 100644 index 0000000..bc347dd --- /dev/null +++ b/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.24) +project(ToolkitIsSystemInclude CUDA) + +# Verify that the nvrtc.h that is inside `CMAKE_CURRENT_SOURCE_DIR` is still +# the first include for `.cu` files. +add_executable(CudaOnlySystemInclude main.cu) +target_include_directories(CudaOnlySystemInclude SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h b/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h new file mode 100644 index 0000000..5a015c4 --- /dev/null +++ b/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h @@ -0,0 +1,5 @@ +#define CMAKE_CUDA_TOOLKIT_IS_SYSTEM 1 + +int main() +{ +} diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu b/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu new file mode 100644 index 0000000..6cff8a1 --- /dev/null +++ b/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu @@ -0,0 +1,4 @@ +#include "nvrtc.h" +#ifndef CMAKE_CUDA_TOOLKIT_IS_SYSTEM +# error "Failed to specify the CUDA Toolkit includes as system" +#endif diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in index 7c6f76a..10f8461 100644 --- a/Tests/EnforceConfig.cmake.in +++ b/Tests/EnforceConfig.cmake.in @@ -10,7 +10,7 @@ if(NOT CTEST_CONFIGURATION_TYPE) set(CTEST_CMD "@CMAKE_CTEST_COMMAND@@CMAKE_EXECUTABLE_SUFFIX@") get_filename_component(CTEST_DIR "${CTEST_CMD}" PATH) get_filename_component(CTEST_EXE "${CTEST_CMD}" NAME) - foreach(cfg Release Debug MinSizeRel RelWithDebInfo) + foreach(cfg IN ITEMS Release Debug MinSizeRel RelWithDebInfo) if(NOT CTEST_CONFIGURATION_TYPE) if(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}") set(CTEST_CONFIGURATION_TYPE ${cfg}) diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index e4c6c66..81d31e7 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -45,7 +45,11 @@ if(NOT DEFINED EP_TEST_HG OR EP_TEST_HG) find_package(Hg) endif() if(NOT DEFINED EP_TEST_HG AND Hg_FOUND) - set(EP_TEST_HG 1) + # Check if hg executable is working + execute_process(COMMAND "${HG_EXECUTABLE}" --version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE HG_RV) + if(HG_RV EQUAL 0) + set(EP_TEST_HG 1) + endif() endif() message(STATUS "EP_TEST_CVS='${EP_TEST_CVS}' CVS_EXECUTABLE='${CVS_EXECUTABLE}'") diff --git a/Tests/FindOpenSP/CMakeLists.txt b/Tests/FindOpenSP/CMakeLists.txt new file mode 100644 index 0000000..26826d3 --- /dev/null +++ b/Tests/FindOpenSP/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindOpenSP.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindOpenSP/Test" + "${CMake_BINARY_DIR}/Tests/FindOpenSP/Test" + ${build_generator_args} + --build-project TestFindOpenSP + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindOpenSP/Test/CMakeLists.txt b/Tests/FindOpenSP/Test/CMakeLists.txt new file mode 100644 index 0000000..d8992d9 --- /dev/null +++ b/Tests/FindOpenSP/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindOpenSP CXX) +include(CTest) + +find_package(OpenSP REQUIRED) + +add_definitions(-DSP_MULTI_BYTE="${OpenSP_MULTI_BYTE}") + +add_executable(test_tgt main.cxx) +target_link_libraries(test_tgt OpenSP::OpenSP) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.cxx) +target_include_directories(test_var PRIVATE ${OpenSP_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${OpenSP_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindOpenSP/Test/main.cxx b/Tests/FindOpenSP/Test/main.cxx new file mode 100644 index 0000000..ef8aa2c --- /dev/null +++ b/Tests/FindOpenSP/Test/main.cxx @@ -0,0 +1,55 @@ +#include <cassert> +#include <string> + +#include "ParserEventGeneratorKit.h" + +std::string CharStringtostring(const SGMLApplication::CharString source) +{ + // The CharString type might have multi-byte characters if SP_MULTI_BYTE was + // defined + std::string result; + result.resize(source.len); + for (size_t i = 0; i < source.len; i++) { + result[i] = static_cast<char>(source.ptr[i]); + } + return result; +} + +class OutlineApplication : public SGMLApplication +{ +public: + OutlineApplication() + : depth_(0) + { + } + void startElement(const StartElementEvent& event) + { + for (unsigned i = 0; i < depth_; i++) + parsedOutput += "\t"; + parsedOutput += CharStringtostring(event.gi); + depth_++; + } + void endElement(const EndElementEvent&) { depth_--; } + std::string parsedOutput; + +private: + unsigned depth_; +}; + +int main() +{ + std::string expectedOutput = "TESTDOC\tTESTELEMENT"; + char file_name[] = "test.sgml"; + char* files[] = { file_name, 0 }; + + ParserEventGeneratorKit parserKit; + EventGenerator* egp = parserKit.makeEventGenerator(1, files); + OutlineApplication app; + unsigned nErrors = egp->run(app); + + assert(nErrors == 0); + assert(app.parsedOutput.compare(expectedOutput) == 0); + + delete egp; + return 0; +} diff --git a/Tests/FindOpenSP/Test/test.sgml b/Tests/FindOpenSP/Test/test.sgml new file mode 100644 index 0000000..bbf0da6 --- /dev/null +++ b/Tests/FindOpenSP/Test/test.sgml @@ -0,0 +1,7 @@ + <!DOCTYPE TESTDOC [ +<!ELEMENT TESTDOC - - (TESTELEMENT)+> +<!ELEMENT TESTELEMENT - - (#PCDATA)> +]> +<TESTDOC> +<TESTELEMENT>Hello</TESTELEMENT> +</TESTDOC> diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index c25b2c3..e4143b9 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -20,7 +20,7 @@ find_package(OpenGL QUIET) find_package(NotAPackage QUIET) # Look for a package that has an advanced find module. -find_package(VTK QUIET) +find_package(Boost QUIET) add_executable(FindPackageTest FindPackageTest.cxx) diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index 520ba9e..d4cf36b 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -423,6 +423,19 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + add_test(NAME FindPython.DifferentComponents COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/DifferentComponents" + "${CMake_BINARY_DIR}/Tests/FindPython/DifferentComponents" + ${build_generator_args} + --build-project DifferentComponents + --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" + "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" + "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + if (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") add_test(NAME FindPython.Interpreter.SOABI COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> diff --git a/Tests/FindPython/DifferentComponents/CMakeLists.txt b/Tests/FindPython/DifferentComponents/CMakeLists.txt new file mode 100644 index 0000000..7476632 --- /dev/null +++ b/Tests/FindPython/DifferentComponents/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestDifferentComponents LANGUAGES C) + +add_subdirectory(subdir) + +find_package(Python3 REQUIRED COMPONENTS Development.Module) diff --git a/Tests/FindPython/DifferentComponents/subdir/CMakeLists.txt b/Tests/FindPython/DifferentComponents/subdir/CMakeLists.txt new file mode 100644 index 0000000..98fcd5f --- /dev/null +++ b/Tests/FindPython/DifferentComponents/subdir/CMakeLists.txt @@ -0,0 +1,2 @@ + +find_package(Python3 REQUIRED COMPONENTS Development) diff --git a/Tests/FindVulkan/Test/CMakeLists.txt b/Tests/FindVulkan/Test/CMakeLists.txt index 727e1ce..dfcfc15 100644 --- a/Tests/FindVulkan/Test/CMakeLists.txt +++ b/Tests/FindVulkan/Test/CMakeLists.txt @@ -8,7 +8,9 @@ set(components shaderc_combined SPIRV-Tools volk + dxc ) + if(APPLE) list(APPEND components MoltenVK) endif() @@ -80,6 +82,10 @@ add_executable(test_tgt_volk main-volk.cxx) target_link_libraries(test_tgt_volk Vulkan::volk) add_test(NAME test_tgt_volk COMMAND test_tgt_volk) +add_executable(test_tgt_dxc_lib main-dxc_lib.cxx) +target_link_libraries(test_tgt_dxc_lib Vulkan::dxc_lib) +add_test(NAME test_tgt_dxc_lib COMMAND test_tgt_dxc_lib) + if(Vulkan_GLSLC_EXECUTABLE) add_test(NAME test_glslc COMMAND ${CMAKE_COMMAND} @@ -97,3 +103,12 @@ if(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE) -P "${CMAKE_CURRENT_LIST_DIR}/Run-glslangValidator.cmake" ) endif() + +if(Vulkan_dxc_EXECUTABLE) + add_test(NAME test_dxc_exe + COMMAND ${CMAKE_COMMAND} + "-DVULKAN_DXC_EXECUTABLE=${Vulkan_dxc_EXECUTABLE}" + "-DVULKAN_DXC_EXECUTABLE_TARGET=$<TARGET_FILE:Vulkan::dxc_exe>" + -P "${CMAKE_CURRENT_LIST_DIR}/Run-dxc_exe.cmake" + ) +endif() diff --git a/Tests/FindVulkan/Test/Run-dxc_exe.cmake b/Tests/FindVulkan/Test/Run-dxc_exe.cmake new file mode 100644 index 0000000..0d38855 --- /dev/null +++ b/Tests/FindVulkan/Test/Run-dxc_exe.cmake @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.12) + +function(run_dxc_exe exe exe_display) + execute_process(COMMAND ${exe} --help + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE result + ) + + if(NOT result EQUAL 0) + message(SEND_ERROR "Result of ${exe_display} --help is ${result}, should be 0") + endif() + + if(NOT output MATCHES "^OVERVIEW: HLSL Compiler for ") + message(SEND_ERROR "Output of ${exe_display} --help is \"${output}\", should begin with \"OVERVIEW: HLSL Compiler for \"") + endif() +endfunction() + +run_dxc_exe("${VULKAN_DXC_EXECUTABLE}" "\${VULKAN_DXC_EXECUTABLE}") +run_dxc_exe("${VULKAN_DXC_EXECUTABLE_TARGET}" "Vulkan::dxc_exe") diff --git a/Tests/FindVulkan/Test/main-dxc_lib.cxx b/Tests/FindVulkan/Test/main-dxc_lib.cxx new file mode 100644 index 0000000..6ccb0de --- /dev/null +++ b/Tests/FindVulkan/Test/main-dxc_lib.cxx @@ -0,0 +1,23 @@ +#include <cstdio> + +#include "dxc/dxcapi.h" +#include "printf.h" + +int main() +{ + IDxcCompiler3* compiler; + DxcCreateInstance(CLSID_DxcCompiler, IID_PPV_ARGS(&compiler)); + + assert(compiler); + + IDxcVersionInfo* version; + compiler->QueryInterface(&version); + + uint32_t major, minor; + version->GetVersion(&major, &minor); + printf("DirectX Shader Compiler: %u.%u\n", major, minor); + version->Release(); + compiler->Release(); + + return 0; +} diff --git a/Tests/FortranModules/Submodules/CMakeLists.txt b/Tests/FortranModules/Submodules/CMakeLists.txt index ab8e0f9..783af7e 100644 --- a/Tests/FortranModules/Submodules/CMakeLists.txt +++ b/Tests/FortranModules/Submodules/CMakeLists.txt @@ -16,6 +16,7 @@ add_executable(submod main.f90 parent.f90 + obfuscated_parent.f90 child.f90 grandchild.f90 greatgrandchild.f90 diff --git a/Tests/FortranModules/Submodules/main.f90 b/Tests/FortranModules/Submodules/main.f90 index 3cd2989..67ffba8 100644 --- a/Tests/FortranModules/Submodules/main.f90 +++ b/Tests/FortranModules/Submodules/main.f90 @@ -1,7 +1,10 @@ program main use parent, only : child_function,grandchild_subroutine use parent, only : sibling_function,GreatGrandChild_subroutine + ! Using a module without postfix + use obfuscated_parent implicit none - if (child_function()) call grandchild_subroutine - if (sibling_function()) call GreatGrandChild_subroutine + if (child_function()) call grandchild_subroutine + if (sibling_function()) call GreatGrandChild_subroutine + if (child_function_obf()) call grandchild_subroutine_obf end program diff --git a/Tests/FortranModules/Submodules/obfuscated_parent.f90 b/Tests/FortranModules/Submodules/obfuscated_parent.f90 new file mode 100644 index 0000000..f3e68be --- /dev/null +++ b/Tests/FortranModules/Submodules/obfuscated_parent.f90 @@ -0,0 +1,33 @@ +! This module has two procedures from the "parent" module +! but it has different combinations 'module <word>' phrases +! in breaked lines for test of modules dependencies detection + +! Module declaration on breaked line with reminder +module & + obfuscated_parent; implicit none + + interface + + ! Boolean module function + module logical & + function child_function_obf() result(child_stuff) + end function + + ! Module subroutine + module subroutine & + grandchild_subroutine_obf() + end subroutine + + end interface + + contains + + module logical function child_function_obf() result(child_stuff) + child_stuff=.true. + end function + + module subroutine grandchild_subroutine_obf() + print *,"Test passed." + end subroutine + +end module obfuscated_parent diff --git a/Tests/FortranModules/test_module_main.f90 b/Tests/FortranModules/test_module_main.f90 index 6ac97fa..958d0a2 100644 --- a/Tests/FortranModules/test_module_main.f90 +++ b/Tests/FortranModules/test_module_main.f90 @@ -1,4 +1,4 @@ PROGRAM MAINF90 - USE TEST_MODULE + USE TEST_MODULE, only : TEST_MODULE_FUNCTION PRINT *,'Sum is',TEST_MODULE_FUNCTION(1., 2.) END PROGRAM MAINF90 diff --git a/Tests/FunctionTest/CMakeLists.txt b/Tests/FunctionTest/CMakeLists.txt index 6450447..0660d0f 100644 --- a/Tests/FunctionTest/CMakeLists.txt +++ b/Tests/FunctionTest/CMakeLists.txt @@ -51,7 +51,7 @@ track_find_variable(testvar is_changed) if ("${is_changed}" STREQUAL changed) pass("same argument name test") else () - pass("same argument name test") + fail("same argument name test" "Got: ${is_changed}") endif () include("Util.cmake") @@ -59,7 +59,7 @@ tester() if (tester_res STREQUAL "${CMAKE_CURRENT_LIST_FILE}") pass("CMAKE_CURRENT_LIST_FILE test") else () - pass("CMAKE_CURRENT_LIST_FILE test") + fail("CMAKE_CURRENT_LIST_FILE test" "Got: ${tester_res}") endif () diff --git a/Tests/MSVCDebugInformationFormat/CMakeLists.txt b/Tests/MSVCDebugInformationFormat/CMakeLists.txt new file mode 100644 index 0000000..b09bc6c --- /dev/null +++ b/Tests/MSVCDebugInformationFormat/CMakeLists.txt @@ -0,0 +1,81 @@ +cmake_minimum_required(VERSION 3.24) +cmake_policy(SET CMP0141 NEW) + +# The debug information format flags do not change preprocessor definitions, +# so override our table of flags to artificially add a definition we can check. +set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/override-C.cmake) +set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/override-CXX.cmake) +set(CMAKE_USER_MAKE_RULES_OVERRIDE_CUDA ${CMAKE_CURRENT_SOURCE_DIR}/override-CUDA.cmake) +set(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran ${CMAKE_CURRENT_SOURCE_DIR}/override-Fortran.cmake) + +project(MSVCDebugInformationFormat) +if(CMake_TEST_CUDA) + enable_language(CUDA) +endif() +if(CMake_TEST_Fortran) + enable_language(Fortran) +endif() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +if("${CMAKE_C_COMPILER_ID};${CMAKE_C_SIMULATE_ID};${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "Clang;MSVC;GNU") + set(verify_default VERIFY_Z7) + set(NO_COMPILER_PDB 1) +elseif("${CMAKE_C_COMPILER_ID};${CMAKE_C_SIMULATE_ID};${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "Clang;MSVC;MSVC") + set(verify_default VERIFY_Zi) + set(NO_EDIT_AND_CONTINUE 1) +else() + set(verify_default VERIFY_Zi) +endif() + +set(verify_def_Embedded -DVERIFY_Z7) +set(verify_def_ProgramDatabase -DVERIFY_Zi) +set(verify_def_EditAndContinue -DVERIFY_ZI) + +function(verify_combination format lang src) + # Test that try_compile builds with this debug format. + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "${format}") + set(CMAKE_TRY_COMPILE_CONFIGURATION "Debug") + set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") + try_compile(${format}_COMPILES + ${CMAKE_CURRENT_BINARY_DIR}/try_compile/${format} + ${CMAKE_CURRENT_SOURCE_DIR}/${src} + COMPILE_DEFINITIONS ${verify_def_${format}} + CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE ${format}_OUTPUT + ) + if(${format}_COMPILES) + message(STATUS "try_compile ${lang} with ${format} worked") + else() + string(REPLACE "\n" "\n " ${format}_OUTPUT " ${${format}_OUTPUT}") + message(SEND_ERROR "try_compile ${lang} with ${format} failed:\n${${format}_OUTPUT}") + endif() + + # Test that targets build with this debug format. + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<BOOL:$<TARGET_PROPERTY:BOOL_TRUE>>:${format}>$<$<BOOL:$<TARGET_PROPERTY:BOOL_FALSE>>:BadContent>") + add_library(${format}-${lang} ${src}) + set_property(TARGET ${format}-${lang} PROPERTY BOOL_TRUE TRUE) + target_compile_definitions(${format}-${lang} PRIVATE ${verify_def_${format}}) +endfunction() + +function(verify lang src) + add_library(default-${lang} ${src}) + target_compile_definitions(default-${lang} PRIVATE "$<$<CONFIG:Debug,RelWithDebInfo>:${verify_default}>") + + verify_combination(Embedded ${lang} ${src}) + if(NOT NO_COMPILER_PDB) + verify_combination(ProgramDatabase ${lang} ${src}) + if(NOT NO_EDIT_AND_CONTINUE AND NOT lang MATCHES "^(Fortran)$") + verify_combination(EditAndContinue ${lang} ${src}) + endif() + endif() +endfunction() + +verify(C verify.c) +verify(CXX verify.cxx) +if(CMake_TEST_CUDA) + verify(CUDA verify.cu) +endif() +if(CMake_TEST_Fortran) + verify(Fortran verify.F90) +endif() diff --git a/Tests/MSVCDebugInformationFormat/override-C.cmake b/Tests/MSVCDebugInformationFormat/override-C.cmake new file mode 100644 index 0000000..e8f5ae4 --- /dev/null +++ b/Tests/MSVCDebugInformationFormat/override-C.cmake @@ -0,0 +1,7 @@ +set(var "CMAKE_C_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded") +string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}") +string(REPLACE "-gcodeview" "-gcodeview;-DTEST_Z7" "${var}" "${${var}}") +set(var "CMAKE_C_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase") +string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}") +set(var "CMAKE_C_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue") +string(REPLACE "-ZI" "-ZI;-DTEST_ZI" "${var}" "${${var}}") diff --git a/Tests/MSVCDebugInformationFormat/override-CUDA.cmake b/Tests/MSVCDebugInformationFormat/override-CUDA.cmake new file mode 100644 index 0000000..f870775 --- /dev/null +++ b/Tests/MSVCDebugInformationFormat/override-CUDA.cmake @@ -0,0 +1,6 @@ +set(var "CMAKE_CUDA_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded") +string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}") +set(var "CMAKE_CUDA_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase") +string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}") +set(var "CMAKE_CUDA_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue") +string(REPLACE "-ZI" "-ZI;-DTEST_ZI" "${var}" "${${var}}") diff --git a/Tests/MSVCDebugInformationFormat/override-CXX.cmake b/Tests/MSVCDebugInformationFormat/override-CXX.cmake new file mode 100644 index 0000000..caa23fe --- /dev/null +++ b/Tests/MSVCDebugInformationFormat/override-CXX.cmake @@ -0,0 +1,7 @@ +set(var "CMAKE_CXX_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded") +string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}") +string(REPLACE "-gcodeview" "-gcodeview;-DTEST_Z7" "${var}" "${${var}}") +set(var "CMAKE_CXX_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase") +string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}") +set(var "CMAKE_CXX_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue") +string(REPLACE "-ZI" "-ZI;-DTEST_ZI" "${var}" "${${var}}") diff --git a/Tests/MSVCDebugInformationFormat/override-Fortran.cmake b/Tests/MSVCDebugInformationFormat/override-Fortran.cmake new file mode 100644 index 0000000..5d2db58 --- /dev/null +++ b/Tests/MSVCDebugInformationFormat/override-Fortran.cmake @@ -0,0 +1,4 @@ +set(var "CMAKE_Fortran_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded") +string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}") +set(var "CMAKE_Fortran_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase") +string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}") diff --git a/Tests/MSVCDebugInformationFormat/verify.F90 b/Tests/MSVCDebugInformationFormat/verify.F90 new file mode 100644 index 0000000..741bca6 --- /dev/null +++ b/Tests/MSVCDebugInformationFormat/verify.F90 @@ -0,0 +1 @@ +#include "verify.h" diff --git a/Tests/MSVCDebugInformationFormat/verify.c b/Tests/MSVCDebugInformationFormat/verify.c new file mode 100644 index 0000000..741bca6 --- /dev/null +++ b/Tests/MSVCDebugInformationFormat/verify.c @@ -0,0 +1 @@ +#include "verify.h" diff --git a/Tests/MSVCDebugInformationFormat/verify.cu b/Tests/MSVCDebugInformationFormat/verify.cu new file mode 100644 index 0000000..741bca6 --- /dev/null +++ b/Tests/MSVCDebugInformationFormat/verify.cu @@ -0,0 +1 @@ +#include "verify.h" diff --git a/Tests/MSVCDebugInformationFormat/verify.cxx b/Tests/MSVCDebugInformationFormat/verify.cxx new file mode 100644 index 0000000..741bca6 --- /dev/null +++ b/Tests/MSVCDebugInformationFormat/verify.cxx @@ -0,0 +1 @@ +#include "verify.h" diff --git a/Tests/MSVCDebugInformationFormat/verify.h b/Tests/MSVCDebugInformationFormat/verify.h new file mode 100644 index 0000000..4bd6529 --- /dev/null +++ b/Tests/MSVCDebugInformationFormat/verify.h @@ -0,0 +1,29 @@ +#ifdef VERIFY_Z7 +# ifndef TEST_Z7 +# error "TEST_Z7 incorrectly not defined by debug format selection" +# endif +#else +# ifdef TEST_Z7 +# error "TEST_Z7 incorrectly defined by non-debug format selection" +# endif +#endif + +#ifdef VERIFY_Zi +# ifndef TEST_Zi +# error "TEST_Zi incorrectly not defined by debug format selection" +# endif +#else +# ifdef TEST_Zi +# error "TEST_Zi incorrectly defined by non-debug format selection" +# endif +#endif + +#ifdef VERIFY_ZI +# ifndef TEST_ZI +# error "TEST_ZI incorrectly not defined by debug format selection" +# endif +#else +# ifdef TEST_ZI +# error "TEST_ZI incorrectly defined by non-debug format selection" +# endif +#endif diff --git a/Tests/Module/CheckIPOSupported-CUDA/CMakeLists.txt b/Tests/Module/CheckIPOSupported-CUDA/CMakeLists.txt new file mode 100644 index 0000000..9dd670e --- /dev/null +++ b/Tests/Module/CheckIPOSupported-CUDA/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.8) +project(CheckIPOSupported-CUDA LANGUAGES CUDA) + +cmake_policy(SET CMP0069 NEW) + +include(CheckIPOSupported) +check_ipo_supported(RESULT ipo_supported OUTPUT ipo_output) +if(ipo_supported) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) +endif() + +if(NOT ipo_supported AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" + AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.2) + message(FATAL_ERROR "CheckIPOSupported failed to correctly identify NVIDIA CUDA IPO support") +endif() + +set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) + +add_library(foo STATIC foo.cu) +set_target_properties(foo PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS ON + POSITION_INDEPENDENT_CODE ON) + +add_library(bar SHARED bar.cu) +set_target_properties(bar PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) +target_link_libraries(bar PRIVATE foo) + +add_executable(CheckIPOSupported-CUDA main.cu) +target_link_libraries(CheckIPOSupported-CUDA PUBLIC bar) + +enable_testing() +add_test(NAME CheckIPOSupported-CUDA COMMAND CheckIPOSupported-CUDA) diff --git a/Tests/Module/CheckIPOSupported-CUDA/bar.cu b/Tests/Module/CheckIPOSupported-CUDA/bar.cu new file mode 100644 index 0000000..79b276d --- /dev/null +++ b/Tests/Module/CheckIPOSupported-CUDA/bar.cu @@ -0,0 +1,12 @@ +__device__ int foo_func(int); + +void __global__ bar_kernel(int x) +{ + foo_func(x); +} + +int launch_kernel(int x) +{ + bar_kernel<<<1, 1>>>(x); + return x; +} diff --git a/Tests/Module/CheckIPOSupported-CUDA/foo.cu b/Tests/Module/CheckIPOSupported-CUDA/foo.cu new file mode 100644 index 0000000..416607b --- /dev/null +++ b/Tests/Module/CheckIPOSupported-CUDA/foo.cu @@ -0,0 +1,4 @@ +extern __device__ int foo_func(int a) +{ + return a * 42 + 9; +} diff --git a/Tests/Module/CheckIPOSupported-CUDA/main.cu b/Tests/Module/CheckIPOSupported-CUDA/main.cu new file mode 100644 index 0000000..8ef4873 --- /dev/null +++ b/Tests/Module/CheckIPOSupported-CUDA/main.cu @@ -0,0 +1,62 @@ +#include <iostream> + +#include "cuda.h" + +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +#else +# define IMPORT +#endif + +IMPORT int launch_kernel(int x); + +int choose_cuda_device() +{ + int nDevices = 0; + cudaError_t err = cudaGetDeviceCount(&nDevices); + if (err != cudaSuccess) { + std::cerr << "Failed to retrieve the number of CUDA enabled devices" + << std::endl; + return 1; + } + for (int i = 0; i < nDevices; ++i) { + cudaDeviceProp prop; + cudaError_t err = cudaGetDeviceProperties(&prop, i); + if (err != cudaSuccess) { + std::cerr << "Could not retrieve properties from CUDA device " << i + << std::endl; + return 1; + } + std::cout << "prop.major: " << prop.major << std::endl; + err = cudaSetDevice(i); + if (err != cudaSuccess) { + std::cout << "Could not select CUDA device " << i << std::endl; + } else { + return 0; + } + } + + std::cout << "Could not find a CUDA enabled card" << std::endl; + + return 1; +} + +int main() +{ + int ret = choose_cuda_device(); + if (ret) { + return 0; + } + + cudaError_t err; + launch_kernel(1); + err = cudaGetLastError(); + if (err != cudaSuccess) { + std::cerr << "launch_kernel: kernel launch should have passed.\n " + "Error message: " + << cudaGetErrorString(err) << std::endl; + return 1; + } + + return 0; +} diff --git a/Tests/ModuleDefinition/CMakeLists.txt b/Tests/ModuleDefinition/CMakeLists.txt index 567fb4b..483bd8b 100644 --- a/Tests/ModuleDefinition/CMakeLists.txt +++ b/Tests/ModuleDefinition/CMakeLists.txt @@ -15,7 +15,17 @@ add_custom_command(OUTPUT example_dll_gen.def add_library(example_dll_gen SHARED example_dll_gen.c example_dll_gen.def) # Test /DEF:<file> flag recognition for VS. -if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Intel") +if(MSVC AND CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM") + # IntelLLVM for MSVC frontend variant needs the /DEF flag wrapped to be sent + # to the linker, which happens automatically when the DEF file is added + # to the sources. + add_library(example_dll_2 SHARED + example_dll_2.c + "${ModuleDefinition_SOURCE_DIR}/example_dll_2.def" + ) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS EXAMPLE_DLL_2) + set(example_dll_2 example_dll_2) +elseif(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Intel") add_library(example_dll_2 SHARED example_dll_2.c) set_property(TARGET example_dll_2 PROPERTY LINK_FLAGS /DEF:"${ModuleDefinition_SOURCE_DIR}/example_dll_2.def") diff --git a/Tests/OutOfSource/CMakeLists.txt b/Tests/OutOfSource/CMakeLists.txt index 4687882..c82d077 100644 --- a/Tests/OutOfSource/CMakeLists.txt +++ b/Tests/OutOfSource/CMakeLists.txt @@ -16,3 +16,6 @@ configure_file( ) set(KEN 1) + +configure_file(SubInBuildCMakeLists.cmake ${CMAKE_CURRENT_BINARY_DIR}/SubInBuild/CMakeLists.txt COPYONLY) +add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/SubInBuild ${CMAKE_CURRENT_BINARY_DIR}/SubInBuild/Build) diff --git a/Tests/OutOfSource/SubInBuildCMakeLists.cmake b/Tests/OutOfSource/SubInBuildCMakeLists.cmake new file mode 100644 index 0000000..c2e2942 --- /dev/null +++ b/Tests/OutOfSource/SubInBuildCMakeLists.cmake @@ -0,0 +1 @@ +add_custom_target(SubInBuildCustom ALL) diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index 4347459..84ca5e8 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -197,9 +197,14 @@ endif() #----------------------------------------------------------------------------- # Inform the test if the debug configuration is getting built. -# The NDEBUG definition takes care of this for release. string(APPEND CMAKE_C_FLAGS_DEBUG " -DPREPROCESS_DEBUG") string(APPEND CMAKE_CXX_FLAGS_DEBUG " -DPREPROCESS_DEBUG") +string(APPEND CMAKE_C_FLAGS_RELEASE " -DPREPROCESS_NDEBUG") +string(APPEND CMAKE_CXX_FLAGS_RELEASE " -DPREPROCESS_NDEBUG") +string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " -DPREPROCESS_NDEBUG") +string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -DPREPROCESS_NDEBUG") +string(APPEND CMAKE_C_FLAGS_MINSIZEREL " -DPREPROCESS_NDEBUG") +string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " -DPREPROCESS_NDEBUG") # Inform the test if it built from Xcode. if(PP_XCODE) diff --git a/Tests/Preprocess/preprocess.c b/Tests/Preprocess/preprocess.c index b3117da..88f9e97 100644 --- a/Tests/Preprocess/preprocess.c +++ b/Tests/Preprocess/preprocess.c @@ -33,7 +33,7 @@ int check_defines_C(void) result = 0; } } -#ifdef NDEBUG +#ifdef PREPROCESS_NDEBUG # ifdef FILE_DEF_DEBUG { fprintf(stderr, "FILE_DEF_DEBUG should not be defined in C\n"); diff --git a/Tests/Preprocess/preprocess.cxx b/Tests/Preprocess/preprocess.cxx index f2fffef..50150d1 100644 --- a/Tests/Preprocess/preprocess.cxx +++ b/Tests/Preprocess/preprocess.cxx @@ -35,7 +35,7 @@ int check_defines_CXX() result = 0; } } -#ifdef NDEBUG +#ifdef PREPROCESS_NDEBUG # ifdef FILE_DEF_DEBUG { fprintf(stderr, "FILE_DEF_DEBUG should not be defined in CXX\n"); diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake index dbcf4b8..fe57d56 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_GENERATOR_PLATFORM STREQUAL "ARM64") + AND NOT CMAKE_VS_PLATFORM_NAME 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_GENERATOR_PLATFORM STREQUAL "ARM64") + NOT CMAKE_VS_PLATFORM_NAME 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/CMakeDependentOption/RunCMakeTest.cmake b/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake index 61e046f..074db65 100644 --- a/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake @@ -4,3 +4,4 @@ run_cmake_script(Regex-CMP0127-NEW) run_cmake_script(Regex-CMP0127-OLD) run_cmake_script(Parentheses-CMP0127-NEW) run_cmake_script(Parentheses-CMP0127-WARN) +run_cmake_script(UseDotSymbol) diff --git a/Tests/RunCMake/CMakeDependentOption/UseDotSymbol-stdout.txt b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol-stdout.txt new file mode 100644 index 0000000..15b56a1 --- /dev/null +++ b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol-stdout.txt @@ -0,0 +1 @@ +-- USE_FOO='ON' diff --git a/Tests/RunCMake/CMakeDependentOption/UseDotSymbol.cmake b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol.cmake new file mode 100644 index 0000000..8f07c48 --- /dev/null +++ b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol.cmake @@ -0,0 +1,4 @@ +include(CMakeDependentOption) + +cmake_dependent_option(USE_FOO "Use Foo" ON "CMAKE_VERSION VERSION_GREATER_EQUAL 3.08" OFF) +message(STATUS "USE_FOO='${USE_FOO}'") diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bbf8ddc..2f5bc87 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -301,9 +301,13 @@ if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(ExportCompileCommands) endif() add_RunCMake_test(ExcludeFromAll) +add_RunCMake_test(ExportImport) add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) +if(CMAKE_USE_SYSTEM_JSONCPP) + list(APPEND FileAPI_ARGS -DJsonCpp_VERSION_STRING=${JsonCpp_VERSION_STRING}) +endif() add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE} -DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}) add_RunCMake_test(FindBoost) @@ -355,6 +359,7 @@ if(MSVC) add_RunCMake_test(MSVCRuntimeLibrary) add_RunCMake_test(MSVCRuntimeTypeInfo) add_RunCMake_test(MSVCWarningFlags) + add_RunCMake_test(MSVCDebugInformationFormat) endif() if(XCODE_VERSION) set(ObjectLibrary_ARGS -DXCODE_VERSION=${XCODE_VERSION}) @@ -372,7 +377,8 @@ add_RunCMake_test(TargetProperties) add_RunCMake_test(ToolchainFile) add_RunCMake_test(find_dependency) add_RunCMake_test(CompileDefinitions) -add_RunCMake_test(CompileWarningAsError) +add_RunCMake_test(CompileWarningAsError -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) +set_property(TEST RunCMake.CompileWarningAsError APPEND PROPERTY LABELS "CUDA") add_RunCMake_test(CompileFeatures -DCMake_NO_C_STANDARD=${CMake_NO_C_STANDARD} -DCMake_NO_CXX_STANDARD=${CMake_NO_CXX_STANDARD}) add_RunCMake_test(Policy) add_RunCMake_test(PolicyScope) @@ -451,6 +457,7 @@ add_RunCMake_test(find_path) add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(foreach) add_RunCMake_test(function) +add_RunCMake_test(block) add_RunCMake_test(get_filename_component) add_RunCMake_test(get_property) add_RunCMake_test(if) @@ -520,7 +527,9 @@ function(add_RunCMake_test_try_compile) set(CMAKE_CXX_STANDARD_DEFAULT 14) endif() endif() - foreach(var + foreach( + var + IN ITEMS CMAKE_SYSTEM_NAME CMAKE_C_COMPILER_ID CMAKE_C_COMPILER_VERSION @@ -534,7 +543,7 @@ function(add_RunCMake_test_try_compile) CMake_TEST_FILESYSTEM_1S CMAKE_OBJC_STANDARD_DEFAULT CMAKE_OBJCXX_STANDARD_DEFAULT - ) + ) if(DEFINED ${var}) list(APPEND try_compile_ARGS -D${var}=${${var}}) endif() @@ -690,6 +699,8 @@ add_RunCMake_test(target_link_libraries-LINK_LIBRARY -DCMAKE_SYSTEM_NAME=${CMAKE -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION} -DMSVC_VERSION=${MSVC_VERSION} + -DXCODE=${XCODE} + -DXCODE_VERSION=${XCODE_VERSION} -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX} -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX} -DCMAKE_IMPORT_LIBRARY_PREFIX=${CMAKE_IMPORT_LIBRARY_PREFIX} @@ -949,7 +960,7 @@ if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN) if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja|Visual Studio 1[456]") message(FATAL_ERROR "Android tests supported only by Makefile, Ninja, and Visual Studio >= 14 generators") endif() - foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN) + foreach(v IN ITEMS TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN) if(CMake_${v}) string(REPLACE ";" "|" ${v} "${CMake_${v}}") list(APPEND Android_ARGS "-D${v}=${${v}}") @@ -968,7 +979,7 @@ endif() if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|9[0-9])") add_RunCMake_test(CSharpCustomCommand) - if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + if(NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") add_RunCMake_test(CSharpReferenceImport) endif() endif() @@ -993,6 +1004,10 @@ add_RunCMake_test(CMakePresetsTest -DPython_EXECUTABLE=${Python_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA} ) +add_RunCMake_test(CMakePresetsPackage + -DPython_EXECUTABLE=${Python_EXECUTABLE} + -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA} + ) add_RunCMake_test(VerifyHeaderSets) diff --git a/Tests/RunCMake/CMakePresets/Comment-stderr.txt b/Tests/RunCMake/CMakePresets/Comment-stderr.txt index 2f404bc..b3b6b66 100644 --- a/Tests/RunCMake/CMakePresets/Comment-stderr.txt +++ b/Tests/RunCMake/CMakePresets/Comment-stderr.txt @@ -1,2 +1,9 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error$ +]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error +Errors: +[^ +]*Comment\/CMakePresets.json: +\* Line 1, Column 1 + Syntax error: value, object or array expected\. +\* Line 2, Column 1 + Extra non-whitespace after JSON value\.$ diff --git a/Tests/RunCMake/CMakePresets/DocumentationExampleListAllPresets-stdout.txt b/Tests/RunCMake/CMakePresets/DocumentationExampleListAllPresets-stdout.txt new file mode 100644 index 0000000..b1fcc28 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/DocumentationExampleListAllPresets-stdout.txt @@ -0,0 +1,18 @@ +^Not searching for unused variables given on the command line\. +Available configure presets: + + "default" ?- Default Config + "ninja-multi" ?- Ninja Multi-Config( + "windows-only" - Windows-only configuration)? + +Available build presets: + + "default" + +Available test presets: + + "default" + +Available package presets: + + "default"$ diff --git a/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt index 6970674..0d3c500 100644 --- a/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt +++ b/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt @@ -1,2 +1,5 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/EmptyPresetName: Invalid preset$ +]*/Tests/RunCMake/CMakePresets/EmptyPresetName: Invalid preset +Errors: +[^ +]*/EmptyPresetName/CMakePresets.json$ diff --git a/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake b/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake index df58e72..d9e399f 100644 --- a/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake +++ b/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake @@ -1,4 +1,5 @@ include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) get_filename_component(_parent "${CMAKE_SOURCE_DIR}" DIRECTORY) +file(REAL_PATH "${_parent}" _parent) test_variable(CMAKE_BINARY_DIR "" "${_parent}/GoodNoSCachePrep-build") diff --git a/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt b/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt index 7ccabab..85a2d78 100644 --- a/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt +++ b/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt @@ -1,2 +1,5 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/IncludeNotFound: File not found$ +]*/Tests/RunCMake/CMakePresets/IncludeNotFound: File not found +Errors: +[^ +]*/IncludeNotFound/NotFound.json: Failed to read file$ diff --git a/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt b/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt index a43bf77..89eff9f 100644 --- a/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt +++ b/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt @@ -1,2 +1,9 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/JSONParseError: JSON parse error$ +]*/Tests/RunCMake/CMakePresets/JSONParseError: JSON parse error +Errors: +[^ +]*JSONParseError/CMakePresets.json: +\* Line 1, Column 1 + Syntax error: value, object or array expected\. +\* Line 1, Column 1 + A valid JSON document must be either an array or an object value\.$ diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild-stdout.txt b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild-stdout.txt new file mode 100644 index 0000000..38f52aa --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild-stdout.txt @@ -0,0 +1,8 @@ +^Not searching for unused variables given on the command line. +Available configure presets: + + "default" + +Available test presets: + + "default"$ diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild.json.in b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild.json.in new file mode 100644 index 0000000..9259477 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild.json.in @@ -0,0 +1,14 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "default" + } + ], + "testPresets": [ + { + "name": "default", + "configurePreset": "default" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest-stdout.txt b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest-stdout.txt new file mode 100644 index 0000000..8cac0a8 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest-stdout.txt @@ -0,0 +1,8 @@ +^Not searching for unused variables given on the command line. +Available configure presets: + + "default" + +Available build presets: + + "default"$ diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest.json.in b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest.json.in new file mode 100644 index 0000000..33fd036 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest.json.in @@ -0,0 +1,14 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "default" + } + ], + "buildPresets": [ + { + "name": "default", + "configurePreset": "default" + } + ] +} diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt +++ b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt diff --git a/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt new file mode 100644 index 0000000..153abee --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: Invalid value specified for --list-presets\. +Valid values are configure, build, test, package, or all\. When no value is passed the default is configure\. +CMake Error: Run 'cmake --help' for all supported options\.$ diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index d097086..efa838e 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -289,6 +289,7 @@ run_cmake_presets(UserInheritance) # Test listing presets set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListPresets.json.in") run_cmake_presets(ListPresets --list-presets) +run_cmake_presets(ListPresetsInvalidType --list-presets=invalid-type) set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ListPresetsWorkingDir") set(RunCMake_TEST_NO_CLEAN 1) @@ -304,6 +305,12 @@ unset(RunCMake_TEST_BINARY_DIR) run_cmake_presets(ListPresetsNoSuchPreset) run_cmake_presets(ListPresetsHidden) +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListAllPresetsNoBuild.json.in") +run_cmake_presets(ListAllPresetsNoBuild --list-presets=all) + +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListAllPresetsNoTest.json.in") +run_cmake_presets(ListAllPresetsNoTest --list-presets=all) + # Test warning and error flags set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Warnings.json.in") set(CMakePresets_WARN_UNUSED_CLI 1) @@ -401,4 +408,5 @@ set(CMakePresets_EXTRA_FILES "${RunCMake_SOURCE_DIR}/moreThings.json.in" ) run_cmake_presets(DocumentationExample --preset=default) +run_cmake_presets(DocumentationExampleListAllPresets --list-presets=all) unset(CMakePresets_EXTRA_FILES) diff --git a/Tests/RunCMake/CMakePresetsPackage/CMakeLists.txt.in b/Tests/RunCMake/CMakePresetsPackage/CMakeLists.txt.in new file mode 100644 index 0000000..129184a --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/CMakeLists.txt.in @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.19) +project("@CASE_NAME@" NONE) +include("@CASE_SOURCE_DIR@/@CASE_NAME@.cmake") diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-config-file-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-config-file-check.cmake new file mode 100644 index 0000000..40240f9 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-config-file-check.cmake @@ -0,0 +1,6 @@ +include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + +set(filename "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/TGZ/config-file-alt.tar.gz") +if(NOT EXISTS "${filename}") + set(RunCMake_TEST_FAILED "Expected ${filename} to exist but it does not") +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-configurations-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-configurations-check.cmake new file mode 100644 index 0000000..3d684af --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-configurations-check.cmake @@ -0,0 +1,18 @@ +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + set(cpack_dir "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}") + set(contents [[Debug +Release +]]) + + file(GLOB dirs RELATIVE "${cpack_dir}" "${cpack_dir}/*") + foreach(dir IN LISTS dirs) + set(configs_file "${cpack_dir}/${dir}/${CPACK_PACKAGE_FILE_NAME}/configs.txt") + file(READ "${configs_file}" actual_contents) + if(NOT contents STREQUAL actual_contents) + string(REPLACE "\n" "\n " contents_formatted "${contents}") + string(REPLACE "\n" "\n " actual_contents_formatted "${actual_contents}") + string(APPEND RunCMake_TEST_FAILED "Expected contents of ${configs_file}:\n ${contents_formatted}\nActual contents:\n ${actual_contents_formatted}\n") + endif() + endforeach() +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-debug-stdout.txt b/Tests/RunCMake/CMakePresetsPackage/Good-package-debug-stdout.txt new file mode 100644 index 0000000..be885b4 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-debug-stdout.txt @@ -0,0 +1,2 @@ +CPack: [^ +]* Enable Debug diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-generators-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-generators-check.cmake new file mode 100644 index 0000000..aaa75e4 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-generators-check.cmake @@ -0,0 +1 @@ +check_cpack_packages("TBZ2;TXZ" "") diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-no-environment-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-no-environment-check.cmake new file mode 100644 index 0000000..205e7b7 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-no-environment-check.cmake @@ -0,0 +1,7 @@ +check_cpack_packages("TGZ;TXZ" [[TEST_ENV not defined +TEST_ENV_REF=xx +TEST_ENV_OVERRIDE not defined +TEST_ENV_OVERRIDE_REF not defined +]]) + +include("${RunCMake_SOURCE_DIR}/check.cmake") diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-package-directory-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-directory-check.cmake new file mode 100644 index 0000000..8f4b771 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-directory-check.cmake @@ -0,0 +1,6 @@ +include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + +set(filename "${RunCMake_TEST_BINARY_DIR}/default/package-directory/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/TGZ/${CPACK_PACKAGE_FILE_NAME}.tar.gz") +if(NOT EXISTS "${filename}") + set(RunCMake_TEST_FAILED "Expected ${filename} to exist but it does not") +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-package-name-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-name-check.cmake new file mode 100644 index 0000000..fdc4824 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-name-check.cmake @@ -0,0 +1,7 @@ +include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + +file(READ "${RunCMake_TEST_BINARY_DIR}/default/${CPACK_PACKAGE_FILE_NAME}.json" contents) +string(JSON package_name GET "${contents}" packageName) +if(NOT package_name STREQUAL "package-name") + set(RunCMake_TEST_FAILED "Expected package name to be \"package-name\" but it was \"${package_name}\"") +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-package-version-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-version-check.cmake new file mode 100644 index 0000000..dba9110 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-version-check.cmake @@ -0,0 +1,7 @@ +include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + +file(READ "${RunCMake_TEST_BINARY_DIR}/default/${CPACK_PACKAGE_FILE_NAME}.json" contents) +string(JSON package_version GET "${contents}" packageVersion) +if(NOT package_version STREQUAL "1.0") + set(RunCMake_TEST_FAILED "Expected package version to be \"1.0\" but it was \"${package_version}\"") +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-variables-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-variables-check.cmake new file mode 100644 index 0000000..2858170 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-variables-check.cmake @@ -0,0 +1,6 @@ +include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + +set(filename "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/TGZ/variables-package.tar.gz") +if(NOT EXISTS "${filename}") + set(RunCMake_TEST_FAILED "Expected ${filename} to exist but it does not") +endif() diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-verbose-stdout.txt b/Tests/RunCMake/CMakePresetsPackage/Good-package-verbose-stdout.txt new file mode 100644 index 0000000..22fd115 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-verbose-stdout.txt @@ -0,0 +1 @@ +CPack: Enable Verbose diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-with-environment-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-with-environment-check.cmake new file mode 100644 index 0000000..a775e4d --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-with-environment-check.cmake @@ -0,0 +1,7 @@ +check_cpack_packages("TGZ;TXZ" [[TEST_ENV=Environment variable +TEST_ENV_REF=xEnvironment variablex +TEST_ENV_OVERRIDE=Override +TEST_ENV_OVERRIDE_REF=xOverridex +]]) + +include("${RunCMake_SOURCE_DIR}/check.cmake") diff --git a/Tests/RunCMake/CMakePresetsPackage/Good.cmake b/Tests/RunCMake/CMakePresetsPackage/Good.cmake new file mode 100644 index 0000000..d019443 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good.cmake @@ -0,0 +1,31 @@ +set(CPACK_PACKAGE_NAME Good) +set(CPACK_GENERATOR "TGZ;TXZ") + +include(CPack) + +install(CODE [[ +function(print_env name) + if(DEFINED ENV{${name}}) + file(APPEND $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/env.txt "${name}=$ENV{${name}}\n") + else() + file(APPEND $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/env.txt "${name} not defined\n") + endif() +endfunction() + +file(REMOVE $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/env.txt) +print_env(TEST_ENV) +print_env(TEST_ENV_REF) +print_env(TEST_ENV_OVERRIDE) +print_env(TEST_ENV_OVERRIDE_REF) + +file(APPEND $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/configs.txt "$<CONFIG>\n") +]]) + +file(WRITE "${CMAKE_BINARY_DIR}/CPackConfigAlt.cmake" [[include(${CMAKE_CURRENT_LIST_DIR}/CPackConfig.cmake) +set(CPACK_PACKAGE_FILE_NAME "config-file-alt") +]]) + +file(WRITE "${CMAKE_BINARY_DIR}/external_package.cmake" [[if(NOT CPACK_PACKAGE_VENDOR STREQUAL "some-vendor") + message(FATAL_ERROR "Expected vendor to be \"some-vendor\" but it was \"${CPACK_PACKAGE_VENDOR}\"") +endif() +]]) diff --git a/Tests/RunCMake/CMakePresetsPackage/Good.json.in b/Tests/RunCMake/CMakePresetsPackage/Good.json.in new file mode 100644 index 0000000..0c0e7d9 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/Good.json.in @@ -0,0 +1,135 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build/${presetName}", + "environment": { + "TEST_ENV": "Environment variable", + "TEST_ENV_OVERRIDE": "Overridden environment variable" + } + } + ], + "buildPresets": [ + { + "name": "build-default-debug", + "configurePreset": "default", + "configuration": "Debug" + }, + { + "name": "build-default-release", + "inherits": "build-default-debug", + "configuration": "Release" + } + ], + "packagePresets": [ + { + "name": "minimal", + "configurePreset": "default" + }, + { + "name": "defaults", + "hidden": false, + "inherits": [], + "vendor": {}, + "displayName": "", + "description": "", + "environment": {}, + "configurePreset": "default", + "inheritConfigureEnvironment": true + }, + { + "name": "no-environment", + "configurePreset": "default", + "inheritConfigureEnvironment": false, + "environment": { + "TEST_ENV_REF": "x$env{TEST_ENV}x" + } + }, + { + "name": "with-environment", + "inherits": "no-environment", + "inheritConfigureEnvironment": true, + "environment": { + "TEST_ENV_OVERRIDE": "Override", + "TEST_ENV_OVERRIDE_REF": "x$env{TEST_ENV_OVERRIDE}x", + "TEST_ENV_REF": "x$env{TEST_ENV}x" + } + }, + { + "name": "generators", + "inherits": "minimal", + "generators": [ + "TBZ2", + "TXZ" + ] + }, + { + "name": "configurations", + "inherits": "minimal", + "configurations": [ + "Debug", + "Release" + ] + }, + { + "name": "variables", + "inherits": "minimal", + "variables": { + "CPACK_PACKAGE_FILE_NAME": "variables-package" + } + }, + { + "name": "config-file", + "inherits": "minimal", + "configFile": "CPackConfigAlt.cmake" + }, + { + "name": "debug", + "inherits": "minimal", + "output": { + "debug": true + } + }, + { + "name": "verbose", + "inherits": "minimal", + "output": { + "verbose": true + } + }, + { + "name": "package-name", + "inherits": "minimal", + "generators": [ + "External" + ], + "packageName": "package-name" + }, + { + "name": "package-version", + "inherits": "minimal", + "generators": [ + "External" + ], + "packageVersion": "1.0" + }, + { + "name": "package-directory", + "inherits": "minimal", + "packageDirectory": "${sourceDir}/build/default/package-directory" + }, + { + "name": "vendor-name", + "inherits": "minimal", + "generators": [ + "External" + ], + "variables": { + "CPACK_EXTERNAL_PACKAGE_SCRIPT": "${sourceDir}/build/default/external_package.cmake" + }, + "vendorName": "some-vendor" + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsPackage/ListPresets-package-x-stdout.txt b/Tests/RunCMake/CMakePresetsPackage/ListPresets-package-x-stdout.txt new file mode 100644 index 0000000..307ec0a --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/ListPresets-package-x-stdout.txt @@ -0,0 +1,4 @@ +^Available package presets: + + "default" + "with-description" - With Description$ diff --git a/Tests/RunCMake/CMakePresetsPackage/ListPresets.cmake b/Tests/RunCMake/CMakePresetsPackage/ListPresets.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/ListPresets.cmake diff --git a/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in b/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in new file mode 100644 index 0000000..5f3cf48 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in @@ -0,0 +1,20 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default" + } + ], + "packagePresets": [ + { + "name": "default", + "configurePreset": "default" + }, + { + "name": "with-description", + "displayName": "With Description", + "description": "This preset has a description", + "configurePreset": "default" + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsPackage/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsPackage/RunCMakeTest.cmake new file mode 100644 index 0000000..269fb6e --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/RunCMakeTest.cmake @@ -0,0 +1,102 @@ +include(RunCMake) + +# 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}") +endif() + +function(run_cmake_package_presets name CMakePresetsPackage_CONFIGURE_PRESETS CMakePresetsPackage_BUILD_PRESETS CMakePresetsPackage_PACKAGE_PRESETS) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${name}") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_SOURCE_DIR}/build") + set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") + + set(RunCMake_TEST_NO_CLEAN TRUE) + + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + set(CASE_NAME "${name}") + set(CASE_SOURCE_DIR "${RunCMake_SOURCE_DIR}") + configure_file("${RunCMake_SOURCE_DIR}/CMakeLists.txt.in" "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" @ONLY) + + if(NOT CMakePresetsPackage_FILE) + set(CMakePresetsPackage_FILE "${RunCMake_SOURCE_DIR}/${name}.json.in") + endif() + if(EXISTS "${CMakePresetsPackage_FILE}") + configure_file("${CMakePresetsPackage_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakePresets.json" @ONLY) + endif() + + if(NOT CMakeUserPresets_FILE) + set(CMakeUserPresets_FILE "${RunCMake_SOURCE_DIR}/${name}User.json.in") + endif() + if(EXISTS "${CMakeUserPresets_FILE}") + configure_file("${CMakeUserPresets_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakeUserPresets.json" @ONLY) + endif() + + foreach(ASSET ${CMakePresetsPackage_ASSETS}) + configure_file("${RunCMake_SOURCE_DIR}/${ASSET}" "${RunCMake_TEST_SOURCE_DIR}" COPYONLY) + endforeach() + + if (NOT CMakePresetsPackage_NO_CONFIGURE) + foreach(CONFIGURE_PRESET ${CMakePresetsPackage_CONFIGURE_PRESETS}) + run_cmake_command("${name}-configure-${CONFIGURE_PRESET}" + "${CMAKE_COMMAND}" "--preset" "${CONFIGURE_PRESET}") + endforeach() + endif() + + if (NOT CMakePresetsPackage_NO_BUILD) + foreach(BUILD_PRESET ${CMakePresetsPackage_BUILD_PRESETS}) + run_cmake_command("${name}-build-${BUILD_PRESET}" + "${CMAKE_COMMAND}" "--build" "--preset" "${BUILD_PRESET}") + endforeach() + endif() + + set(eq 0) + foreach(PACKAGE_PRESET ${CMakePresetsPackage_PACKAGE_PRESETS}) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages") + + if (EXISTS "${RunCMake_SOURCE_DIR}/${name}-package-${PACKAGE_PRESET}-check.cmake") + set(RunCMake-check-file "${name}-package-${PACKAGE_PRESET}-check.cmake") + else() + set(RunCMake-check-file "check.cmake") + endif() + + if(eq) + run_cmake_command(${name}-package-${PACKAGE_PRESET} + ${CMAKE_CPACK_COMMAND} "--preset=${PACKAGE_PRESET}" ${ARGN}) + set(eq 0) + else() + run_cmake_command(${name}-package-${PACKAGE_PRESET} + ${CMAKE_CPACK_COMMAND} "--preset" "${PACKAGE_PRESET}" ${ARGN}) + set(eq 1) + endif() + endforeach() +endfunction() + +function(check_cpack_packages generators contents) + include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake") + + set(cpack_dir "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}") + file(GLOB dirs RELATIVE "${cpack_dir}" "${cpack_dir}/*") + if(NOT dirs STREQUAL generators) + string(APPEND RunCMake_TEST_FAILED "Expected CPack generators: ${generators}\nActual CPack generators: ${dirs}\n") + endif() + + if(contents) + foreach(dir IN LISTS dirs) + set(env_file "${cpack_dir}/${dir}/${CPACK_PACKAGE_FILE_NAME}/env.txt") + file(READ "${env_file}" actual_contents) + if(NOT contents STREQUAL actual_contents) + string(REPLACE "\n" "\n " contents_formatted "${contents}") + string(REPLACE "\n" "\n " actual_contents_formatted "${actual_contents}") + string(APPEND RunCMake_TEST_FAILED "Expected contents of ${env_file}:\n ${contents_formatted}\nActual contents:\n ${actual_contents_formatted}\n") + endif() + endforeach() + endif() + + set(RunCMake_TEST_FAILED ${RunCMake_TEST_FAILED} PARENT_SCOPE) +endfunction() + +run_cmake_package_presets(UnsupportedVersion "x" "" "") +run_cmake_package_presets(Good "default" "build-default-debug" "no-environment;with-environment;generators;configurations;variables;config-file;debug;verbose;package-name;package-version;package-directory;vendor-name") +run_cmake_package_presets(ListPresets "default" "" "x" "--list-presets") diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt +++ b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-result.txt diff --git a/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-stderr.txt b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-stderr.txt new file mode 100644 index 0000000..4c461e3 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion: File version must be 6 or higher for package preset support$ diff --git a/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion.json.in b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion.json.in new file mode 100644 index 0000000..e5f7240 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion.json.in @@ -0,0 +1,4 @@ +{ + "version": 5, + "packagePresets": [] +} diff --git a/Tests/RunCMake/CMakePresetsPackage/check.cmake b/Tests/RunCMake/CMakePresetsPackage/check.cmake new file mode 100644 index 0000000..e79c4f1 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsPackage/check.cmake @@ -0,0 +1,3 @@ +set(CMakePresets_VALIDATE_SCRIPT_PATH "${RunCMake_SOURCE_DIR}/../CMakePresets/validate_schema.py") +include("${RunCMake_SOURCE_DIR}/../CMakePresets/validate_schema.cmake") +include("${RunCMake_SOURCE_DIR}/../CMakePresets/check.cmake") diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index 9b98ed4..8904c69 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -97,7 +97,7 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR) string(APPEND error_extra "; errors \"${deb_install_files_errors}\"") endif() - if(READELF_EXECUTABLE) + if(CPACK_READELF_EXECUTABLE) string(APPEND error_extra "; readelf \"\n") # Only dynamically linked ELF files are included @@ -106,7 +106,7 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR) if(_FILE MATCHES "ELF.*shared object") string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") - execute_process(COMMAND ${READELF_EXECUTABLE} -d "${CMAKE_MATCH_1}" + execute_process(COMMAND ${CPACK_READELF_EXECUTABLE} -d "${CMAKE_MATCH_1}" WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" RESULT_VARIABLE result OUTPUT_VARIABLE output diff --git a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake index 60d02e7..3b02579 100644 --- a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake +++ b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake @@ -14,9 +14,9 @@ function(get_test_prerequirements found_var config_file) endif() # optional tool for some tests - find_program(READELF_EXECUTABLE NAMES readelf) - if(READELF_EXECUTABLE) + find_program(CPACK_READELF_EXECUTABLE NAMES readelf) + if(CPACK_READELF_EXECUTABLE) file(APPEND "${config_file}" - "\nset(READELF_EXECUTABLE \"${READELF_EXECUTABLE}\")") + "\nset(CPACK_READELF_EXECUTABLE \"${CPACK_READELF_EXECUTABLE}\")") endif() endfunction() diff --git a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake index e95cd15..a4741ba 100644 --- a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake +++ b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake @@ -15,9 +15,9 @@ function(get_test_prerequirements found_var config_file) endif() # optional tool for some tests - find_program(OBJDUMP_EXECUTABLE objdump) - if(OBJDUMP_EXECUTABLE) + find_program(CPACK_OBJDUMP_EXECUTABLE objdump) + if(CPACK_OBJDUMP_EXECUTABLE) file(APPEND "${config_file}" - "\nset(OBJDUMP_EXECUTABLE \"${OBJDUMP_EXECUTABLE}\")") + "\nset(CPACK_OBJDUMP_EXECUTABLE \"${CPACK_OBJDUMP_EXECUTABLE}\")") endif() endfunction() diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake index be44b2e..b0bfc9d 100644 --- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake @@ -1,7 +1,7 @@ function(get_test_prerequirements found_var config_file) include(${config_file}) - if(READELF_EXECUTABLE) + if(CPACK_READELF_EXECUTABLE) set(${found_var} true PARENT_SCOPE) endif() endfunction() diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake index be44b2e..b0bfc9d 100644 --- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake @@ -1,7 +1,7 @@ function(get_test_prerequirements found_var config_file) include(${config_file}) - if(READELF_EXECUTABLE) + if(CPACK_READELF_EXECUTABLE) set(${found_var} true PARENT_SCOPE) endif() endfunction() diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake index 90cfe44..f5df8a2 100644 --- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake @@ -2,7 +2,7 @@ function(get_test_prerequirements found_var config_file) if(SUBTEST_SUFFIX MATCHES ".*single_debug_info") include(${config_file}) - if(OBJDUMP_EXECUTABLE) + if(CPACK_OBJDUMP_EXECUTABLE) set(${found_var} true PARENT_SCOPE) endif() else() diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 8ac1747..df3e82a 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -284,7 +284,7 @@ function(run_TestOutputTruncation mode expected) file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " add_test(Truncation_${mode} \"${CMAKE_COMMAND}\" -E echo 123456789) ") - run_cmake_command(TestOutputTruncation + run_cmake_command(TestOutputTruncation_${mode} ${CMAKE_CTEST_COMMAND} -M Experimental -T Test --no-compress-output --test-output-size-passed 5 @@ -294,6 +294,7 @@ endfunction() run_TestOutputTruncation("head" "\\.\\.\\.6789") run_TestOutputTruncation("middle" "12\\.\\.\\..*\\.\\.\\.89") run_TestOutputTruncation("tail" "12345\\.\\.\\.") +run_TestOutputTruncation("bad" "") # Test --stop-on-failure function(run_stop_on_failure) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-stderr.txt new file mode 100644 index 0000000..6afc02b --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Invalid value for '--test-output-truncation': bad$ diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-stderr.txt index 30b46ce..30b46ce 100644 --- a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-stderr.txt diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt new file mode 100644 index 0000000..30b46ce --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt @@ -0,0 +1 @@ +^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt new file mode 100644 index 0000000..30b46ce --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt @@ -0,0 +1 @@ +^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl diff --git a/Tests/RunCMake/CTestTimeout/TestTimeout.c b/Tests/RunCMake/CTestTimeout/TestTimeout.c index 5a008a7..0d534fc 100644 --- a/Tests/RunCMake/CTestTimeout/TestTimeout.c +++ b/Tests/RunCMake/CTestTimeout/TestTimeout.c @@ -1,6 +1,7 @@ #if defined(_WIN32) # include <windows.h> #else +# include <sched.h> # include <unistd.h> #endif diff --git a/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt b/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt index 7b6eb53..ce40a7a 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt @@ -1,4 +1,4 @@ ^(CMake Warning in [^ -]*/Tests/RunCMake/CUDA_architectures/architectures-suffix-build/CMakeFiles/CMakeTmp/CMakeLists.txt: +]*/Tests/RunCMake/CUDA_architectures/architectures-suffix-build/CMakeFiles/CMakeScratch/TryCompile-[^/]*/CMakeLists.txt: Clang doesn't support disabling CUDA real code generation. *)*$ diff --git a/Tests/RunCMake/CXXModules/CMakeLists.txt b/Tests/RunCMake/CXXModules/CMakeLists.txt index 338a412..708d92c 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 "17be90bd-a850-44e0-be50-448de847d652") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake new file mode 100644 index 0000000..cb6f6bd --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake @@ -0,0 +1,40 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/export-modules-targets.cmake" export_script) + +if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules\.cmake"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property script inclusion") +endif () + +file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules.cmake" trampoline_script) + +if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property per-config script inclusion(s)") + endif () +else () + if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-[^.]*\.cmake"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property per-config script inclusion(s)") + endif () +endif () + +set(any_exists 0) +foreach (config IN ITEMS noconfig Debug Release RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-${config}.cmake") + continue () + endif () + set(any_exists 1) + + file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-${config}.cmake" config_script) + + if (NOT config_script MATCHES "include\\(\"\\\${CMAKE_CURRENT_LIST_DIR}/target-export-name-${config}\\.cmake\"\\)") + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module per-target property script inclusion") + endif () +endforeach () + +if (NOT any_exists) + list(APPEND RunCMake_TEST_FAILED + "No per-configuration target files exist.") +endif () diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModules-stderr.txt b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-stderr.txt new file mode 100644 index 0000000..c05b0b4 --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at ExportBuildCxxModules.cmake:6 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +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/ExportBuildCxxModules.cmake b/Tests/RunCMake/CXXModules/ExportBuildCxxModules.cmake new file mode 100644 index 0000000..850f8dc --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModules.cmake @@ -0,0 +1,22 @@ +enable_language(CXX) +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "") + +add_library(export-modules) +target_sources(export-modules + PUBLIC + FILE_SET fs TYPE CXX_MODULES FILES + sources/module.cxx) +target_compile_features(export-modules + PRIVATE + cxx_std_20) +set_property(TARGET export-modules + PROPERTY EXPORT_NAME export-name) + +install(TARGETS export-modules + EXPORT exp + FILE_SET fs DESTINATION "include/cxx/export-modules") + +export(EXPORT exp + FILE "${CMAKE_BINARY_DIR}/lib/cmake/export-modules/export-modules-targets.cmake" + CXX_MODULES_DIRECTORY "cxx-modules") diff --git a/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake new file mode 100644 index 0000000..9e83fd8 --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake @@ -0,0 +1,35 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/exp.cmake" export_script) + +if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules\.cmake"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property script inclusion") +endif () + +file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules.cmake" trampoline_script) + +if (NOT trampoline_script MATCHES [[file\(GLOB _cmake_cxx_module_includes "\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-\*\.cmake"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module property per-config script inclusion(s)") +endif () + +set(any_exists 0) +foreach (config IN ITEMS noconfig Debug Release RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-${config}.cmake") + continue () + endif () + set(any_exists 1) + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-${config}.cmake" config_script) + + if (NOT config_script MATCHES "include\\(\"\\\${CMAKE_CURRENT_LIST_DIR}/target-export-name-${config}\\.cmake\"\\)") + list(APPEND RunCMake_TEST_FAILED + "Could not find C++ module per-target property script inclusion") + endif () +endforeach () + +if (NOT any_exists) + list(APPEND RunCMake_TEST_FAILED + "No per-configuration target files exist.") +endif () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/ExportInstallCxxModules-stderr.txt b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-stderr.txt new file mode 100644 index 0000000..4fe27a9 --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at ExportInstallCxxModules.cmake:6 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +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/ExportInstallCxxModules.cmake b/Tests/RunCMake/CXXModules/ExportInstallCxxModules.cmake new file mode 100644 index 0000000..234a4b5 --- /dev/null +++ b/Tests/RunCMake/CXXModules/ExportInstallCxxModules.cmake @@ -0,0 +1,22 @@ +enable_language(CXX) +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "") + +add_library(export-modules) +target_sources(export-modules + PUBLIC + FILE_SET fs TYPE CXX_MODULES FILES + sources/module.cxx) +target_compile_features(export-modules + PRIVATE + cxx_std_20) +set_property(TARGET export-modules + PROPERTY EXPORT_NAME export-name) + +install(TARGETS export-modules + EXPORT exp + FILE_SET fs DESTINATION "include/cxx/export-modules") + +install(EXPORT exp + DESTINATION "lib/cmake/export-modules" + CXX_MODULES_DIRECTORY "cxx-modules") diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported-stderr.txt new file mode 100644 index 0000000..1b4ba5d --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at FileSetModuleHeaderUnitsInterfaceImported.cmake:2 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake new file mode 100644 index 0000000..9ff5606 --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake @@ -0,0 +1,8 @@ +add_library(module-header SHARED IMPORTED) +target_sources(module-header + INTERFACE + FILE_SET fs TYPE CXX_MODULE_HEADER_UNITS FILES + sources/module-header.h) +target_compile_features(module-header + INTERFACE + cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported-stderr.txt new file mode 100644 index 0000000..4420bbc --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at FileSetModulesInterfaceImported.cmake:2 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake new file mode 100644 index 0000000..6640ae9 --- /dev/null +++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake @@ -0,0 +1,8 @@ +add_library(module SHARED IMPORTED) +target_sources(module + INTERFACE + FILE_SET fs TYPE CXX_MODULES FILES + sources/module.cxx) +target_compile_features(module + INTERFACE + cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/InstallBMI-check.cmake b/Tests/RunCMake/CXXModules/InstallBMI-check.cmake new file mode 100644 index 0000000..f891c80 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMI-check.cmake @@ -0,0 +1,24 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script) + +if (NOT install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi" OR NOT CMAKE_INSTALL_COMPONENT\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find BMI install script component for `bmi`") +endif () + +if (NOT install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find BMI install script inclusion") +endif () + +if (NOT install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi-optional"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find BMI install script component for `bmi-optional`") +endif () + +if (NOT install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi-only-debug" OR NOT CMAKE_INSTALL_COMPONENT\) + if\(CMAKE_INSTALL_CONFIG_NAME MATCHES "\^\(\[Dd\]\[Ee\]\[Bb\]\[Uu\]\[Gg\]\)\$"\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find BMI install script component for `bmi-only-debug`") +endif () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/InstallBMI-stderr.txt b/Tests/RunCMake/CXXModules/InstallBMI-stderr.txt new file mode 100644 index 0000000..fc3c7db --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMI-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at InstallBMI.cmake:8 \(install\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/InstallBMI.cmake b/Tests/RunCMake/CXXModules/InstallBMI.cmake new file mode 100644 index 0000000..f0947b4 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMI.cmake @@ -0,0 +1,23 @@ +enable_language(CXX) + +add_library(install-bmi) +target_sources(install-bmi + PRIVATE + sources/cxx-anchor.cxx) + +install(TARGETS install-bmi + CXX_MODULES_BMI + DESTINATION "lib/bmi" + COMPONENT "bmi") + +install(TARGETS install-bmi + CXX_MODULES_BMI + DESTINATION "lib/bmi" + EXCLUDE_FROM_ALL + COMPONENT "bmi-optional") + +install(TARGETS install-bmi + CXX_MODULES_BMI + DESTINATION "lib/bmi" + CONFIGURATIONS Debug + COMPONENT "bmi-only-debug") diff --git a/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-check.cmake b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-check.cmake new file mode 100644 index 0000000..32a37ad --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-check.cmake @@ -0,0 +1,8 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script) + +if (NOT install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi-generic-args\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Could not find BMI install script inclusion") +endif () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-stderr.txt b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-stderr.txt new file mode 100644 index 0000000..44c961f --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at InstallBMIGenericArgs.cmake:8 \(install\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/InstallBMIGenericArgs.cmake b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs.cmake new file mode 100644 index 0000000..8f17143 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +add_library(install-bmi-generic-args) +target_sources(install-bmi-generic-args + PRIVATE + sources/cxx-anchor.cxx) + +install(TARGETS install-bmi-generic-args + DESTINATION "bin") diff --git a/Tests/RunCMake/CXXModules/InstallBMIIgnore-check.cmake b/Tests/RunCMake/CXXModules/InstallBMIIgnore-check.cmake new file mode 100644 index 0000000..7d13ef0 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIIgnore-check.cmake @@ -0,0 +1,13 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script) + +if (install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi" OR NOT CMAKE_INSTALL_COMPONENT\)]]) + list(APPEND RunCMake_TEST_FAILED + "Found BMI install script component for `bmi`") +endif () + +if (install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi-ignore\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Found BMI install script inclusion") +endif () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/InstallBMIIgnore-stderr.txt b/Tests/RunCMake/CXXModules/InstallBMIIgnore-stderr.txt new file mode 100644 index 0000000..d9d2c2d --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIIgnore-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at InstallBMIIgnore.cmake:5 \(install\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/InstallBMIIgnore.cmake b/Tests/RunCMake/CXXModules/InstallBMIIgnore.cmake new file mode 100644 index 0000000..f339511 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMIIgnore.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +add_library(install-bmi-ignore INTERFACE) + +install(TARGETS install-bmi-ignore + CXX_MODULES_BMI + # An empty destination ignores BMI installation. + DESTINATION "" + COMPONENT "bmi") diff --git a/Tests/RunCMake/CXXModules/InstallBMINoGenericArgs-check.cmake b/Tests/RunCMake/CXXModules/InstallBMINoGenericArgs-check.cmake new file mode 100644 index 0000000..412e260 --- /dev/null +++ b/Tests/RunCMake/CXXModules/InstallBMINoGenericArgs-check.cmake @@ -0,0 +1,8 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script) + +if (install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi-generic-args\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]]) + list(APPEND RunCMake_TEST_FAILED + "Found BMI install script inclusion") +endif () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake new file mode 100644 index 0000000..0d08c44 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake @@ -0,0 +1,34 @@ +include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake") + +if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(have_file 0) + foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${config}/CXXDependInfo.json") + continue () + endif () + set(have_file 1) + + set(CMAKE_BUILD_TYPE "${config}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-private.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + endforeach () + + if (NOT have_file) + list(APPEND RunCMake_TEST_FAILED + "No recognized build configurations found.") + endif () +else () + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-private.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") +endif () diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-stderr.txt b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-stderr.txt new file mode 100644 index 0000000..ebf7be5 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at NinjaDependInfoBMIInstall.cmake:14 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +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/NinjaDependInfoBMIInstall.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall.cmake new file mode 100644 index 0000000..32dc42d --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall.cmake @@ -0,0 +1,76 @@ +# Fake out that we have dyndep; we only need to generate, not actually build +# here. +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "") + +enable_language(CXX) + +if (NOT CMAKE_GENERATOR MATCHES "Ninja") + message(FATAL_ERROR + "This test requires a 'Ninja' generator to be used.") +endif () + +add_library(ninja-bmi-install-public) +target_sources(ninja-bmi-install-public + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-bmi-install-public + PRIVATE + cxx_std_20) +set_property(TARGET ninja-bmi-install-public + PROPERTY EXPORT_NAME "with-public") + +install(TARGETS ninja-bmi-install-public + FILE_SET modules + DESTINATION "lib/cxx" + COMPONENT "modules" + FILE_SET internal_partitions + DESTINATION "lib/cxx/internals" + COMPONENT "modules-internal" + CXX_MODULES_BMI + DESTINATION "lib/cxx/modules/$<CONFIG>" + COMPONENT "bmi") + +add_library(ninja-bmi-install-private) +target_sources(ninja-bmi-install-private + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PRIVATE + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-bmi-install-private + PRIVATE + cxx_std_20) +set_property(TARGET ninja-bmi-install-private + PROPERTY EXPORT_NAME "with-private") + +set(CMAKE_INSTALL_MESSAGE LAZY) +install(TARGETS ninja-bmi-install-private + CXX_MODULES_BMI + DESTINATION "lib/cxx/modules/private/$<CONFIG>" + PERMISSIONS + OWNER_READ OWNER_WRITE + GROUP_READ + WORLD_READ + COMPONENT "bmi") diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake new file mode 100644 index 0000000..7720257 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake @@ -0,0 +1,34 @@ +include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake") + +if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(have_file 0) + foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${config}/CXXDependInfo.json") + continue () + endif () + set(have_file 1) + + set(CMAKE_BUILD_TYPE "${config}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-private.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + endforeach () + + if (NOT have_file) + list(APPEND RunCMake_TEST_FAILED + "No recognized build configurations found.") + endif () +else () + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-private.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") +endif () diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoExport-stderr.txt b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-stderr.txt new file mode 100644 index 0000000..e328223 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at NinjaDependInfoExport.cmake:14 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +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/NinjaDependInfoExport.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoExport.cmake new file mode 100644 index 0000000..05e7ef7 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoExport.cmake @@ -0,0 +1,85 @@ +# Fake out that we have dyndep; we only need to generate, not actually build +# here. +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "") + +enable_language(CXX) + +if (NOT CMAKE_GENERATOR MATCHES "Ninja") + message(FATAL_ERROR + "This test requires a 'Ninja' generator to be used.") +endif () + +add_library(ninja-exports-public) +target_sources(ninja-exports-public + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-exports-public + PRIVATE + cxx_std_20) +set_property(TARGET ninja-exports-public + PROPERTY EXPORT_NAME "with-public") + +install(TARGETS ninja-exports-public + EXPORT exp + FILE_SET modules + DESTINATION "lib/cxx" + COMPONENT "modules" + FILE_SET internal_partitions + DESTINATION "lib/cxx/internals" + COMPONENT "modules-internal") + +add_library(ninja-exports-private) +target_sources(ninja-exports-private + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PRIVATE + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-exports-private + PRIVATE + cxx_std_20) +set_property(TARGET ninja-exports-private + PROPERTY EXPORT_NAME "with-private") + +install(TARGETS ninja-exports-private + EXPORT exp) + +# Test multiple build exports. +export(EXPORT exp + FILE "${CMAKE_BINARY_DIR}/lib/cmake/export1/export1-targets.cmake" + NAMESPACE export1:: + CXX_MODULES_DIRECTORY "cxx-modules") +export(EXPORT exp + FILE "${CMAKE_BINARY_DIR}/lib/cmake/export2/export2-targets.cmake" + CXX_MODULES_DIRECTORY "cxx-modules") + +# Test multiple install exports. +install(EXPORT exp + DESTINATION "lib/cmake/export1" + NAMESPACE export1:: + CXX_MODULES_DIRECTORY "cxx-modules") +install(EXPORT exp + DESTINATION "lib/cmake/export2" + CXX_MODULES_DIRECTORY "cxx-modules") diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake new file mode 100644 index 0000000..b9a1315 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake @@ -0,0 +1,34 @@ +include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake") + +if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(have_file 0) + foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/${config}/CXXDependInfo.json") + continue () + endif () + set(have_file 1) + + set(CMAKE_BUILD_TYPE "${config}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-private.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + endforeach () + + if (NOT have_file) + list(APPEND RunCMake_TEST_FAILED + "No recognized build configurations found.") + endif () +else () + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-public.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") + + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-private.dir/CXXDependInfo.json" actual_contents) + file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-private.json" expect_contents) + check_json("${actual_contents}" "${expect_contents}") +endif () diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-stderr.txt b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-stderr.txt new file mode 100644 index 0000000..ca430cc --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at NinjaDependInfoFileSet.cmake:14 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) +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/NinjaDependInfoFileSet.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet.cmake new file mode 100644 index 0000000..74e729e --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet.cmake @@ -0,0 +1,59 @@ +# Fake out that we have dyndep; we only need to generate, not actually build +# here. +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "") + +enable_language(CXX) + +if (NOT CMAKE_GENERATOR MATCHES "Ninja") + message(FATAL_ERROR + "This test requires a 'Ninja' generator to be used.") +endif () + +add_library(ninja-file-sets-public) +target_sources(ninja-file-sets-public + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-file-sets-public + PRIVATE + cxx_std_20) + +install(TARGETS ninja-file-sets-public + FILE_SET modules + DESTINATION "lib/cxx" + COMPONENT "modules" + FILE_SET internal_partitions + DESTINATION "lib/cxx/internals" + COMPONENT "modules-internal") + +add_library(ninja-file-sets-private) +target_sources(ninja-file-sets-private + PRIVATE + sources/module-impl.cxx + sources/module-internal-part-impl.cxx + sources/module-part-impl.cxx + sources/module-use.cxx + PRIVATE + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-file-sets-private + PRIVATE + cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/NoCXX20.cmake b/Tests/RunCMake/CXXModules/NoCXX20.cmake index d502f7c..b7372e8 100644 --- a/Tests/RunCMake/CXXModules/NoCXX20.cmake +++ b/Tests/RunCMake/CXXModules/NoCXX20.cmake @@ -5,6 +5,7 @@ target_sources(nocxx20 PUBLIC FILE_SET fs TYPE CXX_MODULES FILES sources/module.cxx) -target_compile_features(nocxx20 - PRIVATE - cxx_std_17) +set_target_properties(nocxx20 + PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON) diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index 68fdcae..3f17c1f 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -60,12 +60,30 @@ foreach (fileset_type IN LISTS fileset_types) foreach (scope IN LISTS scopes) run_cmake("FileSet${fileset_type}${scope}") endforeach () + run_cmake("FileSet${fileset_type}InterfaceImported") # Test the error message when a non-C++ source file is found in the source # list. run_cmake("NotCXXSource${fileset_type}") endforeach () +run_cmake(InstallBMI) +run_cmake(InstallBMIGenericArgs) +run_cmake(InstallBMIIgnore) + +run_cmake(ExportBuildCxxModules) +run_cmake(ExportInstallCxxModules) + +# Generator-specific tests. +if (RunCMake_GENERATOR MATCHES "Ninja") + run_cmake(NinjaDependInfoFileSet) + run_cmake(NinjaDependInfoExport) + run_cmake(NinjaDependInfoBMIInstall) +else () + message(FATAL_ERROR + "Please add 'DependInfo' tests for the '${RunCMake_GENERATOR}' generator.") +endif () + # Actual compilation tests. if (NOT CMake_TEST_MODULE_COMPILATION) return () @@ -86,13 +104,23 @@ function (run_cxx_module_test directory) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif () - set(RunCMake_TEST_OPTIONS + if (RunCMake_CXXModules_INSTALL) + set(prefix "${RunCMake_BINARY_DIR}/examples/${test_name}-install") + file(REMOVE_RECURSE "${prefix}") + list(APPEND RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${prefix}") + endif () + + list(APPEND RunCMake_TEST_OPTIONS "-DCMake_TEST_MODULE_COMPILATION_RULES=${CMake_TEST_MODULE_COMPILATION_RULES}" ${ARGN}) run_cmake("examples/${test_name}") set(RunCMake_TEST_NO_CLEAN 1) - run_cmake_command("${test_name}-build" "${CMAKE_COMMAND}" --build . --config Debug) - run_cmake_command("${test_name}-test" "${CMAKE_CTEST_COMMAND}" -C Debug) + run_cmake_command("examples/${test_name}-build" "${CMAKE_COMMAND}" --build . --config Debug) + 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) endfunction () string(REPLACE "," ";" CMake_TEST_MODULE_COMPILATION "${CMake_TEST_MODULE_COMPILATION}") @@ -102,6 +130,8 @@ 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) endif () # Tests which use named modules in shared libraries. @@ -118,3 +148,23 @@ endif () if ("internal_partitions" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(internal-partitions) endif () + +# Tests which install BMIs +if ("export_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) + run_cxx_module_test(export-interface-build) + run_cxx_module_test(export-bmi-and-interface-build) +endif () + +# All of the following tests perform installation. +set(RunCMake_CXXModules_INSTALL 1) + +# Tests which install BMIs +if ("install_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) + run_cxx_module_test(install-bmi) + run_cxx_module_test(install-bmi-and-interfaces) + + if ("export_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) + run_cxx_module_test(export-interface-install) + run_cxx_module_test(export-bmi-and-interface-install) + endif () +endif () diff --git a/Tests/RunCMake/CXXModules/check-json.cmake b/Tests/RunCMake/CXXModules/check-json.cmake new file mode 100644 index 0000000..19d0c8a --- /dev/null +++ b/Tests/RunCMake/CXXModules/check-json.cmake @@ -0,0 +1,160 @@ +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) + +function (json_placeholders in out) + string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" in "${in}") + if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + string(REPLACE "<CONFIG_DIR>" "${CMAKE_BUILD_TYPE}/" in "${in}") + else () + string(REPLACE "<CONFIG_DIR>" "" in "${in}") + endif () + if (CMAKE_BUILD_TYPE) + string(REPLACE "<CONFIG_FORCE>" "${CMAKE_BUILD_TYPE}" in "${in}") + else () + string(REPLACE "<CONFIG_FORCE>" "noconfig" in "${in}") + endif () + string(REPLACE "<SOURCE_DIR>" "${RunCMake_SOURCE_DIR}" in "${in}") + string(REPLACE "<BINARY_DIR>" "${RunCMake_TEST_BINARY_DIR}" in "${in}") + set("${out}" "${in}" PARENT_SCOPE) +endfunction () + +function (check_json_value path actual_type expect_type actual_value expect_value) + if (NOT actual_type STREQUAL expect_type) + list(APPEND RunCMake_TEST_FAILED + "Type mismatch at ${path}: ${actual_type} vs. ${expect_type}") + return () + endif () + + if (actual_type STREQUAL NULL) + # Nothing to check + elseif (actual_type STREQUAL BOOLEAN) + if (NOT actual_value STREQUAL expect_value) + list(APPEND RunCMake_TEST_FAILED + "Boolean mismatch at ${path}: ${actual_value} vs. ${expect_value}") + endif () + elseif (actual_type STREQUAL NUMBER) + if (NOT actual_value EQUAL expect_value) + list(APPEND RunCMake_TEST_FAILED + "Number mismatch at ${path}: ${actual_value} vs. ${expect_value}") + endif () + elseif (actual_type STREQUAL STRING) + # Allow some values to be ignored. + if (expect_value STREQUAL "<IGNORE>") + return () + endif () + + json_placeholders("${expect_value}" expect_value_expanded) + if (NOT actual_value STREQUAL expect_value_expanded) + list(APPEND RunCMake_TEST_FAILED + "String mismatch at ${path}: ${actual_value} vs. ${expect_value_expanded}") + endif () + elseif (actual_type STREQUAL ARRAY) + check_json_array("${path}" "${actual_value}" "${expect_value}") + elseif (actual_type STREQUAL OBJECT) + check_json_object("${path}" "${actual_value}" "${expect_value}") + endif () +endfunction () + +# Check that two arrays are the same. +function (check_json_array path actual expect) + string(JSON actual_len LENGTH "${actual}") + string(JSON expect_len LENGTH "${expect}") + + set(iter_len "${actual_len}") + if (actual_len LESS expect_len) + list(APPEND RunCMake_TEST_FAILED + "Missing array items at ${path}") + elseif (expect_len LESS actual_len) + list(APPEND RunCMake_TEST_FAILED + "Extra array items at ${path}") + set(iter_len "${expect_len}") + endif () + + foreach (idx RANGE "${iter_len}") + if (idx EQUAL iter_len) + break () + endif () + + set(new_path "${path}[${idx}]") + string(JSON actual_type TYPE "${actual}" "${idx}") + string(JSON expect_type TYPE "${expect}" "${idx}") + string(JSON actual_value GET "${actual}" "${idx}") + string(JSON expect_value GET "${expect}" "${idx}") + check_json_value("${new_path}" "${actual_type}" "${expect_type}" "${actual_value}" "${expect_value}") + endforeach () +endfunction () + +# Check that two inner objects are the same. +function (check_json_object path actual expect) + string(JSON actual_len LENGTH "${actual}") + string(JSON expect_len LENGTH "${expect}") + + set(actual_keys "") + set(expect_keys "") + foreach (idx RANGE "${actual_len}") + if (idx EQUAL actual_len) + break () + endif () + + string(JSON actual_key MEMBER "${actual}" "${idx}") + list(APPEND actual_keys "${actual_key}") + endforeach () + foreach (idx RANGE "${expect_len}") + if (idx EQUAL expect_len) + break () + endif () + + string(JSON expect_key MEMBER "${expect}" "${idx}") + list(APPEND expect_keys "${expect_key}") + endforeach () + + json_placeholders("${expect_keys}" expect_keys_expanded) + + set(actual_keys_missed "${actual_keys}") + set(expect_keys_missed "${expect_keys}") + + set(common_keys "") + set(expect_keys_stack "${expect_keys}") + while (expect_keys_stack) + list(POP_BACK expect_keys_stack expect_key) + json_placeholders("${expect_key}" expect_key_expanded) + + if (expect_key_expanded IN_LIST actual_keys_missed AND + expect_key IN_LIST expect_keys_missed) + list(APPEND common_keys "${expect_key}") + endif () + + list(REMOVE_ITEM actual_keys_missed "${expect_key_expanded}") + list(REMOVE_ITEM expect_keys_missed "${expect_key}") + endwhile () + + if (actual_keys_missed) + string(REPLACE ";" ", " actual_keys_missed_text "${actual_keys_missed}") + list(APPEND RunCMake_TEST_FAILED + "Missing expected members at ${path}: ${actual_keys_missed_text}") + endif () + if (expect_keys_missed) + string(REPLACE ";" ", " expect_keys_missed_text "${expect_keys_missed}") + list(APPEND RunCMake_TEST_FAILED + "Extra unexpected members at ${path}: ${expect_keys_missed_text}") + endif () + + foreach (key IN LISTS common_keys) + json_placeholders("${key}" key_expanded) + set(new_path "${path}.${key_expanded}") + string(JSON actual_type TYPE "${actual}" "${key_expanded}") + string(JSON expect_type TYPE "${expect}" "${key}") + string(JSON actual_value GET "${actual}" "${key_expanded}") + string(JSON expect_value GET "${expect}" "${key}") + check_json_value("${new_path}" "${actual_type}" "${expect_type}" "${actual_value}" "${expect_value}") + endforeach () +endfunction () + +# Check that two JSON objects are the same. +function (check_json actual expect) + check_json_object("" "${actual}" "${expect}") +endfunction () + +string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") + +cmake_policy(POP) diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi-and-interfaces.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi-and-interfaces.cmake new file mode 100644 index 0000000..f99455b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi-and-interfaces.cmake @@ -0,0 +1,22 @@ +function (check_for_bmi prefix destination name) + set(found 0) + foreach (ext IN ITEMS gcm) + if (EXISTS "${prefix}/${destination}/${name}.${ext}") + set(found 1) + break () + endif () + endforeach () + + if (NOT found) + message(SEND_ERROR + "Failed to find the ${name} BMI") + endif () +endfunction () + +function (check_for_interface prefix destination subdir name) + set(found 0) + if (NOT EXISTS "${prefix}/${destination}/${subdir}/${name}") + message(SEND_ERROR + "Failed to find the ${name} module interface") + endif () +endfunction () diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake new file mode 100644 index 0000000..91f3995 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake @@ -0,0 +1,27 @@ +function (check_for_bmi prefix destination name) + set(found 0) + foreach (ext IN ITEMS gcm ifc) + if (EXISTS "${prefix}/${destination}/${name}.${ext}") + set(found 1) + break () + endif () + endforeach () + + if (NOT found) + message(SEND_ERROR + "Failed to find the ${name} BMI") + endif () +endfunction () + +function (check_for_interface prefix destination subdir name) + set(found 0) + if (NOT EXISTS "${prefix}/${destination}/${subdir}/${name}") + message(SEND_ERROR + "Failed to find the ${name} module interface") + endif () +endfunction () + +function (report_dirs prefix destination) + message("prefix: ${prefix}") + message("destination: ${destination}") +endfunction () diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake index 91ad208..381094e 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 "17be90bd-a850-44e0-be50-448de847d652") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") if (NOT EXISTS "${CMake_TEST_MODULE_COMPILATION_RULES}") message(FATAL_ERROR diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain-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/deep-chain/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt new file mode 100644 index 0000000..515b240 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_deep_chain CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(a STATIC) +target_sources(a + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + a.cxx) +target_compile_features(a PUBLIC cxx_std_20) + +add_library(b STATIC) +target_sources(b + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + b.cxx) +target_compile_features(b PUBLIC cxx_std_20) +target_link_libraries(b PUBLIC a) + +add_library(c STATIC) +target_sources(c + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + c.cxx) +target_compile_features(c PUBLIC cxx_std_20) +target_link_libraries(c PUBLIC b) + +add_library(d STATIC) +target_sources(d + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + d.cxx) +target_compile_features(d PUBLIC cxx_std_20) +target_link_libraries(d PUBLIC c) + +add_library(e STATIC) +target_sources(e + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + e.cxx) +target_compile_features(e PUBLIC cxx_std_20) +target_link_libraries(e PUBLIC d) + +add_executable(exe) +target_link_libraries(exe PRIVATE e) +target_sources(exe + PRIVATE + main.cxx) + +add_test(NAME exe COMMAND exe) diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/a.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/a.cxx new file mode 100644 index 0000000..9edaec9 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/a.cxx @@ -0,0 +1,6 @@ +export module a; + +export int a() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/b.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/b.cxx new file mode 100644 index 0000000..38ab0c2 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/b.cxx @@ -0,0 +1,7 @@ +export module b; +import a; + +export int b() +{ + return a(); +} diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/c.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/c.cxx new file mode 100644 index 0000000..580a458 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/c.cxx @@ -0,0 +1,7 @@ +export module c; +import b; + +export int c() +{ + return b(); +} diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/d.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/d.cxx new file mode 100644 index 0000000..78bc5ba --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/d.cxx @@ -0,0 +1,7 @@ +export module d; +import c; + +export int d() +{ + return c(); +} diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/e.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/e.cxx new file mode 100644 index 0000000..e019440 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/e.cxx @@ -0,0 +1,7 @@ +export module e; +import d; + +export int e() +{ + return d(); +} diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/main.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/main.cxx new file mode 100644 index 0000000..0b7c15d --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/main.cxx @@ -0,0 +1,6 @@ +import e; + +int main(int argc, char* argv[]) +{ + return e(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-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-bmi-and-interface-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt new file mode 100644 index 0000000..a450b7e --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_bmi_and_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_bmi_and_interfaces STATIC) +target_sources(export_bmi_and_interfaces + 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_bmi_and_interfaces PUBLIC cxx_std_20) + +install(TARGETS export_bmi_and_interfaces + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu" + CXX_MODULES_BMI DESTINATION "lib/cxx/bmi") +export(EXPORT CXXModules + NAMESPACE CXXModules:: + FILE "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-targets.cmake" + CXX_MODULES_DIRECTORY "export_bmi_and_interfaces-cxx-modules") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-config.cmake" + "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_bmi_and_interfaces-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_bmi_and_interfaces_build + COMMAND + "${CMAKE_COMMAND}" + "-Dexpected_source_dir=${CMAKE_CURRENT_SOURCE_DIR}" + "-Dexpected_binary_dir=${CMAKE_CURRENT_BINARY_DIR}" + "-Dexport_bmi_and_interfaces_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-bmi-and-interface-build/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} 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 new file mode 100644 index 0000000..e0b1872 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx @@ -0,0 +1,8 @@ +export module importable; + +int forwarding(); + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/private.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/private.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int from_private() +{ + return 0; +} 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 new file mode 100644 index 0000000..b814b3b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-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 "3c375311-a3c9-4396-a187-3227ef642046") + +find_package(export_bmi_and_interfaces REQUIRED) + +if (NOT TARGET CXXModules::export_bmi_and_interfaces) + message(FATAL_ERROR + "Missing imported target") +endif () + +get_property(file_sets TARGET CXXModules::export_bmi_and_interfaces + PROPERTY INTERFACE_CXX_MODULE_SETS) +if (NOT file_sets STREQUAL "modules") + message(FATAL_ERROR + "Incorrect exported file sets in `CXXModules::export_bmi_and_interfaces`: `${file_sets}`") +endif () + +get_property(file_set_files TARGET CXXModules::export_bmi_and_interfaces + PROPERTY CXX_MODULE_SET_modules) +if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx") + message(FATAL_ERROR + "Incorrect exported file set paths in CXXModules::export_bmi_and_interfaces`: `${file_set_files}`") +endif () + +get_property(imported_modules TARGET CXXModules::export_bmi_and_interfaces + PROPERTY IMPORTED_CXX_MODULES_DEBUG) +if (NOT imported_modules MATCHES "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/CMakeFiles/export_bmi_and_interfaces.dir(/Debug)?/importable.(gcm|pcm|ifc)") + message(FATAL_ERROR + "Incorrect exported modules in CXXModules::export_bmi_and_interfaces`: `${imported_modules}`") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-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-bmi-and-interface-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt new file mode 100644 index 0000000..a5574fe --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt @@ -0,0 +1,59 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_bmi_and_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_bmi_and_interfaces STATIC) +target_sources(export_bmi_and_interfaces + 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_bmi_and_interfaces PUBLIC cxx_std_20) + +install(TARGETS export_bmi_and_interfaces + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu" + CXX_MODULES_BMI DESTINATION "lib/cxx/bmi") +install(EXPORT CXXModules + NAMESPACE CXXModules:: + DESTINATION "lib/cmake/export_bmi_and_interfaces" + FILE "export_bmi_and_interfaces-targets.cmake" + CXX_MODULES_DIRECTORY "export_bmi_and_interfaces-cxx-modules") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-config.cmake" + "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_bmi_and_interfaces-targets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) +") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-config.cmake" + DESTINATION "lib/cmake/export_bmi_and_interfaces") + +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_bmi_and_interfaces_build + COMMAND + "${CMAKE_COMMAND}" + "-Dexpected_source_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu" + "-Dexpected_binary_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/bmi" + "-Dexport_bmi_and_interfaces_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_bmi_and_interfaces" + ${generator} + -S "${CMAKE_CURRENT_SOURCE_DIR}/test" + -B "${CMAKE_CURRENT_BINARY_DIR}/test") diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} 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 new file mode 100644 index 0000000..e0b1872 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx @@ -0,0 +1,8 @@ +export module importable; + +int forwarding(); + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/private.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/private.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int from_private() +{ + return 0; +} 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 new file mode 100644 index 0000000..db0484d --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-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 "3c375311-a3c9-4396-a187-3227ef642046") + +find_package(export_bmi_and_interfaces REQUIRED) + +if (NOT TARGET CXXModules::export_bmi_and_interfaces) + message(FATAL_ERROR + "Missing imported target") +endif () + +get_property(file_sets TARGET CXXModules::export_bmi_and_interfaces + PROPERTY INTERFACE_CXX_MODULE_SETS) +if (NOT file_sets STREQUAL "modules") + message(FATAL_ERROR + "Incorrect exported file sets in `CXXModules::export_bmi_and_interfaces`: `${file_sets}`") +endif () + +get_property(file_set_files TARGET CXXModules::export_bmi_and_interfaces + PROPERTY CXX_MODULE_SET_modules) +if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx") + message(FATAL_ERROR + "Incorrect exported file set paths in CXXModules::export_bmi_and_interfaces`: `${file_set_files}`") +endif () + +get_property(imported_modules TARGET CXXModules::export_bmi_and_interfaces + PROPERTY IMPORTED_CXX_MODULES_DEBUG) +if (NOT imported_modules MATCHES "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/importable.(gcm|pcm|ifc)") + message(FATAL_ERROR + "Incorrect exported modules in CXXModules::export_bmi_and_interfaces`: `${imported_modules}`") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-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-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt new file mode 100644 index 0000000..80ddaf8 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_interfaces STATIC) +target_sources(export_interfaces + 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 PUBLIC cxx_std_20) + +install(TARGETS export_interfaces + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu") +export(EXPORT CXXModules + NAMESPACE CXXModules:: + FILE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-targets.cmake") +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) +") + +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_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-build/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx new file mode 100644 index 0000000..e0b1872 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx @@ -0,0 +1,8 @@ +export module importable; + +int forwarding(); + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/private.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-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-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt new file mode 100644 index 0000000..6145210 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-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 "3c375311-a3c9-4396-a187-3227ef642046") + +find_package(export_interfaces REQUIRED) + +if (NOT TARGET CXXModules::export_interfaces) + message(FATAL_ERROR + "Missing imported target") +endif () + +get_property(file_sets TARGET CXXModules::export_interfaces + PROPERTY INTERFACE_CXX_MODULE_SETS) +if (NOT file_sets STREQUAL "modules") + message(FATAL_ERROR + "Incorrect exported file sets in `CXXModules::export_interfaces`: `${file_sets}`") +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") + 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) + message(FATAL_ERROR + "Unexpected C++ modules specified.") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-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-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt new file mode 100644 index 0000000..1dfb6da --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-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 STATIC) +target_sources(export_interfaces + 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 PUBLIC cxx_std_20) + +install(TARGETS export_interfaces + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu") +install(EXPORT CXXModules + NAMESPACE CXXModules:: + DESTINATION "lib/cmake/export_interfaces" + FILE "export_interfaces-targets.cmake") +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) +") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-config.cmake" + DESTINATION "lib/cmake/export_interfaces") + +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_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_interfaces" + ${generator} + -S "${CMAKE_CURRENT_SOURCE_DIR}/test" + -B "${CMAKE_CURRENT_BINARY_DIR}/test") diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx new file mode 100644 index 0000000..e0b1872 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx @@ -0,0 +1,8 @@ +export module importable; + +int forwarding(); + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/private.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-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-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt new file mode 100644 index 0000000..6145210 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-interface-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 "3c375311-a3c9-4396-a187-3227ef642046") + +find_package(export_interfaces REQUIRED) + +if (NOT TARGET CXXModules::export_interfaces) + message(FATAL_ERROR + "Missing imported target") +endif () + +get_property(file_sets TARGET CXXModules::export_interfaces + PROPERTY INTERFACE_CXX_MODULE_SETS) +if (NOT file_sets STREQUAL "modules") + message(FATAL_ERROR + "Incorrect exported file sets in `CXXModules::export_interfaces`: `${file_sets}`") +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") + 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) + message(FATAL_ERROR + "Unexpected C++ modules specified.") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces-stderr.txt b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces-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/install-bmi-and-interfaces/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/CMakeLists.txt new file mode 100644 index 0000000..efaca0e --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_install_bmi_and_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(install_bmi_and_interfaces STATIC) +target_sources(install_bmi_and_interfaces + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(install_bmi_and_interfaces PUBLIC cxx_std_20) + +install(TARGETS install_bmi_and_interfaces + ARCHIVE DESTINATION "lib" + CXX_MODULES_BMI DESTINATION "lib/cxx/bmi" + FILE_SET CXX_MODULES DESTINATION "lib/cxx/miu") + +add_test(NAME check-for-bmi + COMMAND + "${CMAKE_COMMAND}" + "-Dprefix=${CMAKE_INSTALL_PREFIX}" + "-Dbmi_destination=lib/cxx/bmi" + "-Dfs_destination=lib/cxx/miu" + -P "${CMAKE_CURRENT_SOURCE_DIR}/check-for-bmi.cmake") diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/check-for-bmi.cmake b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/check-for-bmi.cmake new file mode 100644 index 0000000..a8ff1ad --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/check-for-bmi.cmake @@ -0,0 +1,7 @@ +include("${CMAKE_CURRENT_LIST_DIR}/../cxx-modules-find-bmi.cmake") + +report_dirs("${prefix}" "${bmi_destination}") +check_for_bmi("${prefix}" "${bmi_destination}" importable) + +report_dirs("${prefix}" "${fs_destination}") +check_for_interface("${prefix}" "${fs_destination}" "" importable.cxx) diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/importable.cxx b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/importable.cxx new file mode 100644 index 0000000..607680a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/importable.cxx @@ -0,0 +1,6 @@ +export module importable; + +export int from_import() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-stderr.txt b/Tests/RunCMake/CXXModules/examples/install-bmi-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi-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/install-bmi/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/install-bmi/CMakeLists.txt new file mode 100644 index 0000000..4e039f9 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_install_bmi CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(install_bmi STATIC) +target_sources(install_bmi + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(install_bmi PUBLIC cxx_std_20) + +install(TARGETS install_bmi + ARCHIVE DESTINATION "lib" + CXX_MODULES_BMI DESTINATION "lib/cxx/bmi") + +add_test(NAME check-for-bmi + COMMAND + "${CMAKE_COMMAND}" + "-Dprefix=${CMAKE_INSTALL_PREFIX}" + "-Ddestination=lib/cxx/bmi" + -P "${CMAKE_CURRENT_SOURCE_DIR}/check-for-bmi.cmake") diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi/check-for-bmi.cmake b/Tests/RunCMake/CXXModules/examples/install-bmi/check-for-bmi.cmake new file mode 100644 index 0000000..ff84ed6 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi/check-for-bmi.cmake @@ -0,0 +1,4 @@ +include("${CMAKE_CURRENT_LIST_DIR}/../cxx-modules-find-bmi.cmake") + +report_dirs("${prefix}" "${destination}") +check_for_bmi("${prefix}" "${destination}" importable) diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi/importable.cxx b/Tests/RunCMake/CXXModules/examples/install-bmi/importable.cxx new file mode 100644 index 0000000..607680a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/install-bmi/importable.cxx @@ -0,0 +1,6 @@ +export module importable; + +export int from_import() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx b/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx index 8be521b..b872ae9 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 importable : internal_partition; +import : internal_partition; #include "internal-partitions_export.h" diff --git a/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx b/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx index 1e81aaf..d0ac2f4 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 importable : partition; +export import : partition; #include "partitions_export.h" diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt b/Tests/RunCMake/CXXModules/examples/public-req-private-build-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt +++ b/Tests/RunCMake/CXXModules/examples/public-req-private-build-result.txt diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private-build-stdout.txt b/Tests/RunCMake/CXXModules/examples/public-req-private-build-stdout.txt new file mode 100644 index 0000000..b5f1c55 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/public-req-private-build-stdout.txt @@ -0,0 +1 @@ +CMake Error: Public C\+\+ module source `.*/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx` requires the `priv` C\+\+ module which is provided by a private source diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private-stderr.txt b/Tests/RunCMake/CXXModules/examples/public-req-private-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/public-req-private-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/public-req-private/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/public-req-private/CMakeLists.txt new file mode 100644 index 0000000..600fec4 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/public-req-private/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_public_req_private CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(public_req_private) +target_sources(public_req_private + PRIVATE + FILE_SET private TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + priv.cxx + PUBLIC + FILE_SET public TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + pub.cxx) +target_compile_features(public_req_private PUBLIC cxx_std_20) + +add_test(NAME cmake-version COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private/priv.cxx b/Tests/RunCMake/CXXModules/examples/public-req-private/priv.cxx new file mode 100644 index 0000000..7c000b7 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/public-req-private/priv.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int g() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx b/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx new file mode 100644 index 0000000..6ff2d23 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx @@ -0,0 +1,8 @@ +export module pub; + +import priv; + +export int f() +{ + return g(); +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json new file mode 100644 index 0000000..65f0759 --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json @@ -0,0 +1,45 @@ +{ + "bmi-installation": { + "destination": "lib/cxx/modules/private/<CONFIG>", + "message-level": "MESSAGE_LAZY", + "permissions": " OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ", + "script-location": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-private.dir/install-cxx-module-bmi-<CONFIG_FORCE>.cmake" + }, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-bmi-install-private.dir/sources/module-internal-part.cxx.o": { + "destination": null, + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-bmi-install-private.dir/sources/module-part.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-bmi-install-private.dir/sources/module.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-private.dir" +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json new file mode 100644 index 0000000..9c8a895 --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json @@ -0,0 +1,45 @@ +{ + "bmi-installation": { + "destination": "lib/cxx/modules/<CONFIG>", + "message-level": "", + "permissions": "", + "script-location": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir/install-cxx-module-bmi-noconfig.cmake" + }, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-bmi-install-public.dir/sources/module-internal-part.cxx.o": { + "destination": "lib/cxx/internals", + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-bmi-install-public.dir/sources/module-part.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-bmi-install-public.dir/sources/module.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir" +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json new file mode 100644 index 0000000..0545981 --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json @@ -0,0 +1,73 @@ +{ + "bmi-installation": null, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-exports-private.dir/sources/module-internal-part.cxx.o": { + "destination": null, + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-exports-private.dir/sources/module-part.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-exports-private.dir/sources/module.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [ + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "lib/cmake/export1", + "export-name" : "with-private", + "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/d2e2673818fd2bd8c45c0e3ed0e38fcd", + "install" : true, + "namespace" : "export1::" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "lib/cmake/export2", + "export-name" : "with-private", + "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/28cd47cb4c96ad5cadaa3fb1b0201ae8", + "install" : true, + "namespace" : "" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "<BINARY_DIR>/lib/cmake/export1", + "export-name" : "with-private", + "export-prefix" : "<BINARY_DIR>/lib/cmake/export1", + "install" : false, + "namespace" : "export1::" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "<BINARY_DIR>/lib/cmake/export2", + "export-name" : "with-private", + "export-prefix" : "<BINARY_DIR>/lib/cmake/export2", + "install" : false, + "namespace" : "" + } + ], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-private.dir" +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json new file mode 100644 index 0000000..adc3ae3 --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json @@ -0,0 +1,73 @@ +{ + "bmi-installation": null, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-exports-public.dir/sources/module-internal-part.cxx.o": { + "destination": "lib/cxx/internals", + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-exports-public.dir/sources/module-part.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-exports-public.dir/sources/module.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [ + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "lib/cmake/export1", + "export-name" : "with-public", + "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/d2e2673818fd2bd8c45c0e3ed0e38fcd", + "install" : true, + "namespace" : "export1::" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "lib/cmake/export2", + "export-name" : "with-public", + "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/28cd47cb4c96ad5cadaa3fb1b0201ae8", + "install" : true, + "namespace" : "" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "<BINARY_DIR>/lib/cmake/export1", + "export-name" : "with-public", + "export-prefix" : "<BINARY_DIR>/lib/cmake/export1", + "install" : false, + "namespace" : "export1::" + }, + { + "cxx-module-info-dir" : "cxx-modules", + "destination" : "<BINARY_DIR>/lib/cmake/export2", + "export-name" : "with-public", + "export-prefix" : "<BINARY_DIR>/lib/cmake/export2", + "install" : false, + "namespace" : "" + } + ], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-public.dir" +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json new file mode 100644 index 0000000..9ba6568 --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json @@ -0,0 +1,40 @@ +{ + "bmi-installation": null, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-file-sets-private.dir/sources/module-internal-part.cxx.o": { + "destination": null, + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-file-sets-private.dir/sources/module-part.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + }, + "CMakeFiles/ninja-file-sets-private.dir/sources/module.cxx.o": { + "destination": null, + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PRIVATE" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-private.dir" +} diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json new file mode 100644 index 0000000..46e2cbf --- /dev/null +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json @@ -0,0 +1,40 @@ +{ + "bmi-installation": null, + "compiler-id": "<IGNORE>", + "config": "<CONFIG>", + "cxx-modules": { + "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module-internal-part.cxx.o": { + "destination": "lib/cxx/internals", + "name": "internal_partitions", + "relative-directory": "sources", + "source": "<SOURCE_DIR>/sources/module-internal-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module-part.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module-part.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + }, + "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module.cxx.o": { + "destination": "lib/cxx", + "name": "modules", + "relative-directory": "", + "source": "<SOURCE_DIR>/sources/module.cxx", + "type": "CXX_MODULES", + "visibility": "PUBLIC" + } + }, + "dir-cur-bld": "<BINARY_DIR>", + "dir-cur-src": "<SOURCE_DIR>", + "dir-top-bld": "<BINARY_DIR>", + "dir-top-src": "<SOURCE_DIR>", + "exports": [], + "include-dirs": [], + "language": "CXX", + "linked-target-dirs": [], + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-public.dir" +} diff --git a/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt b/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt index dc2c3ad..9a1ba04 100644 --- a/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt +++ b/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt @@ -1,6 +1,6 @@ ^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): - IPO is not supported \(no C/CXX/Fortran languages found in ENABLED_LANGUAGES - global property\)\. + IPO is not supported \(no C/CXX/CUDA/Fortran languages found in + ENABLED_LANGUAGES global property\)\. Call Stack \(most recent call first\): .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) default-lang-none\.cmake:[0-9]+ \(check_ipo_supported\) diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index 6a932f1..1452c9b 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,"version":{.*}}$ +^{"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":{.*}}$ diff --git a/Tests/RunCMake/CommandLine/E_env-equal.cmake b/Tests/RunCMake/CommandLine/E_env-equal.cmake new file mode 100644 index 0000000..3f18bb6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-equal.cmake @@ -0,0 +1,15 @@ +if (NOT DEFINED ENV{TEST_ENV_EXPECTED}) + if (NOT DEFINED ENV{TEST_ENV}) + message(STATUS "TEST_ENV is correctly not set in environment") + else () + message(FATAL_ERROR "TEST_ENV is incorrectly set in environment") + endif () +else () + if (NOT DEFINED ENV{TEST_ENV}) + message(FATAL_ERROR "TEST_ENV is incorrectly not set in environment") + elseif ("$ENV{TEST_ENV}" STREQUAL "$ENV{TEST_ENV_EXPECTED}") + message(STATUS "TEST_ENV is correctly set in environment: $ENV{TEST_ENV}") + else () + message(FATAL_ERROR "TEST_ENV is incorrectly set in environment!\n\tactual: $ENV{TEST_ENV}\n\texpected: $ENV{TEST_ENV_EXPECTED}") + endif () +endif () diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt +++ b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-result.txt diff --git a/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-stderr.txt b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-stderr.txt new file mode 100644 index 0000000..ccfdeab --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: Error: Unrecognized environment manipulation argument: unknown + +cmake -E env: invalid parameter to --modify: TEST_ENV=unknown:$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-cmake_list-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-cmake_list-stdout.txt new file mode 100644 index 0000000..ad42f56 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-cmake_list-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: exp;ect;ed$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-path_list-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-path_list-stdout.txt new file mode 100644 index 0000000..49572a3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-path_list-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: exp[;:]ect[;:]ed$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-reset-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-reset-stdout.txt new file mode 100644 index 0000000..a60f1bf --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-reset-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: expected$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-reset-to-unset-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-reset-to-unset-stdout.txt new file mode 100644 index 0000000..a1d5c01 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-reset-to-unset-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly not set in environment$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-set-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-set-stdout.txt new file mode 100644 index 0000000..feff117 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-set-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: 1$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-string-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-string-stdout.txt new file mode 100644 index 0000000..a60f1bf --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-string-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: expected$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-unset-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-unset-stdout.txt new file mode 100644 index 0000000..a1d5c01 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-unset-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly not set in environment$ diff --git a/Tests/RunCMake/CommandLine/E_env_modify-with-double-dash-result.txt b/Tests/RunCMake/CommandLine/E_env_modify-with-double-dash-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-with-double-dash-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt +++ b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-result.txt diff --git a/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-stderr.txt b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt b/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt index c94c19d..cde76f7 100644 --- a/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt +++ b/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt @@ -1,4 +1,4 @@ -^-- CMAKE_ARGC='8' +^-- CMAKE_ARGC='9' -- CMAKE_ARGV1='-P' -- CMAKE_ARGV2='[^']*/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake' -- CMAKE_ARGV3='--' @@ -6,4 +6,5 @@ -- CMAKE_ARGV5='-S' -- CMAKE_ARGV6='-B' -- CMAKE_ARGV7='--fresh' --- CMAKE_ARGV8=''$ +-- CMAKE_ARGV8='--version' +-- CMAKE_ARGV9=''$ diff --git a/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake index 8dca990..7d79af5 100644 --- a/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake +++ b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake @@ -7,3 +7,4 @@ message(STATUS "CMAKE_ARGV5='${CMAKE_ARGV5}'") message(STATUS "CMAKE_ARGV6='${CMAKE_ARGV6}'") message(STATUS "CMAKE_ARGV7='${CMAKE_ARGV7}'") message(STATUS "CMAKE_ARGV8='${CMAKE_ARGV8}'") +message(STATUS "CMAKE_ARGV9='${CMAKE_ARGV9}'") diff --git a/Tests/RunCMake/CommandLine/P_args-stdout.txt b/Tests/RunCMake/CommandLine/P_args-stdout.txt new file mode 100644 index 0000000..f9d039f --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_args-stdout.txt @@ -0,0 +1,6 @@ +^-- CMAKE_ARGC='5' +-- CMAKE_ARGV1='-P' +-- CMAKE_ARGV2='[^']*/Tests/RunCMake/CommandLine/P_args.cmake' +-- CMAKE_ARGV3='relative/path' +-- CMAKE_ARGV4='[^']*/Tests/RunCMake/CommandLine' +-- CMAKE_ARGV5=''$ diff --git a/Tests/RunCMake/CommandLine/P_args.cmake b/Tests/RunCMake/CommandLine/P_args.cmake new file mode 100644 index 0000000..6c4fa4c --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_args.cmake @@ -0,0 +1,6 @@ +message(STATUS "CMAKE_ARGC='${CMAKE_ARGC}'") +message(STATUS "CMAKE_ARGV1='${CMAKE_ARGV1}'") +message(STATUS "CMAKE_ARGV2='${CMAKE_ARGV2}'") +message(STATUS "CMAKE_ARGV3='${CMAKE_ARGV3}'") +message(STATUS "CMAKE_ARGV4='${CMAKE_ARGV4}'") +message(STATUS "CMAKE_ARGV5='${CMAKE_ARGV5}'") diff --git a/Tests/RunCMake/CommandLine/P_working-dir.cmake b/Tests/RunCMake/CommandLine/P_working-dir.cmake index 4ea0293..e2c0378 100644 --- a/Tests/RunCMake/CommandLine/P_working-dir.cmake +++ b/Tests/RunCMake/CommandLine/P_working-dir.cmake @@ -9,6 +9,11 @@ foreach(d CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRE if(EXPECTED_WORKING_DIR STREQUAL "${${d}}") message(STATUS "${d} is the expected working directory (${EXPECTED_WORKING_DIR})") else() - message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})") + get_filename_component(resolved "${EXPECTED_WORKING_DIR}" REALPATH) + if(resolved STREQUAL "${${d}}") + message(STATUS "${d} is the expected working directory (${resolved}) after symlink resolution") + else() + message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})") + endif() endif() endforeach() diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index c8234ec..1b5a1d6 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -52,7 +52,8 @@ run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G) run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) -run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO -S -B --fresh) +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_fresh ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_fresh.cmake" --fresh) run_cmake_command(build-no-dir @@ -743,6 +744,10 @@ run_cmake_command(E_cat-without-double-dash ${CMAKE_COMMAND} -E cat "-file-start unset(RunCMake_TEST_COMMAND_WORKING_DIRECTORY) unset(out) +# Unset environment variables that are used for testing cmake -E +unset(ENV{TEST_ENV}) +unset(ENV{TEST_ENV_EXPECTED}) + run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) @@ -757,6 +762,56 @@ file(COPY_FILE "${EXIT_CODE_EXE}" "${RunCMake_BINARY_DIR}/env=${exit_code}") run_cmake_command(E_env-with-double-dash ${CMAKE_COMMAND} -E env TEST_ENV=1 -- "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit) run_cmake_command(E_env-without-double-dash ${CMAKE_COMMAND} -E env TEST_ENV=1 "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit) +## Tests of env --modify +# Repeat the same tests as above +run_cmake_command(E_env_modify-set ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake) +run_cmake_command(E_env_modify-unset ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 ${CMAKE_COMMAND} -E env --modify TEST_ENV=unset: ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake) +run_cmake_command(E_env_modify-with-double-dash ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 -- "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit) +run_cmake_command(E_env_modify-without-double-dash ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit) + +# Test environment modification commands +run_cmake_command(E_env_modify-reset + ${CMAKE_COMMAND} -E env TEST_ENV=expected + ${CMAKE_COMMAND} -E env TEST_ENV_EXPECTED=expected TEST_ENV=bad_value --modify TEST_ENV=reset: + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake) + +run_cmake_command(E_env_modify-reset-to-unset + ${CMAKE_COMMAND} -E env --unset=TEST_ENV --unset=TEST_ENV_EXPECTED + ${CMAKE_COMMAND} -E env TEST_ENV=bad_value --modify TEST_ENV=reset: + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake) + +run_cmake_command(E_env_modify-string + ${CMAKE_COMMAND} -E env TEST_ENV_EXPECTED=expected + --modify TEST_ENV=unset: + --modify TEST_ENV=string_append:ect + --modify TEST_ENV=string_prepend:exp + --modify TEST_ENV=string_append:ed + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake) + +if (WIN32) + set(SEP "\\;") +else () + set(SEP ":") +endif () + +run_cmake_command(E_env_modify-path_list + ${CMAKE_COMMAND} -E env "TEST_ENV_EXPECTED=exp${SEP}ect${SEP}ed" + --modify TEST_ENV=unset: + --modify TEST_ENV=path_list_append:ect + --modify TEST_ENV=path_list_prepend:exp + --modify TEST_ENV=path_list_append:ed + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake) + +run_cmake_command(E_env_modify-cmake_list + ${CMAKE_COMMAND} -E env "TEST_ENV_EXPECTED=exp\\;ect\\;ed" + --modify TEST_ENV=unset: + --modify TEST_ENV=cmake_list_append:ect + --modify TEST_ENV=cmake_list_prepend:exp + --modify TEST_ENV=cmake_list_append:ed + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake) + +run_cmake_command(E_env_modify-bad-operation ${CMAKE_COMMAND} -E env --modify TEST_ENV=unknown:) + run_cmake_command(E_md5sum-dir ${CMAKE_COMMAND} -E md5sum .) run_cmake_command(E_sha1sum-dir ${CMAKE_COMMAND} -E sha1sum .) run_cmake_command(E_sha224sum-dir ${CMAKE_COMMAND} -E sha224sum .) @@ -923,6 +978,8 @@ set(RunCMake_TEST_OPTIONS --debug-trycompile) run_cmake(debug-trycompile) unset(RunCMake_TEST_OPTIONS) +run_cmake(trycompile-clean) + function(run_cmake_depends) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_SOURCE_DIR}/cmake_depends") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/cmake_depends-build") @@ -940,8 +997,8 @@ set(CMAKE_DEPENDS_CHECK_C set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"${RunCMake_TEST_SOURCE_DIR}\") set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\") ") - run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E cmake_depends - "Unix Makefiles" + run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E env VERBOSE=1 + ${CMAKE_COMMAND} -E cmake_depends "Unix Makefiles" ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake diff --git a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt index 8fe092b..cf972a8 100644 --- a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt +++ b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt @@ -1 +1 @@ -^Scanning dependencies of target DepTarget$ +Scanning dependencies of target DepTarget$ diff --git a/Tests/RunCMake/CommandLine/debug-trycompile.cmake b/Tests/RunCMake/CommandLine/debug-trycompile.cmake index a3835a7..9619ba8 100644 --- a/Tests/RunCMake/CommandLine/debug-trycompile.cmake +++ b/Tests/RunCMake/CommandLine/debug-trycompile.cmake @@ -1,5 +1,8 @@ enable_language(C) + # Look for a source tree left by enable_language internal checks. -if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeLists.txt) +set(scratch ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeScratch) +file(GLOB_RECURSE remnants ${scratch}/TryCompile-*/CMakeLists.txt) +if(NOT remnants) message(FATAL_ERROR "--debug-trycompile should leave the source behind") endif() diff --git a/Tests/RunCMake/CommandLine/trycompile-clean.cmake b/Tests/RunCMake/CommandLine/trycompile-clean.cmake new file mode 100644 index 0000000..11ec2b9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trycompile-clean.cmake @@ -0,0 +1,8 @@ +enable_language(C) + +# Look for a source tree left by enable_language internal checks. +set(scratch ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeScratch) +file(GLOB_RECURSE remnants ${scratch}/TryCompile-*/*) +if(remnants) + message(FATAL_ERROR "try_compile should not leave artifacts behind") +endif() diff --git a/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake b/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake index a532f72..392c921 100644 --- a/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake @@ -1,13 +1,22 @@ include(RunCMake) -function(run_compile_warn test) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) +function(run_compile_warn test lang extension) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}_${lang}-build) set(RunCMake_TEST_OUTPUT_MERGE 1) - run_cmake_with_options(${test} ${ARGN}) + run_cmake_with_options(${test}_${lang} "-DLANGUAGE=${lang}" "-DEXTENSION=${extension}" ${ARGN}) set(RunCMake_TEST_NO_CLEAN 1) - run_cmake_command(${test}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) + run_cmake_command(${test}_${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) endfunction() -run_compile_warn(WerrorOn) -run_compile_warn(WerrorOff) -run_compile_warn(WerrorOnIgnore "--compile-no-warning-as-error") +set(langs C CXX) +set(exts c cxx) +if(CMake_TEST_CUDA) + list(APPEND langs CUDA) + list(APPEND exts cu) +endif() + +foreach(lang ext IN ZIP_LISTS langs exts) + run_compile_warn(WerrorOn ${lang} ${ext}) + run_compile_warn(WerrorOff ${lang} ${ext}) + run_compile_warn(WerrorOnIgnore ${lang} ${ext} "--compile-no-warning-as-error") +endforeach() diff --git a/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake b/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake index ccc6cc5..d8770e1 100644 --- a/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake +++ b/Tests/RunCMake/CompileWarningAsError/WarningAsErrorOptions.cmake @@ -1,18 +1,29 @@ # add compile options to warning_options to ensure unused-function throws a warning # if warning_options is NOT DEFINED, assume compiler doesn't support warning as error -macro(get_warning_options warning_options) - if (CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|XLClang|IBMClang|LCC|NVCC|IntelLLVM)$") +macro(get_warning_options warning_options lang) + if (CMAKE_${lang}_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|XLClang|IBMClang|LCC|IntelLLVM|NVHPC)$") set(${warning_options} "-Wall") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" - OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC")) + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "MSVC" + OR (CMAKE_${lang}_COMPILER_ID STREQUAL "Intel" AND CMAKE_${lang}_SIMULATE_ID MATCHES "MSVC")) set(${warning_options} "-W4") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "NVIDIA" + AND CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89) + if(CMAKE_${lang}_SIMULATE_ID MATCHES "MSVC") + set(${warning_options} "-Xcompiler=-W4") + else() + set(${warning_options} "-Xcompiler=-Wall") + endif() + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "Intel") set(${warning_options} "-w3") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "XL") + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "XL") set(${warning_options} "-qinfo=all") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") - set(${warning_options} "+w;+w2") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Fujitsu") + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "SunPro") + if(lang STREQUAL CXX) + set(${warning_options} "+w;+w2") + else() + set(${warning_options} "") + endif() + elseif (CMAKE_${lang}_COMPILER_ID STREQUAL "Fujitsu") set(${warning_options} "SHELL:-w 8") endif() endmacro() diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOff.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOff.cmake index b05d65e..0af60f0 100644 --- a/Tests/RunCMake/CompileWarningAsError/WerrorOff.cmake +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOff.cmake @@ -1,8 +1,8 @@ -enable_language(CXX) +enable_language(${LANGUAGE}) include(WarningAsErrorOptions.cmake) -get_warning_options(warning_options) +get_warning_options(warning_options ${LANGUAGE}) -add_executable(WerrorOff warn.cxx) +add_executable(WerrorOff warn.${EXTENSION}) target_compile_options(WerrorOff PUBLIC "${warning_options}") set_target_properties(WerrorOff PROPERTIES COMPILE_WARNING_AS_ERROR OFF) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOff_C.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOff_C.cmake new file mode 100644 index 0000000..35c02aa --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOff_C.cmake @@ -0,0 +1 @@ +include(WerrorOff.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOff_CUDA.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOff_CUDA.cmake new file mode 100644 index 0000000..35c02aa --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOff_CUDA.cmake @@ -0,0 +1 @@ +include(WerrorOff.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOff_CXX.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOff_CXX.cmake new file mode 100644 index 0000000..35c02aa --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOff_CXX.cmake @@ -0,0 +1 @@ +include(WerrorOff.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOn.cmake index 4310333..c3f6526 100644 --- a/Tests/RunCMake/CompileWarningAsError/WerrorOn.cmake +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn.cmake @@ -1,13 +1,13 @@ -enable_language(CXX) +enable_language(${LANGUAGE}) include(WarningAsErrorOptions.cmake) -get_warning_options(warning_options) +get_warning_options(warning_options ${LANGUAGE}) if (DEFINED warning_options) - add_executable(WerrorOn warn.cxx) + add_executable(WerrorOn warn.${EXTENSION}) target_compile_options(WerrorOn PUBLIC "${warning_options}") set_target_properties(WerrorOn PROPERTIES COMPILE_WARNING_AS_ERROR ON) else() - # if no werror option is set for the environment, use err.cxx so that build fails as expected - add_executable(WerrorOn err.cxx) + # if no werror option is set for the environment, use err so that build fails as expected + add_executable(WerrorOn err.${EXTENSION}) endif() diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore.cmake index 1f7ccdb..847bd78 100644 --- a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore.cmake +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore.cmake @@ -1,8 +1,8 @@ -enable_language(CXX) +enable_language(${LANGUAGE}) include(WarningAsErrorOptions.cmake) -get_warning_options(warning_options) +get_warning_options(warning_options ${LANGUAGE}) -add_executable(WerrorOn warn.cxx) +add_executable(WerrorOn warn.${EXTENSION}) target_compile_options(WerrorOn PUBLIC "${warning_options}") set_target_properties(WerrorOn PROPERTIES COMPILE_WARNING_AS_ERROR ON) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_C.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_C.cmake new file mode 100644 index 0000000..ebb9e0e --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_C.cmake @@ -0,0 +1 @@ +include(WerrorOnIgnore.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CUDA.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CUDA.cmake new file mode 100644 index 0000000..ebb9e0e --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CUDA.cmake @@ -0,0 +1 @@ +include(WerrorOnIgnore.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CXX.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CXX.cmake new file mode 100644 index 0000000..ebb9e0e --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOnIgnore_CXX.cmake @@ -0,0 +1 @@ +include(WerrorOnIgnore.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn-Build-result.txt b/Tests/RunCMake/CompileWarningAsError/WerrorOn_C-Build-result.txt index d197c91..d197c91 100644 --- a/Tests/RunCMake/CompileWarningAsError/WerrorOn-Build-result.txt +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_C-Build-result.txt diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_C.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOn_C.cmake new file mode 100644 index 0000000..a00edb8 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_C.cmake @@ -0,0 +1 @@ +include(WerrorOn.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA-Build-result.txt b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA.cmake new file mode 100644 index 0000000..a00edb8 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CUDA.cmake @@ -0,0 +1 @@ +include(WerrorOn.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX-Build-result.txt b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX.cmake b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX.cmake new file mode 100644 index 0000000..a00edb8 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/WerrorOn_CXX.cmake @@ -0,0 +1 @@ +include(WerrorOn.cmake) diff --git a/Tests/RunCMake/CompileWarningAsError/err.c b/Tests/RunCMake/CompileWarningAsError/err.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/err.c diff --git a/Tests/RunCMake/CompileWarningAsError/err.cu b/Tests/RunCMake/CompileWarningAsError/err.cu new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/err.cu diff --git a/Tests/RunCMake/CompileWarningAsError/warn.c b/Tests/RunCMake/CompileWarningAsError/warn.c new file mode 100644 index 0000000..cd0c2ba --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/warn.c @@ -0,0 +1,25 @@ +static void unused_function(); + +#ifdef __SUNPRO_C +KandR(x) int x; +{ + return x; +} +#endif + +#ifdef __SUNPRO_CC +struct A +{ + virtual ~A() throw(); +}; +struct B : public A +{ + virtual ~B() throw(int); +}; +#endif + +int main(int argc, char* argv[]) +{ + unsigned int unused_sign_conversion = -1; + return 1; +} diff --git a/Tests/RunCMake/CompileWarningAsError/warn.cu b/Tests/RunCMake/CompileWarningAsError/warn.cu new file mode 100644 index 0000000..22b8db8 --- /dev/null +++ b/Tests/RunCMake/CompileWarningAsError/warn.cu @@ -0,0 +1 @@ +#include "warn.c" diff --git a/Tests/RunCMake/CompileWarningAsError/warn.cxx b/Tests/RunCMake/CompileWarningAsError/warn.cxx index 64a245a..22b8db8 100644 --- a/Tests/RunCMake/CompileWarningAsError/warn.cxx +++ b/Tests/RunCMake/CompileWarningAsError/warn.cxx @@ -1,17 +1 @@ -static void unused_function(); - -#ifdef __SUNPRO_CC -struct A -{ - virtual ~A() throw(); -}; -struct B : public A -{ - virtual ~B() throw(int); -}; -#endif - -int main(int unused_argument, char* []) -{ - return 1; -} +#include "warn.c" diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake index 84d0479..e6a2605 100644 --- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -17,7 +17,8 @@ endfunction() function(run_compiler_launcher_env lang) string(REGEX REPLACE "-.*" "" core_lang "${lang}") - set(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER} "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") + # Use the noop genexp $<PATH:...> genexp to validate genexp support. + set(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER} "$<PATH:CMAKE_PATH,${CMAKE_COMMAND}>;-E;env;USED_LAUNCHER=1") run_compiler_launcher(${lang}) unset(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER}) endfunction() diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-override.cmake b/Tests/RunCMake/Configure/CopyFileABI-override.cmake index c633555..67f6ed5 100644 --- a/Tests/RunCMake/Configure/FailCopyFileABI-override.cmake +++ b/Tests/RunCMake/Configure/CopyFileABI-override.cmake @@ -1,5 +1,6 @@ # Change the executable suffix that try_compile will use for -# COPY_FILE but not inside the test project. This forces failure. +# COPY_FILE but not inside the test project, to verify +# we can handle envs that try and break everything get_property(in_try_compile GLOBAL PROPERTY IN_TRY_COMPILE) if(NOT in_try_compile) set(CMAKE_EXECUTABLE_SUFFIX .missing) diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt index 92fe233..6a856a4 100644 --- a/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt +++ b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt @@ -1,4 +1,4 @@ -- Detecting C compiler ABI info --- Detecting C compiler ABI info - failed.* +-- Detecting C compiler ABI info - done.* -- Configuring done -- Generating done diff --git a/Tests/RunCMake/Configure/FailCopyFileABI.cmake b/Tests/RunCMake/Configure/CopyFileABI.cmake index 74efd97..4eee100 100644 --- a/Tests/RunCMake/Configure/FailCopyFileABI.cmake +++ b/Tests/RunCMake/Configure/CopyFileABI.cmake @@ -1,2 +1,2 @@ -set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/FailCopyFileABI-override.cmake) +set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/CopyFileABI-override.cmake) enable_language(C) diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake b/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake deleted file mode 100644 index db0cb0a..0000000 --- a/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake +++ /dev/null @@ -1,14 +0,0 @@ -set(log "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/CMakeError.log") -if(EXISTS "${log}") - file(READ "${log}" error_log) -else() - set(error_log "") -endif() -string(REPLACE "\r\n" "\n" regex "Cannot copy output executable.* -to destination specified by COPY_FILE:.* -Unable to find the executable at any of: - .*\\.missing") -if(NOT error_log MATCHES "${regex}") - string(REGEX REPLACE "\n" "\n " error_log " ${error_log}") - set(RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected COPY_FILE failure message:\n${error_log}") -endif() diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake index 9fd4499..750fa3c 100644 --- a/Tests/RunCMake/Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake @@ -1,9 +1,9 @@ include(RunCMake) run_cmake(ContinueAfterError) +run_cmake(CopyFileABI) run_cmake(CustomTargetAfterError) run_cmake(ErrorLogs) -run_cmake(FailCopyFileABI) # 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/CMakeLists.txt b/Tests/RunCMake/ExportImport/CMakeLists.txt new file mode 100644 index 0000000..5ff8d3e --- /dev/null +++ b/Tests/RunCMake/ExportImport/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.23) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExportImport/RunCMakeTest.cmake b/Tests/RunCMake/ExportImport/RunCMakeTest.cmake new file mode 100644 index 0000000..d07fca2 --- /dev/null +++ b/Tests/RunCMake/ExportImport/RunCMakeTest.cmake @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.23) +include(RunCMake) + +function(run_ExportImport_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 + -Dfoo_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/foo + -Dbar_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/bar + ) +endfunction() + +run_ExportImport_test(SharedDep) diff --git a/Tests/RunCMake/ExportImport/SharedDep-export.cmake b/Tests/RunCMake/ExportImport/SharedDep-export.cmake new file mode 100644 index 0000000..2da3e47 --- /dev/null +++ b/Tests/RunCMake/ExportImport/SharedDep-export.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +install(TARGETS foo EXPORT foo) +install(EXPORT foo DESTINATION lib/cmake/foo) +install(FILES foo-config.cmake.in RENAME foo-config.cmake DESTINATION lib/cmake/foo) + +add_library(bar SHARED bar.c) +target_link_libraries(bar PRIVATE foo) +# 'foo' only appears in IMPORTED_LINK_DEPENDENT_LIBRARIES, and so is not enforced on import. +install(TARGETS bar EXPORT bar) +install(EXPORT bar DESTINATION lib/cmake/bar) +install(FILES bar-config.cmake.in RENAME bar-config.cmake DESTINATION lib/cmake/bar) diff --git a/Tests/RunCMake/ExportImport/SharedDep-import.cmake b/Tests/RunCMake/ExportImport/SharedDep-import.cmake new file mode 100644 index 0000000..2e2c2f6 --- /dev/null +++ b/Tests/RunCMake/ExportImport/SharedDep-import.cmake @@ -0,0 +1 @@ +find_package(bar REQUIRED CONFIG NO_DEFAULT_PATH) diff --git a/Tests/RunCMake/ExportImport/bar-config.cmake.in b/Tests/RunCMake/ExportImport/bar-config.cmake.in new file mode 100644 index 0000000..9148046 --- /dev/null +++ b/Tests/RunCMake/ExportImport/bar-config.cmake.in @@ -0,0 +1,2 @@ +# find_dependency(foo) intentionally left out for this test case +include(${CMAKE_CURRENT_LIST_DIR}/bar.cmake) diff --git a/Tests/RunCMake/ExportImport/bar.c b/Tests/RunCMake/ExportImport/bar.c new file mode 100644 index 0000000..19adca9 --- /dev/null +++ b/Tests/RunCMake/ExportImport/bar.c @@ -0,0 +1,12 @@ +#if defined(_WIN32) +__declspec(dllimport) +#endif + int foo(void); + +#ifdef _WIN32 +__declspec(dllexport) +#endif + int bar(void) +{ + return foo(); +} diff --git a/Tests/RunCMake/ExportImport/foo-config.cmake.in b/Tests/RunCMake/ExportImport/foo-config.cmake.in new file mode 100644 index 0000000..b038138 --- /dev/null +++ b/Tests/RunCMake/ExportImport/foo-config.cmake.in @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/foo.cmake) diff --git a/Tests/RunCMake/ExportImport/foo.c b/Tests/RunCMake/ExportImport/foo.c new file mode 100644 index 0000000..8794965 --- /dev/null +++ b/Tests/RunCMake/ExportImport/foo.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int foo(void) +{ + return 0; +} diff --git a/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build1-stdout.txt b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build1-stdout.txt new file mode 100644 index 0000000..2c223f7 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build1-stdout.txt @@ -0,0 +1,6 @@ +.*-- once: configure +.*-- once: build +.*-- once: install +.*-- always: configure +.*-- always: build +.*-- always: install diff --git a/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build2-stdout.txt b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build2-stdout.txt new file mode 100644 index 0000000..d697490 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build2-stdout.txt @@ -0,0 +1,2 @@ +.*-- always: build +.*-- always: install diff --git a/Tests/RunCMake/ExternalProject/BUILD_ALWAYS.cmake b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS.cmake new file mode 100644 index 0000000..2e5fc6f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS.cmake @@ -0,0 +1,20 @@ +include(ExternalProject) + +ExternalProject_Add(once + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/once-configure.cmake + BUILD_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/once-build.cmake + INSTALL_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/once-install.cmake + ) + +ExternalProject_Add(always + DEPENDS once + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/always-configure.cmake + BUILD_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/always-build.cmake + COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${CMAKE_CURRENT_LIST_FILE} + "${CMAKE_CURRENT_BINARY_DIR}/byproduct.txt" + BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/byproduct.txt" + BUILD_ALWAYS 1 + INSTALL_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/always-install.cmake + ) diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 2588d6c..f152f5b 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -177,6 +177,28 @@ if(doSubstitutionTest) __ep_test_with_build(Substitutions) endif() +function(__ep_test_BUILD_ALWAYS) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BUILD_ALWAYS-build) + run_cmake(BUILD_ALWAYS) + set(RunCMake_TEST_NO_CLEAN 1) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-configure.cmake" [[message(STATUS "once: configure")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-build.cmake" [[message(STATUS "once: build")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-install.cmake" [[message(STATUS "once: install")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-configure.cmake" [[message(STATUS "always: configure")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-build.cmake" [[message(STATUS "always: build")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-install.cmake" [[message(STATUS "always: install")]]) + run_cmake_command(BUILD_ALWAYS-build1 ${CMAKE_COMMAND} --build . --target always) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-configure.cmake" [[message(FATAL_ERROR "once: configure should not run again")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-build.cmake" [[message(FATAL_ERROR "once: build should not run again")]]) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-install.cmake" [[message(FATAL_ERROR "once: install should not run again")]]) + if(NOT RunCMake_GENERATOR MATCHES "^(Xcode|Visual Studio 9 )") + # The Xcode and VS 9 build systems decide to run this every time. + file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-configure.cmake" [[message(FATAL_ERROR "always: configure should not run again")]]) + endif() + run_cmake_command(BUILD_ALWAYS-build2 ${CMAKE_COMMAND} --build . --target always) +endfunction() +__ep_test_BUILD_ALWAYS() + function(__ep_test_CONFIGURE_HANDLED_BY_BUILD) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CONFIGURE_HANDLED_BY_BUILD-build) run_cmake(CONFIGURE_HANDLED_BY_BUILD) diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake index 28b8570..3b095a6 100644 --- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake +++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake @@ -38,9 +38,15 @@ run_cmake(exact_1.2.3.5) unset(RunCMake_DEFAULT_stderr) # check if searching for a version 0 works -list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0") +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0") run_cmake(exact_0_matching) +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=") +run_cmake(empty_version) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}") +run_cmake(exact_1_no_version_var) + # check custom error message set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DCustomMessage_VERSION=1.2.3.4") run_cmake(custom_message_1) diff --git a/Tests/RunCMake/FPHSA/empty_version-result.txt b/Tests/RunCMake/FPHSA/empty_version-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/empty_version-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/empty_version-stderr.txt b/Tests/RunCMake/FPHSA/empty_version-stderr.txt new file mode 100644 index 0000000..3b60c7a --- /dev/null +++ b/Tests/RunCMake/FPHSA/empty_version-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at [^ +]*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\): + Could NOT find Pseudo: \(Required is at least version "1"\) \(found TRUE\) +Call Stack \(most recent call first\): + [^ +]*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(_FPHSA_FAILURE_MESSAGE\) + FindPseudo.cmake:[0-9]+ \(find_package_handle_standard_args\) + empty_version.cmake:[0-9]+ \(find_package\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/FPHSA/empty_version.cmake b/Tests/RunCMake/FPHSA/empty_version.cmake new file mode 100644 index 0000000..7b7ff34 --- /dev/null +++ b/Tests/RunCMake/FPHSA/empty_version.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1 REQUIRED) diff --git a/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt b/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt new file mode 100644 index 0000000..7cbdf6e --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt @@ -0,0 +1 @@ +-- Found Pseudo: TRUE \(Required is at least version "1"\) diff --git a/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake b/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake new file mode 100644 index 0000000..7b7ff34 --- /dev/null +++ b/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake @@ -0,0 +1 @@ +find_package(Pseudo 1 REQUIRED) diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index 3b91e24..bb27491 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -16,6 +16,7 @@ run_cmake(UsesTerminalOverride) run_cmake(MakeAvailable) run_cmake(MakeAvailableTwice) run_cmake(MakeAvailableUndeclared) +run_cmake(VerifyHeaderSet) run_cmake_with_options(ManualSourceDirectory -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT=${CMAKE_CURRENT_LIST_DIR}/WithProject" diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet-stdout.txt b/Tests/RunCMake/FetchContent/VerifyHeaderSet-stdout.txt new file mode 100644 index 0000000..354529d --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet-stdout.txt @@ -0,0 +1,4 @@ +-- Before subproject, var = 'TRUE' +-- Inside subproject, var = 'FALSE' +-- After subproject, var = 'TRUE' +-- Subproject target property VERIFY_INTERFACE_HEADER_SETS='FALSE' diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet.cmake b/Tests/RunCMake/FetchContent/VerifyHeaderSet.cmake new file mode 100644 index 0000000..8adfcea --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet.cmake @@ -0,0 +1,16 @@ +enable_language(C) + +set(CMAKE_VERIFY_INTERFACE_HEADER_SETS TRUE) + +include(FetchContent) +FetchContent_Declare(verify_subproj + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/VerifyHeaderSet +) +message(STATUS "Before subproject, var = '${CMAKE_VERIFY_INTERFACE_HEADER_SETS}'") +FetchContent_MakeAvailable(verify_subproj) + +# Provide a way to verify the variable was reset back to its original value +message(STATUS "After subproject, var = '${CMAKE_VERIFY_INTERFACE_HEADER_SETS}'") + +get_property(verify TARGET Blah PROPERTY VERIFY_INTERFACE_HEADER_SETS) +message(STATUS "Subproject target property VERIFY_INTERFACE_HEADER_SETS='${verify}'") diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet/CMakeLists.txt b/Tests/RunCMake/FetchContent/VerifyHeaderSet/CMakeLists.txt new file mode 100644 index 0000000..c6ba37e --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.24) +project(VerifyHeaderSet LANGUAGES C) + +message(STATUS "Inside subproject, var = '${CMAKE_VERIFY_INTERFACE_HEADER_SETS}'") + +add_library(Blah INTERFACE) +target_sources(Blah + INTERFACE FILE_SET HEADERS FILES blah.h +) diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet/blah.h b/Tests/RunCMake/FetchContent/VerifyHeaderSet/blah.h new file mode 100644 index 0000000..5b47e14 --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet/blah.h @@ -0,0 +1 @@ +#error Header was used diff --git a/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake b/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake index c1030fb..4943f9e 100644 --- a/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake +++ b/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake @@ -18,3 +18,7 @@ message(STATUS "Lowercase extra file was read") # This is expected to be re-routed to a FetchContent_MakeAvailable() call find_package(AddedProject REQUIRED) + +# Verify that find_package() version constraints are fully ignored by the +# default-generated config version file +find_package(AddedProject 1.2.3 EXACT REQUIRED) diff --git a/Tests/RunCMake/FileAPI/CMakeLists.txt b/Tests/RunCMake/FileAPI/CMakeLists.txt index 44025d3..9a66cde 100644 --- a/Tests/RunCMake/FileAPI/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.13) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FileAPI/ClientStateful-check.py b/Tests/RunCMake/FileAPI/ClientStateful-check.py index f3d20d1..28679bb 100644 --- a/Tests/RunCMake/FileAPI/ClientStateful-check.py +++ b/Tests/RunCMake/FileAPI/ClientStateful-check.py @@ -108,7 +108,11 @@ def check_query_json_empty(q): check_error_re(q, "value, object or array expected") def check_query_json_extra(q): - check_error_re(q, "Extra non-whitespace after JSON value") + if bool(os.environ.get("CMake_JSONCPP_PRE_1_7_5", "")) and is_dict(q) and sorted(q.keys()) == ["responses"]: + # jsoncpp < 1.7.5 did not diagnose extra non-whitespace characters + check_error(q["responses"], "'requests' member missing") + else: + check_error_re(q, "Extra non-whitespace after JSON value") def check_query_not_file(q): check_error_re(q, "failed to read from file") diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake index 61dce17..961b73a 100644 --- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake +++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake @@ -39,6 +39,10 @@ if(RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo") endif() +if(JsonCpp_VERSION_STRING AND JsonCpp_VERSION_STRING VERSION_LESS 1.7.5) + set(ENV{CMake_JSONCPP_PRE_1_7_5} 1) +endif() + run_cmake(Nothing) run_cmake(Empty) run_cmake(EmptyClient) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index d5f596e..b7623de 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -213,6 +213,16 @@ def check_directory(c): assert is_int(at["index"]) assert c["targets"][at["index"]]["name"] == et["index"] + if e.get("cxxModuleBmiTarget", None) is not None: + expected_keys.append("cxxModuleBmiTarget") + et = e["cxxModuleBmiTarget"] + at = a["cxxModuleBmiTarget"] + assert is_dict(at) + assert sorted(at.keys()) == ["id", "index"] + assert matches(at["id"], et["id"]) + assert is_int(at["index"]) + assert c["targets"][at["index"]]["name"] == et["index"] + if e["backtrace"] is not None: expected_keys.append("backtrace") check_backtrace(d, a["backtrace"], e["backtrace"]) @@ -654,6 +664,7 @@ def gen_check_directories(c, g): read_codemodel_json_data("directories/dir_dir.json"), read_codemodel_json_data("directories/external.json"), read_codemodel_json_data("directories/fileset.json"), + read_codemodel_json_data("directories/subdir.json"), ] if matches(g["name"], "^Visual Studio "): @@ -712,6 +723,7 @@ def gen_check_targets(c, g, inSource): read_codemodel_json_data("targets/c_shared_exe.json"), read_codemodel_json_data("targets/c_static_lib.json"), read_codemodel_json_data("targets/c_static_exe.json"), + read_codemodel_json_data("targets/c_subdir.json"), read_codemodel_json_data("targets/all_build_cxx.json"), read_codemodel_json_data("targets/zero_check_cxx.json"), diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json index 6514910..de8b177 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json @@ -10,7 +10,7 @@ "^cxx_alias_exe::@53632cba2752272bb008$" ], "projectName": "Alias", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": null, "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json index c89e4f9..e57191c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json @@ -10,7 +10,7 @@ "^custom_tgt::@c11385ffed57b860da63$" ], "projectName": "Custom", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": null, "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json index 8052c1a..28f2b99 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json @@ -16,7 +16,7 @@ "^cxx_static_lib::@a56b12a3f5c0529fb296$" ], "projectName": "Cxx", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": true, "installers": [ { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json index 8509f08..2a3756e 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json @@ -7,7 +7,7 @@ ], "targetIds": null, "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": null, "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json index 27184cd..12677f2 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json @@ -5,7 +5,7 @@ "childSources": null, "targetIds": null, "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": null, "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json index 6d2952d..f1199c3 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json @@ -9,7 +9,7 @@ "^generated_exe::@[0-9a-f]+$" ], "projectName": "External", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": true, "installers": [ { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json index 4774a13..c4df2ec 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json @@ -8,7 +8,7 @@ "^c_headers_2::@6b8db101d64c125f29fe$" ], "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": true, "installers": [ { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json index 92b9526..8210d7f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json @@ -13,7 +13,7 @@ "^link_imported_static_exe::@ba7eb709d0b48779c6c8$" ], "projectName": "Imported", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": true, "installers": [ { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json index 90664dc..08edd64 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json @@ -9,7 +9,7 @@ "^iface_srcs::@25b7fa8ea00134654b85$" ], "projectName": "Interface", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": null, "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json new file mode 100644 index 0000000..996da47 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json @@ -0,0 +1,11 @@ +{ + "source": "^subdir$", + "build": "^subdir$", + "parentSource": "^\\.$", + "childSources": null, + "targetIds": null, + "projectName": "codemodel-v2", + "minimumCMakeVersion": "3.13", + "hasInstallRule": null, + "installers": [] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json index e7b146f..aed07e2 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json @@ -11,7 +11,8 @@ "^object$", "^.*/Tests/RunCMake/FileAPIExternalSource$", "^dir$", - "^fileset$" + "^fileset$", + "^subdir$" ], "targetIds": [ "^ALL_BUILD::@6890427a1f51a3e7e1df$", @@ -22,10 +23,11 @@ "^c_shared_lib::@6890427a1f51a3e7e1df$", "^c_static_exe::@6890427a1f51a3e7e1df$", "^c_static_lib::@6890427a1f51a3e7e1df$", + "^c_subdir::@6890427a1f51a3e7e1df$", "^interface_exe::@6890427a1f51a3e7e1df$" ], "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", + "minimumCMakeVersion": "3.13", "hasInstallRule": true, "installers": [ { @@ -48,7 +50,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 39, + "line": 42, "command": "install", "hasParent": true }, @@ -93,7 +95,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -141,7 +143,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -186,7 +188,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -230,7 +232,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -274,7 +276,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 47, + "line": 50, "command": "install", "hasParent": true }, @@ -321,7 +323,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 49, + "line": 52, "command": "install", "hasParent": true }, @@ -366,7 +368,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 50, + "line": 53, "command": "install", "hasParent": true }, @@ -415,7 +417,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 51, + "line": 54, "command": "install", "hasParent": true }, @@ -467,7 +469,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 52, + "line": 55, "command": "install", "hasParent": true }, @@ -516,7 +518,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 56, "command": "install", "hasParent": true }, @@ -558,7 +560,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 54, + "line": 57, "command": "install", "hasParent": true }, @@ -600,7 +602,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 55, + "line": 58, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json index 0d6c4a1..151c0a8 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json @@ -14,7 +14,8 @@ "^\\.$", "^dir$", "^dir/dir$", - "^fileset$" + "^fileset$", + "^subdir$" ], "targetIds": [ "^ALL_BUILD::@6890427a1f51a3e7e1df$", @@ -26,6 +27,7 @@ "^c_shared_exe::@6890427a1f51a3e7e1df$", "^c_static_lib::@6890427a1f51a3e7e1df$", "^c_static_exe::@6890427a1f51a3e7e1df$", + "^c_subdir::@6890427a1f51a3e7e1df$", "^c_headers_1::@6b8db101d64c125f29fe$", "^c_headers_2::@6b8db101d64c125f29fe$" ] 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 4e772a7..0d45d07 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 @@ -96,6 +96,10 @@ "backtrace": null }, { + "id": "^c_subdir::@6890427a1f51a3e7e1df$", + "backtrace": null + }, + { "id": "^c_static_exe::@6890427a1f51a3e7e1df$", "backtrace": null }, 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 b4318dd..9a210ff 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 @@ -115,7 +115,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -145,7 +145,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -175,7 +175,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 47, + "line": 50, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json new file mode 100644 index 0000000..12ec917 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json @@ -0,0 +1,150 @@ +{ + "name": "c_subdir", + "id": "^c_subdir::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "STATIC_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^subdir/empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^subdir/CMakeLists\\.txt$", + "line": 4, + "command": "target_sources", + "hasParent": true + }, + { + "file": "^subdir/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^subdir/empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^subdir/empty\\.c$" + ], + "includes": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/subdir$", + "isSystem": null, + "backtrace": [ + { + "file": "^subdir/CMakeLists\\.txt$", + "line": 2, + "command": "target_include_directories", + "hasParent": true + }, + { + "file": "^subdir/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "defines": [ + { + "define": "SUBDIR", + "backtrace": [ + { + "file": "^subdir/CMakeLists\\.txt$", + "line": 1, + "command": "target_compile_definitions", + "hasParent": true + }, + { + "file": "^subdir/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 17, + "command": "add_library", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib)?c_subdir\\.(a|lib)$", + "artifacts": [ + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_subdir\\.(a|lib)$", + "_dllExtra": false + } + ], + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": null, + "archive": { + "lto": null + }, + "dependencies": [ + { + "id": "^c_lib::@6890427a1f51a3e7e1df$", + "backtrace": [ + { + "file": "^subdir/CMakeLists\\.txt$", + "line": 3, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^subdir/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + } + ] +} 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 5769f0c..16d074a 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json @@ -136,7 +136,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 39, + "line": 42, "command": "install", "hasParent": true }, 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 1fe4d67..03f4cb9 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 @@ -91,7 +91,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -121,7 +121,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 42, + "line": 45, "command": "install", "hasParent": true }, @@ -151,7 +151,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 47, + "line": 50, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake index 019eb87..09db216 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake +++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake @@ -14,6 +14,9 @@ add_library(c_static_lib STATIC empty.c) add_executable(c_static_exe empty.c) target_link_libraries(c_static_exe PRIVATE c_static_lib) +add_library(c_subdir STATIC) +add_subdirectory(subdir) + add_subdirectory(cxx) add_subdirectory(alias) add_subdirectory(object) diff --git a/Tests/RunCMake/FileAPI/subdir/CMakeLists.txt b/Tests/RunCMake/FileAPI/subdir/CMakeLists.txt new file mode 100644 index 0000000..b8f4550 --- /dev/null +++ b/Tests/RunCMake/FileAPI/subdir/CMakeLists.txt @@ -0,0 +1,4 @@ +target_compile_definitions(c_subdir PRIVATE SUBDIR) +target_include_directories(c_subdir PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(c_subdir PRIVATE c_lib) +target_sources(c_subdir PRIVATE empty.c) diff --git a/Tests/RunCMake/FileAPI/subdir/empty.c b/Tests/RunCMake/FileAPI/subdir/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FileAPI/subdir/empty.c diff --git a/Tests/RunCMake/File_Archive/RunCMakeTest.cmake b/Tests/RunCMake/File_Archive/RunCMakeTest.cmake index 3908f42..dad0dd3 100644 --- a/Tests/RunCMake/File_Archive/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Archive/RunCMakeTest.cmake @@ -13,6 +13,9 @@ run_cmake(zip) # Extracting only selected files or directories run_cmake(zip-filtered) +run_cmake(create-missing-args) +run_cmake(extract-missing-args) + run_cmake(unsupported-format) run_cmake(zip-with-bad-compression) run_cmake(7zip-with-bad-compression) diff --git a/Tests/RunCMake/File_Archive/create-missing-args-result.txt b/Tests/RunCMake/File_Archive/create-missing-args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Archive/create-missing-args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Archive/create-missing-args-stderr.txt b/Tests/RunCMake/File_Archive/create-missing-args-stderr.txt new file mode 100644 index 0000000..fd026f9 --- /dev/null +++ b/Tests/RunCMake/File_Archive/create-missing-args-stderr.txt @@ -0,0 +1,19 @@ +^CMake Error at create-missing-args.cmake:[0-9]+ \(file\): + Error after keyword "COMPRESSION": + + missing required value + + Error after keyword "COMPRESSION_LEVEL": + + missing required value + + Error after keyword "FORMAT": + + missing required value + + Error after keyword "OUTPUT": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/File_Archive/create-missing-args.cmake b/Tests/RunCMake/File_Archive/create-missing-args.cmake new file mode 100644 index 0000000..a0c84d2 --- /dev/null +++ b/Tests/RunCMake/File_Archive/create-missing-args.cmake @@ -0,0 +1,8 @@ +file(ARCHIVE_CREATE + OUTPUT # missing output path + FORMAT # missing output format + COMPRESSION # missing compression type + COMPRESSION_LEVEL # missing compression level + MTIME # missing modification time + PATHS # no paths + ) diff --git a/Tests/RunCMake/File_Archive/extract-missing-args-result.txt b/Tests/RunCMake/File_Archive/extract-missing-args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Archive/extract-missing-args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Archive/extract-missing-args-stderr.txt b/Tests/RunCMake/File_Archive/extract-missing-args-stderr.txt new file mode 100644 index 0000000..0c93ece --- /dev/null +++ b/Tests/RunCMake/File_Archive/extract-missing-args-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at extract-missing-args.cmake:[0-9]+ \(file\): + Error after keyword "DESTINATION": + + missing required value + + Error after keyword "INPUT": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/File_Archive/extract-missing-args.cmake b/Tests/RunCMake/File_Archive/extract-missing-args.cmake new file mode 100644 index 0000000..21c5d99 --- /dev/null +++ b/Tests/RunCMake/File_Archive/extract-missing-args.cmake @@ -0,0 +1,5 @@ +file(ARCHIVE_EXTRACT + INPUT # missing input + DESTINATION # missing destination + PATTERNS # no patterns + ) diff --git a/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt b/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt index a6ea314..72292f9 100644 --- a/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt +++ b/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt @@ -1,4 +1,7 @@ CMake Error at BadArgContent.cmake:[0-9]+ \(file\): - file CONFIGURE CONTENT option needs a value. + Error after keyword "CONTENT": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt b/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt index b5a924c..d793f48 100644 --- a/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt +++ b/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt @@ -1,4 +1,7 @@ CMake Error at BadArgOutput.cmake:[0-9]+ \(file\): - file CONFIGURE OUTPUT option needs a value. + Error after keyword "OUTPUT": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/File_Configure/NoArgContent-result.txt b/Tests/RunCMake/File_Configure/NoArgContent-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgContent-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Configure/NoArgContent-stderr.txt b/Tests/RunCMake/File_Configure/NoArgContent-stderr.txt new file mode 100644 index 0000000..2e8dd9a --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgContent-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoArgContent.cmake:[0-9]+ \(file\): + file CONFIGURE CONTENT option is mandatory. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/File_Configure/NoArgContent.cmake b/Tests/RunCMake/File_Configure/NoArgContent.cmake new file mode 100644 index 0000000..cf52c46 --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgContent.cmake @@ -0,0 +1 @@ +file(CONFIGURE OUTPUT "") diff --git a/Tests/RunCMake/File_Configure/NoArgOutput-result.txt b/Tests/RunCMake/File_Configure/NoArgOutput-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgOutput-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Configure/NoArgOutput-stderr.txt b/Tests/RunCMake/File_Configure/NoArgOutput-stderr.txt new file mode 100644 index 0000000..53de48b --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgOutput-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoArgOutput.cmake:[0-9]+ \(file\): + file CONFIGURE OUTPUT option is mandatory. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/File_Configure/NoArgOutput.cmake b/Tests/RunCMake/File_Configure/NoArgOutput.cmake new file mode 100644 index 0000000..77e9cdc --- /dev/null +++ b/Tests/RunCMake/File_Configure/NoArgOutput.cmake @@ -0,0 +1 @@ +file(CONFIGURE CONTENT "") diff --git a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake index 5022985..008ce67 100644 --- a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake @@ -9,6 +9,8 @@ run_cmake(DirOutput) run_cmake(NewLineStyle-NoArg) run_cmake(NewLineStyle-ValidArg) run_cmake(NewLineStyle-WrongArg) +run_cmake(NoArgOutput) +run_cmake(NoArgContent) run_cmake(SubDir) run_cmake(AtOnly) run_cmake(EscapeQuotes) diff --git a/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt b/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt index e823b25..708e6be 100644 --- a/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt +++ b/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt @@ -1,4 +1,7 @@ CMake Error at EmptyCondition1.cmake:2 \(file\): - file Incorrect arguments to GENERATE subcommand. + Error after keyword "CONDITION": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/File_Generate/InputAndContent-check.cmake b/Tests/RunCMake/File_Generate/InputAndContent-check.cmake new file mode 100644 index 0000000..5c9b803 --- /dev/null +++ b/Tests/RunCMake/File_Generate/InputAndContent-check.cmake @@ -0,0 +1,8 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/output-INPUT.txt" input) +if(NOT input MATCHES "INPUT file") + string(APPEND RunCMake_TEST_FAILED "INPUT incorrectly overridden by CONTENT") +endif() +file(READ "${RunCMake_TEST_BINARY_DIR}/output-CONTENT.txt" content) +if(NOT content MATCHES "CONTENT argument") + string(APPEND RunCMake_TEST_FAILED "CONTENT incorrectly overridden by INPUT") +endif() diff --git a/Tests/RunCMake/File_Generate/InputAndContent-input.txt b/Tests/RunCMake/File_Generate/InputAndContent-input.txt new file mode 100644 index 0000000..73f162b --- /dev/null +++ b/Tests/RunCMake/File_Generate/InputAndContent-input.txt @@ -0,0 +1 @@ +INPUT file diff --git a/Tests/RunCMake/File_Generate/InputAndContent.cmake b/Tests/RunCMake/File_Generate/InputAndContent.cmake new file mode 100644 index 0000000..9c3977a --- /dev/null +++ b/Tests/RunCMake/File_Generate/InputAndContent.cmake @@ -0,0 +1,10 @@ +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output-INPUT.txt" + INPUT "${CMAKE_CURRENT_SOURCE_DIR}/InputAndContent-input.txt" + CONTENT "CONTENT argument" +) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output-CONTENT.txt" + CONTENT "CONTENT argument" + INPUT "${CMAKE_CURRENT_SOURCE_DIR}/InputAndContent-input.txt" +) diff --git a/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt b/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt index bc71f2f..b1b7f80 100644 --- a/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt +++ b/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt @@ -1,4 +1,7 @@ CMake Error at NewLineStyle-NoArg.cmake:[0-9]+ \(file\): - file Incorrect arguments to GENERATE subcommand. + Error after keyword "NEWLINE_STYLE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index be3bf04..5a670ae 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -17,6 +17,7 @@ run_cmake(EmptyCondition2) run_cmake(BadCondition) run_cmake(DebugEvaluate) run_cmake(GenerateSource) +run_cmake(InputAndContent) run_cmake(OutputNameMatchesSources) run_cmake(OutputNameMatchesObjects) run_cmake(OutputNameMatchesOtherSources) diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index f479dcf..661ae3f 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -24,6 +24,27 @@ endif() # We need a real pkg-config to run the test for get_variable. find_package(PkgConfig) if (PKG_CONFIG_FOUND) + string(FIND "${CMAKE_CURRENT_BINARY_DIR}" " " IS_SPACES_IN_PATH) + if(IS_SPACES_IN_PATH GREATER -1) + string(REPLACE " " "\\ " ESCAPED_ROOT "${CMAKE_CURRENT_BINARY_DIR}") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_spaces.pc" " +libdir=${ESCAPED_ROOT} +Name: test_spaces.pc +Version: 0.0 +Description: test spaces +Libs: -L\${libdir} +") + set(PKG_CONFIG_PATH_SAVED "$ENV{PKG_CONFIG_PATH}") + set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_BINARY_DIR}") + execute_process(COMMAND "${PKG_CONFIG_EXECUTABLE}" --libs test_spaces + ERROR_QUIET COMMAND_ERROR_IS_FATAL ANY + OUTPUT_VARIABLE test_spaces_LIBS) + set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH_SAVED}") + string(STRIP "${test_spaces_LIBS}" test_spaces_LIBS_STRIPPED) + if(NOT "${test_spaces_LIBS_STRIPPED}" STREQUAL "-L${ESCAPED_ROOT}") + set(PKG_CONFIG_DONT_SUPPORT_SPACES_IN_PATH TRUE) + endif() + endif() run_cmake(FindPkgConfig_GET_VARIABLE) run_cmake(FindPkgConfig_GET_VARIABLE_PREFIX_PATH) run_cmake(FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH) @@ -32,5 +53,7 @@ if (PKG_CONFIG_FOUND) run_cmake(FindPkgConfig_VERSION_OPERATORS) run_cmake(FindPkgConfig_GET_MATCHING_MODULE_NAME) run_cmake(FindPkgConfig_empty_target) - run_cmake(FindPkgConfig_LIBRARY_PATH) + if(NOT PKG_CONFIG_DONT_SUPPORT_SPACES_IN_PATH) + run_cmake(FindPkgConfig_LIBRARY_PATH) + endif() endif () diff --git a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake index 51e627d..3afda4d 100644 --- a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake +++ b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake @@ -23,3 +23,8 @@ string(APPEND content "set(target_file_name ${target_name})\n") file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkMultiConfigPostfixInfo.cmake CONTENT "${content}") + + +# Try to link this framework to ensure postfix is correctly handled +add_library(otherlib SHARED foo.c) +target_link_libraries(otherlib PRIVATE ${target_name}) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake index f20d225..f1023d1 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(add_link_options) run_cmake(link_directories) run_cmake(target_link_options) run_cmake(target_link_directories) +run_cmake(invalid-property) run_cmake(no-arguments) run_cmake(empty-arguments) run_cmake(forbidden-arguments) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt index a80a11b..c3eb103 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_command.cmake:[0-9]+ \(add_custom_command\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt index deb246a..8bd07fe 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_target.cmake:[0-9]+ \(add_custom_target\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt index 17c348c..8314461 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_link_options.cmake:[0-9]+ \(add_link_options\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt index bae6505..b29303b 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt @@ -1,6 +1,6 @@ -CMake Error at forbidden-arguments.cmake:[0-9]+ \(link_libraries\): - Property LINK_LIBRARIES contains the invalid item "<LINK_GROUP:feat>". The - LINK_LIBRARIES property may contain the generator-expression +CMake Error at forbidden-arguments.cmake:[0-9]+ \(add_library\): + Property LINK_LIBRARIES contains the invalid item "</LINK_GROUP:feat>". + The LINK_LIBRARIES property may contain the generator-expression "\$<LINK_GROUP:...>" which may be used to specify how the libraries are linked. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-result.txt b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-stderr.txt new file mode 100644 index 0000000..f39d275 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at invalid-property.cmake:[0-9]+ \(set_property\): + Error evaluating generator expression: + + \$<LINK_GROUP:feat,dep> + + \$<LINK_GROUP:...> may only be used with binary targets to specify group of + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property.cmake b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property.cmake new file mode 100644 index 0000000..549f4c1 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +set (CMAKE_LINK_GROUP_USING_feat "--prefix" "--suffix") +set (CMAKE_LINK_GROUP_USING_feat_SUPPORTED TRUE) + +add_library(dep SHARED empty.c) +set_property(TARGET dep PROPERTY INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE "$<LINK_GROUP:feat,dep>") + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE dep) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt index 51194a4..1ee01f3 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at link_directories.cmake:[0-9]+ \(link_directories\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt index 042dd0b..58a8fc4 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_directories.cmake:[0-9]+ \(target_link_directories\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt index 7030b9c..910106c 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_options.cmake:[0-9]+ \(target_link_options\): \$<LINK_GROUP:FEAT> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake index 3fb68d6..7df0e80 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(add_link_options) run_cmake(link_directories) run_cmake(target_link_options) run_cmake(target_link_directories) +run_cmake(invalid-property) run_cmake(no-arguments) run_cmake(empty-arguments) run_cmake(forbidden-arguments) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt index d8ff0eb..a9c3842 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_command.cmake:[0-9]+ \(add_custom_command\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt index 8ca384d..95104a5 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_target.cmake:[0-9]+ \(add_custom_target\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt index 399a413..f8669ad 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_link_options.cmake:[0-9]+ \(add_link_options\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt index 5245dd8..fc8e383 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt @@ -1,5 +1,5 @@ -CMake Error at forbidden-arguments.cmake:[0-9]+ \(link_libraries\): - Property LINK_LIBRARIES contains the invalid item "<LINK_LIBRARY:feat>". +CMake Error at forbidden-arguments.cmake:[0-9]+ \(add_library\): + Property LINK_LIBRARIES contains the invalid item "</LINK_LIBRARY:feat>". The LINK_LIBRARIES property may contain the generator-expression "\$<LINK_LIBRARY:...>" which may be used to specify how the libraries are linked. diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-stderr.txt new file mode 100644 index 0000000..7410e48 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at invalid-property.cmake:[0-9]+ \(set_property\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:feat,dep> + + \$<LINK_LIBRARY:...> may only be used with binary targets to specify link + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property.cmake new file mode 100644 index 0000000..a8e3a57 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +set (CMAKE_LINK_LIBRARY_USING_feat "<LIBRARY>") +set (CMAKE_LINK_LIBRARY_USING_feat_SUPPORTED TRUE) + +add_library(dep SHARED empty.c) +set_property(TARGET dep PROPERTY INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE "$<LINK_LIBRARY:feat,dep>") + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE dep) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt index aeb32f2..e47bf04 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at link_directories.cmake:[0-9]+ \(link_directories\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt index e0c60c4..7c467fd 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_directories.cmake:[0-9]+ \(target_link_directories\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt index 6c9aab1..02805b7 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_options.cmake:[0-9]+ \(target_link_options\): \$<LINK_LIBRARY:FEAT> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake index 148baac..a79fcaf 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake @@ -2,6 +2,9 @@ include(RunCMake) run_cmake(TARGET_FILE-recursion) run_cmake(OUTPUT_NAME-recursion) +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + run_cmake(TARGET_BUNDLE_DIR_NAME) +endif() run_cmake(TARGET_FILE_DIR-dependency) run_cmake(TARGET_FILE_DIR-no-dependency) run_cmake(TARGET_FILE_PREFIX-imported-target) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME-check.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME-check.cmake new file mode 100644 index 0000000..6e62ce3 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME-check.cmake @@ -0,0 +1 @@ +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_BUNDLE_DIR_NAME-generated.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME.cmake new file mode 100644 index 0000000..23db8fd --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_BUNDLE_DIR_NAME.cmake @@ -0,0 +1,33 @@ +enable_language(C) + +set(GENERATE_CONTENT [[ +macro (check_value test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_library(test-lib MODULE empty.c) +set_target_properties(test-lib PROPERTIES BUNDLE TRUE) + +add_library(test-fw empty.c) +set_target_properties(test-fw PROPERTIES FRAMEWORK TRUE) + +add_executable(test-app MACOSX_BUNDLE empty.c) + +add_executable(test-app-custom MACOSX_BUNDLE empty.c) +set_target_properties(test-app-custom PROPERTIES BUNDLE_EXTENSION custom) + +string(APPEND GENERATE_CONTENT [[ +check_value("TARGET_BUNDLE_DIR_NAME library" "$<TARGET_BUNDLE_DIR_NAME:test-lib>" "test-lib.bundle") +check_value("TARGET_BUNDLE_DIR_NAME framework" "$<TARGET_BUNDLE_DIR_NAME:test-fw>" "test-fw.framework") +check_value("TARGET_BUNDLE_DIR_NAME app" "$<TARGET_BUNDLE_DIR_NAME:test-app>" "test-app.app") +check_value("TARGET_BUNDLE_DIR_NAME custom" "$<TARGET_BUNDLE_DIR_NAME:test-app-custom>" "test-app-custom.custom") +]]) + +file( + GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_BUNDLE_DIR_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" +) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt new file mode 100644 index 0000000..fb61d4b --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error in CMakeLists.txt: + MSVC_DEBUG_INFORMATION_FORMAT value 'BogusValue' not known for this (C|CXX) + compiler. ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake new file mode 100644 index 0000000..165ea38 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0141 NEW) +include(CMP0141-common.cmake) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake new file mode 100644 index 0000000..82754a9 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake @@ -0,0 +1,4 @@ +include(CMP0141-common.cmake) + +# Setting this policy after enable_language command has no effect. +cmake_policy(SET CMP0141 NEW) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake new file mode 100644 index 0000000..7bbe586 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0141 OLD) +include(CMP0141-common.cmake) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake new file mode 100644 index 0000000..912112a --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0141-common.cmake) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake new file mode 100644 index 0000000..8e43a25 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake @@ -0,0 +1,31 @@ +enable_language(CXX) + +cmake_policy(GET CMP0141 cmp0141) +if(cmp0141 STREQUAL "NEW") + if(NOT CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT) + message(SEND_ERROR "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT not set under NEW behavior") + endif() +else() + if(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT) + message(SEND_ERROR "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT is set under OLD behavior") + endif() +endif() + +if(cmp0141 STREQUAL "NEW") + if(CMAKE_CXX_FLAGS_DEBUG MATCHES "[/-]Zi( |$)") + message(SEND_ERROR "CMAKE_CXX_FLAGS_DEBUG has -Zi flags under NEW behavior.") + endif() + if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "[/-]Zi( |$)") + message(SEND_ERROR "CMAKE_CXX_FLAGS_RELWITHDEBINFO has -Zi flags under NEW behavior.") + endif() +else() + if(NOT (CMAKE_CXX_FLAGS_DEBUG MATCHES "[/-]Zi( |$)")) + message(SEND_ERROR "CMAKE_CXX_FLAGS_DEBUG does not have -Zi flags under OLD behavior.") + endif() + if(NOT (CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "[/-]Zi( |$)")) + message(SEND_ERROR "CMAKE_CXX_FLAGS_RELWITHDEBINFO does not have -Zi flags under OLD behavior.") + endif() +endif() + +set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT BogusValue) +add_library(foo empty.cxx) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt new file mode 100644 index 0000000..aba1016 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.24) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake new file mode 100644 index 0000000..f678acf --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(CMP0141-WARN) +run_cmake(CMP0141-OLD) +run_cmake(CMP0141-NEW) +run_cmake(CMP0141-NoEffect) diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx b/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx diff --git a/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake new file mode 100644 index 0000000..a1ae6ac --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake @@ -0,0 +1,28 @@ +set(expected_compile_commands +[==[^\[ +{ + "directory": "[^ +]*(/Tests/RunCMake/NinjaMultiConfig/CompileCommands-build|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\CompileCommands-build)", + "command": "[^ +]*Debug[^ +]*", + "file": "[^ +]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)" +}, +{ + "directory": "[^ +]*(/Tests/RunCMake/NinjaMultiConfig/CompileCommands-build|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\CompileCommands-build)", + "command": "[^ +]*Release[^ +]*", + "file": "[^ +]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)" +} +]$]==]) + +file(READ "${RunCMake_TEST_BINARY_DIR}/compile_commands.json" actual_compile_commands) +if(NOT actual_compile_commands MATCHES "${expected_compile_commands}") + string(REPLACE "\n" "\n " expected_compile_commands_formatted "${expected_compile_commands}") + string(REPLACE "\n" "\n " actual_compile_commands_formatted "${actual_compile_commands}") + string(APPEND RunCMake_TEST_FAILED "Expected compile_commands.json to match:\n ${expected_compile_commands_formatted}\nActual compile_commands.json:\n ${actual_compile_commands_formatted}\n") +endif() diff --git a/Tests/RunCMake/NinjaMultiConfig/CompileCommands.cmake b/Tests/RunCMake/NinjaMultiConfig/CompileCommands.cmake new file mode 100644 index 0000000..fc44d5a --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CompileCommands.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_executable(exe main.c) diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 738bc6c..c040e8f 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -453,6 +453,11 @@ run_cmake_command(NoUnusedVariables ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR} "-DCMAKE_DEFAULT_BUILD_TYPE=Debug" "-DCMAKE_DEFAULT_CONFIGS=all" ) +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_CROSS_CONFIGS=all;-DCMAKE_EXPORT_COMPILE_COMMANDS=ON") +run_cmake(CompileCommands) +unset(RunCMake_TEST_OPTIONS) # CudaSimple uses separable compilation, which is currently only supported on NVCC. if(CMake_TEST_CUDA) diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake index 51c8832..691c495 100644 --- a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake +++ b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake @@ -154,6 +154,7 @@ foreach(t ${targets}) cmake_parse_implicit_link_info("${input}" implicit_libs idirs implicit_fwks log "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}" + LANGUAGE ${lang} COMPUTE_IMPLICIT_OBJECTS implicit_objs) set(library_arch) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 1c92ca0..c329b46 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -1,8 +1,10 @@ -foreach(arg +foreach( + arg + IN ITEMS RunCMake_GENERATOR RunCMake_SOURCE_DIR RunCMake_BINARY_DIR - ) + ) if(NOT DEFINED ${arg}) message(FATAL_ERROR "${arg} not given!") endif() @@ -31,7 +33,7 @@ function(run_cmake test) set(platform_name msys) endif() - foreach(o out err) + 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}}") @@ -176,7 +178,7 @@ function(run_cmake test) "|[^\n]*Bullseye Testing Technology" ")[^\n]*\n)+" ) - foreach(o out err) + 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}}") diff --git a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake index e5bfac4..58a111a 100644 --- a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake +++ b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake @@ -1,5 +1,8 @@ include(RunCMake) +# Do not let ccache modify paths checked by the test cases. +unset(ENV{CCACHE_BASEDIR}) + function(run_symlink_test_case) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt" diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 97c3394..0d8e4c9 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -36,6 +36,7 @@ \* CMP0113 \* CMP0119 \* CMP0131 + \* CMP0142 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake b/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake new file mode 100644 index 0000000..46af974 --- /dev/null +++ b/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake @@ -0,0 +1,46 @@ +macro(DebugInformationFormat_check tgt Debug_expect Release_expect MinSizeRel_expect RelWithDebInfo_expect) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.") + return() + endif() + + set(Debug_actual "") + set(Release_actual "") + set(MinSizeRel_actual "") + set(RelWithDebInfo_actual "") + + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<ItemDefinitionGroup Condition=\"'\\$\\(Configuration\\)\\|\\$\\(Platform\\)'=='([^<>]+)\\|[A-Za-z0-9_]+'\">") + set(Configuration "${CMAKE_MATCH_1}") + endif() + if(line MATCHES "^ *<DebugInformationFormat>([^<>]+)</DebugInformationFormat>") + set(${Configuration}_actual "${CMAKE_MATCH_1}") + endif() + endforeach() + + if (NOT "${Debug_actual}" STREQUAL "${Debug_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Debug Configuration has DebugInformationFormat '${Debug_actual}', not '${Debug_expect}'.") + endif() + if (NOT "${Release_actual}" STREQUAL "${Release_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Release Configuration has DebugInformationFormat '${Release_actual}', not '${Release_expect}'.") + endif() + if (NOT "${MinSizeRel_actual}" STREQUAL "${MinSizeRel_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj MinSizeRel Configuration has DebugInformationFormat '${MinSizeRel_actual}', not '${MinSizeRel_expect}'.") + endif() + if (NOT "${RelWithDebInfo_actual}" STREQUAL "${RelWithDebInfo_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj RelWithDebInfo Configuration has DebugInformationFormat '${RelWithDebInfo_actual}', not '${RelWithDebInfo_expect}'.") + endif() +endmacro() + +DebugInformationFormat_check(default-C ProgramDatabase "" "" ProgramDatabase) +DebugInformationFormat_check(default-CXX ProgramDatabase "" "" ProgramDatabase) +DebugInformationFormat_check(empty-C "" "" "" "") +DebugInformationFormat_check(empty-CXX "" "" "" "") +DebugInformationFormat_check(Embedded-C OldStyle OldStyle OldStyle OldStyle) +DebugInformationFormat_check(Embedded-CXX OldStyle OldStyle OldStyle OldStyle) +DebugInformationFormat_check(ProgramDatabase-C ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase) +DebugInformationFormat_check(ProgramDatabase-CXX ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase) +DebugInformationFormat_check(EditAndContinue-C EditAndContinue EditAndContinue EditAndContinue EditAndContinue) +DebugInformationFormat_check(EditAndContinue-CXX EditAndContinue EditAndContinue EditAndContinue EditAndContinue) diff --git a/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake b/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake new file mode 100644 index 0000000..f670166 --- /dev/null +++ b/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake @@ -0,0 +1,24 @@ +set(CMAKE_CONFIGURATION_TYPES Debug Release MinSizeRel RelWithDebInfo) +cmake_policy(SET CMP0141 NEW) +enable_language(C) +enable_language(CXX) + +add_library(default-C empty.c) +add_library(default-CXX empty.cxx) + +set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "") +add_library(empty-C empty.c) +add_library(empty-CXX empty.cxx) + +set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "Embedded") +add_library(Embedded-C empty.c) +add_library(Embedded-CXX empty.cxx) + +set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase") +add_library(ProgramDatabase-C empty.c) +add_library(ProgramDatabase-CXX empty.cxx) + +add_library(EditAndContinue-C empty.c) +set_property(TARGET EditAndContinue-C PROPERTY MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue") +add_library(EditAndContinue-CXX empty.cxx) +set_property(TARGET EditAndContinue-CXX PROPERTY MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue") diff --git a/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake index bcdc101..1701a36 100644 --- a/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake +++ b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake @@ -5,6 +5,7 @@ if(NOT EXISTS "${vcProjectFile}") endif() set(found_iface_h 0) +set(found_int_dir 0) file(STRINGS "${vcProjectFile}" lines) foreach(line IN LISTS lines) if(line MATCHES "<([A-Za-z0-9_]+) +Include=.*iface\\.h") @@ -19,7 +20,15 @@ foreach(line IN LISTS lines) endif() set(found_iface_h 1) endif() + if(line MATCHES "^ *<IntDir [^<>]+>[^<>]+</IntDir>") + set(found_int_dir 1) + endif() endforeach() if(NOT found_iface_h) set(RunCMake_TEST_FAILED "iface.h not referenced in\n ${vcProjectFile}") + return() +endif() +if(NOT found_int_dir) + set(RunCMake_TEST_FAILED "No references to IntDir in\n ${vcProjectFile}") + return() endif() diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index ee8821a..f027e94 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -16,6 +16,7 @@ run_cmake(NoImpLib) run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) run_cmake(SourceGroupTreeCMakeLists) +run_cmake(SourceGroupFileSet) run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) @@ -87,3 +88,4 @@ run_cmake(VsDotnetStartupObject) run_cmake(VsDotnetTargetFramework) run_cmake(VsDotnetTargetFrameworkVersion) run_cmake(VsNoCompileBatching) +run_cmake(DebugInformationFormat) diff --git a/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake new file mode 100644 index 0000000..fb2eecc --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0011 NEW) + +set(vcFiltersFile "${RunCMake_TEST_BINARY_DIR}/SourceGroupFileSet.vcxproj.filters") +if(NOT EXISTS "${vcFiltersFile}") + set(RunCMake_TEST_FAILED "Filters file ${vcFiltersFile} does not exist.") + return() +endif() + +file(STRINGS "${vcFiltersFile}" lines) + +include(${RunCMake_TEST_SOURCE_DIR}/SourceGroupHelpers.cmake) + +find_source_group("${lines}" "Header Files\\SourceGroupFileSet") diff --git a/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake b/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake new file mode 100644 index 0000000..9541687 --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake @@ -0,0 +1,3 @@ +add_library(SourceGroupFileSet INTERFACE) +target_sources(SourceGroupFileSet PUBLIC FILE_SET HEADERS FILES iface.h) +source_group("Header Files/SourceGroupFileSet" FILES iface.h) diff --git a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake index c82a66e..3a5d2e7 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake @@ -1,8 +1,9 @@ function(find_source_group LINES NAME) set(foundFileFilter 0) set(foundFilter 0) + string(REPLACE "\\" "\\\\" regexName "${NAME}") foreach(line IN LISTS LINES) - if(line MATCHES "<Filter>${NAME}</Filter>") + if(line MATCHES "<Filter>${regexName}</Filter>") if(foundFileFilter) set(RunCMake_TEST_FAILED "Multiple files listed with filter for ${NAME}." PARENT_SCOPE) set(FILTER_FOUND 0 PARENT_SCOPE) @@ -10,7 +11,7 @@ function(find_source_group LINES NAME) endif() set(foundFileFilter 1) endif() - if(line MATCHES "<Filter.*Include=\"${NAME}\"") + if(line MATCHES "<Filter.*Include=\"${regexName}\"") if(foundFilter) set(RunCMake_TEST_FAILED "Multiple copies of ${NAME} filter listed." PARENT_SCOPE) set(FILTER_FOUND 0 PARENT_SCOPE) diff --git a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake index ee0c412..28d0d29 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake @@ -18,9 +18,9 @@ set(SOURCE_GROUPS_TO_FIND "SourcesPrefix\\PrefixedNested" ) -foreach(GROUP_NAME IN LISTS ${SOURCE_GROUPS_TO_FIND}) +foreach(GROUP_NAME IN LISTS SOURCE_GROUPS_TO_FIND) find_source_group("${lines}" ${GROUP_NAME}) - if(NOT ${FILTER_FOUND}) + if(NOT FILTER_FOUND) return() endif() endforeach() diff --git a/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets-all_verify_interface_header_sets-Debug-build-check.cmake b/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets-all_verify_interface_header_sets-Debug-build-check.cmake new file mode 100644 index 0000000..d5a513a --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets-all_verify_interface_header_sets-Debug-build-check.cmake @@ -0,0 +1,10 @@ +# A custom command is used to copy the header file from the source directory to +# the binary directory. If the verification target was built, the custom +# command should have been executed, and the file should be present in the +# binary directory. +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/dir1/lib1.h") + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/dir1/lib1.h should exist but it does not\n") +endif() +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/dir2/lib2.h") + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/dir2/lib2.h should exist but it does not\n") +endif() diff --git a/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets.cmake b/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets.cmake new file mode 100644 index 0000000..8948bac --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/AllVerifyInterfaceHeaderSets.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_subdirectory(dir1) +add_subdirectory(dir2) diff --git a/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake b/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake index f022a43..b4fe720 100644 --- a/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake +++ b/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake @@ -40,8 +40,15 @@ endif() run_cmake_build(VerifyHeaderSets lang_test_c_verify_interface_header_sets) run_cmake_build(VerifyHeaderSets lang_test_cxx_verify_interface_header_sets) +run_cmake_build(VerifyHeaderSets interface_lang_test_cxx_verify_interface_header_sets) run_cmake_build(VerifyHeaderSets list_verify_interface_header_sets) set(RunCMake_TEST_OPTIONS -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON) +run_cmake(AllVerifyInterfaceHeaderSets) +unset(RunCMake_TEST_OPTIONS) + +run_cmake_build(AllVerifyInterfaceHeaderSets all_verify_interface_header_sets) + +set(RunCMake_TEST_OPTIONS -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON) run_cmake(VerifyHeaderSetsNonexistent) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake index 82ed935..f260609 100644 --- a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake +++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake @@ -1,5 +1,7 @@ enable_language(C CXX) +add_compile_definitions(TEST_ADD_COMPILE_DEFINITIONS) + set_property(SOURCE a.h PROPERTY LANGUAGE C) set_property(SOURCE dir/c.h PROPERTY LANGUAGE C) set_property(SOURCE dir/cxx.h PROPERTY LANGUAGE CXX) @@ -59,6 +61,10 @@ add_library(lang_test_cxx STATIC lib.c lib.cxx) target_compile_definitions(lang_test_cxx INTERFACE EXPECT_CXX) target_sources(lang_test_cxx INTERFACE FILE_SET HEADERS FILES lang_test.h) +add_library(interface_lang_test_cxx INTERFACE) +target_compile_definitions(interface_lang_test_cxx INTERFACE EXPECT_CXX) +target_sources(interface_lang_test_cxx INTERFACE FILE_SET HEADERS FILES lang_test.h) + set_property(SOURCE error.h PROPERTY LANGUAGE C) add_library(list STATIC lib.c) diff --git a/Tests/RunCMake/VerifyHeaderSets/a.h b/Tests/RunCMake/VerifyHeaderSets/a.h index 8b17182..898da49 100644 --- a/Tests/RunCMake/VerifyHeaderSets/a.h +++ b/Tests/RunCMake/VerifyHeaderSets/a.h @@ -2,4 +2,8 @@ # error "TEST_A_H defined" #endif +#ifndef TEST_ADD_COMPILE_DEFINITIONS +# error "TEST_ADD_COMPILE_DEFINITIONS not defined" +#endif + extern void a_h(void); diff --git a/Tests/RunCMake/VerifyHeaderSets/dir1/CMakeLists.txt b/Tests/RunCMake/VerifyHeaderSets/dir1/CMakeLists.txt new file mode 100644 index 0000000..d26e933 --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/dir1/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(lib1 STATIC ../lib.c) +add_custom_command(OUTPUT lib1.h COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/lib1.h lib1.h) +target_sources(lib1 PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR} FILES ${CMAKE_CURRENT_BINARY_DIR}/lib1.h) diff --git a/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h b/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h new file mode 100644 index 0000000..69c37ed --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + extern void lib1(void); diff --git a/Tests/RunCMake/VerifyHeaderSets/dir2/CMakeLists.txt b/Tests/RunCMake/VerifyHeaderSets/dir2/CMakeLists.txt new file mode 100644 index 0000000..8c3658c --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/dir2/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(lib2 STATIC ../lib.c) +add_custom_command(OUTPUT lib2.h COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/lib2.h lib2.h) +target_sources(lib2 PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR} FILES ${CMAKE_CURRENT_BINARY_DIR}/lib2.h) diff --git a/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h b/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h new file mode 100644 index 0000000..fa24a9a --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + extern void lib2(void); diff --git a/Tests/RunCMake/XcodeProject/BundleLinkBundle.cmake b/Tests/RunCMake/XcodeProject/BundleLinkBundle.cmake new file mode 100644 index 0000000..1f3c19d --- /dev/null +++ b/Tests/RunCMake/XcodeProject/BundleLinkBundle.cmake @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.23) + +project(BundleLinkBundle CXX) + +add_subdirectory(lib_bundle) + +add_executable(MainBundle MACOSX_BUNDLE main_bundle.cpp) + +target_link_libraries(MainBundle PRIVATE LibBundle) + +set_target_properties(MainBundle PROPERTIES + MACOSX_BUNDLE "YES" + XCODE_LINK_BUILD_PHASE_MODE BUILT_ONLY +) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 80c6b73..d20f5a6 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -151,6 +151,16 @@ endfunction() XcodeXCConfig() +function(BundleLinkBundle) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BundleLinkBundle-build) + run_cmake(BundleLinkBundle) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(BundleLinkBundle-build ${CMAKE_COMMAND} --build .) +endfunction() + +BundleLinkBundle() + + # Isolate device tests from host architecture selection. unset(ENV{CMAKE_OSX_ARCHITECTURES}) diff --git a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake index 71b7d8f..bec8790 100644 --- a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake +++ b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake @@ -12,6 +12,8 @@ set(found_target_library_FRAMEWORK_SEARCH_PATHS 0) set(found_inherited_FRAMEWORK_SEARCH_PATHS 0) set(found_project_LIBRARY_SEARCH_PATHS 0) set(found_target_library_LIBRARY_SEARCH_PATHS 0) +set(found_target_cmp0142old_LIBRARY_SEARCH_PATHS 0) +set(found_target_cmp0142new_LIBRARY_SEARCH_PATHS 0) set(found_inherited_LIBRARY_SEARCH_PATHS 0) file(STRINGS "${xcProjectFile}" lines) foreach(line IN LISTS lines) @@ -42,6 +44,12 @@ foreach(line IN LISTS lines) if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib/\$\(CONFIGURATION\)\$\(EFFECTIVE_PLATFORM_NAME\)(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib(\\")?","\$\(inherited\)"\);]]) set(found_target_library_LIBRARY_SEARCH_PATHS 1) endif() + if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142OLD/\$\(CONFIGURATION\)\$\(EFFECTIVE_PLATFORM_NAME\)(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142OLD(\\")?","\$\(inherited\)"\);]]) + set(found_target_cmp0142old_LIBRARY_SEARCH_PATHS 1) + endif() + if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142NEW(\\")?","\$\(inherited\)"\);]]) + set(found_target_cmp0142new_LIBRARY_SEARCH_PATHS 1) + endif() if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("\$\(inherited\)"\);]]) set(found_inherited_LIBRARY_SEARCH_PATHS 1) endif() @@ -68,6 +76,12 @@ endif() if(NOT found_target_library_LIBRARY_SEARCH_PATHS) string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'library' in\n ${xcProjectFile}\n") endif() +if(NOT found_target_cmp0142old_LIBRARY_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'cmp0142old' in\n ${xcProjectFile}\n") +endif() +if(NOT found_target_cmp0142new_LIBRARY_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'cmp0142new' in\n ${xcProjectFile}\n") +endif() if(found_inherited_LIBRARY_SEARCH_PATHS) string(APPEND RunCMake_TEST_FAILED "Found unexpected LIBRARY_SEARCH_PATHS inherited-only value in\n ${xcProjectFile}\n") endif() diff --git a/Tests/RunCMake/XcodeProject/SearchPaths.cmake b/Tests/RunCMake/XcodeProject/SearchPaths.cmake index ef97709..b469772 100644 --- a/Tests/RunCMake/XcodeProject/SearchPaths.cmake +++ b/Tests/RunCMake/XcodeProject/SearchPaths.cmake @@ -3,6 +3,8 @@ enable_language(C) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathInc/TargetInc.framework") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib/TargetLib.framework") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142OLD") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142NEW") set(CMAKE_XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath") set(CMAKE_XCODE_ATTRIBUTE_LIBRARY_SEARCH_PATHS "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath") @@ -19,3 +21,11 @@ target_include_directories(include PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSe add_executable(library main.c) target_link_libraries(library PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib/TargetLib.framework") target_link_directories(library PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib") + +cmake_policy(SET CMP0142 OLD) +add_executable(cmp0142old main.c) +target_link_directories(cmp0142old PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142OLD") + +cmake_policy(SET CMP0142 NEW) +add_executable(cmp0142new main.c) +target_link_directories(cmp0142new PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142NEW") diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake index efd70cf..6bad527 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake @@ -29,6 +29,8 @@ check_property("UNDEFINED_BEHAVIOUR_SANITIZER" "enableUBSanitizer") check_property("UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "stopOnEveryUBSanitizerIssue") check_property("DISABLE_MAIN_THREAD_CHECKER" "disableMainThreadChecker") check_property("MAIN_THREAD_CHECKER_STOP" "stopOnEveryMainThreadCheckerIssue") +check_property("DISABLE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION" "enableGPUValidationMode") +check_property("ENABLE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION" "enableGPUShaderValidationMode") check_property("MALLOC_SCRIBBLE" "MallocScribble") check_property("MALLOC_GUARD_EDGES" "MallocGuardEdges") diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake index 5edbc89..267e379 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake @@ -32,6 +32,8 @@ function(create_scheme_for_property scheme property value) set_target_properties(${scheme} PROPERTIES XCODE_SCHEME_${property} "${value}") endfunction() +create_scheme_for_property(DISABLE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION ENABLE_GPU_API_VALIDATION OFF) +create_scheme_for_property(ENABLE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION ENABLE_GPU_SHADER_VALIDATION ON) create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_1 ENABLE_GPU_FRAME_CAPTURE_MODE 1) create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_3 ENABLE_GPU_FRAME_CAPTURE_MODE 3) create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED ENABLE_GPU_FRAME_CAPTURE_MODE Disabled) diff --git a/Tests/RunCMake/XcodeProject/lib_bundle/CMakeLIsts.txt b/Tests/RunCMake/XcodeProject/lib_bundle/CMakeLIsts.txt new file mode 100644 index 0000000..7a50ce8 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/lib_bundle/CMakeLIsts.txt @@ -0,0 +1,5 @@ + +add_library(LibBundle lib_bundle.cpp) + +set_target_properties(LibBundle PROPERTIES + MACOSX_BUNDLE YES) diff --git a/Tests/RunCMake/XcodeProject/lib_bundle/lib_bundle.cpp b/Tests/RunCMake/XcodeProject/lib_bundle/lib_bundle.cpp new file mode 100644 index 0000000..9f74584 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/lib_bundle/lib_bundle.cpp @@ -0,0 +1,6 @@ +#include <iostream> + +void foo() +{ + std::cout << "foobar" << std::endl; +} diff --git a/Tests/RunCMake/XcodeProject/main_bundle.cpp b/Tests/RunCMake/XcodeProject/main_bundle.cpp new file mode 100644 index 0000000..11834ac --- /dev/null +++ b/Tests/RunCMake/XcodeProject/main_bundle.cpp @@ -0,0 +1,9 @@ + +extern void foo(); + +int main() +{ + + foo(); + return 0; +} diff --git a/Tests/RunCMake/block/CMakeLists.txt b/Tests/RunCMake/block/CMakeLists.txt new file mode 100644 index 0000000..45cd10e --- /dev/null +++ b/Tests/RunCMake/block/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3...3.25) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/block/EndAlone-result.txt b/Tests/RunCMake/block/EndAlone-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/EndAlone-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/EndAlone-stderr.txt b/Tests/RunCMake/block/EndAlone-stderr.txt new file mode 100644 index 0000000..a588dd7 --- /dev/null +++ b/Tests/RunCMake/block/EndAlone-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at EndAlone.cmake:[0-9]+ \(endblock\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/EndAlone.cmake b/Tests/RunCMake/block/EndAlone.cmake new file mode 100644 index 0000000..0c428a9 --- /dev/null +++ b/Tests/RunCMake/block/EndAlone.cmake @@ -0,0 +1 @@ +endblock() diff --git a/Tests/RunCMake/block/EndAloneWithArgument-result.txt b/Tests/RunCMake/block/EndAloneWithArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/EndAloneWithArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/EndAloneWithArgument-stderr.txt b/Tests/RunCMake/block/EndAloneWithArgument-stderr.txt new file mode 100644 index 0000000..c3d25a3 --- /dev/null +++ b/Tests/RunCMake/block/EndAloneWithArgument-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at EndAloneWithArgument.cmake:[0-9]+ \(endblock\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/EndAloneWithArgument.cmake b/Tests/RunCMake/block/EndAloneWithArgument.cmake new file mode 100644 index 0000000..05df5b0 --- /dev/null +++ b/Tests/RunCMake/block/EndAloneWithArgument.cmake @@ -0,0 +1 @@ +endblock(WRONG_ARG) diff --git a/Tests/RunCMake/block/EndMissing-result.txt b/Tests/RunCMake/block/EndMissing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/EndMissing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/EndMissing-stderr.txt b/Tests/RunCMake/block/EndMissing-stderr.txt new file mode 100644 index 0000000..b9739a5 --- /dev/null +++ b/Tests/RunCMake/block/EndMissing-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at EndMissing.cmake:[0-9]+ \(block\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/EndMissing.cmake b/Tests/RunCMake/block/EndMissing.cmake new file mode 100644 index 0000000..335b64e --- /dev/null +++ b/Tests/RunCMake/block/EndMissing.cmake @@ -0,0 +1 @@ +block() diff --git a/Tests/RunCMake/block/EndWithArgument-stderr.txt b/Tests/RunCMake/block/EndWithArgument-stderr.txt new file mode 100644 index 0000000..7586453 --- /dev/null +++ b/Tests/RunCMake/block/EndWithArgument-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) in EndWithArgument.cmake: + A logical block closing on the line + + .+/Tests/RunCMake/block/EndWithArgument.cmake:[0-9]+ \(endblock\) + + has unexpected arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/block/EndWithArgument.cmake b/Tests/RunCMake/block/EndWithArgument.cmake new file mode 100644 index 0000000..0641c9a --- /dev/null +++ b/Tests/RunCMake/block/EndWithArgument.cmake @@ -0,0 +1,2 @@ +block() +endblock(END_ARG) diff --git a/Tests/RunCMake/block/InvalidArgument-result.txt b/Tests/RunCMake/block/InvalidArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidArgument-stderr.txt b/Tests/RunCMake/block/InvalidArgument-stderr.txt new file mode 100644 index 0000000..bee604b --- /dev/null +++ b/Tests/RunCMake/block/InvalidArgument-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidArgument.cmake:[0-9]+ \(block\): + block PROPAGATE cannot be specified without a new scope for VARIABLES +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidArgument.cmake b/Tests/RunCMake/block/InvalidArgument.cmake new file mode 100644 index 0000000..5269cd0 --- /dev/null +++ b/Tests/RunCMake/block/InvalidArgument.cmake @@ -0,0 +1,2 @@ +block(SCOPE_FOR POLICIES PROPAGATE VAR1) +endblock() diff --git a/Tests/RunCMake/block/InvalidNesting1-result.txt b/Tests/RunCMake/block/InvalidNesting1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting1-stderr.txt b/Tests/RunCMake/block/InvalidNesting1-stderr.txt new file mode 100644 index 0000000..6dfe0e1 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting1-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting1.cmake:[0-9]+ \(else\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting1.cmake b/Tests/RunCMake/block/InvalidNesting1.cmake new file mode 100644 index 0000000..27b7944 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting1.cmake @@ -0,0 +1,6 @@ + +if (TRUE) + block() +else() + endblock() +endif() diff --git a/Tests/RunCMake/block/InvalidNesting2-result.txt b/Tests/RunCMake/block/InvalidNesting2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting2-stderr.txt b/Tests/RunCMake/block/InvalidNesting2-stderr.txt new file mode 100644 index 0000000..71325b6 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting2-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting2.cmake:[0-9]+ \(endblock\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting2.cmake b/Tests/RunCMake/block/InvalidNesting2.cmake new file mode 100644 index 0000000..ae94cdc --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting2.cmake @@ -0,0 +1,6 @@ + +block() +if (TRUE) +elseif(FALSE) +endblock() +endif() diff --git a/Tests/RunCMake/block/InvalidNesting3-result.txt b/Tests/RunCMake/block/InvalidNesting3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting3-stderr.txt b/Tests/RunCMake/block/InvalidNesting3-stderr.txt new file mode 100644 index 0000000..344a931 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting3-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting3.cmake:[0-9]+ \(endwhile\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting3.cmake b/Tests/RunCMake/block/InvalidNesting3.cmake new file mode 100644 index 0000000..f692d24 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting3.cmake @@ -0,0 +1,5 @@ + +while(TRUE) +block() +endwhile() +endblock() diff --git a/Tests/RunCMake/block/InvalidNesting4-result.txt b/Tests/RunCMake/block/InvalidNesting4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting4-stderr.txt b/Tests/RunCMake/block/InvalidNesting4-stderr.txt new file mode 100644 index 0000000..44d6364 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting4-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting4.cmake:[0-9]+ \(endblock\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting4.cmake b/Tests/RunCMake/block/InvalidNesting4.cmake new file mode 100644 index 0000000..6e8e0ae --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting4.cmake @@ -0,0 +1,5 @@ + +block() +foreach(item IN ITEMS A B) +endblock() +endforeach() diff --git a/Tests/RunCMake/block/InvalidNesting5-result.txt b/Tests/RunCMake/block/InvalidNesting5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting5-stderr.txt b/Tests/RunCMake/block/InvalidNesting5-stderr.txt new file mode 100644 index 0000000..976d2e1 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting5-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting5.cmake:[0-9]+ \(endfunction\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting5.cmake b/Tests/RunCMake/block/InvalidNesting5.cmake new file mode 100644 index 0000000..0479e8d --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting5.cmake @@ -0,0 +1,5 @@ + +function(FUNC) + block() +endfunction() +endblock() diff --git a/Tests/RunCMake/block/InvalidNesting6-result.txt b/Tests/RunCMake/block/InvalidNesting6-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/InvalidNesting6-stderr.txt b/Tests/RunCMake/block/InvalidNesting6-stderr.txt new file mode 100644 index 0000000..2d67b16 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting6-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at InvalidNesting6.cmake:[0-9]+ \(endblock\): + Flow control statements are not properly nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/InvalidNesting6.cmake b/Tests/RunCMake/block/InvalidNesting6.cmake new file mode 100644 index 0000000..a1cb359 --- /dev/null +++ b/Tests/RunCMake/block/InvalidNesting6.cmake @@ -0,0 +1,5 @@ + + block() +macro(FUNC) +endblock() +endmacro() diff --git a/Tests/RunCMake/block/MissingArgument-result.txt b/Tests/RunCMake/block/MissingArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/MissingArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/MissingArgument-stderr.txt b/Tests/RunCMake/block/MissingArgument-stderr.txt new file mode 100644 index 0000000..d3e63ca --- /dev/null +++ b/Tests/RunCMake/block/MissingArgument-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at MissingArgument.cmake:[0-9]+ \(block\): + Error after keyword "SCOPE_FOR": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/MissingArgument.cmake b/Tests/RunCMake/block/MissingArgument.cmake new file mode 100644 index 0000000..6018887 --- /dev/null +++ b/Tests/RunCMake/block/MissingArgument.cmake @@ -0,0 +1,2 @@ +block(SCOPE_FOR) +endblock() diff --git a/Tests/RunCMake/block/RunCMakeTest.cmake b/Tests/RunCMake/block/RunCMakeTest.cmake new file mode 100644 index 0000000..4260e76 --- /dev/null +++ b/Tests/RunCMake/block/RunCMakeTest.cmake @@ -0,0 +1,22 @@ +include(RunCMake) + +run_cmake(WrongArgument) +run_cmake(InvalidArgument) +run_cmake(MissingArgument) +run_cmake(WrongScope) +run_cmake(EndMissing) +run_cmake(EndWithArgument) +run_cmake(EndAlone) +run_cmake(EndAloneWithArgument) + +run_cmake(InvalidNesting1) +run_cmake(InvalidNesting2) +run_cmake(InvalidNesting3) +run_cmake(InvalidNesting4) +run_cmake(InvalidNesting5) +run_cmake(InvalidNesting6) + +run_cmake(Scope) +run_cmake(Scope-VARIABLES) +run_cmake(Scope-POLICIES) +run_cmake(Workflows) diff --git a/Tests/RunCMake/block/Scope-POLICIES.cmake b/Tests/RunCMake/block/Scope-POLICIES.cmake new file mode 100644 index 0000000..789b3d9 --- /dev/null +++ b/Tests/RunCMake/block/Scope-POLICIES.cmake @@ -0,0 +1,30 @@ + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") + +cmake_policy(SET CMP0139 NEW) + +# create a block with a new scope for policies +block(SCOPE_FOR POLICIES) + set(VAR1 "INNER1") + unset(VAR2) + set(VAR3 "INNER3") + + cmake_policy(SET CMP0139 OLD) +endblock() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "INNER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(DEFINED VAR2) + message(SEND_ERROR "block/endblock: VAR2 is unexpectedly defined: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() + +cmake_policy(GET CMP0139 CMP0139_STATUS) +if(NOT CMP0139_STATUS STREQUAL "NEW") + message(SEND_ERROR "block/endblock: CMP0139 has unexpected value: ${CMP0139_STATUS}") +endif() diff --git a/Tests/RunCMake/block/Scope-VARIABLES.cmake b/Tests/RunCMake/block/Scope-VARIABLES.cmake new file mode 100644 index 0000000..140e638 --- /dev/null +++ b/Tests/RunCMake/block/Scope-VARIABLES.cmake @@ -0,0 +1,52 @@ + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") +set(VAR3 "OUTER3") +set(VAR4 "OUTER4") +set(VAR5 "OUTER5") + +set(VAR6 "CACHE6" CACHE STRING "") +set(VAR6 "OUTER6") + +cmake_policy(SET CMP0139 NEW) + +# create a block with a new scope for variables +block(SCOPE_FOR VARIABLES PROPAGATE VAR3 VAR4 VAR5 VAR6 VAR7) + set(VAR1 "INNER1") + set(VAR2 "INNER2" PARENT_SCOPE) + set(VAR3 "INNER3") + unset(VAR4) + unset(VAR6) + set(VAR7 "INNER7") + + cmake_policy(SET CMP0139 OLD) +endblock() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2") + message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() +if(DEFINED VAR4) + message(SEND_ERROR "block/endblock: VAR4 is unexpectedly defined: ${VAR4}") +endif() +if(NOT DEFINED VAR5 OR NOT VAR5 STREQUAL "OUTER5") + message(SEND_ERROR "block/endblock: VAR5 has unexpected value: ${VAR5}") +endif() +unset(VAR6 CACHE) +if (DEFINED VAR6) + message(SEND_ERROR "block/endblock: VAR6 is unexpectedly defined: ${VAR6}") +endif() +if(NOT DEFINED VAR7 OR NOT VAR7 STREQUAL "INNER7") + message(SEND_ERROR "block/endblock: VAR7 has unexpected value: ${VAR7}") +endif() + +cmake_policy(GET CMP0139 CMP0139_STATUS) +if(NOT CMP0139_STATUS STREQUAL "OLD") + message(SEND_ERROR "block/endblock: CMP0139 has unexpected value: ${CMP0139_STATUS}") +endif() diff --git a/Tests/RunCMake/block/Scope.cmake b/Tests/RunCMake/block/Scope.cmake new file mode 100644 index 0000000..e1af50a --- /dev/null +++ b/Tests/RunCMake/block/Scope.cmake @@ -0,0 +1,52 @@ + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") +set(VAR3 "OUTER3") +set(VAR4 "OUTER4") +set(VAR5 "OUTER5") + +set(VAR6 "CACHE6" CACHE STRING "") +set(VAR6 "OUTER6") + +cmake_policy(SET CMP0139 NEW) + +# create a block with a new scope for variables and policies +block(PROPAGATE VAR3 VAR4 VAR5 VAR6 VAR7) + set(VAR1 "INNER1") + set(VAR2 "INNER2" PARENT_SCOPE) + set(VAR3 "INNER3") + unset(VAR4) + unset(VAR6) + set(VAR7 "INNER7") + + cmake_policy(SET CMP0139 OLD) +endblock() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2") + message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() +if(DEFINED VAR4) + message(SEND_ERROR "block/endblock: VAR4 is unexpectedly defined: ${VAR4}") +endif() +if(NOT DEFINED VAR5 OR NOT VAR5 STREQUAL "OUTER5") + message(SEND_ERROR "block/endblock: VAR5 has unexpected value: ${VAR5}") +endif() +unset(VAR6 CACHE) +if (DEFINED VAR6) + message(SEND_ERROR "block/endblock: VAR6 is unexpectedly defined: ${VAR6}") +endif() +if(NOT DEFINED VAR7 OR NOT VAR7 STREQUAL "INNER7") + message(SEND_ERROR "block/endblock: VAR6 has unexpected value: ${VAR7}") +endif() + +cmake_policy(GET CMP0139 CMP0139_STATUS) +if(NOT CMP0139_STATUS STREQUAL "NEW") + message(SEND_ERROR "block/endblock: CMP0139 has unexpected value: ${CMP0139_STATUS}") +endif() diff --git a/Tests/RunCMake/block/Workflows.cmake b/Tests/RunCMake/block/Workflows.cmake new file mode 100644 index 0000000..cbf032e --- /dev/null +++ b/Tests/RunCMake/block/Workflows.cmake @@ -0,0 +1,78 @@ + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") +set(VAR3 "OUTER3") + +while (TRUE) + # create a block with a new scope for variables + block(SCOPE_FOR VARIABLES PROPAGATE VAR3) + set(VAR2 "INNER2" PARENT_SCOPE) + set(VAR3 "INNER3") + break() + endblock() +endwhile() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2") + message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() + + + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") +set(VAR3 "OUTER3") + +function (OUTER) + # create a block with a new scope for variables + block(SCOPE_FOR VARIABLES PROPAGATE VAR3) + set(VAR2 "INNER2" PARENT_SCOPE) + set(VAR3 "INNER3") + return() + endblock() + set(VAR1 "INNER1" PARENT_SCOPE) +endfunction() +outer() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "OUTER2") + message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "OUTER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() + + + +set(VAR1 "OUTER1") +set(VAR2 "OUTER2") +set(VAR3 "OUTER3") + +foreach (id IN ITEMS 1 2 3) + # create a block with a new scope for variables + block(SCOPE_FOR VARIABLES PROPAGATE VAR${id}) + set(VAR${id} "INNER${id}") + continue() + set(VAR${id} "BAD${id}") + endblock() +endforeach() + +# check final values for variables +if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "INNER1") + message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}") +endif() +if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2") + message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}") +endif() +if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3") + message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}") +endif() diff --git a/Tests/RunCMake/block/WrongArgument-result.txt b/Tests/RunCMake/block/WrongArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/WrongArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/WrongArgument-stderr.txt b/Tests/RunCMake/block/WrongArgument-stderr.txt new file mode 100644 index 0000000..56faea7 --- /dev/null +++ b/Tests/RunCMake/block/WrongArgument-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at WrongArgument.cmake:[0-9]+ \(block\): + block called with unsupported argument "WRONG_ARG" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/WrongArgument.cmake b/Tests/RunCMake/block/WrongArgument.cmake new file mode 100644 index 0000000..e460866 --- /dev/null +++ b/Tests/RunCMake/block/WrongArgument.cmake @@ -0,0 +1,2 @@ +block(WRONG_ARG) +endblock() diff --git a/Tests/RunCMake/block/WrongScope-result.txt b/Tests/RunCMake/block/WrongScope-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/block/WrongScope-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/block/WrongScope-stderr.txt b/Tests/RunCMake/block/WrongScope-stderr.txt new file mode 100644 index 0000000..dd2a1ef --- /dev/null +++ b/Tests/RunCMake/block/WrongScope-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at WrongScope.cmake:[0-9]+ \(block\): + block SCOPE_FOR unsupported scope "WRONG_SCOPE" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/block/WrongScope.cmake b/Tests/RunCMake/block/WrongScope.cmake new file mode 100644 index 0000000..97a6783 --- /dev/null +++ b/Tests/RunCMake/block/WrongScope.cmake @@ -0,0 +1,2 @@ +block(SCOPE_FOR WRONG_SCOPE) +endblock() diff --git a/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt b/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt index 6a430f1..ea1566d 100644 --- a/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt +++ b/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt @@ -1,5 +1,7 @@ CMake Error at Registry_BadQuery2.cmake:[0-9]+ \(cmake_host_system_information\): - cmake_host_system_information missing expected value for argument\(s\) - "VALUE". + Error after keyword "VALUE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt b/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt index 5eda4ff..f8c96d8 100644 --- a/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt +++ b/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt @@ -1,5 +1,7 @@ CMake Error at Registry_BadView1.cmake:[0-9]+ \(cmake_host_system_information\): - cmake_host_system_information missing expected value for argument\(s\) - "VIEW". + Error after keyword "VIEW": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake index 6480b2e..38ce10b 100644 --- a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake @@ -8,6 +8,7 @@ foreach(command IN ITEMS "if" "elseif" "else" "endif" "while" "endwhile" "foreach" "endforeach" + "block" "endblock" ) message(STATUS "Running call_invalid_command for ${command}...") run_cmake_with_options(call_invalid_command -Dcommand=${command}) @@ -42,6 +43,7 @@ foreach(command IN ITEMS "if" "elseif" "else" "endif" "while" "endwhile" "foreach" "endforeach" + "block" "endblock" "return" ) message(STATUS "Running defer_call_invalid_command for ${command}...") @@ -82,3 +84,61 @@ run_cmake(defer_get_call_id_var) run_cmake(defer_missing_arg) run_cmake(defer_missing_call) run_cmake(defer_unknown_option) + +# Default log level +run_cmake_command( + get_message_log_level_none + ${CMAKE_COMMAND} + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from cache +run_cmake_command( + get_message_log_level_cache + ${CMAKE_COMMAND} + -DCMAKE_MESSAGE_LOG_LEVEL=TRACE + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from regular variable +run_cmake_command( + get_message_log_level_var + ${CMAKE_COMMAND} + -DNEW_LOG_LEVEL=TRACE + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from command line +run_cmake_command( + get_message_log_level_cli + ${CMAKE_COMMAND} + --log-level=DEBUG + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from command line, it has higher priority over a cache variable +run_cmake_command( + get_message_log_level_cli_and_cache + ${CMAKE_COMMAND} + --log-level=DEBUG + -DCMAKE_MESSAGE_LOG_LEVEL=TRACE + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from command line, it has higher priority over a regular variable +run_cmake_command( + get_message_log_level_cli_and_var + ${CMAKE_COMMAND} + --log-level=DEBUG + -DNEW_LOG_LEVEL=TRACE + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) + +# Log level from variable, it has higher priority over a cache variable +run_cmake_command( + get_message_log_level_var_and_cache + ${CMAKE_COMMAND} + -DNEW_LOG_LEVEL=DEBUG + -DCMAKE_MESSAGE_LOG_LEVEL=TRACE + -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake + ) diff --git a/Tests/RunCMake/cmake_language/get_message_log_level.cmake b/Tests/RunCMake/cmake_language/get_message_log_level.cmake new file mode 100644 index 0000000..1740c1f --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level.cmake @@ -0,0 +1,5 @@ +if(NEW_LOG_LEVEL) + set(CMAKE_MESSAGE_LOG_LEVEL "${NEW_LOG_LEVEL}") +endif() +cmake_language(GET_MESSAGE_LOG_LEVEL log_level) +message(STATUS "log level is: ${log_level}") diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cache-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cache-stdout.txt new file mode 100644 index 0000000..cf1cd7b --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_cache-stdout.txt @@ -0,0 +1 @@ +log level is: TRACE diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cli-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cli-stdout.txt new file mode 100644 index 0000000..4d6e1eb --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_cli-stdout.txt @@ -0,0 +1 @@ +log level is: DEBUG diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_cache-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_cache-stdout.txt new file mode 100644 index 0000000..4d6e1eb --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_cache-stdout.txt @@ -0,0 +1 @@ +log level is: DEBUG diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_var-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_var-stdout.txt new file mode 100644 index 0000000..4d6e1eb --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_var-stdout.txt @@ -0,0 +1 @@ +log level is: DEBUG diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_none-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_none-stdout.txt new file mode 100644 index 0000000..92ffd34 --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_none-stdout.txt @@ -0,0 +1 @@ +log level is: STATUS diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_var-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_var-stdout.txt new file mode 100644 index 0000000..cf1cd7b --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_var-stdout.txt @@ -0,0 +1 @@ +log level is: TRACE diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_var_and_cache-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_var_and_cache-stdout.txt new file mode 100644 index 0000000..4d6e1eb --- /dev/null +++ b/Tests/RunCMake/cmake_language/get_message_log_level_var_and_cache-stdout.txt @@ -0,0 +1 @@ +log level is: DEBUG diff --git a/Tests/RunCMake/cmake_path/BASE_DIRECTORY-no-arg-stderr.txt b/Tests/RunCMake/cmake_path/BASE_DIRECTORY-no-arg-stderr.txt new file mode 100644 index 0000000..ad7d134 --- /dev/null +++ b/Tests/RunCMake/cmake_path/BASE_DIRECTORY-no-arg-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + Error after keyword "BASE_DIRECTORY": + + missing required value diff --git a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-empty-stderr.txt b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-empty-stderr.txt new file mode 100644 index 0000000..f1b52cc --- /dev/null +++ b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-empty-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at .+/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + Error after keyword "OUTPUT_VARIABLE": + + empty string not allowed diff --git a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt index e1d6592..63289ef 100644 --- a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt +++ b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt @@ -1,2 +1,4 @@ CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): - cmake_path OUTPUT_VARIABLE requires an argument. + Error after keyword "OUTPUT_VARIABLE": + + missing required value diff --git a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake index 991f46b..1742b06 100644 --- a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake @@ -74,6 +74,14 @@ foreach (command IN ITEMS APPEND APPEND_STRING REMOVE_FILENAME REPLACE_FILENAME endforeach() +## BASE_DIRECTORY without argument +set (RunCMake-stderr-file "BASE_DIRECTORY-no-arg-stderr.txt") + +foreach (command IN ITEMS RELATIVE_PATH ABSOLUTE_PATH) + run_cmake_command (${command}-OUTPUT_VARIABLE-no-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path BASE_DIRECTORY" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + + ## Invalid output variable set (RunCMake-stderr-file "invalid-output-var-stderr.txt") @@ -106,6 +114,9 @@ foreach (command IN ITEMS NATIVE_PATH run_cmake_command (${command}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") endforeach() +# OUTPUT_VARIABLE empty name +set (RunCMake-stderr-file "OUTPUT_VARIABLE-empty-stderr.txt") + foreach (command IN ITEMS APPEND APPEND_STRING REMOVE_FILENAME REPLACE_FILENAME REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH RELATIVE_PATH ABSOLUTE_PATH) diff --git a/Tests/RunCMake/ctest_build/CMakeLists.txt.in b/Tests/RunCMake/ctest_build/CMakeLists.txt.in index 133ae36..4a067fa 100644 --- a/Tests/RunCMake/ctest_build/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_build/CMakeLists.txt.in @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1) @CASE_CMAKELISTS_PREFIX_CODE@ -project(CTestBuild@CASE_NAME@ NONE) +project(CTestBuild@CASE_NAME@ @LANG@) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) @CASE_CMAKELISTS_SUFFIX_CODE@ diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake new file mode 100644 index 0000000..7089d70 --- /dev/null +++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake @@ -0,0 +1,23 @@ +file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml") +if(build_xml_file) + file(READ "${build_xml_file}" build_xml LIMIT 8192) + string(FIND "${build_xml}" [[This should not be compiled]] expected_failure_pos) + if(expected_failure_pos EQUAL "-1") + string(REPLACE "\n" "\n " build_xml " ${build_xml}") + set(RunCMake_TEST_FAILED + "Build.xml does not have expected error message:\n${build_xml}" + ) + else() + string(SUBSTRING "${build_xml}" "${expected_failure_pos}" -1 remaining_xml) + string(FIND "${remaining_xml}" [[<Failure type="Error">]] unexpected_failure_pos) + if(NOT unexpected_failure_pos EQUAL "-1") + string(SUBSTRING "${remaining_xml}" "${unexpected_failure_pos}" -1 error_msg_xml) + string(REPLACE "\n" "\n " error_msg_xml " ${error_msg_xml}") + set(RunCMake_TEST_FAILED + "Build.xml contains unexpected extra <Failure> elements:\n${error_msg_xml}" + ) + endif() + endif() +else() + set(RunCMake_TEST_FAILED "Build.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt new file mode 100644 index 0000000..bbe9410 --- /dev/null +++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt @@ -0,0 +1 @@ +^Error\(s\) when building project diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index e94a55d..6f1b4b6 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCTest) +set(LANG NONE) set(CASE_CTEST_BUILD_ARGS "") set(RunCMake_USE_LAUNCHERS TRUE) set(RunCMake_USE_CUSTOM_BUILD_COMMAND FALSE) @@ -70,3 +71,18 @@ set(RunCMake_USE_LAUNCHERS FALSE) set(RunCMake_BUILD_COMMAND "${COLOR_WARNING}") run_ctest(IgnoreColor) unset(RunCMake_BUILD_COMMAND) + +set(RunCMake_USE_CUSTOM_BUILD_COMMAND FALSE) +if(RunCMake_GENERATOR MATCHES "Ninja") + function(run_NinjaLauncherSingleBuildFailure) + set(LANG C) + set(RunCMake_USE_LAUNCHERS TRUE) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/NinjaLauncherSingleBuildFailure") + configure_file("${RunCMake_SOURCE_DIR}/error.c" "${RunCMake_TEST_SOURCE_DIR}/error.c" COPYONLY) + set(CASE_CMAKELISTS_SUFFIX_CODE [=[ + add_executable(error error.c) + ]=]) + run_ctest(NinjaLauncherSingleBuildFailure) + endfunction() + run_NinjaLauncherSingleBuildFailure() +endif() diff --git a/Tests/RunCMake/ctest_build/error.c b/Tests/RunCMake/ctest_build/error.c new file mode 100644 index 0000000..f10e687 --- /dev/null +++ b/Tests/RunCMake/ctest_build/error.c @@ -0,0 +1 @@ +#error "This should not be compiled" diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-result.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-stdout.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-stdout.txt new file mode 100644 index 0000000..a7eae05 --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-stdout.txt @@ -0,0 +1 @@ +CTEST_TEST_VAR=set-via-ENVIRONMENT-property diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop.cmake b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop.cmake new file mode 100644 index 0000000..51e7f2a --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop.cmake @@ -0,0 +1,9 @@ +include(CTest) + +add_test(NAME cmake_environment COMMAND "${CMAKE_COMMAND}" -E environment) +set_tests_properties( + cmake_environment + PROPERTIES + ENVIRONMENT "CTEST_TEST_VAR=set-via-ENVIRONMENT-property" + ENVIRONMENT_MODIFICATION "CTEST_TEST_VAR=set:set-via-ENVIRONMENT_MODIFICATION;CTEST_TEST_VAR=reset:" +) diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-result.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-stdout.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-stdout.txt new file mode 100644 index 0000000..beaf133 --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-stdout.txt @@ -0,0 +1 @@ +CTEST_TEST_VAR=set-via-system-environment diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system.cmake b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system.cmake new file mode 100644 index 0000000..23268aa --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system.cmake @@ -0,0 +1,9 @@ +include(CTest) + +add_test(NAME cmake_environment COMMAND "${CMAKE_COMMAND}" -E environment) +set_tests_properties( + cmake_environment + PROPERTIES + # ENVIRONMENT "CTEST_TEST_VAR=set-via-ENVIRONMENT-property" + ENVIRONMENT_MODIFICATION "CTEST_TEST_VAR=set:set-via-ENVIRONMENT_MODIFICATION;CTEST_TEST_VAR=reset:" +) diff --git a/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake b/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake index 3447779..365c9e8 100644 --- a/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake @@ -10,3 +10,7 @@ set(RunCTest_VERBOSE_FLAG "-VV") run_ctest(ENVIRONMENT_MODIFICATION-invalid-op) run_ctest(ENVIRONMENT_MODIFICATION-no-colon) run_ctest(ENVIRONMENT_MODIFICATION-no-equals) + +set(ENV{CTEST_TEST_VAR} set-via-system-environment) +run_ctest(ENVIRONMENT_MODIFICATION-reset-to-prop) +run_ctest(ENVIRONMENT_MODIFICATION-reset-to-system) diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index b41c271..74ae99c 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -84,18 +84,18 @@ run_TestOutputSize() function(run_TestOutputTruncation mode expected) set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion) set(TRUNCATED_OUTPUT ${expected}) # used in TestOutputTruncation-check.cmake - set(CASE_TEST_PREFIX_CODE [[ -set( CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION${mode}) - ]]) - set(CASE_CMAKELISTS_SUFFIX_CODE [[ -add_test(NAME Truncation_${mode} COMMAND ${CMAKE_COMMAND} -E echo 123456789) - ]]) + string(CONCAT CASE_TEST_PREFIX_CODE " +set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 5) +set(CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION ${mode})" ) + set(CASE_CMAKELISTS_SUFFIX_CODE " +add_test(NAME Truncation_${mode} COMMAND \${CMAKE_COMMAND} -E echo 123456789)") - run_ctest(TestOutputTruncation) + run_ctest(TestOutputTruncation_${mode}) endfunction() -run_TestOutputTruncation("head" "...6789") -run_TestOutputTruncation("middle" "12....*...89") -run_TestOutputTruncation("tail" "12345...") +run_TestOutputTruncation("head" "\\.\\.\\.6789") +run_TestOutputTruncation("middle" "12\\.\\.\\..*\\.\\.\\.89") +run_TestOutputTruncation("tail" "12345\\.\\.\\.") +run_TestOutputTruncation("bad" "") run_ctest_test(TestRepeatBad1 REPEAT UNKNOWN:3) run_ctest_test(TestRepeatBad2 REPEAT UNTIL_FAIL:-1) diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-check.cmake new file mode 100644 index 0000000..4315074f --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-check.cmake @@ -0,0 +1,4 @@ +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + set(RunCMake_TEST_FAILED "Test.xml should not exist:\n ${test_xml_file}") +endif() diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-result.txt b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-stderr.txt b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-stderr.txt new file mode 100644 index 0000000..ef4d11b --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-stderr.txt @@ -0,0 +1 @@ +^Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: bad$ diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_head-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_head-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_head-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_middle-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_middle-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_middle-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_tail-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_tail-check.cmake new file mode 100644 index 0000000..6065c30 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_tail-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt b/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt index e27f1e6..62cad52 100644 --- a/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt +++ b/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt @@ -1,2 +1,4 @@ CMake Error at .*EchoCommand.cmake:.*\(execute_process\): - execute_process called with no value for COMMAND_ECHO. + Error after keyword "COMMAND_ECHO": + + missing required value diff --git a/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt b/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt index 1a69579..7f85654 100644 --- a/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt +++ b/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt @@ -1,4 +1,7 @@ ^CMake Error at EncodingMissing.cmake:[0-9]+ \(execute_process\): - execute_process called with no value for ENCODING. + Error after keyword "ENCODING": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 0e6020f..ee00b27 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -18,3 +18,4 @@ run_cmake(DependOnDoubleExport) run_cmake(UnknownExport) run_cmake(NamelinkOnlyExport) run_cmake(SeparateNamelinkExport) +run_cmake(TryCompileExport) diff --git a/Tests/RunCMake/export/TryCompileExport.cmake b/Tests/RunCMake/export/TryCompileExport.cmake new file mode 100644 index 0000000..5ad7c6e --- /dev/null +++ b/Tests/RunCMake/export/TryCompileExport.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +add_library(interface INTERFACE) +install(TARGETS interface EXPORT export) +export(EXPORT export) + +add_library(imported IMPORTED INTERFACE) + +try_compile(tc "${CMAKE_CURRENT_BINARY_DIR}/tc" "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" LINK_LIBRARIES imported) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt deleted file mode 100644 index b22387b..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at CHMOD-all-perms\.cmake:[0-9]+ \(file\): - file Remove either PERMISSIONS or FILE_PERMISSIONS or DIRECTORY_PERMISSIONS - from the invocation -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake deleted file mode 100644 index b49583d..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake +++ /dev/null @@ -1,6 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ - FILE_PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt deleted file mode 100644 index 8d09e35..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at CHMOD-invalid-path\.cmake:[0-9]+ \(file\): - file does not exist: - - .*/chmod-tests/I_dont_exist -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake deleted file mode 100644 index 36915c1..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake +++ /dev/null @@ -1,4 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/I_dont_exist PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt deleted file mode 100644 index 84ba2a2..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at CHMOD-invalid-perms\.cmake:[0-9]+ \(file\): - file INVALID_PERMISSION is an invalid permission specifier -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake deleted file mode 100644 index 22cab0b..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS INVALID_PERMISSION) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt deleted file mode 100644 index 2c248f8..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at CHMOD-no-keyword\.cmake:[0-9]+ \(file\): - file No permissions given -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake deleted file mode 100644 index 8b62106..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt deleted file mode 100644 index a18609f..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at CHMOD-no-perms\.cmake:[0-9]+ \(file\): - file No permissions given -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake deleted file mode 100644 index 9fbd359..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake deleted file mode 100644 index 87e3e57..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake deleted file mode 100644 index d9226b8..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake +++ /dev/null @@ -1,6 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a) -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ - FILE_PERMISSIONS OWNER_READ OWNER_WRITE) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt deleted file mode 100644 index 1c87a59..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at CHMOD-write-only\.cmake:[0-9]+ \(file\): - file failed to open for reading \(Permission denied\): - - .*/chmod-tests/a -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake deleted file mode 100644 index 1289efc..0000000 --- a/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake +++ /dev/null @@ -1,6 +0,0 @@ -file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a "CONTENT") -file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_WRITE) -file(READ ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a content) diff --git a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake index 18deb89..e6b1169 100644 --- a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake @@ -1,12 +1,14 @@ include(RunCMake) -run_cmake(CHMOD-no-perms) -run_cmake(CHMOD-no-keyword) -run_cmake(CHMOD-all-perms) -run_cmake(CHMOD-invalid-perms) -run_cmake(CHMOD-invalid-path) -run_cmake(CHMOD-ok) -run_cmake(CHMOD-override) +run_cmake_script(no-perms) +run_cmake_script(missing-perms) +run_cmake_script(missing-file-perms) +run_cmake_script(missing-dir-perms) +run_cmake_script(all-perms) +run_cmake_script(invalid-perms) +run_cmake_script(invalid-path) +run_cmake_script(ok) +run_cmake_script(override) if(UNIX) execute_process(COMMAND id -u $ENV{USER} @@ -15,5 +17,5 @@ if(UNIX) endif() if(NOT WIN32 AND NOT MSYS AND NOT "${uid}" STREQUAL "0") - run_cmake(CHMOD-write-only) + run_cmake_script(write-only) endif() diff --git a/Tests/RunCMake/file-CHMOD/all-perms-result.txt b/Tests/RunCMake/file-CHMOD/all-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/all-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/all-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/all-perms-stderr.txt new file mode 100644 index 0000000..6932a1f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/all-perms-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at [^ +]*/all-perms\.cmake:[0-9]+ \(file\): + file Remove either PERMISSIONS or FILE_PERMISSIONS or DIRECTORY_PERMISSIONS + from the invocation$ diff --git a/Tests/RunCMake/file-CHMOD/all-perms.cmake b/Tests/RunCMake/file-CHMOD/all-perms.cmake new file mode 100644 index 0000000..5ff81b8 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/all-perms.cmake @@ -0,0 +1,3 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ + FILE_PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/invalid-path-result.txt b/Tests/RunCMake/file-CHMOD/invalid-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/invalid-path-stderr.txt b/Tests/RunCMake/file-CHMOD/invalid-path-stderr.txt new file mode 100644 index 0000000..eb5fb31 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-path-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/invalid-path\.cmake:[0-9]+ \(file\): + file does not exist: + + [^ +]*/Tests/RunCMake/file-CHMOD/invalid-path-build/I_dont_exist$ diff --git a/Tests/RunCMake/file-CHMOD/invalid-path.cmake b/Tests/RunCMake/file-CHMOD/invalid-path.cmake new file mode 100644 index 0000000..e8b0313 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-path.cmake @@ -0,0 +1 @@ +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/I_dont_exist PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/invalid-perms-result.txt b/Tests/RunCMake/file-CHMOD/invalid-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/invalid-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/invalid-perms-stderr.txt new file mode 100644 index 0000000..daab22e --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-perms-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at [^ +]*/invalid-perms\.cmake:[0-9]+ \(file\): + file INVALID_PERMISSION is an invalid permission specifier$ diff --git a/Tests/RunCMake/file-CHMOD/invalid-perms.cmake b/Tests/RunCMake/file-CHMOD/invalid-perms.cmake new file mode 100644 index 0000000..42129b9 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/invalid-perms.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS INVALID_PERMISSION) diff --git a/Tests/RunCMake/file-CHMOD/missing-dir-perms-result.txt b/Tests/RunCMake/file-CHMOD/missing-dir-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-dir-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/missing-dir-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/missing-dir-perms-stderr.txt new file mode 100644 index 0000000..c05bb2d --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-dir-perms-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at [^ +]*/missing-dir-perms.cmake:[0-9]+ \(file\): + Error after keyword "DIRECTORY_PERMISSIONS": + + missing required value$ diff --git a/Tests/RunCMake/file-CHMOD/missing-dir-perms.cmake b/Tests/RunCMake/file-CHMOD/missing-dir-perms.cmake new file mode 100644 index 0000000..9d0fdad --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-dir-perms.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS) diff --git a/Tests/RunCMake/file-CHMOD/missing-file-perms-result.txt b/Tests/RunCMake/file-CHMOD/missing-file-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-file-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/missing-file-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/missing-file-perms-stderr.txt new file mode 100644 index 0000000..c3f4f0f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-file-perms-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at [^ +]*/missing-file-perms.cmake:[0-9]+ \(file\): + Error after keyword "FILE_PERMISSIONS": + + missing required value$ diff --git a/Tests/RunCMake/file-CHMOD/missing-file-perms.cmake b/Tests/RunCMake/file-CHMOD/missing-file-perms.cmake new file mode 100644 index 0000000..bcf35aa --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-file-perms.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ FILE_PERMISSIONS) diff --git a/Tests/RunCMake/file-CHMOD/missing-perms-result.txt b/Tests/RunCMake/file-CHMOD/missing-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/missing-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/missing-perms-stderr.txt new file mode 100644 index 0000000..1508b13 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-perms-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at [^ +]*/missing-perms.cmake:[0-9]+ \(file\): + Error after keyword "PERMISSIONS": + + missing required value$ diff --git a/Tests/RunCMake/file-CHMOD/missing-perms.cmake b/Tests/RunCMake/file-CHMOD/missing-perms.cmake new file mode 100644 index 0000000..da9f182 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/missing-perms.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a FILE_PERMISSIONS OWNER_READ PERMISSIONS) diff --git a/Tests/RunCMake/file-CHMOD/no-perms-result.txt b/Tests/RunCMake/file-CHMOD/no-perms-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/no-perms-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/no-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/no-perms-stderr.txt new file mode 100644 index 0000000..4c5a139 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/no-perms-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at [^ +]*/no-perms\.cmake:[0-9]+ \(file\): + file No permissions given$ diff --git a/Tests/RunCMake/file-CHMOD/no-perms.cmake b/Tests/RunCMake/file-CHMOD/no-perms.cmake new file mode 100644 index 0000000..602cfc2 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/no-perms.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a) diff --git a/Tests/RunCMake/file-CHMOD/ok.cmake b/Tests/RunCMake/file-CHMOD/ok.cmake new file mode 100644 index 0000000..7c74d27 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/ok.cmake @@ -0,0 +1,2 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ) diff --git a/Tests/RunCMake/file-CHMOD/override.cmake b/Tests/RunCMake/file-CHMOD/override.cmake new file mode 100644 index 0000000..67e5a23 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/override.cmake @@ -0,0 +1,3 @@ +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a) +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ + FILE_PERMISSIONS OWNER_READ OWNER_WRITE) diff --git a/Tests/RunCMake/file-CHMOD/write-only-result.txt b/Tests/RunCMake/file-CHMOD/write-only-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/write-only-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-CHMOD/write-only-stderr.txt b/Tests/RunCMake/file-CHMOD/write-only-stderr.txt new file mode 100644 index 0000000..169a092 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/write-only-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/write-only\.cmake:[0-9]+ \(file\): + file failed to open for reading \(Permission denied\): + + [^ +]*/Tests/RunCMake/file-CHMOD/write-only-build/a$ diff --git a/Tests/RunCMake/file-CHMOD/write-only.cmake b/Tests/RunCMake/file-CHMOD/write-only.cmake new file mode 100644 index 0000000..aa9d803 --- /dev/null +++ b/Tests/RunCMake/file-CHMOD/write-only.cmake @@ -0,0 +1,3 @@ +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/a "CONTENT") +file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_WRITE) +file(READ ${CMAKE_CURRENT_BINARY_DIR}/a content) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt index c6ad3d0..39f307d 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt @@ -13,11 +13,21 @@ Call Stack \(most recent call first\): This warning is for project developers\. Use -Wno-dev to suppress it\. CMake Error at badargs2\.cmake:[0-9]+ \(file\): - file Keywords missing values: + Error after keyword "BUNDLE_EXECUTABLE": + + missing required value + + Error after keyword "CONFLICTING_DEPENDENCIES_PREFIX": + + missing required value + + Error after keyword "RESOLVED_DEPENDENCIES_VAR": + + missing required value + + Error after keyword "UNRESOLVED_DEPENDENCIES_VAR": + + missing required value - RESOLVED_DEPENDENCIES_VAR - UNRESOLVED_DEPENDENCIES_VAR - CONFLICTING_DEPENDENCIES_PREFIX - BUNDLE_EXECUTABLE Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt index 7c58aeb..54a3e5a 100644 --- a/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt +++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt @@ -1,2 +1,7 @@ -CMake Error at REAL_PATH-no-base-dir.cmake:[0-9]+ \(file\): - file BASE_DIRECTORY requires a value +^CMake Error at REAL_PATH-no-base-dir.cmake:[0-9]+ \(file\): + Error after keyword "BASE_DIRECTORY": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index aff4735..db88956 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -47,6 +47,7 @@ run_cmake(GLOB_RECURSE) run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS) run_cmake(SIZE) run_cmake(SIZE-error-does-not-exist) +run_cmake(TIMESTAMP) run_cmake(REMOVE-empty) diff --git a/Tests/RunCMake/file/TIMESTAMP-stdout.txt b/Tests/RunCMake/file/TIMESTAMP-stdout.txt new file mode 100644 index 0000000..42be6ba --- /dev/null +++ b/Tests/RunCMake/file/TIMESTAMP-stdout.txt @@ -0,0 +1 @@ +-- '[0-9]*-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-6][0-9]Z' diff --git a/Tests/RunCMake/file/TIMESTAMP.cmake b/Tests/RunCMake/file/TIMESTAMP.cmake new file mode 100644 index 0000000..2bd2577 --- /dev/null +++ b/Tests/RunCMake/file/TIMESTAMP.cmake @@ -0,0 +1,2 @@ +file(TIMESTAMP "TIMESTAMP.cmake" output UTC) +message(STATUS "'${output}'") diff --git a/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stderr.txt b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stderr.txt new file mode 100644 index 0000000..48d2fad --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stderr.txt @@ -0,0 +1,43 @@ + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 0 + + find_library considered the following locations:.* + The item was not found.* + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 1 + + find_library considered the following locations:.* + The item was found at.* + .*IgnoreStagingAndInstallPrefix-build/lib.* + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 0 + + find_library considered the following locations:.* + The item was not found.* diff --git a/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stdout.txt b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stdout.txt new file mode 100644 index 0000000..ea6614e --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stdout.txt @@ -0,0 +1,3 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix.cmake b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix.cmake new file mode 100644 index 0000000..9b5700a --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix.cmake @@ -0,0 +1 @@ +include(IgnoreInstallPrefix.cmake) diff --git a/Tests/RunCMake/find_library/IgnoreStagingPrefix-stderr.txt b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stderr.txt new file mode 100644 index 0000000..784c5fd --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stderr.txt @@ -0,0 +1,43 @@ + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 0 + + find_library considered the following locations:.* + The item was not found.* + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 1 + + find_library considered the following locations:.* + The item was found at.* + .*IgnoreStagingPrefix-build/lib.* + find_library called with the following settings:.* + VAR: CREATED_LIBRARY + NAMES: \"created\" + Documentation.* + Framework.* + AppBundle.* + CMAKE_FIND_USE_CMAKE_PATH: 1 + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1 + CMAKE_FIND_USE_INSTALL_PREFIX: 0 + + find_library considered the following locations:.* + The item was not found.* diff --git a/Tests/RunCMake/find_library/IgnoreStagingPrefix-stdout.txt b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stdout.txt new file mode 100644 index 0000000..fd414fb --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stdout.txt @@ -0,0 +1,3 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/IgnoreStagingPrefix-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/IgnoreStagingPrefix.cmake b/Tests/RunCMake/find_library/IgnoreStagingPrefix.cmake new file mode 100644 index 0000000..9b5700a --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingPrefix.cmake @@ -0,0 +1 @@ +include(IgnoreInstallPrefix.cmake) diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index cc005d0..8b223b4 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -4,6 +4,8 @@ run_cmake(Created) run_cmake(FromPrefixPath) run_cmake(FromPATHEnv) run_cmake_with_options(IgnoreInstallPrefix "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/IgnoreInstallPrefix-build/") +run_cmake_with_options(IgnoreStagingPrefix "-DCMAKE_STAGING_PREFIX=${RunCMake_BINARY_DIR}/IgnoreStagingPrefix-build/") +run_cmake_with_options(IgnoreStagingAndInstallPrefix "-DCMAKE_STAGING_PREFIX=${RunCMake_BINARY_DIR}/IgnoreStagingAndInstallPrefix-build/" "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/IgnoreStagingAndInstallPrefix-build/") if(UNIX AND NOT CYGWIN) run_cmake(LibArchLink) run_cmake(LibSymLink) diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index 32e54d5..fa41fc1 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -55,6 +55,22 @@ run_cmake(REGISTRY_VIEW-no-view) run_cmake(REGISTRY_VIEW-wrong-view) run_cmake(REGISTRY_VIEW-propagated) +file( + GLOB SearchPaths_TEST_CASE_LIST + LIST_DIRECTORIES TRUE + "${RunCMake_SOURCE_DIR}/SearchPaths/*" + ) +foreach(TestCasePrefix IN LISTS SearchPaths_TEST_CASE_LIST) + if(IS_DIRECTORY "${TestCasePrefix}") + cmake_path(GET TestCasePrefix FILENAME TestSuffix) + run_cmake_with_options( + SearchPaths_${TestSuffix} + "-DSearchPaths_ROOT=${TestCasePrefix}" + "--debug-find-pkg=SearchPaths" + ) + endif() +endforeach() + if(UNIX AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS ) diff --git a/Tests/RunCMake/find_package/SearchPaths.cmake b/Tests/RunCMake/find_package/SearchPaths.cmake new file mode 100644 index 0000000..a5a10fc --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0074 NEW) +find_package(SearchPaths REQUIRED CONFIG) diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1.2.3/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1.2.3/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1.2.3/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1.2.3/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1.2.3/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1.2.3/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1.2.3/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1.2.3/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1.2.3/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1.2.3/share/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1.2.3/share/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1.2.3/share/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1.2.3/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1.2.3/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1.2.3/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1.2.3/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1.2.3/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix-stderr.txt new file mode 100644 index 0000000..fae13ef --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix-stderr.txt @@ -0,0 +1,10 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-stderr.txt new file mode 100644 index 0000000..eba88c9 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-stderr.txt new file mode 100644 index 0000000..cebc169 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-stderr.txt new file mode 100644 index 0000000..4e5d3f6 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-stderr.txt new file mode 100644 index 0000000..f290545 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-stderr.txt new file mode 100644 index 0000000..32b9fcb --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-stderr.txt new file mode 100644 index 0000000..7bf5cf8 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-stderr.txt new file mode 100644 index 0000000..812c607 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-stderr.txt new file mode 100644 index 0000000..3592f72 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-stderr.txt new file mode 100644 index 0000000..b196b7a --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-stderr.txt new file mode 100644 index 0000000..17e0399 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-stderr.txt new file mode 100644 index 0000000..ee01a50 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-stderr.txt new file mode 100644 index 0000000..d6abd2f --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-stderr.txt new file mode 100644 index 0000000..b578b2b --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-stderr.txt @@ -0,0 +1,14 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-stderr.txt new file mode 100644 index 0000000..2f3f18a --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-stderr.txt new file mode 100644 index 0000000..3eef002 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-stderr.txt new file mode 100644 index 0000000..c962f8b --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-stderr.txt @@ -0,0 +1,12 @@ + find_package considered the following locations for SearchPaths's Config + module: + + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/SearchPathsConfig\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/searchpaths-config\.cmake + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake + + The file was found at + + .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake.cmake new file mode 100644 index 0000000..d831313 --- /dev/null +++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake") diff --git a/Tests/RunCMake/include_external_msproject/Program.cs b/Tests/RunCMake/include_external_msproject/Program.cs new file mode 100644 index 0000000..5ed58c8 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/Program.cs @@ -0,0 +1,9 @@ +namespace ConsoleApp +{ + internal class Program + { + static void Main(string[] args) + { + } + } +} diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake index cb0eb18..4fbf147 100644 --- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake @@ -10,3 +10,14 @@ if(RunCMake_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])") run_cmake(SkipGetTargetFrameworkProperties) run_cmake(VSCSharpReference) endif() + +if(RunCMake_GENERATOR MATCHES "^Visual Studio (1[6-9]|[2-9][0-9])") + function(run_VSCSharpOnlyProject) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VSCSharpOnlyProject-build) + run_cmake(VSCSharpOnlyProject) + set(RunCMake_TEST_NO_CLEAN 1) + set(build_flags /restore) + run_cmake_command(VSCSharpOnlyProject-build ${CMAKE_COMMAND} --build . -- ${build_flags}) + endfunction() + run_VSCSharpOnlyProject() +endif() diff --git a/Tests/RunCMake/include_external_msproject/VSCSharpOnlyProject.cmake b/Tests/RunCMake/include_external_msproject/VSCSharpOnlyProject.cmake new file mode 100644 index 0000000..e7e0b99 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/VSCSharpOnlyProject.cmake @@ -0,0 +1,9 @@ +project(VSCSharpOnlyProject) + +file(COPY + ${CMAKE_CURRENT_SOURCE_DIR}/Program.cs + ${CMAKE_CURRENT_SOURCE_DIR}/consoleapp.csproj + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +include_external_msproject( + test "${CMAKE_CURRENT_BINARY_DIR}/consoleapp.csproj") diff --git a/Tests/RunCMake/include_external_msproject/consoleapp.csproj b/Tests/RunCMake/include_external_msproject/consoleapp.csproj new file mode 100644 index 0000000..2894848 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/consoleapp.csproj @@ -0,0 +1,14 @@ +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net472</TargetFramework> + <RootNamespace>ConsoleApp</RootNamespace> + <AssemblyName>ConsoleApp</AssemblyName> + <PlatformTarget>x64</PlatformTarget> + <EnableDefaultItems>false</EnableDefaultItems> + </PropertyGroup> + + <ItemGroup> + <Compile Include="Program.cs" /> + </ItemGroup> +</Project> diff --git a/Tests/RunCMake/project/LanguagesDuplicate-check.cmake b/Tests/RunCMake/project/LanguagesDuplicate-check.cmake new file mode 100644 index 0000000..31c7da3 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesDuplicate-check.cmake @@ -0,0 +1,10 @@ +if(NOT actual_stderr MATCHES "The following language has been specified multiple times: C\n") + set(RunCMake_TEST_FAILED "'LANGUAGES C C C' should report only 'C' and only once.") +endif() + +if(NOT actual_stderr MATCHES "The following languages have been specified multiple times: C, CXX\n") + if(RunCMake_TEST_FAILED) + string(APPEND RunCMake_TEST_FAILED "\n") + endif() + string(APPEND RunCMake_TEST_FAILED "'LANGUAGES C C CXX CXX' should report 'C' and 'CXX'.") +endif() diff --git a/Tests/RunCMake/project/LanguagesDuplicate.cmake b/Tests/RunCMake/project/LanguagesDuplicate.cmake new file mode 100644 index 0000000..97a79d0 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesDuplicate.cmake @@ -0,0 +1,11 @@ +cmake_policy(SET CMP0057 NEW) + +project(ProjectA C C C) +project(ProjectB C C CXX CXX) + +get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(lang C CXX) + if(NOT lang IN_LIST langs) + message(FATAL_ERROR "Expected language '${lang}' to be enabled.") + endif() +endforeach() diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 945d9ed..6d9f52f 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -12,6 +12,11 @@ run_cmake_with_options(CodeInjection if(CMake_TEST_RESOURCES) run_cmake(ExplicitRC) endif() + +set(RunCMake_DEFAULT_stderr .) +run_cmake(LanguagesDuplicate) +unset(RunCMake_DEFAULT_stderr) + run_cmake(LanguagesImplicit) run_cmake(LanguagesEmpty) run_cmake(LanguagesNONE) diff --git a/Tests/RunCMake/return/CMP0140-NEW.cmake b/Tests/RunCMake/return/CMP0140-NEW.cmake new file mode 100644 index 0000000..eb6b85c --- /dev/null +++ b/Tests/RunCMake/return/CMP0140-NEW.cmake @@ -0,0 +1,13 @@ + +cmake_policy(SET CMP0140 NEW) + +function(FUNC) + set(VAR "set") + return(PROPAGATE VAR) +endfunction() + +set(VAR "initial") +func() +if (NOT DEFINED VAR OR NOT VAR STREQUAL "set") + message(FATAL_ERROR "return(PROPAGATE) not handled correctly.") +endif() diff --git a/Tests/RunCMake/return/CMP0140-OLD.cmake b/Tests/RunCMake/return/CMP0140-OLD.cmake new file mode 100644 index 0000000..8113a43 --- /dev/null +++ b/Tests/RunCMake/return/CMP0140-OLD.cmake @@ -0,0 +1,8 @@ + +cmake_policy(SET CMP0140 OLD) + +function(FUNC) + return(PROPAGATE VAR) +endfunction() + +func() diff --git a/Tests/RunCMake/return/CMP0140-WARN-result.txt b/Tests/RunCMake/return/CMP0140-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/return/CMP0140-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/return/CMP0140-WARN-stderr.txt b/Tests/RunCMake/return/CMP0140-WARN-stderr.txt new file mode 100644 index 0000000..ed4beb6 --- /dev/null +++ b/Tests/RunCMake/return/CMP0140-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0140-WARN.cmake:[0-9]+ \(return\): + Policy CMP0140 is not set: The return\(\) command checks its arguments. Run + "cmake --help-policy CMP0140" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + return\(\) checks its arguments when the policy is set to NEW. Since the + policy is not set the OLD behavior will be used so the arguments will be + ignored. +Call Stack \(most recent call first\): + CMP0140-WARN.cmake:[0-9]+ \(func\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/return/CMP0140-WARN.cmake b/Tests/RunCMake/return/CMP0140-WARN.cmake new file mode 100644 index 0000000..df2fc88 --- /dev/null +++ b/Tests/RunCMake/return/CMP0140-WARN.cmake @@ -0,0 +1,8 @@ + +cmake_policy(VERSION 3.1) + +function(FUNC) + return(PROPAGATE VAR) +endfunction() + +func() diff --git a/Tests/RunCMake/return/CMakeLists.txt b/Tests/RunCMake/return/CMakeLists.txt index ef2163c..6cc903f 100644 --- a/Tests/RunCMake/return/CMakeLists.txt +++ b/Tests/RunCMake/return/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.25) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/return/PropagateFromDirectory.cmake b/Tests/RunCMake/return/PropagateFromDirectory.cmake new file mode 100644 index 0000000..9c820bb --- /dev/null +++ b/Tests/RunCMake/return/PropagateFromDirectory.cmake @@ -0,0 +1,10 @@ + +set(VAR1 "initial") +set(VAR2 "initial") + +add_subdirectory(subdir) + +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC1") +endif() diff --git a/Tests/RunCMake/return/PropagateFromFunction.cmake b/Tests/RunCMake/return/PropagateFromFunction.cmake new file mode 100644 index 0000000..1c12bc1 --- /dev/null +++ b/Tests/RunCMake/return/PropagateFromFunction.cmake @@ -0,0 +1,142 @@ + +function(FUNC1) + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func1() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC1") +endif() + + +function(FUNC2) + block() + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endblock() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func2() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC2") +endif() + + +function(FUNC3) + block(SCOPE_FOR POLICIES) + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endblock() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func3() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC3") +endif() + + +function(FUNC4) + while(TRUE) + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endwhile() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func4() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC4") +endif() + + +function(FUNC5) + foreach(item IN ITEMS A B) + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endforeach() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func5() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC5") +endif() + + +function(FUNC6) + if(TRUE) + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endif() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func6() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC6") +endif() + + +function(FUNC7) + if(FALSE) + else() + set(VAR1 "set") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endif() +endfunction() + +set(VAR1 "initial") +set(VAR2 "initial") +func7() +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for FUNC7") +endif() + + +set(VAR1 "initial") +set(VAR2 "initial") +cmake_language(CALL func7) +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for cmake_language(CALL FUNC7)") +endif() + + +set(VAR1 "initial") +set(VAR2 "initial") +cmake_language(EVAL CODE " + function(FUNC8) + set(VAR1 \"set\") + unset(VAR2) + return(PROPAGATE VAR1 VAR2) + endfunction() + + func8()") +if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set") + OR DEFINED VAR2) + message(SEND_ERROR "erroneous propagation for cmake_language(EVAL CODE)") +endif() diff --git a/Tests/RunCMake/return/PropagateNothing.cmake b/Tests/RunCMake/return/PropagateNothing.cmake new file mode 100644 index 0000000..0ace58e --- /dev/null +++ b/Tests/RunCMake/return/PropagateNothing.cmake @@ -0,0 +1,2 @@ + +return(PROPAGATE) diff --git a/Tests/RunCMake/return/RunCMakeTest.cmake b/Tests/RunCMake/return/RunCMakeTest.cmake index 2cc6c9d..f9e06a5 100644 --- a/Tests/RunCMake/return/RunCMakeTest.cmake +++ b/Tests/RunCMake/return/RunCMakeTest.cmake @@ -1,3 +1,12 @@ include(RunCMake) run_cmake(ReturnFromForeach) + +run_cmake(WrongArgument) +run_cmake(PropagateNothing) +run_cmake(PropagateFromFunction) +run_cmake(PropagateFromDirectory) + +run_cmake(CMP0140-NEW) +run_cmake(CMP0140-OLD) +run_cmake(CMP0140-WARN) diff --git a/Tests/RunCMake/return/WrongArgument-result.txt b/Tests/RunCMake/return/WrongArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/return/WrongArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/return/WrongArgument-stderr.txt b/Tests/RunCMake/return/WrongArgument-stderr.txt new file mode 100644 index 0000000..4d1c5ad --- /dev/null +++ b/Tests/RunCMake/return/WrongArgument-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at WrongArgument.cmake:[0-9]+ \(return\): + return called with unsupported argument "WRONG_ARG" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/return/WrongArgument.cmake b/Tests/RunCMake/return/WrongArgument.cmake new file mode 100644 index 0000000..d03b19f --- /dev/null +++ b/Tests/RunCMake/return/WrongArgument.cmake @@ -0,0 +1,2 @@ + +return(WRONG_ARG) diff --git a/Tests/RunCMake/return/subdir/CMakeLists.txt b/Tests/RunCMake/return/subdir/CMakeLists.txt new file mode 100644 index 0000000..e575d47 --- /dev/null +++ b/Tests/RunCMake/return/subdir/CMakeLists.txt @@ -0,0 +1,5 @@ + +set(VAR1 "set") +unset(VAR2) + +return(PROPAGATE VAR1 VAR2) diff --git a/Tests/RunCMake/string/JSON.cmake b/Tests/RunCMake/string/JSON.cmake index ab4194d..255c16a 100644 --- a/Tests/RunCMake/string/JSON.cmake +++ b/Tests/RunCMake/string/JSON.cmake @@ -129,7 +129,7 @@ assert_strequal("${error}" "member '0' not found") string(JSON result ERROR_VARIABLE error GET "${json1}" array 10) assert_strequal("${result}" "array-10-NOTFOUND") -assert_strequal("${error}" "expected an index less then 4 got '10'") +assert_strequal("${error}" "expected an index less than 4 got '10'") string(JSON result ERROR_VARIABLE error GET "${json1}" array 2 some notThere) assert_strequal("${result}" "array-2-some-notThere-NOTFOUND") @@ -240,7 +240,7 @@ endif() string(JSON result ERROR_VARIABLE error MEMBER "${json1}" values 100) assert_strequal("${result}" "values-100-NOTFOUND") -assert_strequal("${error}" "expected an index less then 5 got '100'") +assert_strequal("${error}" "expected an index less than 5 got '100'") # Test length loops string(JSON arrayLength ERROR_VARIABLE error LENGTH "${json1}" types array) @@ -301,7 +301,7 @@ assert_json_equal("${error}" "${result}" string(JSON result ERROR_VARIABLE error REMOVE ${json2} array 100) assert_strequal("${result}" "array-100-NOTFOUND") -assert_strequal("${error}" "expected an index less then 4 got '100'") +assert_strequal("${error}" "expected an index less than 4 got '100'") # Test SET string(JSON result ERROR_VARIABLE error SET ${json2} new 5) diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-check.cmake new file mode 100644 index 0000000..b6cabf5 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "(/|-)-START_GROUP\"? +\"?(/|-)-PREFIX_LIBRARY\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base2${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIX_LIBRARY\"? +\"?(/|-)-END_GROUP") + set (RunCMake_TEST_FAILED "Not found expected '--START_GROUP --PREFIX_LIBRARY --LIBFLAG<base1> --LIBFLAG<base2> --END_GROUP'.") +endif() diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake index 31eb7e2..fea2f91 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake @@ -20,6 +20,9 @@ set(CMAKE_C_LINK_GROUP_USING_feat1_SUPPORTED TRUE) set(CMAKE_C_LINK_LIBRARY_USING_feat1 "--LIBFLAG<LIBRARY>") set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat2 "--PREFIX_LIBRARY" "--LIBFLAG<LIBRARY>" "--SUFFIX_LIBRARY") +set(CMAKE_C_LINK_LIBRARY_USING_feat2_SUPPORTED TRUE) + set(CMAKE_C_LINK_GROUP_USING_feat2 "--START_GROUP" "--END_GROUP") set(CMAKE_LINK_GROUP_USING_feat2 "--START_GROUP" "--END_GROUP") set(CMAKE_LINK_GROUP_USING_feat2_SUPPORTED TRUE) @@ -53,6 +56,9 @@ target_link_libraries(LinkGroup_group-and-single PRIVATE "$<LINK_GROUP:feat1,bas add_library(LinkGroup_with-LINK_LIBRARY SHARED lib.c) target_link_libraries(LinkGroup_with-LINK_LIBRARY PRIVATE "$<LINK_GROUP:feat1,$<LINK_LIBRARY:feat1,base1>,base2>") +add_library(LinkGroup_with-LINK_LIBRARY2 SHARED lib.c) +target_link_libraries(LinkGroup_with-LINK_LIBRARY2 PRIVATE "$<LINK_GROUP:feat1,$<LINK_LIBRARY:feat2,base1,base2>>") + add_library(LinkGroup_with-LINK_LIBRARY_OVERRIDE SHARED lib.c) target_link_libraries(LinkGroup_with-LINK_LIBRARY_OVERRIDE PRIVATE "$<LINK_GROUP:feat1,$<LINK_LIBRARY:feat1,base1,base3>,base2>") diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake index c1d74d0..3ebe269 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake @@ -46,6 +46,7 @@ if ((RunCMake_GENERATOR MATCHES "Makefiles|Ninja|Xcode" run_cmake_target(LINK_GROUP multiple-groups LinkGroup_multiple-groups) run_cmake_target(LINK_GROUP group-and-single LinkGroup_group-and-single) run_cmake_target(LINK_GROUP with-LINK_LIBRARY LinkGroup_with-LINK_LIBRARY) + run_cmake_target(LINK_GROUP with-LINK_LIBRARY2 LinkGroup_with-LINK_LIBRARY2) run_cmake_target(LINK_GROUP with-LINK_LIBRARY_OVERRIDE LinkGroup_with-LINK_LIBRARY_OVERRIDE) run_cmake(imported-target) diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake index 021de41..9b6581c 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake @@ -90,12 +90,22 @@ if(APPLE AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES run_cmake_target(apple_framework target-framework main-target-framework) run_cmake_target(apple_framework target-reexport_framework main-target-reexport_framework) run_cmake_target(apple_framework target-weak_framework main-target-weak_framework) + + if(RunCMake_GENERATOR_IS_MULTI_CONFIG AND (NOT XCODE OR XCODE_VERSION GREATER_EQUAL 13)) + run_cmake_target(apple_framework target-framework-postfix main-target-framework-postfix) + run_cmake_target(apple_framework target-reexport_framework-postfix main-target-reexport_framework-postfix) + run_cmake_target(apple_framework target-weak_framework-postfix main-target-weak_framework-postfix) + endif() endif() if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION GREATER_EQUAL "12") run_cmake_target(apple_framework needed_framework main-needed_framework) run_cmake_target(apple_framework target-needed_framework main-target-needed_framework) + + if(RunCMake_GENERATOR_IS_MULTI_CONFIG AND (NOT XCODE OR XCODE_VERSION GREATER_EQUAL 13)) + run_cmake_target(apple_framework target-needed_framework-postfix main-target-needed_framework-postfix) + endif() endif() # Apple library features diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake index e9a93e9..ca0e72d 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake @@ -59,3 +59,33 @@ target_link_libraries(main-target-reexport_framework PRIVATE "$<LINK_LIBRARY:FRA # feature WEAK_FRAMEWORK add_executable(main-target-weak_framework main.mm) target_link_libraries(main-target-weak_framework PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:REEXPORT_FRAMEWORK,target-framework>") + + + +get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTI_CONFIG) + add_library(target-framework-postfix SHARED foo.mm) + set_target_properties(target-framework-postfix PROPERTIES FRAMEWORK TRUE + FRAMEWORK_MULTI_CONFIG_POSTFIX_RELEASE "_release") + target_link_libraries(target-framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>") + + + # feature FRAMEWORK + add_executable(main-target-framework-postfix main.mm) + target_link_libraries(main-target-framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:FRAMEWORK,target-framework-postfix>") + + + # feature NEEDED_FRAMEWORK + add_executable(main-target-needed_framework-postfix main.mm) + target_link_libraries(main-target-needed_framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:NEEDED_FRAMEWORK,target-framework-postfix>") + + + # feature REEXPORT_FRAMEWORK + add_executable(main-target-reexport_framework-postfix main.mm) + target_link_libraries(main-target-reexport_framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:REEXPORT_FRAMEWORK,target-framework-postfix>") + + + # feature WEAK_FRAMEWORK + add_executable(main-target-weak_framework-postfix main.mm) + target_link_libraries(main-target-weak_framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:REEXPORT_FRAMEWORK,target-framework-postfix>") +endif() diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake index 2dbcee7..5ade637 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 "17be90bd-a850-44e0-be50-448de847d652") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET UNKNOWN) diff --git a/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-result.txt b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-stderr.txt b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-stderr.txt new file mode 100644 index 0000000..b8d35af --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error in CMakeLists\.txt: + File set "a" is listed in interface file sets of lib1 but has not been + exported + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport.cmake b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport.cmake new file mode 100644 index 0000000..72fab47 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +install(TARGETS lib1 EXPORT a) +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +export(EXPORT a) diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-result.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-stderr.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-stderr.txt new file mode 100644 index 0000000..b8d35af --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error in CMakeLists\.txt: + File set "a" is listed in interface file sets of lib1 but has not been + exported + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall.cmake b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall.cmake new file mode 100644 index 0000000..4e1edff --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +install(TARGETS lib1 EXPORT a) +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +install(EXPORT a DESTINATION lib/cmake/test) diff --git a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake index 024c2cb..332441c 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 "17be90bd-a850-44e0-be50-448de847d652") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET a TYPE UNKNOWN) diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index 135777b..7c67c3f 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -35,6 +35,8 @@ run_cmake(FileSetWrongBaseDirsRelative) run_cmake(FileSetOverlappingBaseDirs) run_cmake(FileSetInstallMissingSetsPrivate) run_cmake(FileSetInstallMissingSetsInterface) +run_cmake(FileSetInstallMissingSetsInterfacePostInstall) +run_cmake(FileSetExportMissingSetsInterfacePostExport) run_cmake(FileSetReadOnlyPrivate) run_cmake(FileSetReadOnlyInterface) run_cmake(FileSetNoExistInstall) diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt index 652bcfc..4e41a19 100644 --- a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt +++ b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadLinkLibraries.cmake:2 \(try_compile\): +CMake Error at BadLinkLibraries.cmake:[0-9]+ \(try_compile\): Only libraries may be used as try_compile or try_run IMPORTED LINK_LIBRARIES. Got not_a_library of type UTILITY. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries.cmake b/Tests/RunCMake/try_compile/BadLinkLibraries.cmake index e8b5add..b758e23 100644 --- a/Tests/RunCMake/try_compile/BadLinkLibraries.cmake +++ b/Tests/RunCMake/try_compile/BadLinkLibraries.cmake @@ -1,3 +1,7 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + add_custom_target(not_a_library) -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c LINK_LIBRARIES not_a_library) diff --git a/Tests/RunCMake/try_compile/BadSources1-stderr.txt b/Tests/RunCMake/try_compile/BadSources1-stderr.txt index 864a294..ddcba4f 100644 --- a/Tests/RunCMake/try_compile/BadSources1-stderr.txt +++ b/Tests/RunCMake/try_compile/BadSources1-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadSources1.cmake:1 \(try_compile\): +CMake Error at BadSources1.cmake:[0-9]+ \(try_compile\): Unknown extension ".c" for file .*/Tests/RunCMake/try_compile/src.c diff --git a/Tests/RunCMake/try_compile/BadSources1.cmake b/Tests/RunCMake/try_compile/BadSources1.cmake index aa4dc5e..c95935d 100644 --- a/Tests/RunCMake/try_compile/BadSources1.cmake +++ b/Tests/RunCMake/try_compile/BadSources1.cmake @@ -1 +1,3 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c) +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_compile/BadSources2-stderr.txt b/Tests/RunCMake/try_compile/BadSources2-stderr.txt index 3313f99..953dd9c 100644 --- a/Tests/RunCMake/try_compile/BadSources2-stderr.txt +++ b/Tests/RunCMake/try_compile/BadSources2-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadSources2.cmake:2 \(try_compile\): +CMake Error at BadSources2.cmake:[0-9]+ \(try_compile\): Unknown extension ".cxx" for file .*/Tests/RunCMake/try_compile/src.cxx diff --git a/Tests/RunCMake/try_compile/BadSources2.cmake b/Tests/RunCMake/try_compile/BadSources2.cmake index ed2b036..3f22bb6 100644 --- a/Tests/RunCMake/try_compile/BadSources2.cmake +++ b/Tests/RunCMake/try_compile/BadSources2.cmake @@ -1,5 +1,6 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) enable_language(C) -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c - ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx ) diff --git a/Tests/RunCMake/try_compile/BinDirEmpty-result.txt b/Tests/RunCMake/try_compile/BinDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/BinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/BinDirEmpty-stderr.txt new file mode 100644 index 0000000..b1f5ae3 --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at BinDirEmpty.cmake:[0-9]+ \(try_compile\): + No <bindir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/BinDirEmpty.cmake b/Tests/RunCMake/try_compile/BinDirEmpty.cmake new file mode 100644 index 0000000..7bea43d --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirEmpty.cmake @@ -0,0 +1 @@ +try_compile(resultVar "" ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_compile/BinDirRelative-result.txt b/Tests/RunCMake/try_compile/BinDirRelative-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirRelative-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/BinDirRelative-stderr.txt b/Tests/RunCMake/try_compile/BinDirRelative-stderr.txt new file mode 100644 index 0000000..a7b6302 --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirRelative-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at BinDirRelative.cmake:[0-9]+ \(try_compile\): + <bindir> is not an absolute path: + + 'bin_dir_relative' +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/BinDirRelative.cmake b/Tests/RunCMake/try_compile/BinDirRelative.cmake new file mode 100644 index 0000000..8deda11 --- /dev/null +++ b/Tests/RunCMake/try_compile/BinDirRelative.cmake @@ -0,0 +1 @@ +try_compile(resultVar bin_dir_relative ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_compile/BuildType.cmake b/Tests/RunCMake/try_compile/BuildType.cmake new file mode 100644 index 0000000..8d7e3be --- /dev/null +++ b/Tests/RunCMake/try_compile/BuildType.cmake @@ -0,0 +1,8 @@ +enable_language(C) +set(CMAKE_BUILD_TYPE RelWithDebInfo) + +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT + ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + ) diff --git a/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake b/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake new file mode 100644 index 0000000..a822156 --- /dev/null +++ b/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake @@ -0,0 +1,9 @@ +enable_language(C) +set(CMAKE_BUILD_TYPE RelWithDebInfo) + +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT + ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + CMAKE_FLAGS "-DCMAKE_BUILD_TYPE=Release" + ) diff --git a/Tests/RunCMake/try_compile/CStandard-stderr.txt b/Tests/RunCMake/try_compile/CStandard-stderr.txt index 209afcc..c3c48a1 100644 --- a/Tests/RunCMake/try_compile/CStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/CStandard-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at .*/Tests/RunCMake/try_compile/CStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): +^CMake Error at .*/Tests/RunCMake/try_compile/CStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\): C_STANDARD is set to invalid value '3' + CMake Error at CStandard.cmake:[0-9]+ \(try_compile\): diff --git a/Tests/RunCMake/try_compile/CStandard.cmake b/Tests/RunCMake/try_compile/CStandard.cmake index 2849ed4..6ac04db 100644 --- a/Tests/RunCMake/try_compile/CStandard.cmake +++ b/Tests/RunCMake/try_compile/CStandard.cmake @@ -1,7 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c C_STANDARD 3 OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/CStandardGNU.cmake b/Tests/RunCMake/try_compile/CStandardGNU.cmake index 79ae874..10a4384 100644 --- a/Tests/RunCMake/try_compile/CStandardGNU.cmake +++ b/Tests/RunCMake/try_compile/CStandardGNU.cmake @@ -1,23 +1,30 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c C_STANDARD 99 C_STANDARD_REQUIRED 1 C_EXTENSIONS 0 OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() cmake_policy(SET CMP0067 NEW) + set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED 1) set(CMAKE_C_EXTENSIONS 0) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() diff --git a/Tests/RunCMake/try_compile/CStandardNoDefault.cmake b/Tests/RunCMake/try_compile/CStandardNoDefault.cmake index 97e72ea..f4dd5ae 100644 --- a/Tests/RunCMake/try_compile/CStandardNoDefault.cmake +++ b/Tests/RunCMake/try_compile/CStandardNoDefault.cmake @@ -1,9 +1,13 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c C_STANDARD 3 # bogus, but not used OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt index 5d09c0c..8c49302 100644 --- a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt +++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at CopyFileErrorNoCopyFile.cmake:1 \(try_compile\): +CMake Error at CopyFileErrorNoCopyFile.cmake:[0-9]+ \(try_compile\): COPY_FILE_ERROR may be used only with COPY_FILE Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake index 8d7cb0e..8d15b3d 100644 --- a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake +++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c COPY_FILE_ERROR _copied) diff --git a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt index bcf95d5..52dff8f 100644 --- a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at .*/Tests/RunCMake/try_compile/CudaStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): +^CMake Error at .*/Tests/RunCMake/try_compile/CudaStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\): CUDA_STANDARD is set to invalid value '4' + CMake Error at CudaStandard.cmake:[0-9]+ \(try_compile\): diff --git a/Tests/RunCMake/try_compile/CudaStandard.cmake b/Tests/RunCMake/try_compile/CudaStandard.cmake index a230424..0be89be 100644 --- a/Tests/RunCMake/try_compile/CudaStandard.cmake +++ b/Tests/RunCMake/try_compile/CudaStandard.cmake @@ -1,7 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(CUDA) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cu + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cu CUDA_STANDARD 4 OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/CxxStandard-stderr.txt b/Tests/RunCMake/try_compile/CxxStandard-stderr.txt index cee1b44..55a06e2 100644 --- a/Tests/RunCMake/try_compile/CxxStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/CxxStandard-stderr.txt @@ -1,13 +1,13 @@ -^(CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt: +^(CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt: The CXX_STANDARD property on target "cmTC_[0-9a-f]*" contained an invalid value: "3". -)?CMake Error at .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): +)?CMake Error at .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\): CXX_STANDARD is set to invalid value '3' ( -CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt: +CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt: The CXX_STANDARD property on target "cmTC_[0-9a-f]*" contained an invalid value: "3". diff --git a/Tests/RunCMake/try_compile/CxxStandard.cmake b/Tests/RunCMake/try_compile/CxxStandard.cmake index bcb49b9..e5b4e78 100644 --- a/Tests/RunCMake/try_compile/CxxStandard.cmake +++ b/Tests/RunCMake/try_compile/CxxStandard.cmake @@ -1,7 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(CXX) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx CXX_STANDARD 3 OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/CxxStandardGNU.cmake b/Tests/RunCMake/try_compile/CxxStandardGNU.cmake index e714fe4..552d99d 100644 --- a/Tests/RunCMake/try_compile/CxxStandardGNU.cmake +++ b/Tests/RunCMake/try_compile/CxxStandardGNU.cmake @@ -1,23 +1,30 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(CXX) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx CXX_STANDARD 11 CXX_STANDARD_REQUIRED 1 CXX_EXTENSIONS 0 OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() cmake_policy(SET CMP0067 NEW) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED 1) set(CMAKE_CXX_EXTENSIONS 0) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() diff --git a/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake b/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake index 35caa9d..e0ebfee 100644 --- a/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake +++ b/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake @@ -1,9 +1,13 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(CXX) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx CXX_STANDARD 3 # bogus, but not used OUTPUT_VARIABLE out ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() diff --git a/Tests/RunCMake/try_compile/EmptyListArgs.cmake b/Tests/RunCMake/try_compile/EmptyListArgs.cmake new file mode 100644 index 0000000..5cd7465 --- /dev/null +++ b/Tests/RunCMake/try_compile/EmptyListArgs.cmake @@ -0,0 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +enable_language(C) + +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + CMAKE_FLAGS # no values + COMPILE_DEFINITIONS # no values + LINK_LIBRARIES # no values + LINK_OPTIONS # no values + ) diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs-result.txt b/Tests/RunCMake/try_compile/EmptyValueArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/EmptyValueArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt new file mode 100644 index 0000000..b1344bd --- /dev/null +++ b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\): + COPY_FILE must be followed by a file path +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +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\) diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake new file mode 100644 index 0000000..fda4f10 --- /dev/null +++ b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake @@ -0,0 +1,7 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "") +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "x" COPY_FILE_ERROR "") diff --git a/Tests/RunCMake/try_compile/EnvConfig.cmake b/Tests/RunCMake/try_compile/EnvConfig.cmake index 4040c59..6e66825 100644 --- a/Tests/RunCMake/try_compile/EnvConfig.cmake +++ b/Tests/RunCMake/try_compile/EnvConfig.cmake @@ -1,3 +1,5 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) set(ENV{CMAKE_BUILD_TYPE} "Bad") @@ -6,8 +8,8 @@ set(ENV{CMAKE_CONFIGURATION_TYPES} "Bad;Debug") add_library(tc_defs INTERFACE IMPORTED) target_compile_definitions(tc_defs INTERFACE "TC_CONFIG_$<UPPER_CASE:$<CONFIG>>") -try_compile(ENV_CONFIG_RESULT "${CMAKE_BINARY_DIR}" - SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/EnvConfig.c" +try_compile(ENV_CONFIG_RESULT "${try_compile_bindir_or_SOURCES}" + ${try_compile_redundant_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/EnvConfig.c" COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/EnvConfig.bin" OUTPUT_VARIABLE tc_output LINK_LIBRARIES tc_defs diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake index 6d29069..1ead4c2 100644 --- a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake @@ -1,8 +1,12 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(ISPC) -set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 - avx512skx-i32x16) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + +set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 avx512skx-i32x16) + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake index 7f59c14..e08e25f 100644 --- a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake @@ -1,11 +1,16 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(ISPC) -set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 - avx512skx-i32x16) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + +set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 avx512skx-i32x16) + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") + if(NOT result) message(FATAL_ERROR "making Ninja and Ninja Multi-Config behave the same") endif() diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake index c1ab6f2..2276bd3 100644 --- a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake +++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake @@ -1,7 +1,12 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(ISPC) + set(CMAKE_ISPC_INSTRUCTION_SETS "avxknl-i32x16") -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ISPCTargets.cmake b/Tests/RunCMake/try_compile/ISPCTargets.cmake index 0d3bd43..bd45569 100644 --- a/Tests/RunCMake/try_compile/ISPCTargets.cmake +++ b/Tests/RunCMake/try_compile/ISPCTargets.cmake @@ -1,7 +1,12 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(ISPC) + set(CMAKE_ISPC_INSTRUCTION_SETS avx512knl-i32x16 avx512skx-i32x16) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/NoArgs-stderr.txt b/Tests/RunCMake/try_compile/NoArgs-stderr.txt index 8808fd1..4228580 100644 --- a/Tests/RunCMake/try_compile/NoArgs-stderr.txt +++ b/Tests/RunCMake/try_compile/NoArgs-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NoArgs.cmake:1 \(try_compile\): - try_compile unknown error. +CMake Error at NoArgs.cmake:[0-9]+ \(try_compile\): + The try_compile\(\) command requires at least 3 arguments. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCStandard-result.txt b/Tests/RunCMake/try_compile/NoCStandard-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/NoCStandard-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/NoCStandard-stderr.txt b/Tests/RunCMake/try_compile/NoCStandard-stderr.txt new file mode 100644 index 0000000..e0bb9ed --- /dev/null +++ b/Tests/RunCMake/try_compile/NoCStandard-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at NoCStandard.cmake:[0-9]+ \(try_compile\): + Error after keyword "C_STANDARD": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCStandard.cmake b/Tests/RunCMake/try_compile/NoCStandard.cmake new file mode 100644 index 0000000..e0d0478 --- /dev/null +++ b/Tests/RunCMake/try_compile/NoCStandard.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 + C_STANDARD) diff --git a/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt index d65d9488..55ba687 100644 --- a/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt +++ b/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoCopyFile.cmake:1 \(try_compile\): - COPY_FILE must be followed by a file path +CMake Error at NoCopyFile.cmake:[0-9]+ \(try_compile\): + Error after keyword "COPY_FILE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCopyFile.cmake b/Tests/RunCMake/try_compile/NoCopyFile.cmake index 8c648ff..270dff9 100644 --- a/Tests/RunCMake/try_compile/NoCopyFile.cmake +++ b/Tests/RunCMake/try_compile/NoCopyFile.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c COPY_FILE) diff --git a/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt index e889524..008d4e9 100644 --- a/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt +++ b/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoCopyFile2.cmake:1 \(try_compile\): - COPY_FILE must be followed by a file path +CMake Error at NoCopyFile2.cmake:[0-9]+ \(try_compile\): + Error after keyword "COPY_FILE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCopyFile2.cmake b/Tests/RunCMake/try_compile/NoCopyFile2.cmake index 04b7f68..2ea8182 100644 --- a/Tests/RunCMake/try_compile/NoCopyFile2.cmake +++ b/Tests/RunCMake/try_compile/NoCopyFile2.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c COPY_FILE CMAKE_FLAGS -DA=B) diff --git a/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt index ed552fd..7ca185d 100644 --- a/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt +++ b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoCopyFileError.cmake:1 \(try_compile\): - COPY_FILE_ERROR must be followed by a variable name +CMake Error at NoCopyFileError.cmake:[0-9]+ \(try_compile\): + Error after keyword "COPY_FILE_ERROR": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCopyFileError.cmake b/Tests/RunCMake/try_compile/NoCopyFileError.cmake index d4d69ee..1a56e86 100644 --- a/Tests/RunCMake/try_compile/NoCopyFileError.cmake +++ b/Tests/RunCMake/try_compile/NoCopyFileError.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copied.bin COPY_FILE_ERROR) diff --git a/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt b/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt index 18ad751..ec29f0b 100644 --- a/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt +++ b/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoOutputVariable.cmake:1 \(try_compile\): - OUTPUT_VARIABLE must be followed by a variable name +CMake Error at NoOutputVariable.cmake:[0-9]+ \(try_compile\): + Error after keyword "OUTPUT_VARIABLE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoOutputVariable.cmake b/Tests/RunCMake/try_compile/NoOutputVariable.cmake index 3b9cb34..13dc4b4 100644 --- a/Tests/RunCMake/try_compile/NoOutputVariable.cmake +++ b/Tests/RunCMake/try_compile/NoOutputVariable.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c OUTPUT_VARIABLE) diff --git a/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt b/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt index 8b2cc25..dd34559 100644 --- a/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt +++ b/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoOutputVariable2.cmake:1 \(try_compile\): - OUTPUT_VARIABLE must be followed by a variable name +CMake Error at NoOutputVariable2.cmake:[0-9]+ \(try_compile\): + Error after keyword "OUTPUT_VARIABLE": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoOutputVariable2.cmake b/Tests/RunCMake/try_compile/NoOutputVariable2.cmake index ad9ac9a..4d5dda3 100644 --- a/Tests/RunCMake/try_compile/NoOutputVariable2.cmake +++ b/Tests/RunCMake/try_compile/NoOutputVariable2.cmake @@ -1,2 +1,4 @@ -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c OUTPUT_VARIABLE CMAKE_FLAGS -DA=B) diff --git a/Tests/RunCMake/try_compile/NoSources-stderr.txt b/Tests/RunCMake/try_compile/NoSources-stderr.txt index 023032b..55603dc 100644 --- a/Tests/RunCMake/try_compile/NoSources-stderr.txt +++ b/Tests/RunCMake/try_compile/NoSources-stderr.txt @@ -1,4 +1,7 @@ -CMake Error at NoSources.cmake:1 \(try_compile\): - SOURCES must be followed by at least one source file +CMake Error at NoSources.cmake:[0-9]+ \(try_compile\): + Error after keyword "SOURCES": + + missing required value + Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt index 025e658..dcd5c7a 100644 --- a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt +++ b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NonSourceCompileDefinitions.cmake:1 \(try_compile\): - COMPILE_DEFINITIONS specified on a srcdir type TRY_COMPILE +CMake Error at NonSourceCompileDefinitions.cmake:[0-9]+ \(try_compile\): + COMPILE_DEFINITIONS allowed only in source file signature Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt b/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt index f5893e1..1b7dfeb 100644 --- a/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt +++ b/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NonSourceCopyFile.cmake:1 \(try_compile\): - COPY_FILE specified on a srcdir type TRY_COMPILE +CMake Error at NonSourceCopyFile.cmake:[0-9]+ \(try_compile\): + COPY_FILE allowed only in source file signature Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt index f1b4df9..59f1d73 100644 --- a/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at .*/Tests/RunCMake/try_compile/ObjCStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): +^CMake Error at .*/Tests/RunCMake/try_compile/ObjCStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\): OBJC_STANDARD is set to invalid value '3' + CMake Error at ObjCStandard.cmake:[0-9]+ \(try_compile\): diff --git a/Tests/RunCMake/try_compile/ObjCStandard.cmake b/Tests/RunCMake/try_compile/ObjCStandard.cmake index b2066f9..a691ddd 100644 --- a/Tests/RunCMake/try_compile/ObjCStandard.cmake +++ b/Tests/RunCMake/try_compile/ObjCStandard.cmake @@ -1,7 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(OBJC) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.m + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.m OBJC_STANDARD 3 OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt index a2f91b4..21fa20f 100644 --- a/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt +++ b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at .*/Tests/RunCMake/try_compile/ObjCxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): +^CMake Error at .*/Tests/RunCMake/try_compile/ObjCxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\): OBJCXX_STANDARD is set to invalid value '3' + CMake Error at ObjCxxStandard.cmake:[0-9]+ \(try_compile\): diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard.cmake b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake index 1221805..b03f560 100644 --- a/Tests/RunCMake/try_compile/ObjCxxStandard.cmake +++ b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake @@ -1,7 +1,11 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(OBJCXX) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.mm + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.mm OBJCXX_STANDARD 3 OUTPUT_VARIABLE out ) + message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt new file mode 100644 index 0000000..e9ec450 --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at OldProjectBinDirEmpty.cmake:[0-9]+ \(try_compile\): + No <bindir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake new file mode 100644 index 0000000..fa922d9 --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake @@ -0,0 +1 @@ +try_compile(RESULT "" ${CMAKE_CURRENT_SOURCE_DIR}/proj Foo) diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt new file mode 100644 index 0000000..47dd60f --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at OldProjectSrcDirEmpty.cmake:[0-9]+ \(try_compile\): + No <srcdir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake new file mode 100644 index 0000000..dfbfba6 --- /dev/null +++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake @@ -0,0 +1 @@ +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} "" Foo) diff --git a/Tests/RunCMake/try_compile/OneArg-stderr.txt b/Tests/RunCMake/try_compile/OneArg-stderr.txt index 12835be..a2e983e 100644 --- a/Tests/RunCMake/try_compile/OneArg-stderr.txt +++ b/Tests/RunCMake/try_compile/OneArg-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at OneArg.cmake:1 \(try_compile\): - try_compile unknown error. +CMake Error at OneArg.cmake:[0-9]+ \(try_compile\): + The try_compile\(\) command requires at least 3 arguments. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake b/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake new file mode 100644 index 0000000..1214bbb --- /dev/null +++ b/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake @@ -0,0 +1,9 @@ +enable_language(C) +set(CMAKE_BUILD_TYPE RelWithDebInfo) + +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT + ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + CMAKE_FLAGS "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=bin" + ) diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt new file mode 100644 index 0000000..57a2bd0 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at ProjectBinDirEmpty.cmake:[0-9]+ \(try_compile\): + No <bindir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake b/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake new file mode 100644 index 0000000..e867cc6 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake @@ -0,0 +1,4 @@ +try_compile(RESULT PROJECT Foo + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/proj + BINARY_DIR "" + ) diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt b/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt b/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt new file mode 100644 index 0000000..45241c9 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at ProjectCopyFile.cmake:[0-9]+ \(try_compile\): + Unknown arguments: + + "COPY_FILE" + "result" +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile.cmake b/Tests/RunCMake/try_compile/ProjectCopyFile.cmake new file mode 100644 index 0000000..6bfec99 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectCopyFile.cmake @@ -0,0 +1,4 @@ +try_compile(RESULT + PROJECT TestProject + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/proj + COPY_FILE result) diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt new file mode 100644 index 0000000..dc6f354 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at ProjectSrcDirEmpty.cmake:[0-9]+ \(try_compile\): + No <srcdir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake new file mode 100644 index 0000000..ac33ed0 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake @@ -0,0 +1 @@ +try_compile(RESULT PROJECT Foo SOURCE_DIR "") diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt new file mode 100644 index 0000000..af6edd5 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at ProjectSrcDirMissing.cmake:[0-9]+ \(try_compile\): + No <srcdir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake b/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake new file mode 100644 index 0000000..e32cdf4 --- /dev/null +++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake @@ -0,0 +1 @@ +try_compile(RESULT PROJECT Foo) diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index eca7bf4..d63624c 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -1,32 +1,39 @@ include(RunCMake) -run_cmake(CopyFileErrorNoCopyFile) run_cmake(NoArgs) run_cmake(OneArg) run_cmake(TwoArgs) -run_cmake(NoCopyFile) -run_cmake(NoCopyFile2) -run_cmake(NoCopyFileError) -run_cmake(NoOutputVariable) -run_cmake(NoOutputVariable2) run_cmake(NoSources) -run_cmake(BadLinkLibraries) -run_cmake(BadSources1) -run_cmake(BadSources2) +run_cmake(BinDirEmpty) +run_cmake(BinDirRelative) +run_cmake(ProjectSrcDirMissing) +run_cmake(ProjectSrcDirEmpty) +run_cmake(ProjectBinDirEmpty) +run_cmake(OldProjectSrcDirEmpty) +run_cmake(OldProjectBinDirEmpty) + +set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=old_signature.cmake) +include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=new_signature.cmake) +include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake) +unset(RunCMake_TEST_OPTIONS) + +run_cmake(SourceFromOneArg) +run_cmake(SourceFromThreeArgs) +run_cmake(SourceFromBadName) +run_cmake(SourceFromBadFile) + +run_cmake(ProjectCopyFile) run_cmake(NonSourceCopyFile) run_cmake(NonSourceCompileDefinitions) -run_cmake(EnvConfig) - set(RunCMake_TEST_OPTIONS --debug-trycompile) run_cmake(PlatformVariables) run_cmake(WarnDeprecated) unset(RunCMake_TEST_OPTIONS) -run_cmake(TargetTypeExe) -run_cmake(TargetTypeInvalid) -run_cmake(TargetTypeStatic) - if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$") set (RunCMake_TEST_OPTIONS -DRunCMake_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) @@ -34,41 +41,6 @@ if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND unset (RunCMake_TEST_OPTIONS) endif() -if(CMAKE_C_STANDARD_DEFAULT) - run_cmake(CStandard) -elseif(DEFINED CMAKE_C_STANDARD_DEFAULT) - run_cmake(CStandardNoDefault) -endif() -if(CMAKE_OBJC_STANDARD_DEFAULT) - run_cmake(ObjCStandard) -endif() -if(CMAKE_CXX_STANDARD_DEFAULT) - run_cmake(CxxStandard) -elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT) - run_cmake(CxxStandardNoDefault) -endif() -if(CMAKE_OBJCXX_STANDARD_DEFAULT) - run_cmake(ObjCxxStandard) -endif() -if(CMake_TEST_CUDA) - run_cmake(CudaStandard) -endif() -if(CMake_TEST_ISPC) - run_cmake(ISPCTargets) - run_cmake(ISPCInvalidTarget) - set(ninja "") - if(RunCMake_GENERATOR MATCHES "Ninja") - set(ninja "Ninja") - endif() - run_cmake(ISPCDuplicateTarget${ninja}) -endif() -if((CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC") - run_cmake(CStandardGNU) -endif() -if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC") - run_cmake(CxxStandardGNU) -endif() - run_cmake(CMP0056) run_cmake(CMP0066) run_cmake(CMP0067) diff --git a/Tests/RunCMake/try_compile/SourceFromBadFile-result.txt b/Tests/RunCMake/try_compile/SourceFromBadFile-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadFile-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/SourceFromBadFile-stderr.txt b/Tests/RunCMake/try_compile/SourceFromBadFile-stderr.txt new file mode 100644 index 0000000..53a6d8d --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadFile-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceFromBadFile.cmake:[0-9]+ \(try_compile\): + SOURCE_FROM_FILE failed to copy "bad#source.c": No such file or directory +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromBadFile.cmake b/Tests/RunCMake/try_compile/SourceFromBadFile.cmake new file mode 100644 index 0000000..0a37f11 --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadFile.cmake @@ -0,0 +1 @@ +try_compile(RESULT SOURCE_FROM_FILE bad.c "bad#source.c") diff --git a/Tests/RunCMake/try_compile/SourceFromBadName-result.txt b/Tests/RunCMake/try_compile/SourceFromBadName-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt b/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt new file mode 100644 index 0000000..ef6847c --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceFromBadName.cmake:[0-9]+ \(try_compile\): + SOURCES_FROM_ARG given invalid filename "bad/name.c" +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromBadName.cmake b/Tests/RunCMake/try_compile/SourceFromBadName.cmake new file mode 100644 index 0000000..e53a73f --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromBadName.cmake @@ -0,0 +1 @@ +try_compile(RESULT SOURCE_FROM_ARG bad/name.c "int main();") diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg-result.txt b/Tests/RunCMake/try_compile/SourceFromOneArg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromOneArg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt b/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt new file mode 100644 index 0000000..bebe8bb --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceFromOneArg.cmake:[0-9]+ \(try_compile\): + SOURCE_FROM_ARG requires exactly two arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg.cmake b/Tests/RunCMake/try_compile/SourceFromOneArg.cmake new file mode 100644 index 0000000..39ca11e --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromOneArg.cmake @@ -0,0 +1 @@ +try_compile(RESULT SOURCE_FROM_ARG test.c) diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs-result.txt b/Tests/RunCMake/try_compile/SourceFromThreeArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt b/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt new file mode 100644 index 0000000..2cf201d --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceFromThreeArgs.cmake:[0-9]+ \(try_compile\): + SOURCE_FROM_ARG requires exactly two arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake b/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake new file mode 100644 index 0000000..af6340d --- /dev/null +++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake @@ -0,0 +1 @@ +try_compile(RESULT SOURCE_FROM_ARG test.c "int" "main();") diff --git a/Tests/RunCMake/try_compile/TargetTypeExe.cmake b/Tests/RunCMake/try_compile/TargetTypeExe.cmake index 9b6e727..330f5f5 100644 --- a/Tests/RunCMake/try_compile/TargetTypeExe.cmake +++ b/Tests/RunCMake/try_compile/TargetTypeExe.cmake @@ -1,14 +1,20 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) + set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c OUTPUT_VARIABLE out COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy COPY_FILE_ERROR copy_err ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() + if(copy_err) message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}") endif() diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt index 08b281a..e9123e3 100644 --- a/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt +++ b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error at TargetTypeInvalid.cmake:2 \(try_compile\): +^CMake Error at TargetTypeInvalid.cmake:[0-9]+ \(try_compile\): Invalid value 'INVALID' for CMAKE_TRY_COMPILE_TARGET_TYPE. Only 'EXECUTABLE' and 'STATIC_LIBRARY' are allowed. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake index 0bbc4ac..15a20bb 100644 --- a/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake +++ b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake @@ -1,2 +1,6 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + set(CMAKE_TRY_COMPILE_TARGET_TYPE INVALID) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c) + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_compile/TargetTypeStatic.cmake b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake index 006b8b8..98dea41 100644 --- a/Tests/RunCMake/try_compile/TargetTypeStatic.cmake +++ b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake @@ -1,14 +1,20 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + enable_language(C) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) -try_compile(result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/other.c + +try_compile(result ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/other.c OUTPUT_VARIABLE out COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy COPY_FILE_ERROR copy_err ) + if(NOT result) message(FATAL_ERROR "try_compile failed:\n${out}") endif() + if(copy_err) message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}") endif() diff --git a/Tests/RunCMake/try_compile/TryRunArgs-stderr.txt b/Tests/RunCMake/try_compile/TryRunArgs-stderr.txt new file mode 100644 index 0000000..2a58e71 --- /dev/null +++ b/Tests/RunCMake/try_compile/TryRunArgs-stderr.txt @@ -0,0 +1,18 @@ +^CMake Warning \(dev\) at TryRunArgs.cmake:[0-9]+ \(try_compile\): + Unknown arguments: + + "COMPILE_OUTPUT_VARIABLE" + "compOutputVar" + "RUN_OUTPUT_VARIABLE" + "runOutputVar" + "RUN_OUTPUT_STDOUT_VARIABLE" + "runOutputStdOutVar" + "RUN_OUTPUT_STDERR_VARIABLE" + "runOutputStdErrVar" + "WORKING_DIRECTORY" + "runWorkDir" + "ARGS" + "runArgs" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/try_compile/TryRunArgs.cmake b/Tests/RunCMake/try_compile/TryRunArgs.cmake new file mode 100644 index 0000000..e4cb1fe --- /dev/null +++ b/Tests/RunCMake/try_compile/TryRunArgs.cmake @@ -0,0 +1,14 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +enable_language(C) + +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + COMPILE_OUTPUT_VARIABLE compOutputVar + RUN_OUTPUT_VARIABLE runOutputVar + RUN_OUTPUT_STDOUT_VARIABLE runOutputStdOutVar + RUN_OUTPUT_STDERR_VARIABLE runOutputStdErrVar + WORKING_DIRECTORY runWorkDir + ARGS runArgs + ) diff --git a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt index b9c08fc..b68e78e 100644 --- a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt +++ b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at TwoArgs.cmake:1 \(try_compile\): - try_compile unknown error. +CMake Error at TwoArgs.cmake:[0-9]+ \(try_compile\): + The try_compile\(\) command requires at least 3 arguments. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/new_signature.cmake b/Tests/RunCMake/try_compile/new_signature.cmake new file mode 100644 index 0000000..cbcb261 --- /dev/null +++ b/Tests/RunCMake/try_compile/new_signature.cmake @@ -0,0 +1,2 @@ +set(try_compile_bindir_or_SOURCES SOURCES) +set(try_compile_redundant_SOURCES "") diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake new file mode 100644 index 0000000..ac07ad3 --- /dev/null +++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake @@ -0,0 +1,66 @@ +# These tests are performed using both the historic and the newer SOURCES +# signatures of try_compile. It is critical that they behave the same and +# produce comparable output for both signatures. Tests that cannot do this +# belong in RunCMakeTests.txt, not here. +# +# Tests here MUST include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) and +# use the variables defined therein appropriately. Refer to existing tests for +# examples. + +run_cmake(CopyFileErrorNoCopyFile) +run_cmake(NoCopyFile) +run_cmake(NoCopyFile2) +run_cmake(NoCopyFileError) +run_cmake(NoCStandard) +run_cmake(NoOutputVariable) +run_cmake(NoOutputVariable2) +run_cmake(BadLinkLibraries) +run_cmake(BadSources1) +run_cmake(BadSources2) +run_cmake(EmptyValueArgs) +run_cmake(EmptyListArgs) +run_cmake(TryRunArgs) +run_cmake(BuildType) +run_cmake(BuildTypeAsFlag) +run_cmake(OutputDirAsFlag) + +run_cmake(EnvConfig) + +run_cmake(TargetTypeExe) +run_cmake(TargetTypeInvalid) +run_cmake(TargetTypeStatic) + +if(CMAKE_C_STANDARD_DEFAULT) + run_cmake(CStandard) +elseif(DEFINED CMAKE_C_STANDARD_DEFAULT) + run_cmake(CStandardNoDefault) +endif() +if(CMAKE_OBJC_STANDARD_DEFAULT) + run_cmake(ObjCStandard) +endif() +if(CMAKE_CXX_STANDARD_DEFAULT) + run_cmake(CxxStandard) +elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT) + run_cmake(CxxStandardNoDefault) +endif() +if(CMAKE_OBJCXX_STANDARD_DEFAULT) + run_cmake(ObjCxxStandard) +endif() +if(CMake_TEST_CUDA) + run_cmake(CudaStandard) +endif() +if(CMake_TEST_ISPC) + run_cmake(ISPCTargets) + run_cmake(ISPCInvalidTarget) + set(ninja "") + if(RunCMake_GENERATOR MATCHES "Ninja") + set(ninja "Ninja") + endif() + run_cmake(ISPCDuplicateTarget${ninja}) +endif() +if((CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC") + run_cmake(CStandardGNU) +endif() +if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC") + run_cmake(CxxStandardGNU) +endif() diff --git a/Tests/RunCMake/try_compile/old_signature.cmake b/Tests/RunCMake/try_compile/old_signature.cmake new file mode 100644 index 0000000..94b12de --- /dev/null +++ b/Tests/RunCMake/try_compile/old_signature.cmake @@ -0,0 +1,2 @@ +set(try_compile_bindir_or_SOURCES ${CMAKE_CURRENT_BINARY_DIR}) +set(try_compile_redundant_SOURCES SOURCES) diff --git a/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt index dcd1bfc..f9cc50e 100644 --- a/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt +++ b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadLinkLibraries.cmake:2 \(try_run\): +CMake Error at BadLinkLibraries.cmake:[0-9+] \(try_run\): Only libraries may be used as try_compile or try_run IMPORTED LINK_LIBRARIES. Got not_a_library of type UTILITY. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/try_run/BadLinkLibraries.cmake b/Tests/RunCMake/try_run/BadLinkLibraries.cmake index a124bf6..950a942 100644 --- a/Tests/RunCMake/try_run/BadLinkLibraries.cmake +++ b/Tests/RunCMake/try_run/BadLinkLibraries.cmake @@ -1,4 +1,7 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + add_custom_target(not_a_library) -try_run(RUN_RESULT COMPILE_RESULT - ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c LINK_LIBRARIES not_a_library) diff --git a/Tests/RunCMake/try_run/BinDirEmpty-result.txt b/Tests/RunCMake/try_run/BinDirEmpty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirEmpty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt b/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt new file mode 100644 index 0000000..def1c22 --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at BinDirEmpty.cmake:[0-9]+ \(try_run\): + No <bindir> specified. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/BinDirEmpty.cmake b/Tests/RunCMake/try_run/BinDirEmpty.cmake new file mode 100644 index 0000000..d4b7ee3 --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirEmpty.cmake @@ -0,0 +1 @@ +try_run(runResultVar compileResultVar "" ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_run/BinDirRelative-result.txt b/Tests/RunCMake/try_run/BinDirRelative-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirRelative-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/BinDirRelative-stderr.txt b/Tests/RunCMake/try_run/BinDirRelative-stderr.txt new file mode 100644 index 0000000..54d4e86 --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirRelative-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at BinDirRelative.cmake:[0-9]+ \(try_run\): + <bindir> is not an absolute path: + + 'bin_dir_relative' +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/BinDirRelative.cmake b/Tests/RunCMake/try_run/BinDirRelative.cmake new file mode 100644 index 0000000..a277403 --- /dev/null +++ b/Tests/RunCMake/try_run/BinDirRelative.cmake @@ -0,0 +1 @@ +try_run(runResultVar compileResultVar bin_dir_relative ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_run/NoCompileOutputVariable-result.txt b/Tests/RunCMake/try_run/NoCompileOutputVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoCompileOutputVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoCompileOutputVariable-stderr.txt b/Tests/RunCMake/try_run/NoCompileOutputVariable-stderr.txt new file mode 100644 index 0000000..e8baffb --- /dev/null +++ b/Tests/RunCMake/try_run/NoCompileOutputVariable-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoCompileOutputVariable.cmake:[0-9]+ \(try_run\): + Error after keyword "COMPILE_OUTPUT_VARIABLE": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/NoCompileOutputVariable.cmake b/Tests/RunCMake/try_run/NoCompileOutputVariable.cmake new file mode 100644 index 0000000..9eb7c5e --- /dev/null +++ b/Tests/RunCMake/try_run/NoCompileOutputVariable.cmake @@ -0,0 +1,6 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COMPILE_OUTPUT_VARIABLE + ) diff --git a/Tests/RunCMake/try_run/NoOutputCompileVariable-result.txt b/Tests/RunCMake/try_run/NoOutputCompileVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoOutputCompileVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoOutputVariable-result.txt b/Tests/RunCMake/try_run/NoOutputVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoOutputVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoOutputVariable-stderr.txt b/Tests/RunCMake/try_run/NoOutputVariable-stderr.txt new file mode 100644 index 0000000..46cfca0 --- /dev/null +++ b/Tests/RunCMake/try_run/NoOutputVariable-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoOutputVariable.cmake:[0-9]+ \(try_run\): + Error after keyword "OUTPUT_VARIABLE": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/NoOutputVariable.cmake b/Tests/RunCMake/try_run/NoOutputVariable.cmake new file mode 100644 index 0000000..1901b30 --- /dev/null +++ b/Tests/RunCMake/try_run/NoOutputVariable.cmake @@ -0,0 +1,4 @@ +try_run(RUN_RESULT COMPILE_RESULT + ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE + ) diff --git a/Tests/RunCMake/try_run/NoRunOutputVariable-result.txt b/Tests/RunCMake/try_run/NoRunOutputVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunOutputVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoRunOutputVariable-stderr.txt b/Tests/RunCMake/try_run/NoRunOutputVariable-stderr.txt new file mode 100644 index 0000000..8ccbdab --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunOutputVariable-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoRunOutputVariable.cmake:[0-9]+ \(try_run\): + Error after keyword "RUN_OUTPUT_VARIABLE": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/NoRunOutputVariable.cmake b/Tests/RunCMake/try_run/NoRunOutputVariable.cmake new file mode 100644 index 0000000..f9e5e0b --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunOutputVariable.cmake @@ -0,0 +1,6 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + RUN_OUTPUT_VARIABLE + ) diff --git a/Tests/RunCMake/try_run/NoRunStdErrVariable-result.txt b/Tests/RunCMake/try_run/NoRunStdErrVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdErrVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoRunStdErrVariable-stderr.txt b/Tests/RunCMake/try_run/NoRunStdErrVariable-stderr.txt new file mode 100644 index 0000000..1443ab2 --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdErrVariable-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoRunStdErrVariable.cmake:[0-9]+ \(try_run\): + Error after keyword "RUN_OUTPUT_STDERR_VARIABLE": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/try_run/NoRunStdErrVariable.cmake b/Tests/RunCMake/try_run/NoRunStdErrVariable.cmake new file mode 100644 index 0000000..888bc25 --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdErrVariable.cmake @@ -0,0 +1,7 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/workdir + RUN_OUTPUT_STDERR_VARIABLE + ) diff --git a/Tests/RunCMake/try_run/NoRunStdOutVariable-result.txt b/Tests/RunCMake/try_run/NoRunStdOutVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdOutVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoRunStdOutVariable-stderr.txt b/Tests/RunCMake/try_run/NoRunStdOutVariable-stderr.txt new file mode 100644 index 0000000..8b90e94 --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdOutVariable-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoRunStdOutVariable.cmake:[0-9]+ \(try_run\): + Error after keyword "RUN_OUTPUT_STDOUT_VARIABLE": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/try_run/NoRunStdOutVariable.cmake b/Tests/RunCMake/try_run/NoRunStdOutVariable.cmake new file mode 100644 index 0000000..ed6ab88 --- /dev/null +++ b/Tests/RunCMake/try_run/NoRunStdOutVariable.cmake @@ -0,0 +1,7 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/workdir + RUN_OUTPUT_STDOUT_VARIABLE + ) diff --git a/Tests/RunCMake/try_run/NoWorkingDirectory-result.txt b/Tests/RunCMake/try_run/NoWorkingDirectory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/NoWorkingDirectory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/NoWorkingDirectory-stderr.txt b/Tests/RunCMake/try_run/NoWorkingDirectory-stderr.txt new file mode 100644 index 0000000..b6e258f --- /dev/null +++ b/Tests/RunCMake/try_run/NoWorkingDirectory-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at NoWorkingDirectory.cmake:[0-9]+ \(try_run\): + Error after keyword "WORKING_DIRECTORY": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_run/NoWorkingDirectory.cmake b/Tests/RunCMake/try_run/NoWorkingDirectory.cmake new file mode 100644 index 0000000..0d68182 --- /dev/null +++ b/Tests/RunCMake/try_run/NoWorkingDirectory.cmake @@ -0,0 +1,6 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + WORKING_DIRECTORY + ) diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake index d74add0..dbea089 100644 --- a/Tests/RunCMake/try_run/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake @@ -1,6 +1,16 @@ include(RunCMake) -run_cmake(BadLinkLibraries) +run_cmake(BinDirEmpty) +run_cmake(BinDirRelative) +run_cmake(NoOutputVariable) + +set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=old_signature.cmake) +include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=new_signature.cmake) +include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake) +unset(RunCMake_TEST_OPTIONS) if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$") @@ -8,5 +18,3 @@ if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND run_cmake(LinkOptions) unset (RunCMake_TEST_OPTIONS) endif() - -run_cmake(WorkingDirArg) diff --git a/Tests/RunCMake/try_run/WorkingDirArg.cmake b/Tests/RunCMake/try_run/WorkingDirArg.cmake index b583823..375a703 100644 --- a/Tests/RunCMake/try_run/WorkingDirArg.cmake +++ b/Tests/RunCMake/try_run/WorkingDirArg.cmake @@ -1,6 +1,8 @@ -try_run(RUN_RESULT COMPILE_RESULT - ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c - RUN_OUTPUT_VARIABLE OUTPUT_VARIABLE +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + RUN_OUTPUT_VARIABLE RUN_OUTPUT WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/workdir ) diff --git a/Tests/RunCMake/try_run/new_signature.cmake b/Tests/RunCMake/try_run/new_signature.cmake new file mode 100644 index 0000000..cbcb261 --- /dev/null +++ b/Tests/RunCMake/try_run/new_signature.cmake @@ -0,0 +1,2 @@ +set(try_compile_bindir_or_SOURCES SOURCES) +set(try_compile_redundant_SOURCES "") diff --git a/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake new file mode 100644 index 0000000..e1c1784 --- /dev/null +++ b/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake @@ -0,0 +1,20 @@ +# These tests are performed using both the historic and the newer SOURCES +# signatures of try_run. It is critical that they behave the same and produce +# comparable output for both signatures. Tests that cannot do this belong in +# RunCMakeTests.txt, not here. +# +# Tests here MUST include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) and +# use the variables defined therein appropriately. Refer to existing tests for +# examples. + +run_cmake(BadLinkLibraries) +run_cmake(BinDirEmpty) +run_cmake(BinDirRelative) + +run_cmake(WorkingDirArg) + +run_cmake(NoCompileOutputVariable) +run_cmake(NoRunOutputVariable) +run_cmake(NoRunStdOutVariable) +run_cmake(NoRunStdErrVariable) +run_cmake(NoWorkingDirectory) diff --git a/Tests/RunCMake/try_run/old_signature.cmake b/Tests/RunCMake/try_run/old_signature.cmake new file mode 100644 index 0000000..94b12de --- /dev/null +++ b/Tests/RunCMake/try_run/old_signature.cmake @@ -0,0 +1,2 @@ +set(try_compile_bindir_or_SOURCES ${CMAKE_CURRENT_BINARY_DIR}) +set(try_compile_redundant_SOURCES SOURCES) diff --git a/Tests/SwiftMixLib/CMakeLists.txt b/Tests/SwiftMixLib/CMakeLists.txt new file mode 100644 index 0000000..40d3498 --- /dev/null +++ b/Tests/SwiftMixLib/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.24) +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) diff --git a/Tests/SwiftMixLib/lib.c b/Tests/SwiftMixLib/lib.c new file mode 100644 index 0000000..8eca512 --- /dev/null +++ b/Tests/SwiftMixLib/lib.c @@ -0,0 +1,4 @@ +int add_int(int a, int b) +{ + return a + b; +} diff --git a/Tests/SwiftMixLib/lib.cpp b/Tests/SwiftMixLib/lib.cpp new file mode 100644 index 0000000..3e156b8 --- /dev/null +++ b/Tests/SwiftMixLib/lib.cpp @@ -0,0 +1,4 @@ +int add(int a, int b) +{ + return a + b; +} diff --git a/Tests/SwiftMixLib/lib.swift b/Tests/SwiftMixLib/lib.swift new file mode 100644 index 0000000..61009d8 --- /dev/null +++ b/Tests/SwiftMixLib/lib.swift @@ -0,0 +1,3 @@ +public func add(a: Int, b: Int) -> Int { + a + b +} diff --git a/Tests/SwiftMixLib/main.swift b/Tests/SwiftMixLib/main.swift new file mode 100644 index 0000000..d2e9364 --- /dev/null +++ b/Tests/SwiftMixLib/main.swift @@ -0,0 +1,3 @@ +import SwiftMixedLib + +print(add(a: 1, b: 2)) diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt index 01c2222..e92e544 100644 --- a/Tests/SwiftOnly/CMakeLists.txt +++ b/Tests/SwiftOnly/CMakeLists.txt @@ -25,6 +25,7 @@ endif() set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) add_executable(SwiftOnly main.swift) +target_compile_definitions(SwiftOnly PRIVATE SWIFTONLY) add_library(L L.swift) diff --git a/Tests/SwiftOnly/main.swift b/Tests/SwiftOnly/main.swift index 28560d0..a3f1a2c 100644 --- a/Tests/SwiftOnly/main.swift +++ b/Tests/SwiftOnly/main.swift @@ -1 +1,7 @@ dump("SwiftOnly") + +#if SWIFTONLY +dump("SWIFTONLY defined") +#else +fatalError("SWIFTONLY NOT defined") +#endif diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 000fd2c..9396cfa 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -4,6 +4,30 @@ if(POLICY CMP0129) endif() project(TryCompile) +macro(EXPECT_PASS var out) + if(NOT ${var}) + message(SEND_ERROR "Should pass failed:\n${out}") + endif() +endmacro() + +macro(EXPECT_FAIL var out) + if(${var}) + message(SEND_ERROR "Should fail passed:\n${out}") + endif() +endmacro() + +macro(EXPECT_COMPILED name var out) + if(NOT ${var}) + message(SEND_ERROR "${name} failed compiling:\n${out}") + endif() +endmacro() + +macro(EXPECT_RUN_RESULT name var expected) + if(NOT ${var} EQUAL ${expected}) + message(SEND_ERROR " ${name} gave unexpected run result: ${${var}} expected: ${expected}") + endif() +endmacro() + macro(TEST_ASSERT value msg) if (NOT ${value}) message (SEND_ERROR "Assertion failure:" ${msg} ) @@ -28,139 +52,72 @@ macro(TEST_EXPECT_CONTAINS command expected) endif() endmacro() - -# try to compile a file that should compile -# also check that COPY_FILE works -try_compile(SHOULD_PASS - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/pass.c - OUTPUT_VARIABLE TRY_OUT - COPY_FILE ${TryCompile_BINARY_DIR}/CopyOfPass - ) - -if(NOT SHOULD_PASS) - message(SEND_ERROR "should pass failed ${TRY_OUT}") -endif() -if(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass") - message(SEND_ERROR "COPY_FILE to \"${TryCompile_BINARY_DIR}/CopyOfPass\" failed") -else() - file(REMOVE "${TryCompile_BINARY_DIR}/CopyOfPass") -endif() - -# try to compile a file that should compile -# also check that COPY_FILE_ERROR works -file(WRITE ${TryCompile_BINARY_DIR}/invalid "") -try_compile(SHOULD_PASS - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/pass.c - OUTPUT_VARIABLE TRY_OUT - COPY_FILE ${TryCompile_BINARY_DIR}/invalid/path - COPY_FILE_ERROR _captured - ) -if(NOT SHOULD_PASS) - message(SEND_ERROR "should pass failed ${TRY_OUT}") -endif() -if(NOT _captured MATCHES "Cannot copy output executable.*/invalid/path") - message(SEND_ERROR "COPY_FILE_ERROR did not capture expected message") +if (APPLE) + enable_language(OBJC) + enable_language(OBJCXX) endif() -# try to compile a file that should not compile -try_compile(SHOULD_FAIL - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/fail.c - OUTPUT_VARIABLE TRY_OUT) -if(SHOULD_FAIL) - message(SEND_ERROR "Should fail passed ${TRY_OUT}") -endif() -# try to compile a file that should compile -try_compile(SHOULD_PASS - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/pass.c - OUTPUT_VARIABLE TRY_OUT) -if(NOT SHOULD_PASS) - message(SEND_ERROR "should pass failed ${TRY_OUT}") -endif() +# run old signature tests +set(try_compile_bindir_or_SOURCES ${TryCompile_BINARY_DIR}) +set(try_compile_redundant_SOURCES SOURCES) +set(try_compile_output_vars OUTPUT_VARIABLE TRY_OUT) +set(try_compile_compile_output_var TRY_OUT) +set(try_compile_run_output_var TRY_OUT) +include(old_and_new_signature_tests.cmake) -# try to compile a file that should not compile -try_compile(SHOULD_FAIL - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/fail.c - OUTPUT_VARIABLE TRY_OUT) -if(SHOULD_FAIL) - message(SEND_ERROR "Should fail passed ${TRY_OUT}") -endif() +# run new signature tests +set(try_compile_bindir_or_SOURCES SOURCES) +set(try_compile_redundant_SOURCES "") +set(try_compile_output_vars + COMPILE_OUTPUT_VARIABLE COMPILE_OUT + RUN_OUTPUT_VARIABLE RUN_OUTPUT) +set(try_compile_compile_output_var COMPILE_OUT) +set(try_compile_run_output_var RUN_OUTPUT) +include(old_and_new_signature_tests.cmake) -# try to compile two files that should compile -try_compile(SHOULD_PASS - ${TryCompile_BINARY_DIR} - SOURCES ${TryCompile_SOURCE_DIR}/pass2a.c ${TryCompile_SOURCE_DIR}/pass2b.cxx - OUTPUT_VARIABLE TRY_OUT) -if(NOT SHOULD_PASS) - message(SEND_ERROR "should pass failed ${TRY_OUT}") +# try to compile an empty source specified directly +try_compile(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE + SOURCE_FROM_ARG empty.c "") +if(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE) + message(SEND_ERROR "Trying to compile an empty source succeeded?") endif() -# try to compile two files that should not compile -try_compile(SHOULD_FAIL - ${TryCompile_BINARY_DIR} - SOURCES ${TryCompile_SOURCE_DIR}/fail2a.c ${TryCompile_SOURCE_DIR}/fail2b.c - OUTPUT_VARIABLE TRY_OUT) -if(SHOULD_FAIL) - message(SEND_ERROR "Should fail passed ${TRY_OUT}") +try_compile(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE + SOURCE_FROM_VAR empty.c NAME_OF_A_VAR_THAT_IS_NOT_SET) +if(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE) + message(SEND_ERROR "Trying to compile an empty source succeeded?") endif() -# try to compile a file that should compile -set(_c_flags "${CMAKE_C_FLAGS}") -if(WATCOM) - string(APPEND CMAKE_C_FLAGS " -dTESTDEF") -else() - string(APPEND CMAKE_C_FLAGS " \"-DTESTDEF\"") -endif() +# try to compile a copied source try_compile(SHOULD_PASS - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/testdef.c - OUTPUT_VARIABLE TRY_OUT) -if(NOT SHOULD_PASS) - message(SEND_ERROR "should pass failed ${TRY_OUT}") -endif() -set(CMAKE_C_FLAGS "${_c_flags}") - -if(NOT SHOULD_FAIL) - if(SHOULD_PASS) - message("All Tests passed, ignore all previous output.") - else() - message("Test failed") - endif() -else() - message("Test failed") -endif() -try_compile(CMAKE_ANSI_FOR_SCOPE - ${TryCompile_BINARY_DIR} - ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT) -if (CMAKE_ANSI_FOR_SCOPE) - message("Compiler supports ansi for") -else() - message("Compiler does not support ansi for scope") -endif() + SOURCE_FROM_FILE pass.c ${TryCompile_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE TRY_OUT) +EXPECT_COMPILED("SOURCE_FROM_FILE" SHOULD_PASS "${TRY_OUT}") -try_compile(CMAKE_ANSI_FOR_SCOPE - ${TryCompile_BINARY_DIR} - ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT) -if (CMAKE_ANSI_FOR_SCOPE) - message("Compiler supports ansi for") -else() - message("Compiler does not support ansi for scope") -endif() +# try to run a source specified directly +set(TRY_RUN_MAIN_CODE + "extern int answer(); \n" + "int main() { return answer(); }\n") +set(TRY_RUN_EXT_CODE + "int answer() { return 42; }\n") -message("use the module now") -include(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake) -if (CMAKE_ANSI_FOR_SCOPE) - message("Compiler supports ansi for") -else() - message("Compiler does not support ansi for scope") -endif() +try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE + SOURCE_FROM_ARG main.c "${TRY_RUN_MAIN_CODE}" + SOURCE_FROM_ARG answer.c "${TRY_RUN_EXT_CODE}" + COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT) +EXPECT_COMPILED("SOURCE_FROM_ARG" SHOULD_COMPILE "${COMPILE_OUTPUT}") +EXPECT_RUN_RESULT("SOURCE_FROM_ARG" SHOULD_EXIT_WITH_ERROR 42) -message("Testing try_compile project mode") +try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE + SOURCE_FROM_VAR main.c TRY_RUN_MAIN_CODE + SOURCE_FROM_VAR answer.c TRY_RUN_EXT_CODE + COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT) +EXPECT_COMPILED("SOURCE_FROM_VAR" SHOULD_COMPILE "${COMPILE_OUTPUT}") +EXPECT_RUN_RESULT("SOURCE_FROM_VAR" SHOULD_EXIT_WITH_ERROR 42) + +# try to compile a project (old signature) +message("Testing try_compile project mode (old signature)") try_compile(TEST_INNER ${TryCompile_BINARY_DIR}/CMakeFiles/Inner ${TryCompile_SOURCE_DIR}/Inner @@ -168,102 +125,17 @@ try_compile(TEST_INNER OUTPUT_VARIABLE output) TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}") -try_compile(COMPILE_DEFINITIONS_LIST_EXPANDED - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/check_a_b.c - OUTPUT_VARIABLE output - COMPILE_DEFINITIONS "-DDEF_A;-DDEF_B" - ) -if(COMPILE_DEFINITIONS_LIST_EXPANDED) - message(STATUS "COMPILE_DEFINITIONS list expanded correctly") -else() - string(REPLACE "\n" "\n " output " ${output}") - message(SEND_ERROR "COMPILE_DEFINITIONS list did not expand correctly\n${output}") -endif() - -try_compile(SHOULD_FAIL_DUE_TO_BAD_SOURCE - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/pass.c - OUTPUT_VARIABLE output - COMPILE_DEFINITIONS "bad#source.c" - ) -if(SHOULD_FAIL_DUE_TO_BAD_SOURCE AND NOT CMAKE_GENERATOR MATCHES "Watcom WMake|NMake Makefiles") - string(REPLACE "\n" "\n " output " ${output}") - message(SEND_ERROR "try_compile with bad#source.c did not fail:\n${output}") -elseif(NOT output MATCHES [[(bad#source\.c|bad\.c|bad')]]) - string(REPLACE "\n" "\n " output " ${output}") - message(SEND_ERROR "try_compile with bad#source.c failed without mentioning bad source:\n${output}") -else() - message(STATUS "try_compile with bad#source.c correctly failed") -endif() +# try to compile a project (new signature) +message("Testing try_compile project mode (new signature)") +try_compile(TEST_INNER + PROJECT TryCompileInner + SOURCE_DIR ${TryCompile_SOURCE_DIR}/Inner + TARGET innerexe + OUTPUT_VARIABLE output) +TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}") add_executable(TryCompile pass.c) -###################################### - -# now two tests for try_run() - -# try to run a file that should compile and run without error -# also check that OUTPUT_VARIABLE contains both the compile output -# and the run output -try_run(SHOULD_RUN SHOULD_COMPILE - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/exit_success.c - OUTPUT_VARIABLE TRY_OUT) -if(NOT SHOULD_COMPILE) - message(SEND_ERROR "exit_success failed compiling: ${TRY_OUT}") -endif() -if(NOT "${SHOULD_RUN}" STREQUAL "0") - message(SEND_ERROR "exit_success failed running with exit code ${SHOULD_RUN}") -endif() -# check the compile output for the filename -if(NOT "${TRY_OUT}" MATCHES "exit_success") - message(SEND_ERROR " TRY_OUT didn't contain \"exit_success\": \"${TRY_OUT}\"") -endif() -# check the run output -if(NOT "${TRY_OUT}" MATCHES "hello world") - message(SEND_ERROR " TRY_OUT didn't contain \"hello world\": \"${TRY_OUT}\"") -endif() - -try_run(ARG_TEST_RUN ARG_TEST_COMPILE - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/expect_arg.c - OUTPUT_VARIABLE TRY_OUT - ARGS arg1 arg2) -if(NOT ARG_TEST_COMPILE) - message(SEND_ERROR "expect_arg failed compiling: ${TRY_OUT}") -endif() -if(NOT "${ARG_TEST_RUN}" STREQUAL "0") - message(SEND_ERROR "expect_arg failed running with exit code ${ARG_TEST_RUN} ${TRY_OUT}") -endif() - -# try to run a file that should compile and run, but return an error -try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/exit_with_error.c - COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT - RUN_OUTPUT_VARIABLE RUN_OUTPUT) - -if(NOT SHOULD_COMPILE) - message(STATUS " exit_with_error failed compiling: ${COMPILE_OUTPUT}") -endif() -if("${SHOULD_EXIT_WITH_ERROR}" STREQUAL "0") - message(SEND_ERROR " exit_with_error passed with exit code ${SHOULD_EXIT_WITH_ERROR}") -endif() - -# check the compile output, it should contain the filename -if(NOT "${COMPILE_OUTPUT}" MATCHES "exit_with_error") - message(SEND_ERROR " COMPILE_OUT didn't contain \"exit_with_error\": \"${COMPILE_OUTPUT}\"") -endif() -#... but not the run time output -if("${COMPILE_OUTPUT}" MATCHES "hello world") - message(SEND_ERROR " COMPILE_OUT contains the run output: \"${COMPILE_OUTPUT}\"") -endif() -# check the run output, it should stdout -if(NOT "${RUN_OUTPUT}" MATCHES "hello world") - message(SEND_ERROR " RUN_OUTPUT didn't contain \"hello world\": \"${RUN_OUTPUT}\"") -endif() - ####################################################################### # # also test that the CHECK_C_SOURCE_COMPILES, CHECK_CXX_SOURCE_COMPILES @@ -382,25 +254,6 @@ if (APPLE) TEST_ASSERT(SIMPLE_OBJCXX_RUN_SHOULD_WORK "CHECK_OBJCXX_SOURCE_RUNS() failed, but should have succeeded") TEST_FAIL(OBJCXX_RUN_SHOULD_FAIL "CHECK_OBJCXX_SOURCE_RUNS() succeeds, but should have failed") TEST_ASSERT(OBJCXX_RUN_SHOULD_WORK "CHECK_OBJCXX_SOURCE_RUNS() failed, but should have succeeded") - - # try to compile a file that should compile - try_compile(SHOULD_PASS - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/pass.m - OUTPUT_VARIABLE TRY_OUT) - if(NOT SHOULD_PASS) - message(SEND_ERROR "should pass failed ${TRY_OUT}") - endif() - - # try to compile a file that should not compile - try_compile(SHOULD_FAIL - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/fail.m - OUTPUT_VARIABLE TRY_OUT) - if(SHOULD_FAIL) - message(SEND_ERROR "Should fail passed ${TRY_OUT}") - endif() - endif() ####################################################################### diff --git a/Tests/TryCompile/exit_with_error.c b/Tests/TryCompile/exit_with_error.c index f3c523d..dbddcf5 100644 --- a/Tests/TryCompile/exit_with_error.c +++ b/Tests/TryCompile/exit_with_error.c @@ -3,5 +3,5 @@ int main() { printf("hello world\n"); - return -1; + return 1; } diff --git a/Tests/TryCompile/old_and_new_signature_tests.cmake b/Tests/TryCompile/old_and_new_signature_tests.cmake new file mode 100644 index 0000000..997a5a3 --- /dev/null +++ b/Tests/TryCompile/old_and_new_signature_tests.cmake @@ -0,0 +1,224 @@ +# try to compile a file that should compile +try_compile(SHOULD_PASS + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE TRY_OUT) +EXPECT_PASS(SHOULD_PASS "${TRY_OUT}") + +# try to compile a file that should compile +# also check that COPY_FILE works +try_compile(SHOULD_PASS + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE TRY_OUT + COPY_FILE ${TryCompile_BINARY_DIR}/CopyOfPass + ) +EXPECT_PASS(SHOULD_PASS "${TRY_OUT}") + +if(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass") + message(SEND_ERROR "COPY_FILE to \"${TryCompile_BINARY_DIR}/CopyOfPass\" failed") +else() + file(REMOVE "${TryCompile_BINARY_DIR}/CopyOfPass") +endif() + +# try to compile a file that should compile +# also check that COPY_FILE_ERROR works +file(WRITE ${TryCompile_BINARY_DIR}/invalid "") +try_compile(SHOULD_PASS + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE TRY_OUT + COPY_FILE ${TryCompile_BINARY_DIR}/invalid/path + COPY_FILE_ERROR _captured + ) +EXPECT_PASS(SHOULD_PASS "${TRY_OUT}") + +if(NOT _captured MATCHES "Cannot copy output executable.*/invalid/path") + message(SEND_ERROR "COPY_FILE_ERROR did not capture expected message") +endif() + +# try to compile a file that should not compile +try_compile(SHOULD_FAIL + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/fail.c + OUTPUT_VARIABLE TRY_OUT) +EXPECT_FAIL(SHOULD_FAIL "${TRY_OUT}") + +# try to compile two files that should compile +try_compile(SHOULD_PASS + ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} + ${TryCompile_SOURCE_DIR}/pass2a.c + ${TryCompile_SOURCE_DIR}/pass2b.cxx + OUTPUT_VARIABLE TRY_OUT) +EXPECT_PASS(SHOULD_PASS "${TRY_OUT}") + +# try to compile two files that should not compile +try_compile(SHOULD_FAIL + ${try_compile_bindir_or_SOURCES} + ${try_compile_redundant_SOURCES} + ${TryCompile_SOURCE_DIR}/fail2a.c + ${TryCompile_SOURCE_DIR}/fail2b.c + OUTPUT_VARIABLE TRY_OUT) +EXPECT_FAIL(SHOULD_FAIL "${TRY_OUT}") + +# try to compile a file that should compile +set(_c_flags "${CMAKE_C_FLAGS}") +if(WATCOM) + string(APPEND CMAKE_C_FLAGS " -dTESTDEF") +else() + string(APPEND CMAKE_C_FLAGS " \"-DTESTDEF\"") +endif() +try_compile(SHOULD_PASS + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/testdef.c + OUTPUT_VARIABLE TRY_OUT) +EXPECT_PASS(SHOULD_PASS "${TRY_OUT}") +set(CMAKE_C_FLAGS "${_c_flags}") + +try_compile(CMAKE_ANSI_FOR_SCOPE + ${try_compile_bindir_or_SOURCES} + ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT) +if(CMAKE_ANSI_FOR_SCOPE) + message("Compiler supports ansi for") +else() + message("Compiler does not support ansi for scope") +endif() + +message("use the module now") +include(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake) +if(CMAKE_ANSI_FOR_SCOPE) + message("Compiler supports ansi for") +else() + message("Compiler does not support ansi for scope") +endif() + +# test that COMPILE_DEFINITIONS are correctly expanded +try_compile(COMPILE_DEFINITIONS_LIST_EXPANDED + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/check_a_b.c + OUTPUT_VARIABLE output + COMPILE_DEFINITIONS "-DDEF_A;-DDEF_B" + ) +if(COMPILE_DEFINITIONS_LIST_EXPANDED) + message(STATUS "COMPILE_DEFINITIONS list expanded correctly") +else() + string(REPLACE "\n" "\n " output " ${output}") + message(SEND_ERROR "COMPILE_DEFINITIONS list did not expand correctly\n${output}") +endif() + +# try to compile a file that doesn't exist +try_compile(SHOULD_FAIL_DUE_TO_BAD_SOURCE + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE output + COMPILE_DEFINITIONS "bad#source.c" + ) +if(SHOULD_FAIL_DUE_TO_BAD_SOURCE AND NOT CMAKE_GENERATOR MATCHES "Watcom WMake|NMake Makefiles") + string(REPLACE "\n" "\n " output " ${output}") + message(SEND_ERROR "try_compile with bad#source.c did not fail:\n${output}") +elseif(NOT output MATCHES [[(bad#source\.c|bad\.c|bad')]]) + string(REPLACE "\n" "\n " output " ${output}") + message(SEND_ERROR "try_compile with bad#source.c failed without mentioning bad source:\n${output}") +else() + message(STATUS "try_compile with bad#source.c correctly failed") +endif() + +if(APPLE) + # try to compile a file that should compile + try_compile(SHOULD_PASS + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/pass.m + OUTPUT_VARIABLE TRY_OUT) + EXPECT_PASS(SHOULD_PASS "${TRY_OUT}") + + # try to compile a file that should not compile + try_compile(SHOULD_FAIL + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/fail.m + OUTPUT_VARIABLE TRY_OUT) + EXPECT_FAIL(SHOULD_FAIL "${TRY_OUT}") +endif() + +###################################### + +# now test try_run() + +# try to run a file that should compile and run without error +# also check that OUTPUT_VARIABLE contains both the compile output +# and the run output +try_run(SHOULD_RUN SHOULD_COMPILE + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/exit_success.c + ${try_compile_output_vars}) +EXPECT_COMPILED("exit_success" SHOULD_COMPILE "${${try_compile_compile_output_var}}") +EXPECT_RUN_RESULT("exit_success" SHOULD_RUN 0) + +# check the compile output for the filename +if(NOT "${${try_compile_compile_output_var}}" MATCHES "exit_success") + message(SEND_ERROR + " ${try_compile_compile_output_var} didn't contain \"exit_success\":" + " \"${${try_compile_compile_output_var}}\"") +endif() +# check the run output +if(NOT "${${try_compile_run_output_var}}" MATCHES "hello world") + message(SEND_ERROR + " ${try_compile_run_output_var} didn't contain \"hello world\":" + " \"${${try_compile_run_output_var}}\"") +endif() + +try_run(ARG_TEST_RUN ARG_TEST_COMPILE + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/expect_arg.c + COMPILE_OUTPUT_VARIABLE TRY_OUT + ARGS arg1 arg2) +EXPECT_COMPILED("expect_arg" ARG_TEST_COMPILE "${TRY_OUT}") +EXPECT_RUN_RESULT("expect_arg" ARG_TEST_RUN 0) + +# try to run a file that should compile and run, but return an error +try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/exit_with_error.c + COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT + RUN_OUTPUT_VARIABLE RUN_OUTPUT) +EXPECT_COMPILED("exit_with_error" SHOULD_COMPILE "${COMPILE_OUTPUT}") +EXPECT_RUN_RESULT("exit_with_error" SHOULD_EXIT_WITH_ERROR 1) + +# check the compile output, it should contain the filename +if(NOT "${COMPILE_OUTPUT}" MATCHES "exit_with_error") + message(SEND_ERROR " COMPILE_OUT didn't contain \"exit_with_error\": \"${COMPILE_OUTPUT}\"") +endif() +#... but not the run time output +if("${COMPILE_OUTPUT}" MATCHES "hello world") + message(SEND_ERROR " COMPILE_OUT contains the run output: \"${COMPILE_OUTPUT}\"") +endif() +# check the run output, it should contain stdout +if(NOT "${RUN_OUTPUT}" MATCHES "hello world") + message(SEND_ERROR " RUN_OUTPUT didn't contain \"hello world\": \"${RUN_OUTPUT}\"") +endif() + +# try to run a file and parse stdout and stderr separately +# also check that COPY_FILE works +try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE + ${try_compile_bindir_or_SOURCES} + ${TryCompile_SOURCE_DIR}/stdout_and_stderr.c + COPY_FILE ${TryCompile_BINARY_DIR}/CopyOfRun + COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT + RUN_OUTPUT_STDOUT_VARIABLE RUN_OUTPUT_STDOUT + RUN_OUTPUT_STDERR_VARIABLE RUN_OUTPUT_STDERR) +EXPECT_PASS(SHOULD_COMPILE "${COMPILE_OUTPUT}") + +if(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfRun") + message(SEND_ERROR "COPY_FILE to \"${TryCompile_BINARY_DIR}/CopyOfRun\" failed") +else() + file(REMOVE "${TryCompile_BINARY_DIR}/CopyOfRun") +endif() + +# check the run stdout output +if(NOT "${RUN_OUTPUT_STDOUT}" MATCHES "hello world") + message(SEND_ERROR " RUN_OUTPUT_STDOUT didn't contain \"hello world\": \"${RUN_OUTPUT_STDOUT}\"") +endif() +# check the run stderr output +if(NOT "${RUN_OUTPUT_STDERR}" MATCHES "error") + message(SEND_ERROR " RUN_OUTPUT_STDERR didn't contain \"error\": \"${RUN_OUTPUT_STDERR}\"") +endif() diff --git a/Tests/TryCompile/stdout_and_stderr.c b/Tests/TryCompile/stdout_and_stderr.c new file mode 100644 index 0000000..84ded1f --- /dev/null +++ b/Tests/TryCompile/stdout_and_stderr.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +int main() +{ + fputs("error\n", stderr); + puts("hello world\n"); + return 0; +} diff --git a/Tests/VSGNUFortran/CMakeLists.txt b/Tests/VSGNUFortran/CMakeLists.txt index 993d0d6..2b4f4fa 100644 --- a/Tests/VSGNUFortran/CMakeLists.txt +++ b/Tests/VSGNUFortran/CMakeLists.txt @@ -11,7 +11,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") # to be in the same directory. get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) - foreach(config ${CMAKE_CONFIGURATION_TYPES}) + foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES) string(TOUPPER "${config}" config) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${config} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) diff --git a/Tests/VSWinStorePhone/VerifyAppPackage.cmake b/Tests/VSWinStorePhone/VerifyAppPackage.cmake index f9440d7..52e8a54 100644 --- a/Tests/VSWinStorePhone/VerifyAppPackage.cmake +++ b/Tests/VSWinStorePhone/VerifyAppPackage.cmake @@ -26,7 +26,7 @@ if(NOT result EQUAL 0) message(FATAL_ERROR "Listing app package content failed with: ${error}") endif() -foreach(app_pkg_item ${EXPECTED_APP_PKG_CONTENT}) +foreach(app_pkg_item IN LISTS EXPECTED_APP_PKG_CONTENT) string(FIND ${APP_PKG_CONTENT_OUTPUT} ${app_pkg_item} _found) if(_found EQUAL -1) message(FATAL_ERROR "Generated app package is missing an expected item: ${app_pkg_item}") |