Skip to content

Commit 428e817

Browse files
committed
Improved documentation of dependency() function.
Added more explanations about dependency build files. Signed-off-by: kilo52 <[email protected]>
1 parent 25847e3 commit 428e817

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

share/c/cmake/DependencyUtil.cmake

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,29 @@ include(FetchContent)
2626
# either Git repositories or source archive files. It is a thin wrapper
2727
# around the FetchContent machinery provided by CMake. By using this function,
2828
# a dependency becomes available to the underlying project in a
29-
# declarative way. There are three steps involved in processing a dependency:
29+
# declarative way. There are four steps involved in processing a dependency:
3030
# First, the specified dependency is passed to the CMake FetchContent_Declare()
3131
# function. The caller does not need to take care of the different arguments
3232
# as used by FetchContent_Declare(), as they are handled entirely by
3333
# this function. Secondly, an additional configuration file is potentially
3434
# included by this function. The purpose of such a file is to configure the
3535
# dependency to be made available to the underlying project. The configuration
36-
# file can contain arbitrary CMake code. Lastly, the dependency is made
36+
# file can contain arbitrary CMake code. Thirdly, the dependency is made
3737
# available by means of the CMake FetchContent_MakeAvailable() function.
38+
# This steps makes the declared targets of the dependency available to
39+
# the underlying project. Lastly, an additional build file is potentially
40+
# included by this function. This is similar to the configuration step, but
41+
# it allows a project to potentially manipulate the dependency target and its
42+
# build directly.
3843
#
39-
# The configuration file for a dependency is an ordinary CMake file, i.e. it
40-
# must contain syntactically valid CMake code. Each dependency configuration
41-
# file is included by this function. It can be used to set variables or do any
42-
# other kind of processing in order to properly configure the dependency to
43-
# be used by the underlying project. If no concrete config file is
44-
# specified by the DEPENDENCY_CONFIG_FILE argument, then this function will
45-
# look for a dependency config file in the "cmake" directory relative
44+
# The configuration and build files for a dependency are ordinary CMake files,
45+
# i.e. it must contain syntactically valid CMake code. Each dependency
46+
# configuration and build file included by this function if found.
47+
# The configuration file can be used to set variables or do any other kind of
48+
# processing in order to properly configure the dependency to be used by the
49+
# underlying project. If no concrete config file is specified by
50+
# the DEPENDENCY_CONFIG_FILE argument, then this function will look for a
51+
# dependency config file in the "cmake" directory relative
4652
# to CMAKE_CURRENT_SOURCE_DIR. The corresponding config file must be
4753
# named "Config${DEPENDENCY_NAME}.cmake", where ${DEPENDENCY_NAME} is the
4854
# value of the mandatory dependency name argument. Please note that the
@@ -51,6 +57,9 @@ include(FetchContent)
5157
# concrete dependency is named "mydep", then the conventional config file
5258
# has to be named "ConfigMydep.cmake". The inclusion of any dependency config
5359
# file can be disabled by using the DEPENDENCY_NO_CONFIG option.
60+
# The same convention applies to the build file, with a varying file prefix
61+
# of "Build*" instead of "Config*". For example, a conventional build file
62+
# might be named "BuildMydep.cmake".
5463
#
5564
# Every dependency has a scope. A dependency is only used if its scope
5665
# is active. The following scopes are available: "ANY", "RELEASE", "TEST"

share/cpp/cmake/DependencyUtil.cmake

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,29 @@ include(FetchContent)
2626
# either Git repositories or source archive files. It is a thin wrapper
2727
# around the FetchContent machinery provided by CMake. By using this function,
2828
# a dependency becomes available to the underlying project in a
29-
# declarative way. There are three steps involved in processing a dependency:
29+
# declarative way. There are four steps involved in processing a dependency:
3030
# First, the specified dependency is passed to the CMake FetchContent_Declare()
3131
# function. The caller does not need to take care of the different arguments
3232
# as used by FetchContent_Declare(), as they are handled entirely by
3333
# this function. Secondly, an additional configuration file is potentially
3434
# included by this function. The purpose of such a file is to configure the
3535
# dependency to be made available to the underlying project. The configuration
36-
# file can contain arbitrary CMake code. Lastly, the dependency is made
36+
# file can contain arbitrary CMake code. Thirdly, the dependency is made
3737
# available by means of the CMake FetchContent_MakeAvailable() function.
38+
# This steps makes the declared targets of the dependency available to
39+
# the underlying project. Lastly, an additional build file is potentially
40+
# included by this function. This is similar to the configuration step, but
41+
# it allows a project to potentially manipulate the dependency target and its
42+
# build directly.
3843
#
39-
# The configuration file for a dependency is an ordinary CMake file, i.e. it
40-
# must contain syntactically valid CMake code. Each dependency configuration
41-
# file is included by this function. It can be used to set variables or do any
42-
# other kind of processing in order to properly configure the dependency to
43-
# be used by the underlying project. If no concrete config file is
44-
# specified by the DEPENDENCY_CONFIG_FILE argument, then this function will
45-
# look for a dependency config file in the "cmake" directory relative
44+
# The configuration and build files for a dependency are ordinary CMake files,
45+
# i.e. it must contain syntactically valid CMake code. Each dependency
46+
# configuration and build file included by this function if found.
47+
# The configuration file can be used to set variables or do any other kind of
48+
# processing in order to properly configure the dependency to be used by the
49+
# underlying project. If no concrete config file is specified by
50+
# the DEPENDENCY_CONFIG_FILE argument, then this function will look for a
51+
# dependency config file in the "cmake" directory relative
4652
# to CMAKE_CURRENT_SOURCE_DIR. The corresponding config file must be
4753
# named "Config${DEPENDENCY_NAME}.cmake", where ${DEPENDENCY_NAME} is the
4854
# value of the mandatory dependency name argument. Please note that the
@@ -51,6 +57,9 @@ include(FetchContent)
5157
# concrete dependency is named "mydep", then the conventional config file
5258
# has to be named "ConfigMydep.cmake". The inclusion of any dependency config
5359
# file can be disabled by using the DEPENDENCY_NO_CONFIG option.
60+
# The same convention applies to the build file, with a varying file prefix
61+
# of "Build*" instead of "Config*". For example, a conventional build file
62+
# might be named "BuildMydep.cmake".
5463
#
5564
# Every dependency has a scope. A dependency is only used if its scope
5665
# is active. The following scopes are available: "ANY", "RELEASE", "TEST"

0 commit comments

Comments
 (0)