Skip to content

Commit

Permalink
Prevent endless builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausKlein committed Sep 5, 2024
1 parent a9830ab commit 997a331
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions chapter08/custom_target_dependency_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Chapter 8 example to illustrate using a custom target with an implicit dependency on another target
# Chapter 8 example to illustrate using a custom target with an dependency on another target
#
# SPDX-License-Identifier: MIT

Expand All @@ -8,7 +8,7 @@ project(
ch8_generate_hash_using_a_target
VERSION 1.0
DESCRIPTION
"A simple C++ project to demonstrate creation of a custom target that implicitly depends on another one"
"A simple C++ project to demonstrate creation of a custom target that depends on another one"
LANGUAGES CXX
)

Expand All @@ -17,11 +17,12 @@ project(
# generator expression implcitely adds the dependency between the targets. the
# ALL keyword adds the custom target to the ALL meta-target
add_custom_target(
ch8_create_hash ALL
ch8_create_hash # XXX ALL
COMMAND
cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CreateSha256.cmake
$<TARGET_FILE:ch8_generate_hash_using_a_target>
${CMAKE_CURRENT_BINARY_DIR}/hash_example.sha256
DEPENDS ch8_generate_hash_using_a_target
COMMENT
"Creating sha256 hash using a custom target $<TARGET_FILE:ch8_generate_hash_using_a_target>"
)
Expand Down
2 changes: 1 addition & 1 deletion chapter08/custom_target_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ list(
# the variable ${MYLIST} to be expanded as a string. if this is not set B and C
# will be treated as separate commands
add_custom_target(
ch8_echo_target ALL
ch8_echo_target # XXX ALL
COMMAND cmake -E echo "Hello from a custom target in chapter 8 ${MYLIST}"
COMMAND_EXPAND_LISTS
)

0 comments on commit 997a331

Please sign in to comment.