Skip to content

Commit 692dcca

Browse files
committed
Don't regenerate IntrospectionSchema.* unless updating sampels
1 parent 805b924 commit 692dcca

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/CMakeLists.txt

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,24 @@ endif()
4242
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
4343
target_link_libraries(schemagen PRIVATE ${BOOST_LIBRARIES})
4444

45-
add_custom_command(
46-
OUTPUT
47-
${CMAKE_BINARY_DIR}/IntrospectionSchema.cpp
48-
${CMAKE_BINARY_DIR}/include/graphqlservice/IntrospectionSchema.h
49-
COMMAND schemagen --introspection
50-
DEPENDS schemagen
51-
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
52-
COMMENT "Generating IntrospectionSchema files"
53-
)
45+
if(GRAPHQL_UPDATE_SAMPLES)
46+
add_custom_command(
47+
OUTPUT
48+
${CMAKE_BINARY_DIR}/IntrospectionSchema.cpp
49+
${CMAKE_BINARY_DIR}/include/graphqlservice/IntrospectionSchema.h
50+
COMMAND schemagen --introspection
51+
DEPENDS schemagen
52+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
53+
COMMENT "Generating IntrospectionSchema files")
54+
55+
install(FILES
56+
${CMAKE_BINARY_DIR}/include/graphqlservice/IntrospectionSchema.h
57+
${CMAKE_BINARY_DIR}/IntrospectionSchema.cpp
58+
DESTINATION ${CMAKE_SOURCE_DIR}/samples/introspection)
59+
else()
60+
file(COPY ${CMAKE_SOURCE_DIR}/samples/introspection/IntrospectionSchema.cpp DESTINATION ${CMAKE_BINARY_DIR})
61+
file(COPY ${CMAKE_SOURCE_DIR}/samples/introspection/IntrospectionSchema.h DESTINATION ${CMAKE_BINARY_DIR}/include/graphqlservice)
62+
endif()
5463

5564
# graphqlservice
5665
add_library(graphqlservice
@@ -98,13 +107,6 @@ else()
98107
set(GRAPHQL_BUILD_TESTS OFF CACHE BOOL "GRAPHQL_BUILD_TESTS depends on BUILD_GRAPHQLJSON" FORCE)
99108
endif()
100109

101-
if(GRAPHQL_UPDATE_SAMPLES)
102-
install(FILES
103-
${CMAKE_BINARY_DIR}/include/graphqlservice/IntrospectionSchema.h
104-
${CMAKE_BINARY_DIR}/IntrospectionSchema.cpp
105-
DESTINATION ${CMAKE_SOURCE_DIR}/samples/introspection)
106-
endif()
107-
108110
install(TARGETS
109111
graphqlpeg
110112
graphqlservice

0 commit comments

Comments
 (0)