From 8d61fd774c5f4852874464139c90710da425b744 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 17 Nov 2023 09:41:28 +0100 Subject: [PATCH] Update vendored CMakeRC to latest commit --- 3rdparty/cmrc.cmake | 4 ++-- 3rdparty/cmrc/CMakeRC.cmake | 35 +++++++++++++++++++++++++++-------- 3rdparty/cmrc/README.CMakeRC | 2 +- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/3rdparty/cmrc.cmake b/3rdparty/cmrc.cmake index 0426d53e..096d80be 100644 --- a/3rdparty/cmrc.cmake +++ b/3rdparty/cmrc.cmake @@ -7,9 +7,9 @@ set(_dir "${CMAKE_CURRENT_SOURCE_DIR}/cmrc") if(YCM_DOWNLOAD_3RDPARTY) - set(_files CMakeRC.cmake 15109e38dddefce15028a0d0563557b2dc72446a + set(_files CMakeRC.cmake 6f82bf951d9d32c610892b1315ad588dbfc2f8de LICENSE.txt 053245749bccc40304ec4d9d0a47aea0b1c9f8f6) - set(_ref f26f6e35a859b0ba28818dbcc0ed9b3880881cf4) + set(_ref 952ffddba731fc110bd50409e8d2b8a06abbd237) _ycm_download(3rdparty-cmrc "CMakeRC (A Standalone CMake-Based C++ Resource Compiler) git repository" diff --git a/3rdparty/cmrc/CMakeRC.cmake b/3rdparty/cmrc/CMakeRC.cmake index cf7f232a..6a5147ae 100644 --- a/3rdparty/cmrc/CMakeRC.cmake +++ b/3rdparty/cmrc/CMakeRC.cmake @@ -34,7 +34,7 @@ endif() set(_version 2.0.0) -cmake_minimum_required(VERSION 3.3) +cmake_minimum_required(VERSION 3.12) include(CMakeParseArguments) if(COMMAND cmrc_add_resource_library) @@ -77,6 +77,10 @@ set(hpp_content [==[ #include #include +#if !(defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) || defined(CMRC_NO_EXCEPTIONS)) +#define CMRC_NO_EXCEPTIONS 1 +#endif + namespace cmrc { namespace detail { struct dummy; } } #define CMRC_DECLARE(libid) \ @@ -243,15 +247,15 @@ public: return !(*this == rhs); } - iterator operator++() noexcept { - auto cp = *this; + iterator& operator++() noexcept { ++_base_iter; - return cp; + return *this; } - iterator& operator++(int) noexcept { + iterator operator++(int) noexcept { + auto cp = *this; ++_base_iter; - return *this; + return cp; } }; @@ -339,7 +343,12 @@ public: file open(const std::string& path) const { auto entry_ptr = _get(path); if (!entry_ptr || !entry_ptr->is_file()) { +#ifdef CMRC_NO_EXCEPTIONS + fprintf(stderr, "Error no such file or directory: %s\n", path.c_str()); + abort(); +#else throw std::system_error(make_error_code(std::errc::no_such_file_or_directory), path); +#endif } auto& dat = entry_ptr->as_file(); return file{dat.begin_ptr, dat.end_ptr}; @@ -362,10 +371,20 @@ public: directory_iterator iterate_directory(const std::string& path) const { auto entry_ptr = _get(path); if (!entry_ptr) { +#ifdef CMRC_NO_EXCEPTIONS + fprintf(stderr, "Error no such file or directory: %s\n", path.c_str()); + abort(); +#else throw std::system_error(make_error_code(std::errc::no_such_file_or_directory), path); +#endif } if (!entry_ptr->is_directory()) { +#ifdef CMRC_NO_EXCEPTIONS + fprintf(stderr, "Error not a directory: %s\n", path.c_str()); + abort(); +#else throw std::system_error(make_error_code(std::errc::not_a_directory), path); +#endif } return entry_ptr->as_directory().begin(); } @@ -387,7 +406,7 @@ endif() file(GENERATE OUTPUT "${cmrc_hpp}" CONTENT "${hpp_content}" CONDITION ${_generate}) add_library(cmrc-base INTERFACE) -target_include_directories(cmrc-base INTERFACE "${CMRC_INCLUDE_DIR}") +target_include_directories(cmrc-base INTERFACE $) # Signal a basic C++11 feature to require C++11. target_compile_features(cmrc-base INTERFACE cxx_nullptr) set_property(TARGET cmrc-base PROPERTY INTERFACE_CXX_EXTENSIONS OFF) @@ -566,7 +585,7 @@ function(cmrc_add_resources name) endif() get_filename_component(dirpath "${ARG_PREFIX}${relpath}" DIRECTORY) _cmrc_register_dirs("${name}" "${dirpath}") - get_filename_component(abs_out "${libdir}/intermediate/${relpath}.cpp" ABSOLUTE) + get_filename_component(abs_out "${libdir}/intermediate/${ARG_PREFIX}${relpath}.cpp" ABSOLUTE) # Generate a symbol name relpath the file's character array _cm_encode_fpath(sym "${relpath}") # Get the symbol name for the parent directory diff --git a/3rdparty/cmrc/README.CMakeRC b/3rdparty/cmrc/README.CMakeRC index dd1af21f..5a2373e0 100644 --- a/3rdparty/cmrc/README.CMakeRC +++ b/3rdparty/cmrc/README.CMakeRC @@ -1,5 +1,5 @@ Some of the files in this folder and its subfolder come from the CMakeRC git -repository (ref f26f6e35a859b0ba28818dbcc0ed9b3880881cf4): +repository (ref 952ffddba731fc110bd50409e8d2b8a06abbd237): https://github.com/vector-of-bool/cmrc/