Skip to content

Commit 589b104

Browse files
committed
Fix update_version dependencies so source dirs are not outputs
1 parent b44df99 commit 589b104

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/CMakeLists.txt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ if(GRAPHQL_UPDATE_VERSION)
99
${CMAKE_CURRENT_BINARY_DIR}/Version.h
1010
@ONLY)
1111

12-
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/../include/graphqlservice/internal/Version.h
12+
add_custom_command(OUTPUT updated_version_h
1313
COMMAND ${CMAKE_COMMAND} -E copy_if_different Version.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/graphqlservice/internal
14+
COMMAND ${CMAKE_COMMAND} -E touch updated_version_h
1415
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Version.h)
1516

1617
add_custom_target(update_version_h ALL
17-
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../include/graphqlservice/internal/Version.h)
18+
DEPENDS updated_version_h)
1819

1920
# res/target_version.rc
2021
set(GRAPHQL_RC_VERSION "${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},0")
@@ -29,12 +30,14 @@ if(GRAPHQL_UPDATE_VERSION)
2930
${CMAKE_CURRENT_BINARY_DIR}/${target}_version.rc
3031
@ONLY)
3132

32-
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/../res/${target}_version.rc
33+
add_custom_command(OUTPUT updated_${target}_version_rc
3334
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${target}_version.rc ${CMAKE_CURRENT_SOURCE_DIR}/../res
35+
COMMAND ${CMAKE_COMMAND} -E touch updated_${target}_version_rc
3436
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}_version.rc)
3537

3638
add_custom_target(update_${target}_version_rc ALL
37-
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../res/${target}_version.rc)
39+
DEPENDS updated_${target}_version_rc)
40+
add_dependencies(${target} update_${target}_version_rc)
3841
endfunction()
3942
endif()
4043

@@ -128,12 +131,14 @@ if(GRAPHQL_BUILD_SCHEMAGEN)
128131
${CMAKE_CURRENT_BINARY_DIR}/SchemaGen.rc
129132
@ONLY)
130133

131-
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/../res/SchemaGen.rc
134+
add_custom_command(OUTPUT updated_schemagen_rc
132135
COMMAND ${CMAKE_COMMAND} -E copy_if_different SchemaGen.rc ${CMAKE_CURRENT_SOURCE_DIR}/../res
136+
COMMAND ${CMAKE_COMMAND} -E touch updated_schemagen_rc
133137
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SchemaGen.rc)
134138

135139
add_custom_target(update_schemagen_rc ALL
136-
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../res/SchemaGen.rc)
140+
DEPENDS updated_schemagen_rc)
141+
add_dependencies(schemagen update_schemagen_rc)
137142
endif()
138143

139144
if(WIN32)
@@ -165,12 +170,14 @@ if(GRAPHQL_BUILD_CLIENTGEN)
165170
${CMAKE_CURRENT_BINARY_DIR}/ClientGen.rc
166171
@ONLY)
167172

168-
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/../res/ClientGen.rc
173+
add_custom_command(OUTPUT updated_clientgen_rc
169174
COMMAND ${CMAKE_COMMAND} -E copy_if_different ClientGen.rc ${CMAKE_CURRENT_SOURCE_DIR}/../res
175+
COMMAND ${CMAKE_COMMAND} -E touch updated_clientgen_rc
170176
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ClientGen.rc)
171177

172178
add_custom_target(update_clientgen_rc ALL
173-
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../res/ClientGen.rc)
179+
DEPENDS updated_clientgen_rc)
180+
add_dependencies(clientgen update_clientgen_rc)
174181
endif()
175182

176183
if(WIN32)

0 commit comments

Comments
 (0)