Skip to content

Commit

Permalink
Update vendored CMakeRC to latest commit
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed Nov 17, 2023
1 parent fea7cbf commit 8d61fd7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
4 changes: 2 additions & 2 deletions 3rdparty/cmrc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
35 changes: 27 additions & 8 deletions 3rdparty/cmrc/CMakeRC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -77,6 +77,10 @@ set(hpp_content [==[
#include <system_error>
#include <type_traits>

#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) \
Expand Down Expand Up @@ -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;
}
};

Expand Down Expand Up @@ -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};
Expand All @@ -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();
}
Expand All @@ -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 $<BUILD_INTERFACE:${CMRC_INCLUDE_DIR}>)
# 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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/cmrc/README.CMakeRC
Original file line number Diff line number Diff line change
@@ -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/

Expand Down

0 comments on commit 8d61fd7

Please sign in to comment.