Skip to content

Commit 3183f7b

Browse files
committed
CMake: fix TodaySchema sample install
When UPDATE_SAMPLES=ON and BUILD_TESTS=OFF, the install target produced the following error: -- Install configuration: "" -- Installing: .../samples/IntrospectionSchema.h -- Installing: .../samples/IntrospectionSchema.cpp CMake Error at cmake_install.cmake:49 (file): file INSTALL cannot find ".../TodaySchema.h". The reason was that by default `add_custom_command()` is not added to the default build target. `add_custom_target(<tgt> ALL ...)` on the other hand has this capability, so use that.
1 parent 494a577 commit 3183f7b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,14 @@ if(BUILD_TESTS OR UPDATE_SAMPLES)
5151
COMMENT "Generating mock TodaySchema files"
5252
)
5353

54+
# force the generation of samples on the default build target
55+
add_custom_target(update_samples ALL
56+
DEPENDS ${CMAKE_BINARY_DIR}/TodaySchema.cpp
57+
)
58+
5459
if(BUILD_TESTS)
5560
add_library(todaygraphql
56-
TodaySchema.cpp
61+
${CMAKE_BINARY_DIR}/TodaySchema.cpp
5762
Today.cpp)
5863
target_link_libraries(todaygraphql
5964
graphqlservice)

0 commit comments

Comments
 (0)