Skip to content

Commit 4b03e64

Browse files
committed
Modify initialize-submodules so it can handle subdirectories without CMakeLists.txt.
1 parent 66031b7 commit 4b03e64

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

cmake/initialize-submodules.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
macro(add_submodule submodule_name)
55
# Clone a submodule and add its subdirectory to the build (if the corresponding target hasn't already been added)
6-
set(options) # None
6+
set(options
7+
NO_CMAKELISTS # Skip adding a subdirectory if the submodule doesn't have a CMakeLists.txt file
8+
)
79
set(one_value_args
810
TARGET_NAME # Specify if target name is different from the submodule name
911
PARENT_SUBMODULE_PATH # Specify if you want to leverage a submodule outside of this project's vendor directory
@@ -39,7 +41,7 @@ macro(add_submodule submodule_name)
3941
endif ()
4042

4143
# Add subdirectory
42-
if (NOT TARGET ${target_name} AND (EXISTS "${submodule_path}"))
44+
if (NOT TARGET ${target_name} AND (EXISTS "${submodule_path}") AND NOT add_${submodule_name}_args_NO_CMAKELISTS)
4345
add_subdirectory(${submodule_path})
4446
endif ()
4547

vendor/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ endif()
1111

1212
add_submodule(courier MARK_AS_ADVANCED courier_BUILD_TESTING courier_COVERAGE courier_STATIC_LIB)
1313
add_submodule(glfw)
14+
add_submodule(libtess2 NO_CMAKELISTS TARGET_NAME tess2)
1415

1516
# GLAD
1617
add_subdirectory(glad)

0 commit comments

Comments
 (0)