Skip to content

Commit

Permalink
Revert submodule labels.
Browse files Browse the repository at this point in the history
  • Loading branch information
spahrenk committed Jul 2, 2024
1 parent 10e5889 commit 1b10e0f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "googletest"]
[submodule "vendor/googletest"]
path = vendor/googletest
url = https://github.com/google/googletest.git
[submodule "fmt"]
[submodule "vendor/fmt"]
path = vendor/fmt
url = https://github.com/fmtlib/fmt.git
20 changes: 12 additions & 8 deletions cmake/initialize-submodules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@
macro(add_submodule module_name)

message(STATUS "Attempting to add \"${module_name}\" to project \"${PROJECT_NAME}\"")

set(have_submodule FALSE)
set(have_path FALSE)

# first optional argument is module path
set(Args ${ARGN})
list(LENGTH Args NumArgs)

# first optional argument is module reference
if(NumArgs GREATER 0)
set(module_path ${ARGV1})
set(module_ref_name ${ARGV1})
else()
set(module_path ${CMAKE_CURRENT_SOURCE_DIR}/${module_name})
set(module_ref_name ${module_name})
endif()

# second optional argument is module reference
# second optional argument is module path
if(NumArgs GREATER 1)
set(module_ref_name ${ARGV2})
set(module_path ${ARGV2})
else()
set(module_ref_name ${module_name})
set(module_path ${CMAKE_CURRENT_SOURCE_DIR}/${module_name})
endif()

set(is_submodule FALSE)
Expand Down Expand Up @@ -59,9 +63,9 @@ macro(add_submodule module_name)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(GIT_SUBMOD_RESULT EQUAL "0")
message(STATUS "Successfully updated submodule \"${module_name}\" at ${submodule_path}")
message(STATUS "Successfully updated submodule \"${module_name}\"")
else()
message(FATAL_ERROR "Unable to update submodule \"${module_name}\" at ${submodule_path}")
message(FATAL_ERROR "Unable to update submodule \"${module_name}\"")
endif()
endif()
else()
Expand Down
4 changes: 2 additions & 2 deletions vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include(initialize-submodules)

add_submodule(fmt)
add_submodule(fmt vendor/fmt)
if (NOT TARGET fmt)
set(FMT_INSTALL OFF CACHE BOOL "" FORCE)
mark_as_advanced(FMT_CMAKE_DIR FMT_CUDA_TEST FMT_DEBUG_POSTFIX FMT_DOC FMT_FUZZ FMT_INC_DIR FMT_INSTALL FMT_INSTALL
Expand All @@ -18,5 +18,5 @@ if (${PROJECT_NAME}_BUILD_TESTING AND NOT TARGET gtest)
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
mark_as_advanced(BUILD_GTEST BUILD_GMOCK INSTALL_GTEST)

add_submodule(gtest ${CMAKE_CURRENT_SOURCE_DIR}/googletest googletest)
add_submodule(gtest vendor/googletest ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
endif ()

0 comments on commit 1b10e0f

Please sign in to comment.