1+ function (update_submodule submodule)
2+ find_package (Git REQUIRED)
3+ execute_process (COMMAND ${GIT_EXECUTABLE} submodule update --init thirdparty/${submodule}
4+ WORKING_DIRECTORY "${PROJECT_SOURCE_DIR} " )
5+ endfunction ()
16
27find_package (expected-lite QUIET )
38if (expected-lite_FOUND)
49 add_library (expected-lite ALIAS expected-lite::expected-lite)
510else ()
611 message (STATUS "expected-lite not found, using submodule" )
12+ update_submodule(nonstd/expected-light)
713 add_subdirectory (nonstd/expected-light EXCLUDE_FROM_ALL )
814endif ()
915
@@ -12,6 +18,7 @@ if(variant-lite_FOUND)
1218 add_library (variant-lite ALIAS variant-lite::variant-lite)
1319else ()
1420 message (STATUS "variant-lite not found, using submodule" )
21+ update_submodule(nonstd/variant-light)
1522 add_subdirectory (nonstd/variant-light EXCLUDE_FROM_ALL )
1623 # There's a bug in the lib, the target does not include the header include dirs.
1724 # See https://github.com/martinmoene/variant-lite/issues/25
@@ -23,6 +30,7 @@ if(value-ptr-lite_FOUND)
2330 add_library (value -ptr-lite ALIAS value -ptr-lite::value -ptr-lite)
2431else ()
2532 message (STATUS "value-ptr-lite not found, using submodule" )
33+ update_submodule(nonstd/value -ptr-lite)
2634 add_subdirectory (nonstd/value -ptr-lite EXCLUDE_FROM_ALL )
2735 add_library (value -ptr-lite ALIAS value_ptr-lite)
2836endif ()
@@ -42,6 +50,7 @@ if(boost_filesystem_FOUND AND
4250 add_library (boost_optional ALIAS boost_optional::boost_optional)
4351else ()
4452 message (STATUS "One or more boost modules not found, using submodule" )
53+ update_submodule(boost)
4554 set (BOOST_CMAKE_LIBRARIES filesystem algorithm variant optional CACHE INTERNAL "" )
4655 add_subdirectory (boost EXCLUDE_FROM_ALL )
4756
@@ -71,6 +80,7 @@ if(JINJA2CPP_BUILD_TESTS)
7180 add_library (gtest ALIAS gtest::gtest)
7281 else ()
7382 message (STATUS "expected-lite not found, using submodule" )
83+ update_submodule(gtest)
7484
7585 if (MSVC )
7686 if (MSVC_RUNTIME_TYPE STREQUAL "/MD" OR NOT MSVC_RUNTIME_TYPE)
0 commit comments