diff options
Diffstat (limited to 'Tests')
280 files changed, 2009 insertions, 242 deletions
diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index 0a2c819..1b7e57d 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required (VERSION 3.8) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() project(Assembler C) message("CTEST_FULL_OUTPUT ") set(CMAKE_VERBOSE_MAKEFILE 1) @@ -9,7 +12,7 @@ set(SRCS) # and also generate assembler files from C: if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ";") - if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID MATCHES "Intel" AND UNIX) + if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|LCC|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID MATCHES "Intel" AND UNIX) AND NOT (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")) set(C_FLAGS "${CMAKE_C_FLAGS}") separate_arguments(C_FLAGS) diff --git a/Tests/BundleTest/BundleLib.cxx b/Tests/BundleTest/BundleLib.cxx index d25ad27..cfb5f7d 100644 --- a/Tests/BundleTest/BundleLib.cxx +++ b/Tests/BundleTest/BundleLib.cxx @@ -20,7 +20,8 @@ int findBundleFile(char* exec, const char* file) { int res; char* nexec = strdup(exec); - char* fpath = (char*)malloc(strlen(exec) + 100); + size_t fpathlen = strlen(nexec) + 1 + strlen(file); + char* fpath = (char*)malloc(fpathlen); int cc; int cnt = 0; printf("Process executable name: %s\n", exec); @@ -36,7 +37,7 @@ int findBundleFile(char* exec, const char* file) } } printf("Process executable path: %s\n", nexec); - sprintf(fpath, "%s/%s", nexec, file); + snprintf(fpath, fpathlen, "%s/%s", nexec, file); printf("Check for file: %s\n", fpath); res = fileExists(fpath); free(nexec); diff --git a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt index b28d0be..a6b3ffe 100644 --- a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt @@ -1,12 +1,16 @@ cmake_minimum_required(VERSION 2.8.12) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() + project(add_compile_options) add_compile_options(-DTEST_OPTION) add_executable(add_compile_options main.cpp) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC") target_compile_definitions(add_compile_options PRIVATE "DO_GNU_TESTS" diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 268c7eb..869a941 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -1,20 +1,24 @@ cmake_minimum_required(VERSION 2.8.12) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() + project(target_compile_options) add_executable(target_compile_options "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" ) target_compile_options(target_compile_options - PRIVATE $<$<CXX_COMPILER_ID:AppleClang,Clang,GNU>:-DMY_PRIVATE_DEFINE> - PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,GNU>:-DMY_PUBLIC_DEFINE> - PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>:-DMY_MUTLI_COMP_PUBLIC_DEFINE> - INTERFACE $<$<CXX_COMPILER_ID:GNU>:-DMY_INTERFACE_DEFINE> - INTERFACE $<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-DMY_MULTI_COMP_INTERFACE_DEFINE> + PRIVATE $<$<CXX_COMPILER_ID:AppleClang,Clang,GNU,LCC>:-DMY_PRIVATE_DEFINE> + PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,GNU,LCC>:-DMY_PUBLIC_DEFINE> + PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,GNU,LCC,Clang,AppleClang>:-DMY_MUTLI_COMP_PUBLIC_DEFINE> + INTERFACE $<$<CXX_COMPILER_ID:GNU,LCC>:-DMY_INTERFACE_DEFINE> + INTERFACE $<$<CXX_COMPILER_ID:GNU,LCC,Clang,AppleClang>:-DMY_MULTI_COMP_INTERFACE_DEFINE> ) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC") target_compile_definitions(target_compile_options PRIVATE "DO_GNU_TESTS" @@ -47,10 +51,10 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio") endif() target_compile_options(consumer - PRIVATE $<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:$<TARGET_PROPERTY:target_compile_options,INTERFACE_COMPILE_OPTIONS>> + PRIVATE $<$<CXX_COMPILER_ID:GNU,LCC,Clang,AppleClang>:$<TARGET_PROPERTY:target_compile_options,INTERFACE_COMPILE_OPTIONS>> ) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC") target_compile_definitions(consumer PRIVATE "DO_GNU_TESTS" diff --git a/Tests/CMakeCommands/target_link_directories/CMakeLists.txt b/Tests/CMakeCommands/target_link_directories/CMakeLists.txt index bc7b9b2..a5f69f3 100644 --- a/Tests/CMakeCommands/target_link_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_directories/CMakeLists.txt @@ -10,31 +10,31 @@ target_link_directories(target_link_directories PRIVATE) add_library(target_link_directories_2 SHARED EXCLUDE_FROM_ALL LinkDirectoriesLib.c) target_link_directories(target_link_directories_2 PRIVATE /private/dir INTERFACE /interface/dir) get_target_property(result target_link_directories_2 LINK_DIRECTORIES) -if (NOT result MATCHES "/private/dir") +if (NOT result STREQUAL "/private/dir") message(SEND_ERROR "${result} target_link_directories not populated the LINK_DIRECTORIES target property") endif() get_target_property(result target_link_directories_2 INTERFACE_LINK_DIRECTORIES) -if (NOT result MATCHES "/interface/dir") +if (NOT result STREQUAL "/interface/dir") message(SEND_ERROR "target_link_directories not populated the INTERFACE_LINK_DIRECTORIES target property of shared library") endif() add_library(target_link_directories_3 STATIC EXCLUDE_FROM_ALL LinkDirectoriesLib.c) target_link_directories(target_link_directories_3 INTERFACE /interface/dir) get_target_property(result target_link_directories_3 INTERFACE_LINK_DIRECTORIES) -if (NOT result MATCHES "/interface/dir") +if (NOT result STREQUAL "/interface/dir") message(SEND_ERROR "target_link_directories not populated the INTERFACE_LINK_DIRECTORIES target property of static library") endif() add_library(target_link_directories_4 SHARED EXCLUDE_FROM_ALL LinkDirectoriesLib.c) target_link_directories(target_link_directories_4 PRIVATE relative/dir) get_target_property(result target_link_directories_4 LINK_DIRECTORIES) -if (NOT result MATCHES "${CMAKE_CURRENT_SOURCE_DIR}/relative/dir") +if (NOT result STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/relative/dir") message(SEND_ERROR "target_link_directories not populated the LINK_DIRECTORIES with relative path") endif() add_subdirectory(subdir) target_link_directories(target_link_directories_5 PRIVATE relative/dir) get_target_property(result target_link_directories_5 LINK_DIRECTORIES) -if (NOT result MATCHES "${CMAKE_CURRENT_SOURCE_DIR}/relative/dir") +if (NOT result STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/relative/dir") message(SEND_ERROR "target_link_directories not populated the LINK_DIRECTORIES with relative path") endif() diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index 07ec4e3..52080bd 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -3,6 +3,10 @@ # 2.8.12 cmake_minimum_required(VERSION 2.8) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() + project(target_link_libraries) file(WRITE diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt index 741c73e..83103cf 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt @@ -25,7 +25,7 @@ target_link_libraries(staticlib1 LINK_PUBLIC staticlib2) # Try adding a private link item to be propagated out of a static lib. set(private_link "") -if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang) +if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES LCC) if (CMAKE_SYSTEM_NAME STREQUAL "SunOS") set(private_link "-Wl,-V") else() diff --git a/Tests/CMakeLib/testCTestBinPacker.cxx b/Tests/CMakeLib/testCTestBinPacker.cxx index abdbefb..772f417 100644 --- a/Tests/CMakeLib/testCTestBinPacker.cxx +++ b/Tests/CMakeLib/testCTestBinPacker.cxx @@ -224,7 +224,7 @@ static const std::vector<AllocationComparison> comparisons{ /* clang-format on */ }; -bool TestExpectedPackResult(const ExpectedPackResult& expected) +static bool TestExpectedPackResult(const ExpectedPackResult& expected) { std::vector<cmCTestBinPackerAllocation> roundRobinAllocations; roundRobinAllocations.reserve(expected.SlotsNeeded.size()); diff --git a/Tests/CMakeLib/testCTestResourceAllocator.cxx b/Tests/CMakeLib/testCTestResourceAllocator.cxx index 33d6b91..72e06e5 100644 --- a/Tests/CMakeLib/testCTestResourceAllocator.cxx +++ b/Tests/CMakeLib/testCTestResourceAllocator.cxx @@ -12,7 +12,7 @@ static const cmCTestResourceSpec spec{ { { /* clang-format on */ } } }; -bool testInitializeFromResourceSpec() +static bool testInitializeFromResourceSpec() { bool retval = true; @@ -39,7 +39,7 @@ bool testInitializeFromResourceSpec() return retval; } -bool testAllocateResource() +static bool testAllocateResource() { bool retval = true; @@ -216,7 +216,7 @@ bool testAllocateResource() return retval; } -bool testDeallocateResource() +static bool testDeallocateResource() { bool retval = true; @@ -370,7 +370,7 @@ bool testDeallocateResource() return retval; } -bool testResourceFree() +static bool testResourceFree() { bool retval = true; diff --git a/Tests/CMakeLib/testCTestResourceGroups.cxx b/Tests/CMakeLib/testCTestResourceGroups.cxx index c3532a6..776d65d 100644 --- a/Tests/CMakeLib/testCTestResourceGroups.cxx +++ b/Tests/CMakeLib/testCTestResourceGroups.cxx @@ -104,7 +104,7 @@ static const std::vector<ExpectedParseResult> expectedResults{ /* clang-format on */ }; -bool TestExpectedParseResult(const ExpectedParseResult& expected) +static bool TestExpectedParseResult(const ExpectedParseResult& expected) { std::vector<std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>> result; diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx index 9d4b72a..2007fff 100644 --- a/Tests/CMakeLib/testOptional.cxx +++ b/Tests/CMakeLib/testOptional.cxx @@ -116,7 +116,7 @@ public: # define END_IGNORE_UNINITIALIZED #endif -void swap(EventLogger& e1, EventLogger& e2) +static void swap(EventLogger& e1, EventLogger& e2) { BEGIN_IGNORE_UNINITIALIZED events.push_back({ Event::SWAP, &e1, &e2, e2.Value }); @@ -180,37 +180,37 @@ EventLogger& EventLogger::operator=(int value) return *this; } -bool operator==(const EventLogger& lhs, const EventLogger& rhs) +static bool operator==(const EventLogger& lhs, const EventLogger& rhs) { events.push_back({ Event::COMPARE_EE_EQ, &lhs, &rhs, lhs.Value }); return lhs.Value == rhs.Value; } -bool operator!=(const EventLogger& lhs, const EventLogger& rhs) +static bool operator!=(const EventLogger& lhs, const EventLogger& rhs) { events.push_back({ Event::COMPARE_EE_NE, &lhs, &rhs, lhs.Value }); return lhs.Value != rhs.Value; } -bool operator<(const EventLogger& lhs, const EventLogger& rhs) +static bool operator<(const EventLogger& lhs, const EventLogger& rhs) { events.push_back({ Event::COMPARE_EE_LT, &lhs, &rhs, lhs.Value }); return lhs.Value < rhs.Value; } -bool operator<=(const EventLogger& lhs, const EventLogger& rhs) +static bool operator<=(const EventLogger& lhs, const EventLogger& rhs) { events.push_back({ Event::COMPARE_EE_LE, &lhs, &rhs, lhs.Value }); return lhs.Value <= rhs.Value; } -bool operator>(const EventLogger& lhs, const EventLogger& rhs) +static bool operator>(const EventLogger& lhs, const EventLogger& rhs) { events.push_back({ Event::COMPARE_EE_GT, &lhs, &rhs, lhs.Value }); return lhs.Value > rhs.Value; } -bool operator>=(const EventLogger& lhs, const EventLogger& rhs) +static bool operator>=(const EventLogger& lhs, const EventLogger& rhs) { events.push_back({ Event::COMPARE_EE_GE, &lhs, &rhs, lhs.Value }); return lhs.Value >= rhs.Value; diff --git a/Tests/CMakeLib/testRST.cxx b/Tests/CMakeLib/testRST.cxx index 28d80a5..77f2a66 100644 --- a/Tests/CMakeLib/testRST.cxx +++ b/Tests/CMakeLib/testRST.cxx @@ -8,7 +8,8 @@ #include "cmRST.h" #include "cmSystemTools.h" -void reportLine(std::ostream& os, bool ret, std::string const& line, bool eol) +static void reportLine(std::ostream& os, bool ret, std::string const& line, + bool eol) { if (ret) { os << "\"" << line << "\" (" << (eol ? "with EOL" : "without EOL") << ")"; diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index a003205..c924083 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -64,14 +64,15 @@ bool operator==(const cmUVProcessChain::Status* actual, return true; } -bool resultsMatch(const std::vector<const cmUVProcessChain::Status*>& actual, - const std::vector<ExpectedStatus>& expected) +static bool resultsMatch( + const std::vector<const cmUVProcessChain::Status*>& actual, + const std::vector<ExpectedStatus>& expected) { return actual.size() == expected.size() && std::equal(actual.begin(), actual.end(), expected.begin()); } -std::string getInput(std::istream& input) +static std::string getInput(std::istream& input) { char buffer[1024]; std::ostringstream str; @@ -103,8 +104,9 @@ std::ostream& operator<<( return func(stream); } -void printResults(const std::vector<const cmUVProcessChain::Status*>& actual, - const std::vector<ExpectedStatus>& expected) +static void printResults( + const std::vector<const cmUVProcessChain::Status*>& actual, + const std::vector<ExpectedStatus>& expected) { std::cout << "Expected: " << std::endl; for (auto const& e : expected) { @@ -129,8 +131,8 @@ void printResults(const std::vector<const cmUVProcessChain::Status*>& actual, } } -bool checkExecution(cmUVProcessChainBuilder& builder, - std::unique_ptr<cmUVProcessChain>& chain) +static bool checkExecution(cmUVProcessChainBuilder& builder, + std::unique_ptr<cmUVProcessChain>& chain) { std::vector<const cmUVProcessChain::Status*> status; @@ -171,7 +173,7 @@ bool checkExecution(cmUVProcessChainBuilder& builder, return true; } -bool checkOutput(std::istream& outputStream, std::istream& errorStream) +static bool checkOutput(std::istream& outputStream, std::istream& errorStream) { std::string output = getInput(outputStream); if (output != "HELO WRD!") { diff --git a/Tests/CMakeLib/testUVProcessChainHelper.cxx b/Tests/CMakeLib/testUVProcessChainHelper.cxx index 9c25834..bc0ef8e 100644 --- a/Tests/CMakeLib/testUVProcessChainHelper.cxx +++ b/Tests/CMakeLib/testUVProcessChainHelper.cxx @@ -7,7 +7,7 @@ #include <string> #include <thread> -std::string getStdin() +static std::string getStdin() { char buffer[1024]; std::ostringstream str; diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx index 7d21959..fd88e24 100644 --- a/Tests/CMakeLib/testUVRAII.cxx +++ b/Tests/CMakeLib/testUVRAII.cxx @@ -221,10 +221,15 @@ static bool testLoopDestructor() int testUVRAII(int, char** const) { - if ((testAsyncShutdown() && - testAsyncDtor() & testAsyncMove() & testCrossAssignment() & - testAllMoves() & testLoopReset() & testLoopDestructor()) == 0) { + if (!testAsyncShutdown()) { return -1; } - return 0; + bool passed = true; + passed = testAsyncDtor() && passed; + passed = testAsyncMove() && passed; + passed = testCrossAssignment() && passed; + passed = testAllMoves() && passed; + passed = testLoopReset() && passed; + passed = testLoopDestructor() && passed; + return passed ? 0 : -1; } diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx index b86ed76..760fa29 100644 --- a/Tests/CMakeLib/testUVStreambuf.cxx +++ b/Tests/CMakeLib/testUVStreambuf.cxx @@ -15,9 +15,10 @@ #define TEST_STR_LINE_3 "with libuv's uv_stream_t." #define TEST_STR TEST_STR_LINE_1 "\n" TEST_STR_LINE_2 "\n" TEST_STR_LINE_3 -bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, - char* outputData, unsigned int outputDataLength, - const char* /* unused */) +static bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, + char* outputData, + unsigned int outputDataLength, + const char* /* unused */) { int err; @@ -66,9 +67,11 @@ bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, return true; } -bool writeDataToStreamProcess(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, - char* outputData, unsigned int /* unused */, - const char* cmakeCommand) +static bool writeDataToStreamProcess(uv_loop_t& loop, + cm::uv_pipe_ptr& inputPipe, + char* outputData, + unsigned int /* unused */, + const char* cmakeCommand) { int err; @@ -130,7 +133,7 @@ bool writeDataToStreamProcess(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, return true; } -bool testUVStreambufRead( +static bool testUVStreambufRead( bool (*cb)(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, char* outputData, unsigned int outputDataLength, const char* cmakeCommand), const char* cmakeCommand) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8b38080..b1f473b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -531,8 +531,8 @@ if(BUILD_TESTING) if (NOT CMAKE_GENERATOR STREQUAL "Xcode") ADD_TEST_MACRO(SourceFileIncludeDirProperty SourceFileIncludeDirProperty) endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL GNU - AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) + if(CMAKE_CXX_COMPILER_ID STREQUAL "LCC" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)) set(runCxxDialectTest 1) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL Clang @@ -670,7 +670,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader) - if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + 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() @@ -687,9 +687,10 @@ if(BUILD_TESTING) ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets) endif() - if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND + if(CMAKE_CXX_COMPILER_ID MATCHES "LCC" OR + ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND (NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.2) AND - (CMAKE_SYSTEM_NAME MATCHES "Linux")) + (CMAKE_SYSTEM_NAME MATCHES "Linux"))) include(CheckCXXCompilerFlag) check_cxx_compiler_flag( @@ -2011,7 +2012,7 @@ if(BUILD_TESTING) set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1) # Test static linking on toolchains known to support it. - if(CMAKE_C_COMPILER_ID STREQUAL "GNU" + if((CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC") AND NOT APPLE AND NOT WIN32 AND NOT CYGWIN AND EXISTS "/usr/lib/libm.a") add_test(LinkStatic ${CMAKE_CTEST_COMMAND} @@ -2026,7 +2027,7 @@ if(BUILD_TESTING) ) endif() - if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode") + if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode" AND NOT CMAKE_GENERATOR STREQUAL "Watcom WMake") add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDirSpaces" @@ -3665,6 +3666,7 @@ if(BUILD_TESTING) if(CMAKE_GENERATOR MATCHES "^((Unix|MSYS) Makefiles|Ninja)$" AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.4) OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + OR (CMAKE_CXX_COMPILER_ID STREQUAL "LCC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))) add_test(IncludeDirectoriesCPATH ${CMAKE_CTEST_COMMAND} --build-and-test diff --git a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt index aca99ce..c7e3105 100644 --- a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required(VERSION 2.8.12) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() project(CheckCXXCompilerFlag) message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") @@ -57,7 +60,7 @@ else() message("Unhandled Platform") endif() -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") check_cxx_compiler_flag("-x c++" HAVE_X_CXX) if(NOT HAVE_X_CXX) message(FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed") diff --git a/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt b/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt index 9a9bb2a..3d65b7a 100644 --- a/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt @@ -48,4 +48,15 @@ if (CMAKE_COMPILER_IS_GNUCC) if (CSE_RESULT_O3) message(SEND_ERROR "CheckSymbolExists reported a nonexistent symbol as existing with optimization -O3") endif () + + string(APPEND CMAKE_C_FLAGS " -pedantic-errors") + unset(CS_RESULT_PEDANTIC_ERRORS CACHE) + message(STATUS "Testing with -pedantic-errors") + + check_symbol_exists(fopen "stdio.h" CSE_RESULT_PEDANTIC_ERRORS) + + if(NOT CSE_RESULT_PEDANTIC_ERRORS) + message(SEND_ERROR "CheckSymbolExists reported an existing symbol as nonexisting with -pedantic-errors") + endif() + endif () diff --git a/Tests/CTestTestCrash/crash.cxx b/Tests/CTestTestCrash/crash.cxx index 370c3fb..88d4b1d 100644 --- a/Tests/CTestTestCrash/crash.cxx +++ b/Tests/CTestTestCrash/crash.cxx @@ -1,6 +1,6 @@ // causes a segfault int main() { - int* ptr = 0; + volatile int* ptr = 0; *ptr = 1; } diff --git a/Tests/CompileFeatures/cxx_generalized_initializers.cpp b/Tests/CompileFeatures/cxx_generalized_initializers.cpp index bfe0d41..c4f47fe 100644 --- a/Tests/CompileFeatures/cxx_generalized_initializers.cpp +++ b/Tests/CompileFeatures/cxx_generalized_initializers.cpp @@ -11,8 +11,11 @@ class initializer_list const _E* __begin_; size_t __size_; -#ifdef __INTEL_COMPILER - // The Intel compiler internally asserts the constructor overloads, so +#if defined(__INTEL_COMPILER) || \ + (defined(__LCC__) && \ + (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))) + // Compilers based on EDG, such as Intel compiler and MCST LCC, + // internally assert the constructor overloads, so // reproduce the constructor used in its <initializer_list> header. initializer_list(const _E*, size_t) {} #else diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 1bedac0..0fbfb83 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.0) if(POLICY CMP0092) cmake_policy(SET CMP0092 NEW) endif() +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build" FORCE) @@ -30,8 +33,8 @@ endif() set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS "-DTEST_DEFINE" "-DNEEDS_ESCAPE=\"E$CAPE\"" - "$<$<CXX_COMPILER_ID:GNU>:-DTEST_DEFINE_GNU>" - "$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-DTEST_DEFINE_CXX_AND_GNU>" + "$<$<CXX_COMPILER_ID:GNU,LCC>:-DTEST_DEFINE_GNU>" + "$<$<COMPILE_LANG_AND_ID:CXX,GNU,LCC>:-DTEST_DEFINE_CXX_AND_GNU>" "SHELL:" # produces no options ${c_tests} ${cxx_tests} @@ -49,15 +52,15 @@ else() ) endif() -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland|Embarcadero" AND NOT "${CMAKE_GENERATOR}" MATCHES "NMake Makefiles") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang|Borland|Embarcadero" AND NOT "${CMAKE_GENERATOR}" MATCHES "NMake Makefiles") set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS "-DTEST_OCTOTHORPE=\"#\"" ) endif() -if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|AppleClang|MSVC)$") +if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|LCC|AppleClang|MSVC)$") target_compile_definitions(CompileOptions PRIVATE "DO_FLAG_TESTS") - if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|AppleClang)$") + if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|LCC|AppleClang)$") string(APPEND CMAKE_CXX_FLAGS " -w") endif() string(APPEND CMAKE_CXX_FLAGS " -DFLAG_A=1 -DFLAG_B=1") @@ -79,7 +82,7 @@ endif() target_link_libraries(CompileOptions testlib) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC") target_compile_definitions(CompileOptions PRIVATE "DO_GNU_TESTS" diff --git a/Tests/CudaOnly/All/CMakeLists.txt b/Tests/CudaOnly/All/CMakeLists.txt new file mode 100644 index 0000000..fe29bb0 --- /dev/null +++ b/Tests/CudaOnly/All/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.20) +project(CudaOnlyAll CUDA) + +if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND + CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.5.0) + + set(compile_options -Wno-deprecated-gpu-targets) + function(verify_output flag output_var) + string(REGEX MATCHALL "-arch compute_([0-9]+)" target_archs "${${output_var}}") + list(LENGTH target_archs count) + if(count LESS 2) + message(FATAL_ERROR "${flag} failed to map to multiple architectures") + endif() + endfunction() +endif() + +if(COMMAND verify_output) + set(try_compile_flags -v ${compile_options}) + + set(CMAKE_CUDA_ARCHITECTURES all) + try_compile(all_archs_compiles + ${CMAKE_CURRENT_BINARY_DIR}/try_compile/all_archs_compiles + ${CMAKE_CURRENT_SOURCE_DIR}/main.cu + COMPILE_DEFINITIONS ${try_compile_flags} + OUTPUT_VARIABLE output + ) + verify_output(all output) + + set(CMAKE_CUDA_ARCHITECTURES all-major) + try_compile(all_major_archs_compiles + ${CMAKE_CURRENT_BINARY_DIR}/try_compile/all_major_archs_compiles + ${CMAKE_CURRENT_SOURCE_DIR}/main.cu + COMPILE_DEFINITIONS ${try_compile_flags} + OUTPUT_VARIABLE output + ) + verify_output(all-major output) + + if(all_archs_compiles AND all_major_archs_compiles) + add_executable(CudaOnlyAll main.cu) + target_compile_options(CudaOnlyAll PRIVATE ${compile_options}) + endif() +else() + add_executable(CudaOnlyAll main.cu) +endif() diff --git a/Tests/CudaOnly/All/main.cu b/Tests/CudaOnly/All/main.cu new file mode 100644 index 0000000..5047a34 --- /dev/null +++ b/Tests/CudaOnly/All/main.cu @@ -0,0 +1,3 @@ +int main() +{ +} diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index a3fb409..cacfb76 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -4,8 +4,10 @@ macro (add_cuda_test_macro name) PROPERTY LABELS "CUDA") endmacro () +add_cuda_test_macro(CudaOnly.All CudaOnlyAll) add_cuda_test_macro(CudaOnly.Architecture Architecture) 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) @@ -16,6 +18,7 @@ add_cuda_test_macro(CudaOnly.WithDefs CudaOnlyWithDefs) add_cuda_test_macro(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine) add_cuda_test_macro(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols) add_cuda_test_macro(CudaOnly.SeparateCompilation main/CudaOnlySeparateCompilation) +add_cuda_test_macro(CudaOnly.SeparateCompilationPTX CudaOnlySeparateCompilationPTX) if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") # Clang doesn't have flags for selecting the runtime. diff --git a/Tests/CudaOnly/ExportPTX/CMakeLists.txt b/Tests/CudaOnly/ExportPTX/CMakeLists.txt index e7e7bc4..f1667af 100644 --- a/Tests/CudaOnly/ExportPTX/CMakeLists.txt +++ b/Tests/CudaOnly/ExportPTX/CMakeLists.txt @@ -56,7 +56,7 @@ add_custom_command( "-DBIN_TO_C_COMMAND=${bin_to_c}" "-DOBJECTS=$<TARGET_OBJECTS:CudaPTX>" "-DOUTPUT=${output_file}" - -P ${CMAKE_CURRENT_SOURCE_DIR}/bin2c_wrapper.cmake + -P ${CMAKE_CURRENT_SOURCE_DIR}/../utils/bin2c_wrapper.cmake VERBATIM DEPENDS $<TARGET_OBJECTS:CudaPTX> COMMENT "Converting Object files to a C header" diff --git a/Tests/CudaOnly/SeparateCompilationPTX/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilationPTX/CMakeLists.txt new file mode 100644 index 0000000..273f955 --- /dev/null +++ b/Tests/CudaOnly/SeparateCompilationPTX/CMakeLists.txt @@ -0,0 +1,51 @@ +cmake_minimum_required(VERSION 3.19) +project (SeparateCompPTX CUDA) + +#Goal for this example: +# How to generate PTX files with RDC enabled + +# PTX can be compiled only for a single virtual architecture at a time +list(POP_FRONT CMAKE_CUDA_ARCHITECTURES temp) +set(CMAKE_CUDA_ARCHITECTURES ${temp}) +string(APPEND CMAKE_CUDA_ARCHITECTURES "-virtual") + +add_library(CudaPTX OBJECT kernels.cu) +set_property(TARGET CudaPTX PROPERTY CUDA_PTX_COMPILATION ON) +set_property(TARGET CudaPTX PROPERTY CUDA_SEPARABLE_COMPILATION ON) + + +set(output_file ${CMAKE_CURRENT_BINARY_DIR}/embedded_objs.h) + +find_package(CUDAToolkit REQUIRED) +find_program(bin_to_c + NAMES bin2c + PATHS ${CUDAToolkit_BIN_DIR} + ) +if(NOT bin_to_c) + message(FATAL_ERROR + "bin2c not found:\n" + " CUDAToolkit_BIN_DIR='${CUDAToolkit_BIN_DIR}'\n" + ) +endif() + +add_custom_command( + OUTPUT "${output_file}" + COMMAND ${CMAKE_COMMAND} + "-DBIN_TO_C_COMMAND=${bin_to_c}" + "-DOBJECTS=$<TARGET_OBJECTS:CudaPTX>" + "-DOUTPUT=${output_file}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/../utils/bin2c_wrapper.cmake + VERBATIM + DEPENDS $<TARGET_OBJECTS:CudaPTX> + COMMENT "Converting Object files to a C header" + ) + +add_executable(CudaOnlySeparateCompilationPTX main.cu ${output_file}) +target_compile_features(CudaOnlySeparateCompilationPTX PRIVATE cuda_std_11) +target_include_directories(CudaOnlySeparateCompilationPTX PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} ) +target_link_libraries(CudaOnlySeparateCompilationPTX PRIVATE CUDA::cuda_driver) +if(APPLE) + # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime. + set_property(TARGET CudaOnlySeparateCompilationPTX PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) +endif() diff --git a/Tests/CudaOnly/SeparateCompilationPTX/kernels.cu b/Tests/CudaOnly/SeparateCompilationPTX/kernels.cu new file mode 100644 index 0000000..f4a52d4 --- /dev/null +++ b/Tests/CudaOnly/SeparateCompilationPTX/kernels.cu @@ -0,0 +1,14 @@ + +__global__ void kernelA(float* r, float* x, float* y, float* z, int size) +{ + for (int i = threadIdx.x; i < size; i += blockDim.x) { + r[i] = x[i] * y[i] + z[i]; + } +} + +__global__ void kernelB(float* r, float* x, float* y, float* z, int size) +{ + for (int i = threadIdx.x; i < size; i += blockDim.x) { + r[i] = x[i] * y[i] + z[i]; + } +} diff --git a/Tests/CudaOnly/SeparateCompilationPTX/main.cu b/Tests/CudaOnly/SeparateCompilationPTX/main.cu new file mode 100644 index 0000000..164cde5 --- /dev/null +++ b/Tests/CudaOnly/SeparateCompilationPTX/main.cu @@ -0,0 +1,30 @@ +#include <iostream> + +#include <cuda.h> + +#include "embedded_objs.h" + +int main() +{ + cuInit(0); + int count = 0; + cuDeviceGetCount(&count); + if (count == 0) { + std::cerr << "No CUDA devices found\n"; + return 1; + } + + CUdevice device; + cuDeviceGet(&device, 0); + + CUcontext context; + cuCtxCreate(&context, 0, device); + + CUmodule module; + cuModuleLoadData(&module, kernels); + if (module == nullptr) { + std::cerr << "Failed to load the embedded ptx" << std::endl; + return 1; + } + std::cout << module << std::endl; +} diff --git a/Tests/CudaOnly/ExportPTX/bin2c_wrapper.cmake b/Tests/CudaOnly/utils/bin2c_wrapper.cmake index 0baf934..0baf934 100644 --- a/Tests/CudaOnly/ExportPTX/bin2c_wrapper.cmake +++ b/Tests/CudaOnly/utils/bin2c_wrapper.cmake diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index a2968d4..a79efd0 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required (VERSION 2.7.20090711) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() project(Export C CXX) # Pretend that RelWithDebInfo should link to debug libraries to test @@ -145,6 +148,19 @@ set_property(TARGET testLibCycleA PROPERTY LINK_INTERFACE_MULTIPLICITY 3) add_library(testLibNoSONAME SHARED testLibNoSONAME.c) set_property(TARGET testLibNoSONAME PROPERTY NO_SONAME 1) +add_library(testInterfaceIncludeUser INTERFACE) +target_include_directories(testInterfaceIncludeUser + INTERFACE + "$<INSTALL_INTERFACE:include/testInterfaceIncludeUser>" + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/testInterfaceIncludeUser>" +) +set_property(TARGET testInterfaceIncludeUser PROPERTY IMPORTED_NO_SYSTEM 1) +install( + FILES + "${CMAKE_CURRENT_SOURCE_DIR}/include/testInterfaceIncludeUser/testInterfaceInclude.h" + DESTINATION include/testInterfaceIncludeUser +) + cmake_policy(PUSH) cmake_policy(SET CMP0022 NEW) # Test exporting dependent libraries into different exports @@ -286,6 +302,7 @@ set_property(TARGET testSharedLibRequired set_property(TARGET testSharedLibRequired APPEND PROPERTY INTERFACE_COMPILE_OPTIONS $<$<CXX_COMPILER_ID:GNU>:-DCUSTOM_COMPILE_OPTION> + $<$<CXX_COMPILER_ID:LCC>:-DCUSTOM_COMPILE_OPTION> ) add_library(testSharedLibRequiredUser SHARED testSharedLibRequiredUser.cpp) @@ -531,6 +548,7 @@ install( cmp0022NEW cmp0022OLD TopDirLib SubDirLinkA systemlib + testInterfaceIncludeUser EXPORT exp RUNTIME DESTINATION $<1:bin>$<0:/wrong> LIBRARY DESTINATION $<1:lib>$<0:/wrong> NAMELINK_SKIP @@ -590,6 +608,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 cmp0022NEW cmp0022OLD TopDirLib SubDirLinkA systemlib + testInterfaceIncludeUser NAMESPACE bld_ FILE ExportBuildTree.cmake ) diff --git a/Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h b/Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h new file mode 100644 index 0000000..fa882cb --- /dev/null +++ b/Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h @@ -0,0 +1 @@ +/* empty file */ diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 3cb3833..d6cc8d0 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -70,6 +70,10 @@ target_link_libraries(imp_testExe1 exp_testLibPerConfigDest ) +add_library(imp_testInterfaceInclude1 STATIC imp_testInterfaceInclude1.c) +target_include_directories(imp_testInterfaceInclude1 SYSTEM PRIVATE testInterfaceIncludeSystem) +target_link_libraries(imp_testInterfaceInclude1 PRIVATE exp_testInterfaceIncludeUser) + # Try building a plugin to an executable imported from the install tree. add_library(imp_mod1 MODULE imp_mod1.c) target_link_libraries(imp_mod1 exp_testExe2) @@ -110,6 +114,10 @@ target_link_libraries(imp_testExe1b bld_testLibPerConfigDest ) +add_library(imp_testInterfaceInclude1b STATIC imp_testInterfaceInclude1.c) +target_include_directories(imp_testInterfaceInclude1b SYSTEM PRIVATE testInterfaceIncludeSystem) +target_link_libraries(imp_testInterfaceInclude1b PRIVATE bld_testInterfaceIncludeUser) + add_custom_target(check_testLib1_genex ALL COMMAND ${CMAKE_COMMAND} -DtestLib1=$<TARGET_FILE:exp_testLib1> -Dprefix=${CMAKE_INSTALL_PREFIX} @@ -325,14 +333,14 @@ target_compile_definitions(deps_shared_iface $<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH> ) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC") target_compile_definitions(deps_shared_iface PRIVATE "DO_GNU_TESTS" ) endif() -if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") +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() @@ -365,7 +373,7 @@ endif() add_executable(deps_shared_iface2 deps_shared_iface.cpp) target_link_libraries(deps_shared_iface2 bld_testSharedLibDepends bld_subdirlib) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC") target_compile_definitions(deps_shared_iface2 PRIVATE "DO_GNU_TESTS" @@ -413,6 +421,7 @@ endforeach() unset(_configs) if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4) + OR CMAKE_C_COMPILER_ID MATCHES "LCC" OR (CMAKE_C_COMPILER_ID STREQUAL Clang AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")) AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja")) include(CheckCXXCompilerFlag) diff --git a/Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c b/Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c new file mode 100644 index 0000000..88a49b5 --- /dev/null +++ b/Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c @@ -0,0 +1,6 @@ +#include "testInterfaceInclude.h" + +int imp_testInterfaceInclude1(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h b/Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h new file mode 100644 index 0000000..2beeb8b --- /dev/null +++ b/Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h @@ -0,0 +1 @@ +#error testInterfaceInclude.h included from testInterfaceIncludeSystem diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt index 0063130..e6dcd65 100644 --- a/Tests/ExportImport/Import/CMakeLists.txt +++ b/Tests/ExportImport/Import/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required (VERSION 2.7.20090711) cmake_policy(SET CMP0025 NEW) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() project(Import C CXX) # Import everything in a subdirectory. diff --git a/Tests/FindGTest/Test/CMakeLists.txt b/Tests/FindGTest/Test/CMakeLists.txt index 6537238..9c1eb5e 100644 --- a/Tests/FindGTest/Test/CMakeLists.txt +++ b/Tests/FindGTest/Test/CMakeLists.txt @@ -16,3 +16,7 @@ add_executable(test_gtest_var main.cxx) target_include_directories(test_gtest_var PRIVATE ${GTEST_INCLUDE_DIRS}) target_link_libraries(test_gtest_var PRIVATE ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) add_test(NAME test_gtest_var COMMAND test_gtest_var) + +add_executable(test_gmock_tgt main.cxx) +target_link_libraries(test_gmock_tgt GTest::gmock_main) +add_test(NAME test_gmock_tgt COMMAND test_gmock_tgt) diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index 2fc47a5..cdc08c4 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required (VERSION 3.1) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() project(testf C CXX Fortran) message("CTEST_FULL_OUTPUT ") @@ -14,7 +17,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(XL|VisualAge)$") # We do not implement SHARED Fortran libs on AIX yet! # Workaround: Set LINKER_LANGUAGE to C, which uses 'xlc' and Fortran implicits. set(_SHARED STATIC) -elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC") # g77 2.96 does not support shared libs on Itanium because g2c is not -fPIC execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --version OUTPUT_VARIABLE output ERROR_VARIABLE output) @@ -26,7 +29,7 @@ endif() # Pick a module .def file with the properly mangled symbol name. set(world_def "") if(WIN32 AND NOT CYGWIN) - if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC") set(world_def world_gnu.def) elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel" OR CMAKE_GENERATOR MATCHES "Visual Studio") # Intel plugin diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index f00565e..788c5be 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -1,10 +1,15 @@ cmake_minimum_required (VERSION 2.6) -project(IncludeDirectories) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() + +project(IncludeDirectories) if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4) OR (CMAKE_C_COMPILER_ID STREQUAL Clang AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") OR CMAKE_C_COMPILER_ID STREQUAL NVHPC OR CMAKE_C_COMPILER_ID STREQUAL AppleClang + OR CMAKE_C_COMPILER_ID STREQUAL LCC OR ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "19.29.30036.3" AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")) # No support for VS generators yet. @@ -116,6 +121,13 @@ add_library(ordertest ordertest.cpp) target_include_directories(ordertest SYSTEM PUBLIC SystemIncludeDirectories/systemlib) target_include_directories(ordertest PUBLIC SystemIncludeDirectories/userlib) +add_library(ordertest2 ordertest.cpp) +target_include_directories(ordertest2 SYSTEM PRIVATE SystemIncludeDirectories/systemlib) +target_link_libraries(ordertest2 PRIVATE ordertest2_userlib) +add_library(ordertest2_userlib INTERFACE IMPORTED) +target_include_directories(ordertest2_userlib INTERFACE SystemIncludeDirectories/userlib) +set_property(TARGET ordertest2_userlib PROPERTY IMPORTED_NO_SYSTEM 1) + add_subdirectory(StandardIncludeDirectories) add_subdirectory(TargetIncludeDirectories) diff --git a/Tests/LinkStatic/CMakeLists.txt b/Tests/LinkStatic/CMakeLists.txt index 200d4e5..ad3b111 100644 --- a/Tests/LinkStatic/CMakeLists.txt +++ b/Tests/LinkStatic/CMakeLists.txt @@ -1,8 +1,11 @@ cmake_minimum_required(VERSION 2.8.4.20110303 FATAL_ERROR) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() project(LinkStatic C) -if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU") - message(FATAL_ERROR "This test works only with the GNU compiler!") +if(NOT CMAKE_C_COMPILER_ID MATCHES "GNU|LCC") + message(FATAL_ERROR "This test works only with the GNU or LCC compiler!") endif() find_library(MATH_LIBRARY NAMES libm.a) diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index e406758..8898f3b 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required(VERSION 3.1.0) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() project(WriteCompilerDetectionHeader) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -52,7 +55,7 @@ endmacro() # detailed features tables, not just meta-features if (CMAKE_C_COMPILE_FEATURES) - if (NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$") + if (NOT CMAKE_C_COMPILER_ID MATCHES "^(LCC|Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$") set(C_expected_features ${CMAKE_C_COMPILE_FEATURES}) list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]") endif() @@ -95,7 +98,7 @@ if (C_expected_features) endif() if (CMAKE_CXX_COMPILE_FEATURES) - if (NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$") + if (NOT CMAKE_CXX_COMPILER_ID MATCHES "^(LCC|Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$") set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES}) list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") endif() diff --git a/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake b/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake index c74f033..04cd698 100644 --- a/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake +++ b/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake @@ -1,5 +1,10 @@ file(TOUCH "${RunCMake_TEST_BINARY_DIR}/main.c") -foreach(i RANGE 1 20000) +if(RunCMake_GENERATOR STREQUAL "Borland Makefiles") + set(num_headers 2000) +else() + set(num_headers 20000) +endif() +foreach(i RANGE 1 ${num_headers}) file(WRITE "${RunCMake_TEST_BINARY_DIR}/temp_header_file_${i}.h" "#define HEADER_${i} ${i}\n" ) diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 27bbff6..06f416b 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -159,6 +159,7 @@ endif() if ((RunCMake_GENERATOR STREQUAL "Unix Makefiles" AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" + OR CMAKE_C_COMPILER_ID STREQUAL "LCC" OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")) OR (RunCMake_GENERATOR STREQUAL "NMake Makefiles" diff --git a/Tests/RunCMake/CMP0119/RunCMakeTest.cmake b/Tests/RunCMake/CMP0119/RunCMakeTest.cmake index e547ef5..7395827 100644 --- a/Tests/RunCMake/CMP0119/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0119/RunCMakeTest.cmake @@ -12,6 +12,6 @@ if(NOT RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND run_CMP0119(WARN) run_CMP0119(OLD) endif() -if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI)")) +if((CMAKE_C_COMPILER_ID MATCHES "(GNU|LCC|Clang|MSVC|Borland|Embarcadero|Intel|TI)")) run_CMP0119(NEW) endif() diff --git a/Tests/RunCMake/CMP0129/C.cmake b/Tests/RunCMake/CMP0129/C.cmake new file mode 100644 index 0000000..e9ebe90 --- /dev/null +++ b/Tests/RunCMake/CMP0129/C.cmake @@ -0,0 +1,8 @@ +if(SET_CMP0129) + cmake_policy(SET CMP0129 ${SET_CMP0129}) +endif() + +enable_language(C) +set(CMAKE_VERBOSE_MAKEFILE TRUE) +include(CompareCompilerVersion.cmake) +compare_compiler_version(C) diff --git a/Tests/RunCMake/CMP0129/CMakeLists.txt b/Tests/RunCMake/CMP0129/CMakeLists.txt new file mode 100644 index 0000000..d8200fc --- /dev/null +++ b/Tests/RunCMake/CMP0129/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.22) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0129/CXX.cmake b/Tests/RunCMake/CMP0129/CXX.cmake new file mode 100644 index 0000000..ffb81b8 --- /dev/null +++ b/Tests/RunCMake/CMP0129/CXX.cmake @@ -0,0 +1,8 @@ +if(SET_CMP0129) + cmake_policy(SET CMP0129 ${SET_CMP0129}) +endif() + +enable_language(CXX) +set(CMAKE_VERBOSE_MAKEFILE TRUE) +include(CompareCompilerVersion.cmake) +compare_compiler_version(CXX) diff --git a/Tests/RunCMake/CMP0129/CompareCompilerVersion.cmake b/Tests/RunCMake/CMP0129/CompareCompilerVersion.cmake new file mode 100644 index 0000000..e4ba191 --- /dev/null +++ b/Tests/RunCMake/CMP0129/CompareCompilerVersion.cmake @@ -0,0 +1,41 @@ +function(compare_compiler_version lang) + cmake_policy(GET CMP0129 LCC_FALLBACK_MODE) + if(${CMAKE_${lang}_COMPILER} STREQUAL "LCC" OR ${CMAKE_${lang}_COMPILER} STREQUAL "GNU") + execute_process(COMMAND ${CMAKE_${lang}_COMPILER} --version OUTPUT_VARIABLE output) + if("${output}" MATCHES [[lcc:([0-9]+.[0-9]+.([0-9]+)):]]) + set(native_version ${CMAKE_MATCH_1}) + else() + message(FATAL_ERROR "Can not identify native LCC version for language ${lang}.") + endif() + if("${output}" MATCHES [[\(GCC\) ([0-9]+.[0-9]+.([0-9]+)) compatible]]) + set(simulated_version ${CMAKE_MATCH_1}) + else() + message(FATAL_ERROR "Can not identify simulated GNU version for language ${lang}.") + endif() + message(STATUS "Compiler native version is ${native_version}, simulated version is ${simulated_version}.") + if("${LCC_FALLBACK_MODE}" STREQUAL "NEW") + if(NOT "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "LCC") + message(FATAL_ERROR "Policy is in NEW mode, but compiler identification is ${CMAKE_${lang}_COMPILER_ID} instead of LCC.") + endif() + if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" STREQUAL "${native_version}") + message(FATAL_ERROR "Policy is in NEW mode, but compiler version is ${CMAKE_${lang}_COMPILER_VERSION} instead of ${native_version}.") + endif() + if(NOT "${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "GNU") + message(FATAL_ERROR "Policy is in NEW mode, but simulated compiler identification is ${CMAKE_${lang}_SIMULATE_ID} instead of GNU.") + endif() + if(NOT "${CMAKE_${lang}_SIMULATE_VERSION}" STREQUAL "${simulated_version}") + message(FATAL_ERROR "Policy is in NEW mode, but simulated compiler version is ${CMAKE_${lang}_SIMULATE_VERSION} instead of ${simulated_version}.") + endif() + else() + if(NOT "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "GNU") + message(FATAL_ERROR "Policy is in OLD mode, but compiler identification is ${CMAKE_${lang}_COMPILER_ID} instead of GNU.") + endif() + if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" STREQUAL "${simulated_version}") + message(FATAL_ERROR "Policy is in OLD mode, but compiler version is ${CMAKE_${lang}_COMPILER_VERSION} instead of ${simulated_version}.") + endif() + if(${CMAKE_${lang}_SIMULATE_VERSION} OR ${CMAKE_${lang}_SIMULATE_ID) + message(FATAL_ERROR "Policy is in OLD mode, but simulated compiler ID/version is ${CMAKE_${lang}_COMPILER_ID}/${CMAKE_${lang}_COMPILER_VERSION} instead of undefined.") + endif() + endif() + endif() +endfunction() diff --git a/Tests/RunCMake/CMP0129/Fortran.cmake b/Tests/RunCMake/CMP0129/Fortran.cmake new file mode 100644 index 0000000..abaca7e --- /dev/null +++ b/Tests/RunCMake/CMP0129/Fortran.cmake @@ -0,0 +1,15 @@ +include(CheckLanguage) +check_language(Fortran) +if(NOT CMAKE_Fortran_COMPILER) + # No Fortran compiler, skipping Fortran test + return() +endif() + +if(SET_CMP0129) + cmake_policy(SET CMP0129 ${SET_CMP0129}) +endif() + +enable_language(Fortran) +set(CMAKE_VERBOSE_MAKEFILE TRUE) +include(CompareCompilerVersion.cmake) +compare_compiler_version(Fortran) diff --git a/Tests/RunCMake/CMP0129/RunCMakeTest.cmake b/Tests/RunCMake/CMP0129/RunCMakeTest.cmake new file mode 100644 index 0000000..1b0e11b --- /dev/null +++ b/Tests/RunCMake/CMP0129/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +set(RunCMake_TEST_NO_CMP0129 ON) +include(RunCMake) + +foreach(lang C CXX Fortran) + run_cmake(${lang}) + run_cmake_with_options(${lang} "-DSET_CMP0129=NEW") + run_cmake_with_options(${lang} "-DSET_CMP0129=OLD") +endforeach() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e24ef58..5dc7031 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -256,7 +256,7 @@ endif() add_RunCMake_test(ArtifactOutputDirs) if(NOT DEFINED CMake_TEST_BuildDepends_GNU_AS - AND CMAKE_C_COMPILER_ID STREQUAL "GNU" + AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC") AND CMAKE_GENERATOR MATCHES "^Ninja" ) execute_process(COMMAND "${CMAKE_C_COMPILER}" -print-prog-name=as @@ -345,9 +345,8 @@ if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STRE add_RunCMake_test(RuntimePath) endif() add_RunCMake_test(ScriptMode) -add_RunCMake_test(Swift -DCMAKE_Swift_COMPILER=${CMAKE_Swift_COMPILER}) +add_RunCMake_test(Swift -DCMAKE_Swift_COMPILER=${CMAKE_Swift_COMPILER} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(TargetObjects) -add_RunCMake_test(TargetSources) add_RunCMake_test(TargetProperties) add_RunCMake_test(ToolchainFile) add_RunCMake_test(find_dependency) @@ -682,7 +681,7 @@ set_property(TEST RunCMake.CheckCompilerFlag add_RunCMake_test(CheckModules) add_RunCMake_test(CheckIPOSupported) if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)" - AND (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU" OR CMAKE_Fortran_COMPILER_ID MATCHES "GNU")) + AND (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|LCC" OR CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC")) add_RunCMake_test(CheckLinkerFlag -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID} -DCMake_TEST_CUDA=${CMake_TEST_CUDA} @@ -928,3 +927,7 @@ endif() if(WIN32) add_RunCMake_test(Win32GenEx) endif() + +if("${CMAKE_C_COMPILER_ID}" STREQUAL "LCC" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "LCC" OR "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "LCC") + add_RunCMake_test("CMP0129") +endif() diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt index 1b3dbb2..c81b34e 100644 --- a/Tests/RunCMake/CPack/CMakeLists.txt +++ b/Tests/RunCMake/CPack/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() + set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "") project(${RunCMake_TEST} CXX) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 7997c78..eb9ff03 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -3,13 +3,22 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) include(RunCMake) include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") +# A debugedit binary is required for these tests, so skip them if it's not found +find_program(DEBUGEDIT debugedit) + # run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES" run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM.CUSTOM_BINARY_SPEC_FILE" false "MONOLITHIC;COMPONENT") run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ;DragNDrop" true "COMPONENT") -run_cpack_test(DEBUGINFO "RPM.DEBUGINFO;DEB.DEBUGINFO" true "COMPONENT") +run_cpack_test(DEBUGINFO "DEB.DEBUGINFO" true "COMPONENT") +if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND") + run_cpack_test(DEBUGINFO "RPM.DEBUGINFO" true "COMPONENT") +endif() run_cpack_test(DEBUGINFO "DEB.DEBUGINFO" true "MONOLITHIC") run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM.DEFAULT_PERMISSIONS;DEB.DEFAULT_PERMISSIONS" false "MONOLITHIC;COMPONENT") -run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES;DEB.DEPENDENCIES" true "COMPONENT") +run_cpack_test(DEPENDENCIES "DEB.DEPENDENCIES" true "COMPONENT") +if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND") + run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES" true "COMPONENT") +endif() run_cpack_test(DIST "RPM.DIST" false "MONOLITHIC") run_cpack_test(DMG_SLA "DragNDrop" false "MONOLITHIC") run_cpack_test(EMPTY_DIR "RPM.EMPTY_DIR;DEB.EMPTY_DIR;TGZ" true "MONOLITHIC;COMPONENT") @@ -17,7 +26,10 @@ run_cpack_test(VERSION "RPM.VERSION;DEB.VERSION" false "MONOLITHIC;COMPONENT") run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT") run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB.GENERATE_SHLIBS" true "COMPONENT") run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB.GENERATE_SHLIBS_LDCONFIG" true "COMPONENT") -run_cpack_test_subtests(INSTALL_SCRIPTS "default;single_debug_info;no_scripts;no_scripts_single_debug_info" "RPM.INSTALL_SCRIPTS" false "COMPONENT") +run_cpack_test_subtests(INSTALL_SCRIPTS "default;no_scripts" "RPM.INSTALL_SCRIPTS" false "COMPONENT") +if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND") + run_cpack_test_subtests(INSTALL_SCRIPTS "single_debug_info;no_scripts_single_debug_info" "RPM.INSTALL_SCRIPTS" false "COMPONENT") +endif() run_cpack_test(LONG_FILENAMES "DEB.LONG_FILENAMES" false "MONOLITHIC") run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM.MAIN_COMPONENT" false "COMPONENT") run_cpack_test(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT") @@ -27,8 +39,13 @@ run_cpack_test_package_target(THREADED "TXZ;DEB" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC") run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM.PARTIALLY_RELOCATABLE_WARNING" false "COMPONENT") run_cpack_test(PER_COMPONENT_FIELDS "RPM.PER_COMPONENT_FIELDS;DEB.PER_COMPONENT_FIELDS" false "COMPONENT") -run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM.SINGLE_DEBUGINFO" true "CUSTOM") -run_cpack_test(EXTRA_SLASH_IN_PATH "RPM.EXTRA_SLASH_IN_PATH" true "COMPONENT") +run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component" "RPM.SINGLE_DEBUGINFO" true "CUSTOM") +if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND") + run_cpack_test_subtests(SINGLE_DEBUGINFO "one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM.SINGLE_DEBUGINFO" true "CUSTOM") +endif() +if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND") + run_cpack_test(EXTRA_SLASH_IN_PATH "RPM.EXTRA_SLASH_IN_PATH" true "COMPONENT") +endif() run_cpack_source_test(SOURCE_PACKAGE "RPM.SOURCE_PACKAGE") run_cpack_test(SUGGESTS "RPM.SUGGESTS" false "MONOLITHIC") run_cpack_test(SYMLINKS "RPM.SYMLINKS;TGZ" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake index e9cebbf..1d21dec 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake @@ -1,7 +1,7 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) # Some compilers do not add build id to binaries by default. -if(CMAKE_CXX_COMPILER_ID MATCHES "^(IntelLLVM|PGI|NVHPC)$") +if(CMAKE_CXX_COMPILER_ID MATCHES "^(LCC|IntelLLVM|PGI|NVHPC)$") string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") endif() diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt b/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt index 5df274a..df777ea 100644 --- a/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt +++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt @@ -1 +1,2 @@ -^CPackDeb: ((- Generating dependency list)|(Using only user-provided dependencies because dpkg-shlibdeps is not found\.))$ +^CPackDeb: ((- Generating dependency list)( +CMake Warning.*broken dpkg-shlibdeps on E2K detected.*\(cpack_deb_prepare_package_vars\))?|(Using only user-provided dependencies because dpkg-shlibdeps is not found\.))$ diff --git a/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt b/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt index 0421e28..30cb9ae 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt +++ b/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.13) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() + project(${RunCMake_TEST} LANGUAGES NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake index 6483f11..79d67e5 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake @@ -9,14 +9,14 @@ if(SHOULD_FAIL) message(SEND_ERROR "invalid C compile flag didn't fail.") endif() -if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") +if(CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") check_compiler_flag(C "-x c" SHOULD_WORK) if(NOT SHOULD_WORK) message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c' check failed") endif() endif() -if(CMAKE_C_COMPILER_ID STREQUAL "GNU") +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # LCC C compiler silently ignore -frtti instead of failing, so skip it here. check_compiler_flag(C "-frtti" SHOULD_FAIL_RTTI) if(SHOULD_FAIL_RTTI) message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-frtti' check passed but should have failed") diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake index 60e9755..4b20ebd 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake @@ -9,7 +9,7 @@ if(SHOULD_FAIL) message(SEND_ERROR "invalid CXX compile flag didn't fail.") endif() -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") check_compiler_flag(CXX "-x c++" SHOULD_WORK) if(NOT SHOULD_WORK) message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed") diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake index 7bb88b1..236f37b 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake @@ -8,7 +8,7 @@ if(SHOULD_FAIL) message(SEND_ERROR "invalid Fortran compile flag didn't fail.") endif() -if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") +if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU|LCC") check_compiler_flag(Fortran "-Wall" SHOULD_WORK) if(NOT SHOULD_WORK) message(SEND_ERROR "${CMAKE_Fortran_COMPILER_ID} compiler flag '-Wall' check failed") diff --git a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake index 5e5bff6..39fc430 100644 --- a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake @@ -1,6 +1,6 @@ include(RunCMake) -if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") +if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|LCC") run_cmake(CheckCLinkerFlag) run_cmake(CheckCXXLinkerFlag) if (APPLE) @@ -9,7 +9,7 @@ if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") endif() endif() -if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU") +if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC") run_cmake(CheckFortranLinkerFlag) endif() diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index 3df3e52..6a932f1 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":3}]},{"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,"version":{.*}}$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index dc066f1..74cd90a 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -247,8 +247,14 @@ function(run_BuildDir) run_cmake_command(BuildDir--build-jobs-no-number-trailing--target ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build -j --target CustomTarget) if(RunCMake_GENERATOR MATCHES "Unix Makefiles" OR RunCMake_GENERATOR MATCHES "Ninja") + set(_backup_lang "$ENV{LANG}") + set(_backup_lc_messages "$ENV{LC_MESSAGES}") + set(ENV{LANG} "C") + set(ENV{LC_MESSAGES} "C") run_cmake_command(BuildDir--build-jobs-no-number-trailing--invalid-target ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build -j --target invalid-target) + set(ENV{LANG} "${_backup_lang}") + set(ENV{LC_MESSAGES} "${_backup_lc_messages}") endif() run_cmake_command(BuildDir--build--parallel-no-number ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build --parallel) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index 6cf57a3..b31088d 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -12,7 +12,7 @@ def read_codemodel_json_data(filename): def check_objects(o, g): assert is_list(o) assert len(o) == 1 - check_index_object(o[0], "codemodel", 2, 3, check_object_codemodel(g)) + check_index_object(o[0], "codemodel", 2, 4, check_object_codemodel(g)) def check_backtrace(t, b, backtrace): btg = t["backtraceGraph"] @@ -188,6 +188,31 @@ def check_directory(c): expected_keys.append("runtimeDependencySetType") assert is_string(a["runtimeDependencySetType"], e["runtimeDependencySetType"]) + if e.get("fileSetName", None) is not None: + expected_keys.append("fileSetName") + assert is_string(a["fileSetName"], e["fileSetName"]) + + if e.get("fileSetType", None) is not None: + expected_keys.append("fileSetType") + assert is_string(a["fileSetType"], e["fileSetType"]) + + if e.get("fileSetDirectories", None) is not None: + expected_keys.append("fileSetDirectories") + assert is_list(a["fileSetDirectories"]) + assert len(a["fileSetDirectories"]) == len(e["fileSetDirectories"]) + for ad, ed in zip(a["fileSetDirectories"], e["fileSetDirectories"]): + assert matches(ad, ed) + + if e.get("fileSetTarget", None) is not None: + expected_keys.append("fileSetTarget") + et = e["fileSetTarget"] + at = a["fileSetTarget"] + 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"]) @@ -628,6 +653,7 @@ def gen_check_directories(c, g): read_codemodel_json_data("directories/dir.json"), read_codemodel_json_data("directories/dir_dir.json"), read_codemodel_json_data("directories/external.json"), + read_codemodel_json_data("directories/fileset.json"), ] if matches(g["name"], "^Visual Studio "): @@ -729,9 +755,12 @@ def gen_check_targets(c, g, inSource): read_codemodel_json_data("targets/all_build_external.json"), read_codemodel_json_data("targets/zero_check_external.json"), read_codemodel_json_data("targets/generated_exe.json"), + + read_codemodel_json_data("targets/c_headers_1.json"), + read_codemodel_json_data("targets/c_headers_2.json"), ] - if cxx_compiler_id in ['Clang', 'AppleClang', 'GNU', 'Intel', 'IntelLLVM', 'MSVC', 'Embarcadero'] and g["name"] != "Xcode": + if cxx_compiler_id in ['Clang', 'AppleClang', 'LCC', 'GNU', 'Intel', 'IntelLLVM', 'MSVC', 'Embarcadero'] and g["name"] != "Xcode": for e in expected: if e["name"] == "cxx_exe": if matches(g["name"], "^(Visual Studio |Ninja Multi-Config)"): diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json new file mode 100644 index 0000000..4774a13 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json @@ -0,0 +1,203 @@ +{ + "source": "^fileset$", + "build": "^fileset$", + "parentSource": "^\\.$", + "childSources": null, + "targetIds": [ + "^c_headers_1::@6b8db101d64c125f29fe$", + "^c_headers_2::@6b8db101d64c125f29fe$" + ], + "projectName": "codemodel-v2", + "minimumCMakeVersion": "3.12", + "hasInstallRule": true, + "installers": [ + { + "component": "Unspecified", + "type": "target", + "destination": "lib", + "paths": [ + "^fileset/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_headers_1\\.(a|lib)?$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": "^c_headers_1::@6b8db101d64c125f29fe$", + "targetIndex": "c_headers_1", + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 20, + "command": "install", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Headers", + "type": "fileSet", + "destination": "include", + "paths": [ + "^fileset/error\\.c$", + "^fileset/other\\.c$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "fileSetName": "HEADERS", + "fileSetType": "HEADERS", + "fileSetDirectories": [ + "^fileset$" + ], + "fileSetTarget": { + "id": "^c_headers_1::@6b8db101d64c125f29fe$", + "index": "c_headers_1" + }, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 20, + "command": "install", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "fileSet", + "destination": "include/dir", + "paths": [ + "^fileset/dir/h2\\.h$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "fileSetName": "b", + "fileSetType": "HEADERS", + "fileSetDirectories": [ + "^fileset/dir$" + ], + "fileSetTarget": { + "id": "^c_headers_1::@6b8db101d64c125f29fe$", + "index": "c_headers_1" + }, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 20, + "command": "install", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "fileSet", + "destination": "include", + "paths": [ + "^fileset/h3\\.h$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "fileSetName": "c", + "fileSetType": "HEADERS", + "fileSetDirectories": [ + "^fileset$" + ], + "fileSetTarget": { + "id": "^c_headers_1::@6b8db101d64c125f29fe$", + "index": "c_headers_1" + }, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 20, + "command": "install", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "target", + "destination": "lib", + "paths": [ + "^fileset/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_headers_2\\.(a|lib)?$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": "^c_headers_2::@6b8db101d64c125f29fe$", + "targetIndex": "c_headers_2", + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 25, + "command": "install", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json index 99287fb..22b4536 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json @@ -10,7 +10,8 @@ "^interface$", "^object$", "^.*/Tests/RunCMake/FileAPIExternalSource$", - "^dir$" + "^dir$", + "^fileset$" ], "targetIds": [ "^ALL_BUILD::@6890427a1f51a3e7e1df$", @@ -47,7 +48,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 38, + "line": 39, "command": "install", "hasParent": true }, @@ -92,7 +93,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 41, + "line": 42, "command": "install", "hasParent": true }, @@ -140,7 +141,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 41, + "line": 42, "command": "install", "hasParent": true }, @@ -185,7 +186,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 41, + "line": 42, "command": "install", "hasParent": true }, @@ -229,7 +230,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 41, + "line": 42, "command": "install", "hasParent": true }, @@ -273,7 +274,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 46, + "line": 47, "command": "install", "hasParent": true }, @@ -320,7 +321,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 48, + "line": 49, "command": "install", "hasParent": true }, @@ -365,7 +366,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 49, + "line": 50, "command": "install", "hasParent": true }, @@ -414,7 +415,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 50, + "line": 51, "command": "install", "hasParent": true }, @@ -466,7 +467,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 51, + "line": 52, "command": "install", "hasParent": true }, @@ -515,7 +516,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 52, + "line": 53, "command": "install", "hasParent": true }, @@ -557,7 +558,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 54, "command": "install", "hasParent": true }, @@ -599,7 +600,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 54, + "line": 55, "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 4d0cdc0..0d6c4a1 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json @@ -13,7 +13,8 @@ "directorySources": [ "^\\.$", "^dir$", - "^dir/dir$" + "^dir/dir$", + "^fileset$" ], "targetIds": [ "^ALL_BUILD::@6890427a1f51a3e7e1df$", @@ -24,6 +25,8 @@ "^c_shared_lib::@6890427a1f51a3e7e1df$", "^c_shared_exe::@6890427a1f51a3e7e1df$", "^c_static_lib::@6890427a1f51a3e7e1df$", - "^c_static_exe::@6890427a1f51a3e7e1df$" + "^c_static_exe::@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 d023f99..4e772a7 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 @@ -186,6 +186,14 @@ { "id": "^generated_exe::@[0-9a-f]+$", "backtrace": null + }, + { + "id": "^c_headers_1::@6b8db101d64c125f29fe$", + "backtrace": null + }, + { + "id": "^c_headers_2::@6b8db101d64c125f29fe$", + "backtrace": null } ] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json new file mode 100644 index 0000000..c189623 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json @@ -0,0 +1,231 @@ +{ + "name": "c_headers_1", + "id": "^c_headers_1::@6b8db101d64c125f29fe$", + "directorySource": "^fileset$", + "projectName": "codemodel-v2", + "type": "STATIC_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^fileset/empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 1, + "command": "add_library", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^fileset/error\\.c$", + "isGenerated": null, + "sourceGroupName": "Header Files", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 3, + "command": "target_sources", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^fileset/other\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 3, + "command": "target_sources", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^fileset/h1\\.h$", + "isGenerated": null, + "sourceGroupName": "Header Files", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 3, + "command": "target_sources", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^fileset/dir/h2\\.h$", + "isGenerated": null, + "sourceGroupName": "Header Files", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 7, + "command": "target_sources", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^fileset/empty\\.c$", + "^fileset/other\\.c$" + ] + }, + { + "name": "Header Files", + "sourcePaths": [ + "^fileset/error\\.c$", + "^fileset/h1\\.h$", + "^fileset/dir/h2\\.h$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^fileset/empty\\.c$" + ], + "includes": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/fileset$", + "isSystem": null, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 3, + "command": "target_sources", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/fileset/dir$", + "isSystem": null, + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 7, + "command": "target_sources", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 1, + "command": "add_library", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib)?c_headers_1\\.(a|lib)$", + "artifacts": [ + { + "path": "^fileset/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_headers_1\\.(a|lib)$", + "_dllExtra": false + } + ], + "build": "^fileset$", + "source": "^fileset$", + "install": { + "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$", + "destinations": [ + { + "path": "lib", + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 20, + "command": "install", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] + }, + "link": null, + "archive": { + "lto": null + }, + "dependencies": [ + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json new file mode 100644 index 0000000..75fe58c --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json @@ -0,0 +1,105 @@ +{ + "name": "c_headers_2", + "id": "^c_headers_2::@6b8db101d64c125f29fe$", + "directorySource": "^fileset$", + "projectName": "codemodel-v2", + "type": "STATIC_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^fileset/empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 15, + "command": "add_library", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^fileset/empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^fileset/empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 15, + "command": "add_library", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib)?c_headers_2\\.(a|lib)$", + "artifacts": [ + { + "path": "^fileset/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_headers_2\\.(a|lib)$", + "_dllExtra": false + } + ], + "build": "^fileset$", + "source": "^fileset$", + "install": { + "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$", + "destinations": [ + { + "path": "lib", + "backtrace": [ + { + "file": "^fileset/CMakeLists\\.txt$", + "line": 25, + "command": "install", + "hasParent": true + }, + { + "file": "^fileset/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] + }, + "link": null, + "archive": { + "lto": null + }, + "dependencies": [ + { + "id": "^ZERO_CHECK::@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 e3a8d0b..b4318dd 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": 41, + "line": 42, "command": "install", "hasParent": true }, @@ -145,7 +145,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 41, + "line": 42, "command": "install", "hasParent": true }, @@ -175,7 +175,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 46, + "line": 47, "command": "install", "hasParent": true }, 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 385fa62..5769f0c 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": 38, + "line": 39, "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 73e8e12..1fe4d67 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": 41, + "line": 42, "command": "install", "hasParent": true }, @@ -121,7 +121,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 41, + "line": 42, "command": "install", "hasParent": true }, @@ -151,7 +151,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 46, + "line": 47, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake index da928eb..019eb87 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake +++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake @@ -22,6 +22,7 @@ add_subdirectory(interface) add_subdirectory(custom) add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../FileAPIExternalSource" "${CMAKE_CURRENT_BINARY_DIR}/../FileAPIExternalBuild") add_subdirectory(dir) +add_subdirectory(fileset) set_property(TARGET c_shared_lib PROPERTY LIBRARY_OUTPUT_DIRECTORY lib) set_property(TARGET c_shared_lib PROPERTY RUNTIME_OUTPUT_DIRECTORY lib) diff --git a/Tests/RunCMake/FileAPI/fileset/CMakeLists.txt b/Tests/RunCMake/FileAPI/fileset/CMakeLists.txt new file mode 100644 index 0000000..f80f12b --- /dev/null +++ b/Tests/RunCMake/FileAPI/fileset/CMakeLists.txt @@ -0,0 +1,25 @@ +add_library(c_headers_1 STATIC empty.c) + +target_sources(c_headers_1 + PUBLIC FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES error.c other.c + PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES h1.h + ) +target_sources(c_headers_1 + PUBLIC FILE_SET b TYPE HEADERS BASE_DIRS "$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>" FILES "$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir/h2.h>" + ) +target_sources(c_headers_1 + INTERFACE FILE_SET c TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES h3.h + ) +source_group("Source Files" FILES "${CMAKE_CURRENT_SOURCE_DIR}/other.c") + +add_library(c_headers_2 STATIC empty.c) +target_sources(c_headers_2 + INTERFACE FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES h1.h + ) + +install(TARGETS c_headers_1 + FILE_SET HEADERS DESTINATION include COMPONENT Headers + FILE_SET b DESTINATION include/dir + FILE_SET c + ) +install(TARGETS c_headers_2) diff --git a/Tests/RunCMake/FileAPI/fileset/dir/h2.h b/Tests/RunCMake/FileAPI/fileset/dir/h2.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FileAPI/fileset/dir/h2.h diff --git a/Tests/RunCMake/FileAPI/fileset/empty.c b/Tests/RunCMake/FileAPI/fileset/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FileAPI/fileset/empty.c diff --git a/Tests/RunCMake/FileAPI/fileset/error.c b/Tests/RunCMake/FileAPI/fileset/error.c new file mode 100644 index 0000000..f10e687 --- /dev/null +++ b/Tests/RunCMake/FileAPI/fileset/error.c @@ -0,0 +1 @@ +#error "This should not be compiled" diff --git a/Tests/RunCMake/FileAPI/fileset/h1.h b/Tests/RunCMake/FileAPI/fileset/h1.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FileAPI/fileset/h1.h diff --git a/Tests/RunCMake/FileAPI/fileset/h3.h b/Tests/RunCMake/FileAPI/fileset/h3.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FileAPI/fileset/h3.h diff --git a/Tests/RunCMake/FileAPI/fileset/other.c b/Tests/RunCMake/FileAPI/fileset/other.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FileAPI/fileset/other.c diff --git a/Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt b/Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt new file mode 100644 index 0000000..899122e --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0093-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0093 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GNUInstallDirs/Opt-FreeBSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Opt-FreeBSD-stderr.txt index feb747b..3e18410 100644 --- a/Tests/RunCMake/GNUInstallDirs/Opt-FreeBSD-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Opt-FreeBSD-stderr.txt @@ -9,7 +9,7 @@ CMAKE_INSTALL_LIBEXECDIR='libexec' CMAKE_INSTALL_LOCALEDIR='share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' CMAKE_INSTALL_RUNSTATEDIR='var/run' -CMAKE_INSTALL_MANDIR='man' +CMAKE_INSTALL_MANDIR='share/man' CMAKE_INSTALL_SBINDIR='sbin' CMAKE_INSTALL_SHAREDSTATEDIR='com' CMAKE_INSTALL_SYSCONFDIR='etc' @@ -24,7 +24,7 @@ CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var/opt/Opt' CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run/opt/Opt' -CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/man' +CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/share/man' CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin' CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com' CMAKE_INSTALL_FULL_SYSCONFDIR='/etc/opt/Opt'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt index 25f80d3..2019459 100644 --- a/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt @@ -4,7 +4,7 @@ CMAKE_INSTALL_DATAROOTDIR='usr/share' CMAKE_INSTALL_DOCDIR='usr/share/doc/Root' CMAKE_INSTALL_INCLUDEDIR='usr/include' CMAKE_INSTALL_INFODIR='usr/share/info' -CMAKE_INSTALL_LIBDIR='usr/lib' +CMAKE_INSTALL_LIBDIR='usr/lib/arch' CMAKE_INSTALL_LIBEXECDIR='usr/libexec' CMAKE_INSTALL_LOCALEDIR='usr/share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' @@ -19,7 +19,7 @@ CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root' CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' -CMAKE_INSTALL_FULL_LIBDIR='/usr/lib' +CMAKE_INSTALL_FULL_LIBDIR='/usr/lib/arch' CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' diff --git a/Tests/RunCMake/GNUInstallDirs/Root-FreeBSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-FreeBSD-stderr.txt index 4284a15..8c13368 100644 --- a/Tests/RunCMake/GNUInstallDirs/Root-FreeBSD-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Root-FreeBSD-stderr.txt @@ -9,7 +9,7 @@ CMAKE_INSTALL_LIBEXECDIR='usr/libexec' CMAKE_INSTALL_LOCALEDIR='usr/share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' CMAKE_INSTALL_RUNSTATEDIR='var/run' -CMAKE_INSTALL_MANDIR='usr/man' +CMAKE_INSTALL_MANDIR='usr/share/man' CMAKE_INSTALL_SBINDIR='usr/sbin' CMAKE_INSTALL_SHAREDSTATEDIR='usr/com' CMAKE_INSTALL_SYSCONFDIR='etc' @@ -24,7 +24,7 @@ CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run' -CMAKE_INSTALL_FULL_MANDIR='/usr/man' +CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Usr-FreeBSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Usr-FreeBSD-stderr.txt index 9efc110..a591436 100644 --- a/Tests/RunCMake/GNUInstallDirs/Usr-FreeBSD-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Usr-FreeBSD-stderr.txt @@ -9,7 +9,7 @@ CMAKE_INSTALL_LIBEXECDIR='libexec' CMAKE_INSTALL_LOCALEDIR='share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' CMAKE_INSTALL_RUNSTATEDIR='var/run' -CMAKE_INSTALL_MANDIR='man' +CMAKE_INSTALL_MANDIR='share/man' CMAKE_INSTALL_SBINDIR='sbin' CMAKE_INSTALL_SHAREDSTATEDIR='com' CMAKE_INSTALL_SYSCONFDIR='etc' @@ -24,7 +24,7 @@ CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run' -CMAKE_INSTALL_FULL_MANDIR='/usr/man' +CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt index 30795c8..0830138 100644 --- a/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt @@ -4,7 +4,7 @@ CMAKE_INSTALL_DATAROOTDIR='share' CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal' CMAKE_INSTALL_INCLUDEDIR='include' CMAKE_INSTALL_INFODIR='share/info' -CMAKE_INSTALL_LIBDIR='lib' +CMAKE_INSTALL_LIBDIR='lib/arch' CMAKE_INSTALL_LIBEXECDIR='libexec' CMAKE_INSTALL_LOCALEDIR='share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' @@ -19,7 +19,7 @@ CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share' CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal' CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include' CMAKE_INSTALL_FULL_INFODIR='/usr/local/share/info' -CMAKE_INSTALL_FULL_LIBDIR='/usr/local/lib' +CMAKE_INSTALL_FULL_LIBDIR='/usr/local/lib/arch' CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var' diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-FreeBSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-FreeBSD-stderr.txt index 505bf08..f957e0e 100644 --- a/Tests/RunCMake/GNUInstallDirs/UsrLocal-FreeBSD-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-FreeBSD-stderr.txt @@ -9,7 +9,7 @@ CMAKE_INSTALL_LIBEXECDIR='libexec' CMAKE_INSTALL_LOCALEDIR='share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' CMAKE_INSTALL_RUNSTATEDIR='var/run' -CMAKE_INSTALL_MANDIR='man' +CMAKE_INSTALL_MANDIR='share/man' CMAKE_INSTALL_SBINDIR='sbin' CMAKE_INSTALL_SHAREDSTATEDIR='com' CMAKE_INSTALL_SYSCONFDIR='etc' @@ -24,7 +24,7 @@ CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var' CMAKE_INSTALL_FULL_RUNSTATEDIR='/usr/local/var/run' -CMAKE_INSTALL_FULL_MANDIR='/usr/local/man' +CMAKE_INSTALL_FULL_MANDIR='/usr/local/share/man' CMAKE_INSTALL_FULL_SBINDIR='/usr/local/sbin' CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/local/com' CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/local/etc'$ diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed-result.txt b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetSources/ConfigNotAllowed-result.txt +++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt new file mode 100644 index 0000000..ef71404 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio [^ +]+ + + given instance specification + + Test Instance,version=1\.2\.3\.4,version=1\.2\.3\.4 + + that contains duplicate field key 'version'\.$ diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt +++ b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-result.txt diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt new file mode 100644 index 0000000..d6c73c8 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio [^ +]+ + + given instance specification + + Test Instance,nocomma + + that contains a field after the first ',' with no '='\.$ diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt +++ b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-result.txt diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt new file mode 100644 index 0000000..ecfe229 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio [^ +]+ + + given instance specification + + Test Instance,unknown= + + that contains invalid field 'unknown='\.$ diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt new file mode 100644 index 0000000..a0894b6 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio [^ +]+ + + given instance specification + + version=1\.2\.3 + + but the version field is not 4 integer components starting in [0-9]+\.$ diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt new file mode 100644 index 0000000..2b3a23b --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio [^ +]+ + + given instance specification + + version=1\.2\.3\.x + + but the version field is not 4 integer components starting in [0-9]+\.$ diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt +++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt new file mode 100644 index 0000000..3a27341 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at CMakeLists.txt:[0-9] \(project\): + Generator + + Visual Studio [^ +]+ + + could not find specified instance of Visual Studio: + + version=[0-9]+\.999\.99999\.999$ diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake index 7750c2e..9761f0c 100644 --- a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake +++ b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake @@ -11,3 +11,4 @@ elseif(NOT IS_DIRECTORY "${CMAKE_GENERATOR_INSTANCE}") " ${CMAKE_GENERATOR_INSTANCE}\n" "which is not an existing directory.") endif() +file(WRITE "${CMAKE_BINARY_DIR}/instance.txt" "${CMAKE_GENERATOR_INSTANCE}") diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt new file mode 100644 index 0000000..baa17aa --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio [^ +]+ + + could not find specified instance of Visual Studio: + + [^ +]+/Tests/RunCMake/GeneratorInstance + + The directory exists, but the instance is not known to the Visual Studio + Installer, and no 'version=' field was given\.$ diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake b/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake index e7f9ccb..dfcdcf8 100644 --- a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake @@ -1,14 +1,40 @@ include(RunCMake) -if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio 1[56789]") +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio (1[56789])") + set(vs_major "${CMAKE_MATCH_1}") + set(RunCMake_GENERATOR_INSTANCE "") run_cmake(DefaultInstance) + set(instance_txt "${RunCMake_BINARY_DIR}/DefaultInstance-build/instance.txt") + if(EXISTS "${instance_txt}") + file(READ "${instance_txt}" default_instance) + endif() set(RunCMake_GENERATOR_INSTANCE "${RunCMake_SOURCE_DIR}/instance_does_not_exist") run_cmake(MissingInstance) set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/MissingInstance-toolchain.cmake) run_cmake(MissingInstanceToolchain) unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_GENERATOR_INSTANCE "Test Instance,nocomma") + run_cmake(BadFieldNoComma) + set(RunCMake_GENERATOR_INSTANCE "Test Instance,unknown=") + run_cmake(BadFieldUnknown) + set(RunCMake_GENERATOR_INSTANCE "Test Instance,version=1.2.3.4,version=1.2.3.4") + run_cmake(BadFieldDuplicate) + set(RunCMake_GENERATOR_INSTANCE "version=1.2.3") + run_cmake(BadVersionFormat1) + set(RunCMake_GENERATOR_INSTANCE "version=1.2.3.x") + run_cmake(BadVersionFormat2) + set(RunCMake_GENERATOR_INSTANCE "version=${vs_major}.999.99999.999") + run_cmake(BadVersionNumber) + if(IS_DIRECTORY "${default_instance}") + set(RunCMake_GENERATOR_INSTANCE "${default_instance},version=${vs_major}.999.99999.999") + run_cmake(WrongVersion) + endif() + + set(RunCMake_GENERATOR_INSTANCE "${RunCMake_SOURCE_DIR}") + run_cmake(PortableNoVersion) else() set(RunCMake_GENERATOR_INSTANCE "") run_cmake(NoInstance) diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt b/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt b/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt new file mode 100644 index 0000000..156a9ee --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt @@ -0,0 +1,10 @@ +^CMake Error at CMakeLists.txt:[0-9] \(project\): + Generator + + Visual Studio [^ +]+ + + could not find specified instance of Visual Studio: + + [^, +]+,version=[0-9]+\.999\.99999\.999$ diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake b/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt new file mode 100644 index 0000000..3984a78 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0091-OLD.cmake:[0-9] \(cmake_policy\): + The OLD behavior for policy CMP0091 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD-stderr.txt b/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD-stderr.txt new file mode 100644 index 0000000..535b997 --- /dev/null +++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0092-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0092 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 4a0c130..919015f 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -448,7 +448,7 @@ run_cmake_command(NoUnusedVariables ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR} ) # CudaSimple uses separable compilation, which is currently only supported on NVCC. -if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") +if(CMake_TEST_CUDA) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CudaSimple-build) run_cmake_configure(CudaSimple) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) diff --git a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake index 6efa0d4..468b80a 100644 --- a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake +++ b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake @@ -26,6 +26,7 @@ if (PIE_SUPPORTED OR NO_PIE_SUPPORTED) if ((READELF OR OTOOL) AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + OR CMAKE_CXX_COMPILER_ID STREQUAL "LCC" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) macro(run_cmake_target test subtest) diff --git a/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake index 3e7fb30..ac3bf59 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake @@ -1,4 +1,4 @@ -if (NOT CMAKE_C_COMPILER_ID MATCHES "GNU|Intel" OR +if (NOT CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Intel" OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND CMAKE_HOST_WIN32)) return() endif() diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 3363a57..6f79b78 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -92,6 +92,9 @@ function(run_cmake test) if(APPLE) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) endif() + if(NOT RunCMake_TEST_NO_CMP0129 AND CMAKE_C_COMPILER_ID STREQUAL "LCC") + list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0129=NEW) + endif() if(RunCMake_MAKE_PROGRAM) list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}") endif() diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake index 1db202e..21d5a25 100644 --- a/Tests/RunCMake/Swift/RunCMakeTest.cmake +++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake @@ -6,11 +6,14 @@ if(RunCMake_GENERATOR STREQUAL Xcode) endif() elseif(RunCMake_GENERATOR STREQUAL Ninja) if(CMAKE_Swift_COMPILER) - run_cmake(Win32ExecutableDisallowed) - - set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Darwin) - run_cmake(SwiftMultiArch) - unset(RunCMake_TEST_OPTIONS) + if (CMAKE_SYSTEM_NAME MATCHES "Windows") + run_cmake_with_options(Win32ExecutableDisallowed) + else() + run_cmake_with_options(Win32ExecutableIgnored) + set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Darwin) + run_cmake(SwiftMultiArch) + unset(RunCMake_TEST_OPTIONS) + endif() endif() elseif(RunCMake_GENERATOR STREQUAL "Ninja Multi-Config") if(CMAKE_Swift_COMPILER) diff --git a/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake b/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake new file mode 100644 index 0000000..02d5447 --- /dev/null +++ b/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake @@ -0,0 +1,4 @@ +enable_language(Swift) +add_executable(E E.swift) +set_target_properties(E PROPERTIES + WIN32_EXECUTABLE TRUE) diff --git a/Tests/RunCMake/TargetSources/CMakeLists.txt b/Tests/RunCMake/TargetSources/CMakeLists.txt deleted file mode 100644 index a06591c..0000000 --- a/Tests/RunCMake/TargetSources/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(${RunCMake_TEST} CXX) -include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt deleted file mode 100644 index 4581d8a..0000000 --- a/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- iface: .*Tests/RunCMake/TargetSources/empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt deleted file mode 100644 index 7f48082..0000000 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- genexlib: \$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp>;\$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/../empty_1.cpp>;\$<1:empty_2.cpp> diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt deleted file mode 100644 index aa4851f..0000000 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp;empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt deleted file mode 100644 index 5990a05..0000000 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- iface: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_2.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt deleted file mode 100644 index fa5bcbf..0000000 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_2.cpp diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake deleted file mode 100644 index b56ee44..0000000 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ /dev/null @@ -1,22 +0,0 @@ -include(RunCMake) - -if(RunCMake_GENERATOR STREQUAL "Xcode") - run_cmake(ConfigNotAllowed) -endif() - -run_cmake(OriginDebug) -run_cmake(CMP0026-LOCATION) -run_cmake(CMP0076-OLD) -run_cmake(CMP0076-WARN) -run_cmake(RelativePathInInterface) -run_cmake(RelativePathInSubdirGenEx) -run_cmake(RelativePathInSubdirInterface) -run_cmake(RelativePathInSubdirPrivate) -run_cmake(RelativePathInSubdirInclude) -run_cmake(ExportBuild) -run_cmake(AddCustomTargetPublicSources) -run_cmake(AddCustomTargetPrivateSources) -run_cmake(AddCustomTargetInterfaceSources) -run_cmake(AddCustomTargetSources) -run_cmake(AddCustomTargetCheckProperty) -run_cmake(AddCustomTargetGenx) diff --git a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake index c00f78b..e3643c0 100644 --- a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake +++ b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake @@ -2,11 +2,9 @@ include(RunCMake) function(run_build name) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) - set(RunCMake_TEST_NO_CLEAN 1) run_cmake(${name}) + set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --config Debug) - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) endfunction() run_cmake(unitybuild_c) @@ -28,14 +26,28 @@ run_build(unitybuild_anon_ns) run_build(unitybuild_anon_ns_no_unity_build) run_build(unitybuild_anon_ns_group_mode) -function(run_test name) +function(run_per_config name) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + run_cmake(${name}) set(RunCMake_TEST_NO_CLEAN 1) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + run_cmake_command(${name}-build-debug ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${name}-build-release ${CMAKE_COMMAND} --build . --config Release) + else() + run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) + endif() +endfunction() + +if(NOT RunCMake_GENERATOR STREQUAL "Xcode") + run_per_config(per_config_c) +endif() + +function(run_test name) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) run_cmake(${name}) + set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --config Debug) run_cmake_command(${name}-test ${CMAKE_CTEST_COMMAND} -C Debug) - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) endfunction() run_test(unitybuild_runtest) diff --git a/Tests/RunCMake/UnityBuild/per_config_c.c b/Tests/RunCMake/UnityBuild/per_config_c.c new file mode 100644 index 0000000..081c7d3 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/per_config_c.c @@ -0,0 +1,16 @@ +#ifdef CFG_DEBUG +extern void per_config_c_debug(void); +#endif +#ifdef CFG_OTHER +extern void per_config_c_other(void); +#endif +int main(void) +{ +#ifdef CFG_DEBUG + per_config_c_debug(); +#endif +#ifdef CFG_OTHER + per_config_c_other(); +#endif + return 0; +} diff --git a/Tests/RunCMake/UnityBuild/per_config_c.cmake b/Tests/RunCMake/UnityBuild/per_config_c.cmake new file mode 100644 index 0000000..9f2ee48 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/per_config_c.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +add_executable(per_config_c per_config_c.c + "$<$<CONFIG:Debug>:per_config_c_debug.c>" + "$<$<NOT:$<CONFIG:Debug>>:per_config_c_other.c>" + ) + +set_target_properties(per_config_c PROPERTIES UNITY_BUILD ON) +target_compile_definitions(per_config_c PRIVATE + "$<$<CONFIG:Debug>:CFG_DEBUG>" + "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>" + ) diff --git a/Tests/RunCMake/UnityBuild/per_config_c_debug.c b/Tests/RunCMake/UnityBuild/per_config_c_debug.c new file mode 100644 index 0000000..6d32ead --- /dev/null +++ b/Tests/RunCMake/UnityBuild/per_config_c_debug.c @@ -0,0 +1,9 @@ +#ifndef CFG_DEBUG +# error "per_config_c_debug built without CFG_DEBUG" +#endif +#ifdef CFG_OTHER +# error "per_config_c_debug built with CFG_OTHER" +#endif +void per_config_c_debug(void) +{ +} diff --git a/Tests/RunCMake/UnityBuild/per_config_c_other.c b/Tests/RunCMake/UnityBuild/per_config_c_other.c new file mode 100644 index 0000000..89c7a6b --- /dev/null +++ b/Tests/RunCMake/UnityBuild/per_config_c_other.c @@ -0,0 +1,9 @@ +#ifdef CFG_DEBUG +# error "per_config_c_other built with CFG_DEBUG" +#endif +#ifndef CFG_OTHER +# error "per_config_c_other built without CFG_OTHER" +#endif +void per_config_c_other(void) +{ +} diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index d5ed136..f945b43 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -64,6 +64,21 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio 1[0-4] 201[0-5]" OR else() run_cmake(UnityBuildNative) run_cmake(UnityBuildNativeGrouped) + + function(run_UnityBuildPCH) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/UnityBuildPCH-build) + run_cmake(UnityBuildPCH) + set(RunCMake_TEST_NO_CLEAN 1) + set(vcxproj "${RunCMake_TEST_BINARY_DIR}/UnityBuildPCH.vcxproj") + if(EXISTS "${vcxproj}") + file(STRINGS ${vcxproj} vcxproj_strings REGEX "ClCompile[^\n]*UnityBuildPCH\\.c") + endif() + if(vcxproj_strings MATCHES "Include=\"([^\"]+)\"") + set(src "${CMAKE_MATCH_1}") + run_cmake_command(UnityBuildPCH-build ${CMAKE_COMMAND} --build . --config Debug --target UnityBuildPCH -- -t:ClCompile -p:SelectedFiles=${src}) + endif() + endfunction() + run_UnityBuildPCH() endif() run_cmake(VsDotnetTargetFramework) diff --git a/Tests/RunCMake/VS10Project/UnityBuildPCH-build-check.cmake b/Tests/RunCMake/VS10Project/UnityBuildPCH-build-check.cmake new file mode 100644 index 0000000..9043bb7 --- /dev/null +++ b/Tests/RunCMake/VS10Project/UnityBuildPCH-build-check.cmake @@ -0,0 +1,10 @@ +set(obj "${RunCMake_TEST_BINARY_DIR}/UnityBuildPCH.dir/Debug/UnityBuildPCH.obj") +if(NOT EXISTS "${obj}") + set(RunCMake_TEST_FAILED "Expected object file does not exist:\n ${obj}") + return() +endif() +set(lib "${RunCMake_TEST_BINARY_DIR}/Debug/UnityBuildPCH.lib") +if(EXISTS "${lib}") + set(RunCMake_TEST_FAILED "Unexpected library file exists:\n ${lib}") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/UnityBuildPCH.c b/Tests/RunCMake/VS10Project/UnityBuildPCH.c new file mode 100644 index 0000000..b96b068 --- /dev/null +++ b/Tests/RunCMake/VS10Project/UnityBuildPCH.c @@ -0,0 +1,4 @@ +int UnityBuildPCH(void) +{ + return 0; +} diff --git a/Tests/RunCMake/VS10Project/UnityBuildPCH.cmake b/Tests/RunCMake/VS10Project/UnityBuildPCH.cmake new file mode 100644 index 0000000..875ffec --- /dev/null +++ b/Tests/RunCMake/VS10Project/UnityBuildPCH.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_library(UnityBuildPCH STATIC UnityBuildPCH.c) +target_precompile_headers(UnityBuildPCH PRIVATE UnityBuildPCH.h) +set_property(TARGET UnityBuildPCH PROPERTY UNITY_BUILD ON) diff --git a/Tests/RunCMake/VS10Project/UnityBuildPCH.h b/Tests/RunCMake/VS10Project/UnityBuildPCH.h new file mode 100644 index 0000000..fa882cb --- /dev/null +++ b/Tests/RunCMake/VS10Project/UnityBuildPCH.h @@ -0,0 +1 @@ +/* empty file */ diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake new file mode 100644 index 0000000..576be11 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "RemoveHeadersOnCopy" TRUE) +findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake new file mode 100644 index 0000000..57f8fbe --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedPlugIns.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake new file mode 100644 index 0000000..1bd1bd0 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake @@ -0,0 +1,20 @@ +add_executable(plug_in MACOS_BUNDLE Empty.txt) +set_target_properties(plug_in PROPERTIES + LINKER_LANGUAGE CXX + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in" + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app.plug_in" + XCODE_EXPLICIT_FILE_TYPE "wrapper.cfbundle" + XCODE_ATTRIBUTE_MACH_O_TYPE "mh_bundle" +) + +add_executable(app MACOSX_BUNDLE main.m) +add_dependencies(app plug_in) +set_target_properties(app PROPERTIES + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_EMBED_PLUGINS plug_in + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app" +) diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake index c742f50..be44ecd 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake @@ -37,6 +37,12 @@ check_property("ZOMBIE_OBJECTS" "NSZombieEnabled") check_property("MALLOC_STACK" "MallocStackLogging") check_property("DYNAMIC_LINKER_API_USAGE" "DYLD_PRINT_APIS") check_property("DYNAMIC_LIBRARY_LOADS" "DYLD_PRINT_LIBRARIES") +check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_1" "enableGPUFrameCaptureMode=\"1\"") +check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_3" "enableGPUFrameCaptureMode=\"3\"") +check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED" "enableGPUFrameCaptureMode=\"3\"") +check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL" "enableGPUFrameCaptureMode=\"1\"") +check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE" "enableGPUFrameCaptureMode=\"3\"") +check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE" "enableGPUFrameCaptureMode=\"1\"") check_property("EXECUTABLE" "myExecutable") check_property("ARGUMENTS" [=["--foo"]=]) diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake index ce5c0c9..126a9fc 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake @@ -26,16 +26,22 @@ create_scheme_for_variable(MALLOC_STACK) create_scheme_for_variable(DYNAMIC_LINKER_API_USAGE) create_scheme_for_variable(DYNAMIC_LIBRARY_LOADS) -function(create_scheme_for_property property value) +function(create_scheme_for_property scheme property value) set(XCODE_SCHEME_${property} ON) - add_executable(${property} main.cpp) - set_target_properties(${property} PROPERTIES XCODE_SCHEME_${property} "${value}") + add_executable(${scheme} main.cpp) + set_target_properties(${scheme} PROPERTIES XCODE_SCHEME_${property} "${value}") endfunction() -create_scheme_for_property(EXECUTABLE myExecutable) -create_scheme_for_property(ARGUMENTS "--foo;--bar=baz") -create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar") -create_scheme_for_property(WORKING_DIRECTORY "/working/dir") +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) +create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_METAL ENABLE_GPU_FRAME_CAPTURE_MODE Metal) +create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE ENABLE_GPU_FRAME_CAPTURE_MODE DISAbled) +create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE ENABLE_GPU_FRAME_CAPTURE_MODE METal) +create_scheme_for_property(EXECUTABLE EXECUTABLE myExecutable) +create_scheme_for_property(ARGUMENTS ARGUMENTS "--foo;--bar=baz") +create_scheme_for_property(ENVIRONMENT ENVIRONMENT "FOO=foo;BAR=bar") +create_scheme_for_property(WORKING_DIRECTORY WORKING_DIRECTORY "/working/dir") add_executable(NoSchema main.cpp) set_target_properties(NoSchema PROPERTIES XCODE_GENERATE_SCHEME OFF) diff --git a/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual.cmake b/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual.cmake new file mode 100644 index 0000000..2994fc2 --- /dev/null +++ b/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual.cmake @@ -0,0 +1,16 @@ +set(root "${CMAKE_CURRENT_SOURCE_DIR}/FindRootPathAndPrefixPathAreEqual") +set(CMAKE_FIND_ROOT_PATH "${root}") +set(CMAKE_PREFIX_PATH "${root}") +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE "ONLY") + +find_package(Foo + REQUIRED + CONFIG + NO_CMAKE_ENVIRONMENT_PATH + NO_SYSTEM_ENVIRONMENT_PATH + # Important because CMAKE_SYSTEM_PREFIX_PATH might contain "/" as a prefix + # And when "/" is rerooted onto the root above, the package is found even if + # CMAKE_PREFIX_PATH is empty. We want to ensure that we hit + # the CMAKE_FIND_ROOT_PATH == CMAKE_PREFIX_PATH code path. + NO_CMAKE_SYSTEM_PATH + ) diff --git a/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual/lib/cmake/Foo/FooConfig.cmake b/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual/lib/cmake/Foo/FooConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual/lib/cmake/Foo/FooConfig.cmake diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index b20a889..ad9757d 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -25,6 +25,7 @@ run_cmake(PackageRootNestedModule) run_cmake(PolicyPush) run_cmake(PolicyPop) run_cmake(RequiredOptionValuesClash) +run_cmake(FindRootPathAndPrefixPathAreEqual) run_cmake(SetFoundFALSE) run_cmake(WrongVersion) run_cmake(WrongVersionConfig) diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt index 1939097..138a69d 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt +++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt @@ -1,2 +1,11 @@ -^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\. -INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$ +^CMake Warning \(dev\) at TARGETS-Defaults-Cache.cmake:[0-9]+ \(install\): + Target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at TARGETS-Defaults-Cache.cmake:[0-9]+ \(install\): + Target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt index 1939097..5f56986 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt +++ b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt @@ -1,2 +1,11 @@ -^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\. -INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$ +^CMake Warning \(dev\) at TARGETS-Defaults.cmake:[0-9]+ \(install\): + Target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at TARGETS-Defaults.cmake:[0-9]+ \(install\): + Target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake index 806ae79..f726759 100644 --- a/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake @@ -2,7 +2,7 @@ include(RunCMake) run_cmake(empty_keyword_args) -if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") +if (CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang") macro(run_cmake_target test subtest target) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) set(RunCMake_TEST_OUTPUT_MERGE 1) @@ -28,7 +28,7 @@ function(run_Order) run_cmake_command(Order-build ${CMAKE_COMMAND} --build . --verbose --config Custom) endfunction() if(RunCMake_GENERATOR MATCHES "Ninja|Make" AND - CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$" AND + CMAKE_C_COMPILER_ID MATCHES "^(GNU|LCC|Clang|AppleClang)$" AND NOT CMAKE_C_SIMULATE_ID STREQUAL "MSVC") run_Order() endif() diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake index a707383..1a29ecf 100644 --- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake @@ -53,16 +53,13 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") run_cmake_target(genex_DEVICE_LINK interface LinkOptions_shared_interface --config Release) run_cmake_target(genex_DEVICE_LINK private LinkOptions_private --config Release) if (CMake_TEST_CUDA) - # Separable compilation is only supported on NVCC. - if(NOT CMake_TEST_CUDA STREQUAL "Clang") - run_cmake_target(genex_DEVICE_LINK CMP0105_UNSET LinkOptions_CMP0105_UNSET --config Release) - run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release) - run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release) - run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release) - - if (RunCMake_GENERATOR MATCHES "(Ninja|Unix Makefiles)") - run_cmake_target(genex_DEVICE_LINK host_link_options LinkOptions_host_link_options --config Release ${VERBOSE}) - endif() + run_cmake_target(genex_DEVICE_LINK CMP0105_UNSET LinkOptions_CMP0105_UNSET --config Release) + run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release) + run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release) + run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release) + + if (RunCMake_GENERATOR MATCHES "(Ninja|Unix Makefiles)") + run_cmake_target(genex_DEVICE_LINK host_link_options LinkOptions_host_link_options --config Release ${VERBOSE}) endif() run_cmake_target(genex_DEVICE_LINK no_device LinkOptions_no_device --config Release) diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake index 31ffe7f..cc3088a 100644 --- a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake @@ -1,4 +1,9 @@ +if(CMake_TEST_CUDA STREQUAL "NVIDIA") + set(expected "-Xlinker=OPT1 -Xlinker=OPT2 -Xlinker=OPT3 -Xlinker=OPT4 -Xlinker=OPT5") +elseif(CMake_TEST_CUDA STREQUAL "Clang") + set(expected "-Wl,OPT1 -Xlinker OPT2 -Xlinker OPT3 -Xlinker OPT4") +endif() -if (NOT actual_stdout MATCHES "-Xlinker=OPT1 -Xlinker=OPT2 -Xlinker=OPT3 -Xlinker=OPT4 -Xlinker=OPT5") - set (RunCMake_TEST_FAILED "Not found expected '-Xlinker=OPT1 -Xlinker=OPT2 -Xlinker=OPT3 -Xlinker=OPT4 -Xlinker=OPT5'.") +if(NOT actual_stdout MATCHES "${expected}") + set(RunCMake_TEST_FAILED "Not found expected '${expected}'") endif() diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake index a53ab20..b6c9ee6 100644 --- a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake @@ -25,32 +25,33 @@ target_link_options (LinkOptions_private PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEV if (CMake_TEST_CUDA) enable_language(CUDA) - # Separable compilation is only supported on NVCC. - if(NOT CMake_TEST_CUDA STREQUAL "Clang") - add_executable(LinkOptions_CMP0105_UNSET LinkOptionsDevice.cu) - set_property(TARGET LinkOptions_CMP0105_UNSET PROPERTY CUDA_SEPARABLE_COMPILATION ON) - target_link_options(LinkOptions_CMP0105_UNSET PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>) + add_executable(LinkOptions_CMP0105_UNSET LinkOptionsDevice.cu) + set_property(TARGET LinkOptions_CMP0105_UNSET PROPERTY CUDA_SEPARABLE_COMPILATION ON) + target_link_options(LinkOptions_CMP0105_UNSET PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>) - cmake_policy(SET CMP0105 OLD) + cmake_policy(SET CMP0105 OLD) - add_executable(LinkOptions_CMP0105_OLD LinkOptionsDevice.cu) - set_property(TARGET LinkOptions_CMP0105_OLD PROPERTY CUDA_SEPARABLE_COMPILATION ON) - target_link_options(LinkOptions_CMP0105_OLD PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>) + add_executable(LinkOptions_CMP0105_OLD LinkOptionsDevice.cu) + set_property(TARGET LinkOptions_CMP0105_OLD PROPERTY CUDA_SEPARABLE_COMPILATION ON) + target_link_options(LinkOptions_CMP0105_OLD PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>) - cmake_policy(SET CMP0105 NEW) + cmake_policy(SET CMP0105 NEW) - add_executable(LinkOptions_CMP0105_NEW LinkOptionsDevice.cu) - set_property(TARGET LinkOptions_CMP0105_NEW PROPERTY CUDA_SEPARABLE_COMPILATION ON) - target_link_options(LinkOptions_CMP0105_NEW PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>) + add_executable(LinkOptions_CMP0105_NEW LinkOptionsDevice.cu) + set_property(TARGET LinkOptions_CMP0105_NEW PROPERTY CUDA_SEPARABLE_COMPILATION ON) + target_link_options(LinkOptions_CMP0105_NEW PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>) - add_executable(LinkOptions_device LinkOptionsDevice.cu) - set_property(TARGET LinkOptions_device PROPERTY CUDA_SEPARABLE_COMPILATION ON) - target_link_options(LinkOptions_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}> - $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>) + add_executable(LinkOptions_device LinkOptionsDevice.cu) + set_property(TARGET LinkOptions_device PROPERTY CUDA_SEPARABLE_COMPILATION ON) + target_link_options(LinkOptions_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}> + $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>) - add_executable(LinkOptions_host_link_options LinkOptionsDevice.cu) - set_property(TARGET LinkOptions_host_link_options PROPERTY CUDA_SEPARABLE_COMPILATION ON) + add_executable(LinkOptions_host_link_options LinkOptionsDevice.cu) + set_property(TARGET LinkOptions_host_link_options PROPERTY CUDA_SEPARABLE_COMPILATION ON) + if(CMake_TEST_CUDA STREQUAL "NVIDIA") target_link_options(LinkOptions_host_link_options PRIVATE -Wl,OPT1 -Xlinker=OPT2 "SHELL:-Xlinker OPT3" "SHELL:LINKER:OPT4 LINKER:OPT5") + elseif(CMake_TEST_CUDA STREQUAL "Clang") + target_link_options(LinkOptions_host_link_options PRIVATE -Wl,OPT1 "SHELL:-Xlinker OPT2" "SHELL:LINKER:OPT3 LINKER:OPT4") endif() add_executable(LinkOptions_no_device LinkOptionsDevice.cu) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake b/Tests/RunCMake/target_sources/AddCustomTargetCheckProperty.cmake index 1787e87..1787e87 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake +++ b/Tests/RunCMake/target_sources/AddCustomTargetCheckProperty.cmake diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake b/Tests/RunCMake/target_sources/AddCustomTargetGenx.cmake index 0078eab..0078eab 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake +++ b/Tests/RunCMake/target_sources/AddCustomTargetGenx.cmake diff --git a/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-result.txt b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-stderr.txt index 9334bf6..9334bf6 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt +++ b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-stderr.txt diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources.cmake index 42a8ca2..42a8ca2 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake +++ b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources.cmake diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetPrivateSources.cmake index 11f0258..11f0258 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake +++ b/Tests/RunCMake/target_sources/AddCustomTargetPrivateSources.cmake diff --git a/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-result.txt b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-stderr.txt index afba4be..afba4be 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt +++ b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-stderr.txt diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources.cmake index d9e82c0..d9e82c0 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake +++ b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources.cmake diff --git a/Tests/RunCMake/target_sources/AddCustomTargetSources-result.txt b/Tests/RunCMake/target_sources/AddCustomTargetSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt b/Tests/RunCMake/target_sources/AddCustomTargetSources-stderr.txt index 4a153e9..4a153e9 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt +++ b/Tests/RunCMake/target_sources/AddCustomTargetSources-stderr.txt diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetSources.cmake index dd688d3..dd688d3 100644 --- a/Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake +++ b/Tests/RunCMake/target_sources/AddCustomTargetSources.cmake diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt b/Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt index 573541a..573541a 100644 --- a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt +++ b/Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt b/Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt index d7ccedb..d7ccedb 100644 --- a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt +++ b/Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake b/Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake index 464df36..642856c 100644 --- a/Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake +++ b/Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake @@ -1,5 +1,6 @@ cmake_policy(SET CMP0026 OLD) +enable_language(CXX) add_library(objlib OBJECT empty_1.cpp diff --git a/Tests/RunCMake/target_sources/CMP0076-OLD-result.txt b/Tests/RunCMake/target_sources/CMP0076-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0076-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt b/Tests/RunCMake/target_sources/CMP0076-OLD-stderr.txt index d47dd4d..d47dd4d 100644 --- a/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt +++ b/Tests/RunCMake/target_sources/CMP0076-OLD-stderr.txt diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake b/Tests/RunCMake/target_sources/CMP0076-OLD.cmake index 4d8c268..4d8c268 100644 --- a/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake +++ b/Tests/RunCMake/target_sources/CMP0076-OLD.cmake diff --git a/Tests/RunCMake/target_sources/CMP0076-WARN-result.txt b/Tests/RunCMake/target_sources/CMP0076-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0076-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt b/Tests/RunCMake/target_sources/CMP0076-WARN-stderr.txt index bd888ee..bd888ee 100644 --- a/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt +++ b/Tests/RunCMake/target_sources/CMP0076-WARN-stderr.txt diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake b/Tests/RunCMake/target_sources/CMP0076-WARN.cmake index 2e07331..2e07331 100644 --- a/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake +++ b/Tests/RunCMake/target_sources/CMP0076-WARN.cmake diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt b/Tests/RunCMake/target_sources/CMP0076-WARN/CMakeLists.txt index f9c7d6d..f9c7d6d 100644 --- a/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt +++ b/Tests/RunCMake/target_sources/CMP0076-WARN/CMakeLists.txt diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/CMP0076-WARN/subdir_empty_1.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp +++ b/Tests/RunCMake/target_sources/CMP0076-WARN/subdir_empty_1.cpp diff --git a/Tests/RunCMake/target_sources/CMakeLists.txt b/Tests/RunCMake/target_sources/CMakeLists.txt index 14ef56e..727f93a 100644 --- a/Tests/RunCMake/target_sources/CMakeLists.txt +++ b/Tests/RunCMake/target_sources/CMakeLists.txt @@ -1,5 +1,3 @@ cmake_minimum_required(VERSION 3.11) - project(${RunCMake_TEST} LANGUAGES NONE) - include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/target_sources/ConfigNotAllowed-result.txt b/Tests/RunCMake/target_sources/ConfigNotAllowed-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/ConfigNotAllowed-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt b/Tests/RunCMake/target_sources/ConfigNotAllowed-stderr.txt index c6b75fc..bc4afb7 100644 --- a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt +++ b/Tests/RunCMake/target_sources/ConfigNotAllowed-stderr.txt @@ -4,9 +4,9 @@ CMake Error in CMakeLists.txt: Config "Debug": - .*/Tests/RunCMake/TargetSources/empty_1.cpp - .*/Tests/RunCMake/TargetSources/empty_2.cpp + .*/Tests/RunCMake/target_sources/empty_1.cpp + .*/Tests/RunCMake/target_sources/empty_2.cpp Config "Release": - .*/Tests/RunCMake/TargetSources/empty_1.cpp + .*/Tests/RunCMake/target_sources/empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed.cmake b/Tests/RunCMake/target_sources/ConfigNotAllowed.cmake index 02af379..02af379 100644 --- a/Tests/RunCMake/TargetSources/ConfigNotAllowed.cmake +++ b/Tests/RunCMake/target_sources/ConfigNotAllowed.cmake diff --git a/Tests/RunCMake/target_sources/empty_keyword_args.cmake b/Tests/RunCMake/target_sources/EmptyKeywordArgs.cmake index 5cee451..5cee451 100644 --- a/Tests/RunCMake/target_sources/empty_keyword_args.cmake +++ b/Tests/RunCMake/target_sources/EmptyKeywordArgs.cmake diff --git a/Tests/RunCMake/TargetSources/ExportBuild-result.txt b/Tests/RunCMake/target_sources/ExportBuild-result.txt index 573541a..573541a 100644 --- a/Tests/RunCMake/TargetSources/ExportBuild-result.txt +++ b/Tests/RunCMake/target_sources/ExportBuild-result.txt diff --git a/Tests/RunCMake/TargetSources/ExportBuild.cmake b/Tests/RunCMake/target_sources/ExportBuild.cmake index b626aa6..b626aa6 100644 --- a/Tests/RunCMake/TargetSources/ExportBuild.cmake +++ b/Tests/RunCMake/target_sources/ExportBuild.cmake diff --git a/Tests/RunCMake/target_sources/FileSetChangeScope-result.txt b/Tests/RunCMake/target_sources/FileSetChangeScope-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeScope-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetChangeScope-stderr.txt b/Tests/RunCMake/target_sources/FileSetChangeScope-stderr.txt new file mode 100644 index 0000000..600d006 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeScope-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FileSetChangeScope\.cmake:[0-9]+ \(target_sources\): + target_sources Scope PUBLIC for file set "a" does not match original scope + INTERFACE +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetChangeScope.cmake b/Tests/RunCMake/target_sources/FileSetChangeScope.cmake new file mode 100644 index 0000000..9d835fe --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeScope.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS) +target_sources(lib1 PUBLIC FILE_SET a) diff --git a/Tests/RunCMake/target_sources/FileSetChangeType-result.txt b/Tests/RunCMake/target_sources/FileSetChangeType-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeType-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetChangeType-stderr.txt b/Tests/RunCMake/target_sources/FileSetChangeType-stderr.txt new file mode 100644 index 0000000..85fc718 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeType-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FileSetChangeType\.cmake:[0-9]+ \(target_sources\): + target_sources Type "RESOURCES" for file set "a" does not match original + type "HEADERS" +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetChangeType.cmake b/Tests/RunCMake/target_sources/FileSetChangeType.cmake new file mode 100644 index 0000000..69eb6bc --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeType.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS) +target_sources(lib1 PRIVATE FILE_SET a TYPE RESOURCES) diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongType-result.txt b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongType-stderr.txt b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-stderr.txt new file mode 100644 index 0000000..faf0f5a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetDefaultWrongType\.cmake:[0-9]+ \(target_sources\): + target_sources File set TYPE may only be "HEADERS" +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongType.cmake b/Tests/RunCMake/target_sources/FileSetDefaultWrongType.cmake new file mode 100644 index 0000000..c810d66 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongType.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET UNKNOWN) diff --git a/Tests/RunCMake/target_sources/FileSetDirectories.cmake b/Tests/RunCMake/target_sources/FileSetDirectories.cmake new file mode 100644 index 0000000..af30b1e --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetDirectories.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_subdirectory(dir3) +add_subdirectory(dir4) diff --git a/Tests/RunCMake/target_sources/FileSetExport.cmake b/Tests/RunCMake/target_sources/FileSetExport.cmake new file mode 100644 index 0000000..cde826a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExport.cmake @@ -0,0 +1,21 @@ +enable_language(C) + +add_library(lib1 STATIC lib1.c) +target_sources(lib1 + PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES error.c + PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h + PUBLIC FILE_SET b TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h2.h + INTERFACE FILE_SET c TYPE HEADERS BASE_DIRS "$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>" FILES "$<1:dir/dir.h>" + INTERFACE FILE_SET d TYPE HEADERS BASE_DIRS FILES "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty.h" + INTERFACE FILE_SET e TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>" FILES "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty2.h" + INTERFACE FILE_SET f TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES "${CMAKE_CURRENT_SOURCE_DIR}/empty3.h" + INTERFACE FILE_SET g TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/dir1" "${CMAKE_CURRENT_SOURCE_DIR}/dir2" FILES "${CMAKE_CURRENT_SOURCE_DIR}/dir1/file1.h" "${CMAKE_CURRENT_SOURCE_DIR}/dir2/file2.h" + INTERFACE FILE_SET dir3 TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/dir3" FILES dir3/dir3.h + ) + +install(TARGETS lib1 EXPORT export FILE_SET HEADERS FILE_SET a FILE_SET b FILE_SET c DESTINATION include/dir FILE_SET d FILE_SET e FILE_SET f DESTINATION include/$<IF:$<CONFIG:Debug>,debug,release> FILE_SET g FILE_SET dir3 DESTINATION include/dir3) +install(EXPORT export FILE export.cmake NAMESPACE install:: DESTINATION lib/cmake) +export(EXPORT export FILE export.cmake NAMESPACE export::) + +add_library(lib2 STATIC lib2.c) +target_link_libraries(lib2 PRIVATE lib1) diff --git a/Tests/RunCMake/target_sources/FileSetFileNoExist-result.txt b/Tests/RunCMake/target_sources/FileSetFileNoExist-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFileNoExist-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt b/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt new file mode 100644 index 0000000..9a2ca6a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt @@ -0,0 +1,10 @@ +^CMake Error at FileSetFileNoExist\.cmake:[0-9]+ \(add_library\): + Cannot find source file: + + [^ +]*/Tests/RunCMake/target_sources/noexist\.h +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/target_sources/FileSetFileNoExist.cmake b/Tests/RunCMake/target_sources/FileSetFileNoExist.cmake new file mode 100644 index 0000000..0df8186 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFileNoExist.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES noexist.h) diff --git a/Tests/RunCMake/target_sources/FileSetImport.cmake b/Tests/RunCMake/target_sources/FileSetImport.cmake new file mode 100644 index 0000000..9c7358a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetImport.cmake @@ -0,0 +1,97 @@ +enable_language(C) + +get_property(_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + +function(assert_prop_eq tgt prop value) + unset(actual_value) + get_property(actual_value TARGET ${tgt} PROPERTY ${prop}) + if(NOT actual_value STREQUAL value) + message(SEND_ERROR "Expected value of ${prop}:\n ${value}\nActual value:\n ${actual_value}") + endif() +endfunction() + +get_filename_component(export_build_dir "${CMAKE_BINARY_DIR}" DIRECTORY) +string(APPEND export_build_dir "/FileSetExport-build") + +include("${export_build_dir}/export.cmake") +include("${export_build_dir}/install/lib/cmake/export.cmake") + +assert_prop_eq(export::lib1 HEADER_SETS "") +assert_prop_eq(export::lib1 INTERFACE_HEADER_SETS "HEADERS;b;c;d;e;f;g;dir3") +assert_prop_eq(export::lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/error.c") +assert_prop_eq(export::lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(export::lib1 HEADER_SET_b "${CMAKE_CURRENT_SOURCE_DIR}/h2.h") +assert_prop_eq(export::lib1 HEADER_DIRS_b "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(export::lib1 HEADER_SET_c "$<1:dir/dir.h>") +assert_prop_eq(export::lib1 HEADER_DIRS_c "$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>") +assert_prop_eq(export::lib1 HEADER_SET_d "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty.h") +assert_prop_eq(export::lib1 HEADER_DIRS_d "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(export::lib1 HEADER_SET_e "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty2.h") +assert_prop_eq(export::lib1 HEADER_DIRS_e "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>") +assert_prop_eq(export::lib1 HEADER_SET_f "${CMAKE_CURRENT_SOURCE_DIR}/empty3.h") +assert_prop_eq(export::lib1 HEADER_DIRS_f "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(export::lib1 HEADER_SET_g "${CMAKE_CURRENT_SOURCE_DIR}/dir1/file1.h;${CMAKE_CURRENT_SOURCE_DIR}/dir2/file2.h") +assert_prop_eq(export::lib1 HEADER_DIRS_g "${CMAKE_CURRENT_SOURCE_DIR}/dir1;${CMAKE_CURRENT_SOURCE_DIR}/dir2") +assert_prop_eq(export::lib1 INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR};$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>;${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>;${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/dir1;${CMAKE_CURRENT_SOURCE_DIR}/dir2;${CMAKE_CURRENT_SOURCE_DIR}/dir3;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir1>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir2>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir3>") + +assert_prop_eq(install::lib1 HEADER_SETS "") +assert_prop_eq(install::lib1 INTERFACE_HEADER_SETS "HEADERS;b;c;d;e;f;g;dir3") +assert_prop_eq(install::lib1 HEADER_SET "${export_build_dir}/install/include/error.c") +assert_prop_eq(install::lib1 HEADER_DIRS "${export_build_dir}/install/include") +assert_prop_eq(install::lib1 HEADER_SET_b "${export_build_dir}/install/include/h2.h") +assert_prop_eq(install::lib1 HEADER_DIRS_b "${export_build_dir}/install/include") +assert_prop_eq(install::lib1 HEADER_SET_c "${export_build_dir}/install/include/dir/dir.h") +assert_prop_eq(install::lib1 HEADER_DIRS_c "${export_build_dir}/install/include/dir") +if(_multi_config) + assert_prop_eq(install::lib1 HEADER_SET_d "$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug/empty.h>;$<$<CONFIG:Release>:${export_build_dir}/install/include/release/empty.h>") +else() + assert_prop_eq(install::lib1 HEADER_SET_d "${export_build_dir}/install/include/debug/empty.h") +endif() +assert_prop_eq(install::lib1 HEADER_DIRS_d "${export_build_dir}/install/include") +if(_multi_config) + assert_prop_eq(install::lib1 HEADER_SET_e "$<$<CONFIG:Debug>:${export_build_dir}/install/include/empty2.h>;$<$<CONFIG:Release>:${export_build_dir}/install/include/empty2.h>") +else() + assert_prop_eq(install::lib1 HEADER_SET_e "${export_build_dir}/install/include/empty2.h") +endif() +assert_prop_eq(install::lib1 HEADER_DIRS_e "${export_build_dir}/install/include") +if(_multi_config) + assert_prop_eq(install::lib1 HEADER_SET_f "$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug/empty3.h>;$<$<CONFIG:Release>:${export_build_dir}/install/include/release/empty3.h>") + assert_prop_eq(install::lib1 HEADER_DIRS_f "$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug>;$<$<CONFIG:Release>:${export_build_dir}/install/include/release>") +else() + assert_prop_eq(install::lib1 HEADER_SET_f "${export_build_dir}/install/include/debug/empty3.h") + assert_prop_eq(install::lib1 HEADER_DIRS_f "${export_build_dir}/install/include/debug") +endif() +assert_prop_eq(install::lib1 HEADER_SET_g "${export_build_dir}/install/include/file1.h;${export_build_dir}/install/include/file2.h") +assert_prop_eq(install::lib1 HEADER_DIRS_g "${export_build_dir}/install/include") +if(_multi_config) + assert_prop_eq(install::lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug>>;$<BUILD_INTERFACE:$<$<CONFIG:Release>:${export_build_dir}/install/include/release>>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir3>") +else() + assert_prop_eq(install::lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/debug>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir3>") +endif() + +file(GLOB_RECURSE actual + LIST_DIRECTORIES TRUE + RELATIVE "${CMAKE_BINARY_DIR}/../FileSetExport-build/install/include" + "${CMAKE_BINARY_DIR}/../FileSetExport-build/install/include/*" + ) +if(actual) + list(SORT actual) +endif() +if(_multi_config) + set(expect "^debug;debug/empty\\.h;debug/empty3\\.h;dir;dir/dir\\.h;dir3;dir3/dir3\.h;empty2\\.h;error\\.c;file1\\.h;file2\\.h;h2\\.h;release;release/empty\\.h;release/empty3\\.h$") +else() + set(expect "^debug;debug/empty\\.h;debug/empty3\\.h;dir;dir/dir\\.h;dir3;dir3/dir3\.h;empty2\\.h;error\\.c;file1\\.h;file2\\.h;h2\\.h$") +endif() +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "Installed files: + ${actual} +do not match what we expected: + ${expect} +in directory: + ${CMAKE_INSTALL_PREFIX}") +endif() + +add_library(lib2_export STATIC lib2.c) +target_link_libraries(lib2_export PRIVATE export::lib1) +add_library(lib2_install STATIC lib2.c) +target_link_libraries(lib2_install PRIVATE install::lib1) diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-result.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-stderr.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-stderr.txt new file mode 100644 index 0000000..694f227 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FileSetInstallMissingSetsInterface\.cmake:[0-9]+ \(install\): + install TARGETS target lib1 is exported but not all of its file sets are + installed +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface.cmake b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface.cmake new file mode 100644 index 0000000..face69e --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +install(TARGETS lib1 EXPORT a) diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsPrivate.cmake b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsPrivate.cmake new file mode 100644 index 0000000..84778d1 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsPrivate.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +install(TARGETS lib1 EXPORT a) + +add_library(lib2 STATIC empty.c) +target_sources(lib2 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +install(TARGETS lib2) diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt b/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt new file mode 100644 index 0000000..3972c89 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetNoExistInterface\.cmake:[0-9]+ \(set_property\): + Header set "a" has not yet been created\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake b/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake new file mode 100644 index 0000000..266bc61 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +set_property(TARGET lib1 PROPERTY INTERFACE_HEADER_SETS "a") + +# Error happens at configure-time, so this doesn't help. +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS) diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt new file mode 100644 index 0000000..336bafe --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetNoExistPrivate\.cmake:[0-9]+ \(set_property\): + Header set "a" has not yet been created\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake b/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake new file mode 100644 index 0000000..f501912 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +set_property(TARGET lib1 PROPERTY HEADER_SETS "a") + +# Error happens at configure-time, so this doesn't help. +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS) diff --git a/Tests/RunCMake/target_sources/FileSetNoScope-result.txt b/Tests/RunCMake/target_sources/FileSetNoScope-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoScope-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt new file mode 100644 index 0000000..835ffe7 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetNoScope\.cmake:[0-9]+ \(target_sources\): + target_sources File set "a" is not in HEADER_SETS or INTERFACE_HEADER_SETS +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoScope.cmake b/Tests/RunCMake/target_sources/FileSetNoScope.cmake new file mode 100644 index 0000000..79ff341 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoScope.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +set_property(TARGET lib1 PROPERTY HEADER_SETS) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS FILES h2.h) diff --git a/Tests/RunCMake/target_sources/FileSetNoType-result.txt b/Tests/RunCMake/target_sources/FileSetNoType-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoType-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetNoType-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoType-stderr.txt new file mode 100644 index 0000000..5405fdb --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoType-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetNoType\.cmake:[0-9]+ \(target_sources\): + target_sources Must specify a TYPE when creating file set +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoType.cmake b/Tests/RunCMake/target_sources/FileSetNoType.cmake new file mode 100644 index 0000000..961525d --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoType.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a) diff --git a/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-result.txt b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-stderr.txt b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-stderr.txt new file mode 100644 index 0000000..551b9e7 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at FileSetOverlappingBaseDirs\.cmake:[0-9]+ \(target_sources\): + Base directories in file set cannot be subdirectories of each other: + + [^ +]*/Tests/RunCMake/target_sources/\. + [^ +]*/Tests/RunCMake/target_sources/dir3 +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs.cmake b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs.cmake new file mode 100644 index 0000000..eba4191 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS $<1:${CMAKE_CURRENT_SOURCE_DIR}/.$<SEMICOLON>${CMAKE_CURRENT_SOURCE_DIR}/dir3> FILES h1.h) diff --git a/Tests/RunCMake/target_sources/FileSetProperties.cmake b/Tests/RunCMake/target_sources/FileSetProperties.cmake new file mode 100644 index 0000000..ce010a3 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetProperties.cmake @@ -0,0 +1,67 @@ +enable_language(C) + +function(assert_prop_undef tgt prop) + unset(actual_value) + get_property(actual_value TARGET ${tgt} PROPERTY ${prop}) + if(DEFINED actual_value) + message(SEND_ERROR "${prop} should be undefined, actual value:\n ${actual_value}") + endif() +endfunction() + +function(assert_prop_eq tgt prop value) + unset(actual_value) + get_property(actual_value TARGET ${tgt} PROPERTY ${prop}) + if(NOT actual_value STREQUAL value) + message(SEND_ERROR "Expected value of ${prop}:\n ${value}\nActual value:\n ${actual_value}") + endif() +endfunction() + +add_library(lib1 STATIC empty.c) +assert_prop_eq(lib1 HEADER_SETS "") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "") +assert_prop_undef(lib1 INCLUDE_DIRECTORIES) +assert_prop_undef(lib1 INTERFACE_INCLUDE_DIRECTORIES) + +target_sources(lib1 PUBLIC FILE_SET a TYPE HEADERS BASE_DIRS "." FILES h1.h h2.h) +assert_prop_eq(lib1 HEADER_SETS "a") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a") +assert_prop_eq(lib1 HEADER_DIRS_a "${CMAKE_CURRENT_SOURCE_DIR}/.") +assert_prop_eq(lib1 HEADER_SET_a "${CMAKE_CURRENT_SOURCE_DIR}/h1.h;${CMAKE_CURRENT_SOURCE_DIR}/h2.h") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>") + +target_sources(lib1 PUBLIC FILE_SET a FILES h3.h) +assert_prop_eq(lib1 HEADER_SETS "a") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a") +assert_prop_eq(lib1 HEADER_DIRS_a "${CMAKE_CURRENT_SOURCE_DIR}/.") +assert_prop_eq(lib1 HEADER_SET_a "${CMAKE_CURRENT_SOURCE_DIR}/h1.h;${CMAKE_CURRENT_SOURCE_DIR}/h2.h;${CMAKE_CURRENT_SOURCE_DIR}/h3.h") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>") + +target_sources(lib1 PRIVATE FILE_SET b TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/dir" FILES dir/dir.h) +assert_prop_eq(lib1 HEADER_SETS "a;b") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a") +assert_prop_eq(lib1 HEADER_DIRS_b "${CMAKE_CURRENT_SOURCE_DIR}/dir") +assert_prop_eq(lib1 HEADER_SET_b "${CMAKE_CURRENT_SOURCE_DIR}/dir/dir.h") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>") + +target_sources(lib1 INTERFACE FILE_SET c TYPE HEADERS) +assert_prop_eq(lib1 HEADER_SETS "a;b") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a;c") +assert_prop_eq(lib1 HEADER_DIRS_c "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(lib1 HEADER_SET_c "") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") + +target_sources(lib1 PUBLIC FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES h1.h) +assert_prop_eq(lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/h1.h") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") + +target_sources(lib1 PUBLIC FILE_SET HEADERS FILES h2.h) +assert_prop_eq(lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/h1.h;${CMAKE_CURRENT_SOURCE_DIR}/h2.h") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-result.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-stderr.txt new file mode 100644 index 0000000..f4bd447 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at FileSetWrongBaseDirs\.cmake:[0-9]+ \(target_sources\): + File: + + [^ +]*/Tests/RunCMake/target_sources/h1\.h + + must be in one of the file set's base directories: + + [^ +]*/Tests/RunCMake/target_sources/dir3 +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirs.cmake b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs.cmake new file mode 100644 index 0000000..38d3abd --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/dir3 FILES h1.h) diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-result.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-stderr.txt new file mode 100644 index 0000000..6bb0ec6 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at reldir/CMakeLists\.txt:[0-9]+ \(target_sources\): + File: + + [^ +]*/Tests/RunCMake/target_sources/reldir/\.\./h1\.h + + must be in one of the file set's base directories: + + [^ +]*/Tests/RunCMake/target_sources/reldir/\. diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative.cmake b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative.cmake new file mode 100644 index 0000000..2ca8a8e --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_subdirectory(reldir) diff --git a/Tests/RunCMake/target_sources/FileSetWrongType-result.txt b/Tests/RunCMake/target_sources/FileSetWrongType-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongType-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetWrongType-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongType-stderr.txt new file mode 100644 index 0000000..8ffa786 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongType-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetWrongType\.cmake:[0-9]+ \(target_sources\): + target_sources File set TYPE may only be "HEADERS" +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetWrongType.cmake b/Tests/RunCMake/target_sources/FileSetWrongType.cmake new file mode 100644 index 0000000..b7dee72 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongType.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE UNKNOWN) diff --git a/Tests/RunCMake/TargetSources/OriginDebug-result.txt b/Tests/RunCMake/target_sources/OriginDebug-result.txt index 573541a..573541a 100644 --- a/Tests/RunCMake/TargetSources/OriginDebug-result.txt +++ b/Tests/RunCMake/target_sources/OriginDebug-result.txt diff --git a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt b/Tests/RunCMake/target_sources/OriginDebug-stderr.txt index a40f463..502d5f1 100644 --- a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt +++ b/Tests/RunCMake/target_sources/OriginDebug-stderr.txt @@ -1,7 +1,7 @@ CMake Debug Log at OriginDebug.cmake:13 \(add_library\): Used sources for target OriginDebug: - \* .*Tests/RunCMake/TargetSources/empty_2.cpp + \* .*Tests/RunCMake/target_sources/empty_2.cpp Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) @@ -9,7 +9,7 @@ Call Stack \(most recent call first\): CMake Debug Log at OriginDebug.cmake:16 \(set_property\): Used sources for target OriginDebug: - \* .*Tests/RunCMake/TargetSources/empty_3.cpp + \* .*Tests/RunCMake/target_sources/empty_3.cpp Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) @@ -17,7 +17,7 @@ Call Stack \(most recent call first\): CMake Debug Log at OriginDebug.cmake:20 \(target_sources\): Used sources for target OriginDebug: - \* .*Tests/RunCMake/TargetSources/empty_4.cpp + \* .*Tests/RunCMake/target_sources/empty_4.cpp Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) @@ -25,7 +25,7 @@ Call Stack \(most recent call first\): CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\): Used sources for target OriginDebug: - \* .*Tests/RunCMake/TargetSources/empty_1.cpp + \* .*Tests/RunCMake/target_sources/empty_1.cpp Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/TargetSources/OriginDebug.cmake b/Tests/RunCMake/target_sources/OriginDebug.cmake index d40a1d8..d40a1d8 100644 --- a/Tests/RunCMake/TargetSources/OriginDebug.cmake +++ b/Tests/RunCMake/target_sources/OriginDebug.cmake diff --git a/Tests/RunCMake/target_sources/RelativePathInInterface-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInInterface-stdout.txt new file mode 100644 index 0000000..19818b8 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInInterface-stdout.txt @@ -0,0 +1 @@ +-- iface: .*Tests/RunCMake/target_sources/empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake b/Tests/RunCMake/target_sources/RelativePathInInterface.cmake index 0d3e9a4..25b22dd 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake +++ b/Tests/RunCMake/target_sources/RelativePathInInterface.cmake @@ -1,4 +1,5 @@ cmake_policy(SET CMP0076 NEW) +enable_language(CXX) add_library(iface INTERFACE) target_sources(iface INTERFACE empty_1.cpp) diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx-stdout.txt new file mode 100644 index 0000000..a51a792 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx-stdout.txt @@ -0,0 +1 @@ +-- genexlib: \$<1:.*Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp>;\$<1:.*Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/../empty_1.cpp>;\$<1:empty_2.cpp> diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx.cmake index 1cdc2a7..9afcea5 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx.cmake @@ -1,4 +1,5 @@ cmake_policy(SET CMP0076 NEW) +enable_language(CXX) add_library(genexlib) add_subdirectory(RelativePathInSubdirGenEx) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/CMakeLists.txt index 3bcf454..3bcf454 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/CMakeLists.txt diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInclude-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude-stdout.txt new file mode 100644 index 0000000..c42c88b --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude-stdout.txt @@ -0,0 +1 @@ +-- privatelib: .*Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp;empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude.cmake index 4acbeca..f5954c4 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude.cmake @@ -1,4 +1,5 @@ cmake_policy(SET CMP0076 NEW) +enable_language(CXX) add_library(privatelib) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/CMakeLists.txt index 3dcb135..3dcb135 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/CMakeLists.txt diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInterface-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface-stdout.txt new file mode 100644 index 0000000..ebbb29f --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface-stdout.txt @@ -0,0 +1 @@ +-- iface: .*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/../empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/../empty_2.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface.cmake index 3652b4f..6a4e200 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface.cmake @@ -1,4 +1,5 @@ cmake_policy(SET CMP0076 NEW) +enable_language(CXX) add_library(iface INTERFACE) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/CMakeLists.txt index 02e6966..02e6966 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/CMakeLists.txt diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate-stdout.txt new file mode 100644 index 0000000..104f1de --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate-stdout.txt @@ -0,0 +1 @@ +-- privatelib: .*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/../empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/../empty_2.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate.cmake index d0d3dc4..dd16e3f 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate.cmake @@ -1,4 +1,5 @@ cmake_policy(SET CMP0076 NEW) +enable_language(CXX) add_library(privatelib) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/CMakeLists.txt index 56ee853..56ee853 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/CMakeLists.txt diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index b67c598..9828fa2 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -1,3 +1,80 @@ include(RunCMake) -run_cmake(empty_keyword_args) +if(RunCMake_GENERATOR STREQUAL "Xcode") + run_cmake(ConfigNotAllowed) +endif() + +run_cmake(EmptyKeywordArgs) +run_cmake(OriginDebug) +run_cmake(CMP0026-LOCATION) +run_cmake(CMP0076-OLD) +run_cmake(CMP0076-WARN) +run_cmake(RelativePathInInterface) +run_cmake(RelativePathInSubdirGenEx) +run_cmake(RelativePathInSubdirInterface) +run_cmake(RelativePathInSubdirPrivate) +run_cmake(RelativePathInSubdirInclude) +run_cmake(ExportBuild) +run_cmake(AddCustomTargetPublicSources) +run_cmake(AddCustomTargetPrivateSources) +run_cmake(AddCustomTargetInterfaceSources) +run_cmake(AddCustomTargetSources) +run_cmake(AddCustomTargetCheckProperty) +run_cmake(AddCustomTargetGenx) + +run_cmake(FileSetProperties) +run_cmake(FileSetNoType) +run_cmake(FileSetWrongType) +run_cmake(FileSetDefaultWrongType) +run_cmake(FileSetChangeScope) +run_cmake(FileSetChangeType) +run_cmake(FileSetWrongBaseDirs) +run_cmake(FileSetWrongBaseDirsRelative) +run_cmake(FileSetOverlappingBaseDirs) +run_cmake(FileSetInstallMissingSetsPrivate) +run_cmake(FileSetInstallMissingSetsInterface) +run_cmake(FileSetNoScope) +run_cmake(FileSetNoExistPrivate) +run_cmake(FileSetNoExistInterface) +run_cmake(FileSetDirectories) + +set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0115=NEW) +run_cmake(FileSetFileNoExist) +unset(RunCMake_TEST_OPTIONS) + +function(run_export_import name) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(_config_options "-DCMAKE_CONFIGURATION_TYPES=Debug\\\\;Release") + else() + set(_config_options -DCMAKE_BUILD_TYPE=Debug) + endif() + + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Export-build") + set(RunCMake_TEST_OPTIONS "--install-prefix=${RunCMake_TEST_BINARY_DIR}/install" ${_config_options}) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${name}Export) + run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Debug) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Release) + endif() + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Import-build") + unset(RunCMake_TEST_OPTIONS) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${name}Import) + run_cmake_command(${name}Import-build ${CMAKE_COMMAND} --build . --config Debug) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + run_cmake_command(${name}Import-build ${CMAKE_COMMAND} --build . --config Release) + endif() + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endfunction() + +run_export_import(FileSet) diff --git a/Tests/RunCMake/target_sources/debug/empty.h b/Tests/RunCMake/target_sources/debug/empty.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/debug/empty.h diff --git a/Tests/RunCMake/target_sources/debug/empty2.h b/Tests/RunCMake/target_sources/debug/empty2.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/debug/empty2.h diff --git a/Tests/RunCMake/target_sources/dir/dir.h b/Tests/RunCMake/target_sources/dir/dir.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir/dir.h diff --git a/Tests/RunCMake/target_sources/dir1/file1.h b/Tests/RunCMake/target_sources/dir1/file1.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir1/file1.h diff --git a/Tests/RunCMake/target_sources/dir2/file2.h b/Tests/RunCMake/target_sources/dir2/file2.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir2/file2.h diff --git a/Tests/RunCMake/target_sources/dir3/CMakeLists.txt b/Tests/RunCMake/target_sources/dir3/CMakeLists.txt new file mode 100644 index 0000000..e23ceb8 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir3/CMakeLists.txt @@ -0,0 +1 @@ +add_library(lib1 STATIC ../empty.c) diff --git a/Tests/RunCMake/target_sources/dir3/dir3.h b/Tests/RunCMake/target_sources/dir3/dir3.h new file mode 100644 index 0000000..e45c25a --- /dev/null +++ b/Tests/RunCMake/target_sources/dir3/dir3.h @@ -0,0 +1,4 @@ +#ifndef DIR3_H +#define DIR3_H + +#endif diff --git a/Tests/RunCMake/target_sources/dir4/CMakeLists.txt b/Tests/RunCMake/target_sources/dir4/CMakeLists.txt new file mode 100644 index 0000000..6475685 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir4/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(lib1 PRIVATE FILE_SET HEADERS BASE_DIRS ${CMAKE_SOURCE_DIR} FILES + $<1:dir3.h> + dir4.h + ) diff --git a/Tests/RunCMake/target_sources/dir4/dir4.h b/Tests/RunCMake/target_sources/dir4/dir4.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir4/dir4.h diff --git a/Tests/RunCMake/target_sources/empty.c b/Tests/RunCMake/target_sources/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/empty.c diff --git a/Tests/RunCMake/target_sources/empty3.h b/Tests/RunCMake/target_sources/empty3.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/empty3.h diff --git a/Tests/RunCMake/TargetSources/empty_1.cpp b/Tests/RunCMake/target_sources/empty_1.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/empty_1.cpp +++ b/Tests/RunCMake/target_sources/empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/empty_2.cpp b/Tests/RunCMake/target_sources/empty_2.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/empty_2.cpp +++ b/Tests/RunCMake/target_sources/empty_2.cpp diff --git a/Tests/RunCMake/TargetSources/empty_3.cpp b/Tests/RunCMake/target_sources/empty_3.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/empty_3.cpp +++ b/Tests/RunCMake/target_sources/empty_3.cpp diff --git a/Tests/RunCMake/TargetSources/empty_4.cpp b/Tests/RunCMake/target_sources/empty_4.cpp index 11ec041..11ec041 100644 --- a/Tests/RunCMake/TargetSources/empty_4.cpp +++ b/Tests/RunCMake/target_sources/empty_4.cpp diff --git a/Tests/RunCMake/target_sources/error.c b/Tests/RunCMake/target_sources/error.c new file mode 100644 index 0000000..f10e687 --- /dev/null +++ b/Tests/RunCMake/target_sources/error.c @@ -0,0 +1 @@ +#error "This should not be compiled" diff --git a/Tests/RunCMake/target_sources/h1.h b/Tests/RunCMake/target_sources/h1.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/h1.h diff --git a/Tests/RunCMake/target_sources/h2.h b/Tests/RunCMake/target_sources/h2.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/h2.h diff --git a/Tests/RunCMake/target_sources/h3.h b/Tests/RunCMake/target_sources/h3.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/h3.h diff --git a/Tests/RunCMake/target_sources/lib1.c b/Tests/RunCMake/target_sources/lib1.c new file mode 100644 index 0000000..95042de --- /dev/null +++ b/Tests/RunCMake/target_sources/lib1.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + void lib1(void) +{ +} diff --git a/Tests/RunCMake/target_sources/lib2.c b/Tests/RunCMake/target_sources/lib2.c new file mode 100644 index 0000000..a060dc9 --- /dev/null +++ b/Tests/RunCMake/target_sources/lib2.c @@ -0,0 +1,8 @@ +#include <dir3.h> + +#ifdef _WIN32 +__declspec(dllexport) +#endif + void lib2(void) +{ +} diff --git a/Tests/RunCMake/TargetSources/main.cpp b/Tests/RunCMake/target_sources/main.cpp index 766b775..766b775 100644 --- a/Tests/RunCMake/TargetSources/main.cpp +++ b/Tests/RunCMake/target_sources/main.cpp diff --git a/Tests/RunCMake/target_sources/reldir/CMakeLists.txt b/Tests/RunCMake/target_sources/reldir/CMakeLists.txt new file mode 100644 index 0000000..df22b25 --- /dev/null +++ b/Tests/RunCMake/target_sources/reldir/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(lib1 STATIC ../empty.c) +target_sources(lib1 PRIVATE FILE_SET HEADERS BASE_DIRS . FILES ../h1.h) diff --git a/Tests/RunCMake/target_sources/release/empty.h b/Tests/RunCMake/target_sources/release/empty.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/release/empty.h diff --git a/Tests/RunCMake/target_sources/release/empty2.h b/Tests/RunCMake/target_sources/release/empty2.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/release/empty2.h diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index b19fd0e..dcd3799 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -28,7 +28,7 @@ run_cmake(TargetTypeInvalid) run_cmake(TargetTypeStatic) if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND - CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|Clang|AppleClang)$") + CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$") set (RunCMake_TEST_OPTIONS -DRunCMake_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) run_cmake(LinkOptions) unset (RunCMake_TEST_OPTIONS) @@ -62,10 +62,10 @@ if(CMake_TEST_ISPC) endif() run_cmake(ISPCDuplicateTarget${ninja}) endif() -if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) +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 STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) +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_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake index fa30eb4..d74add0 100644 --- a/Tests/RunCMake/try_run/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) run_cmake(BadLinkLibraries) if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND - CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|Clang|AppleClang)$") + CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$") set (RunCMake_TEST_OPTIONS -DRunCMake_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) run_cmake(LinkOptions) unset (RunCMake_TEST_OPTIONS) diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt index 80348ab..14e9d6e 100644 --- a/Tests/SetLang/CMakeLists.txt +++ b/Tests/SetLang/CMakeLists.txt @@ -1,5 +1,8 @@ # test forcing a source file language to c++ from c cmake_minimum_required (VERSION 2.6) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() project(SetLang) # force this to be verbose so I can debug a dashboard entry set(CMAKE_VERBOSE_MAKEFILE 1) @@ -20,7 +23,7 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio" AND "x${CMAKE_C_COMPILER_ID}" STREQU set_property(TARGET stay PROPERTY COMPILE_OPTIONS "-TP") endif() -if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)")) +if((CMAKE_C_COMPILER_ID MATCHES "(GNU|LCC|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)")) cmake_policy(SET CMP0119 NEW) add_library(zoom zoom.zzz) set_source_files_properties(zoom.zzz PROPERTIES LANGUAGE CXX) diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index d0c413f..b1b9d57 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required (VERSION 2.8.12) +if(POLICY CMP0129) + cmake_policy(SET CMP0129 NEW) +endif() project(TryCompile) macro(TEST_ASSERT value msg) @@ -321,7 +324,7 @@ if(DEFINED CXX_BOGUS_FLAG) message(SEND_ERROR "CHECK_CXX_COMPILER_FLAG shouldn't construct CXX_BOGUS_FLAG as a normal variable") endif() -if(CMAKE_C_COMPILER_ID STREQUAL "GNU") +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC") unset(C_STRICT_PROTOTYPES CACHE) CHECK_C_COMPILER_FLAG("-Werror;-Wstrict-prototypes" C_STRICT_PROTOTYPES) TEST_ASSERT(C_STRICT_PROTOTYPES "CHECK_C_COMPILER_FLAG failed -Werror -Wstrict-prototypes") diff --git a/Tests/X11/CMakeLists.txt b/Tests/X11/CMakeLists.txt index 76ae58c..ba45e96 100644 --- a/Tests/X11/CMakeLists.txt +++ b/Tests/X11/CMakeLists.txt @@ -29,7 +29,6 @@ if(X11_FOUND) target_link_libraries(HelloWorldX11 ${X11_LIBRARIES}) install(TARGETS HelloWorldX11 DESTINATION bin) - set(CPACK_BINARY_OSXX11 ON CACHE BOOL "" FORCE) set(CPACK_BINARY_PACKAGEMAKER OFF CACHE BOOL "" FORCE ) set(CPACK_PACKAGE_NAME HelloWorldX11Package) set(CPACK_PACKAGE_EXECUTABLES HelloWorldX11 HelloWorldX11) |