@@ -67,21 +67,36 @@ cppgraphqlgen_target_set_cxx_standard(graphqlservice)
67
67
# RapidJSON is the only option for JSON serialization used in this project, but if you want
68
68
# to use another JSON library you can implement an alternate version of the functions in
69
69
# JSONResponse.cpp to serialize to and from GraphQLResponse and build graphqljson from that.
70
+ # You will also need to define how to build the graphqljson library target with your
71
+ # implementation, and you should set BUILD_GRAPHQLJSON so that the test dependencies know
72
+ # about your version of graphqljson.
70
73
option (USE_RAPIDJSON "Use RapidJSON for JSON serialization." ON )
71
74
72
75
if (USE_RAPIDJSON )
73
76
find_package (RapidJSON CONFIG REQUIRED )
74
77
78
+ set (BUILD_GRAPHQLJSON ON )
75
79
add_library (graphqljson
76
80
JSONResponse.cpp )
77
- target_link_libraries (graphqljson PUBLIC
78
- graphqlservice )
79
81
target_include_directories (graphqljson SYSTEM PRIVATE
80
82
${RAPIDJSON_INCLUDE_DIRS} )
83
+ endif ()
84
+
85
+ if (BUILD_GRAPHQLJSON )
86
+ option (BUILD_TESTS "Build the tests and sample schema library." ON )
87
+
88
+ target_link_libraries (graphqljson PUBLIC
89
+ graphqlservice )
81
90
cppgraphqlgen_target_set_cxx_standard (graphqljson )
91
+
92
+ install (TARGETS
93
+ graphqljson
94
+ EXPORT cppgraphqlgen-targets
95
+ RUNTIME DESTINATION bin
96
+ ARCHIVE DESTINATION lib
97
+ LIBRARY DESTINATION lib )
82
98
endif ()
83
99
84
- option (BUILD_TESTS "Build the tests and sample schema library." ON )
85
100
option (UPDATE_SAMPLES "Regenerate the sample schema sources whether or not we're building the tests and the sample library." ON )
86
101
87
102
if (BUILD_TESTS OR UPDATE_SAMPLES )
@@ -160,15 +175,6 @@ install(TARGETS
160
175
ARCHIVE DESTINATION lib
161
176
LIBRARY DESTINATION lib )
162
177
163
- if (USE_RAPIDJSON )
164
- install (TARGETS
165
- graphqljson
166
- EXPORT cppgraphqlgen-targets
167
- RUNTIME DESTINATION bin
168
- ARCHIVE DESTINATION lib
169
- LIBRARY DESTINATION lib )
170
- endif ()
171
-
172
178
set (CMAKE_INSTALL_TOOLSDIR ${CMAKE_INSTALL_PREFIX} /bin/${PROJECT_NAME}
173
179
CACHE PATH "Install schemagen to this directory." )
174
180
0 commit comments