Skip to content

Commit

Permalink
Don't allow Core targets to be installed if submodule (#7379)
Browse files Browse the repository at this point in the history
Co-authored-by: Kenneth Geisshirt <kenneth.geisshirt@mongodb.com>
Co-authored-by: Jørgen Edelbo <jorgen.edelbo@mongodb.com>
  • Loading branch information
3 people authored Feb 26, 2024
1 parent 58b9d52 commit 166e7df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project(RealmCore)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake")

if(NOT CMAKE_SOURCE_DIR STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
if(NOT DEFINED REALM_CORE_SUBMODULE_BUILD AND NOT CMAKE_SOURCE_DIR STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
# Realm Core is being built as part of another project, likely an SDK
set(REALM_CORE_SUBMODULE_BUILD ON)
endif()
Expand Down Expand Up @@ -361,6 +361,11 @@ add_subdirectory(bindgen)
# Install the licence and changelog files
install(FILES LICENSE CHANGELOG.md DESTINATION "doc/realm" COMPONENT devel)

# Only prepare test/install/package targets if we're not a submodule
if(REALM_CORE_SUBMODULE_BUILD)
return()
endif()

# Make the project importable from the build directory
set(REALM_EXPORTED_TARGETS
Storage
Expand Down Expand Up @@ -394,11 +399,6 @@ install(FILES tools/cmake/AcquireRealmDependency.cmake
COMPONENT devel
)

# Only prepare test/install/package targets if we're not a submodule
if(REALM_CORE_SUBMODULE_BUILD)
return()
endif()

if(CMAKE_SYSTEM_NAME MATCHES "^Windows")
# Increase the Catch2 virtual console width because our test names can be very long and they break test reports
set(CATCH_CONFIG_CONSOLE_WIDTH 300)
Expand Down
2 changes: 1 addition & 1 deletion bindgen/src/realm_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ struct Helpers {
{
size_t max_size = util::base64_decoded_size(input.size());
std::unique_ptr<char[]> data(new char[max_size]);
if (auto size = util::base64_decode(input, data.get(), max_size)) {
if (auto size = util::base64_decode(input, {data.get(), max_size})) {
OwnedBinaryData result(std::move(data), *size);
return result;
}
Expand Down

0 comments on commit 166e7df

Please sign in to comment.