Skip to content

Commit d195e8c

Browse files
authored
Merge pull request microsoft#96 from wravery/master
Re-enable GRAPHQL_BUILD_SCHEMAGEN option in CMake
2 parents 08aa0e5 + 0f206b9 commit d195e8c

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ if(NOT pegtl_FOUND)
3131
add_subdirectory(PEGTL)
3232
endif()
3333

34-
option(GRAPHQL_UPDATE_SAMPLES "Regenerate the sample schema sources whether or not we're building the tests." ON)
34+
option(GRAPHQL_BUILD_SCHEMAGEN "Build the schemagen tool." ON)
35+
36+
if(GRAPHQL_BUILD_SCHEMAGEN)
37+
option(GRAPHQL_UPDATE_SAMPLES "Regenerate the sample schema sources whether or not we're building the tests." ON)
38+
else()
39+
set(GRAPHQL_UPDATE_SAMPLES OFF CACHE BOOL "Disable regenerating samples." FORCE)
40+
endif()
3541

3642
add_subdirectory(cmake)
3743
add_subdirectory(src)

src/CMakeLists.txt

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,31 @@ if(WIN32 AND BUILD_SHARED_LIBS)
3838
endif()
3939

4040
# schemagen
41-
add_executable(schemagen SchemaGenerator.cpp)
42-
target_link_libraries(schemagen PRIVATE
43-
graphqlpeg
44-
graphqlresponse)
45-
add_bigobj_flag(schemagen)
46-
47-
set(BOOST_COMPONENTS program_options)
48-
set(BOOST_LIBRARIES Boost::program_options)
49-
50-
if(NOT MSVC)
51-
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} filesystem)
52-
set(BOOST_LIBRARIES ${BOOST_LIBRARIES} Boost::filesystem)
53-
target_compile_options(schemagen PRIVATE -DUSE_BOOST_FILESYSTEM)
41+
if(GRAPHQL_BUILD_SCHEMAGEN)
42+
add_executable(schemagen SchemaGenerator.cpp)
43+
target_link_libraries(schemagen PRIVATE
44+
graphqlpeg
45+
graphqlresponse)
46+
add_bigobj_flag(schemagen)
47+
48+
set(BOOST_COMPONENTS program_options)
49+
set(BOOST_LIBRARIES Boost::program_options)
50+
51+
if(NOT MSVC)
52+
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} filesystem)
53+
set(BOOST_LIBRARIES ${BOOST_LIBRARIES} Boost::filesystem)
54+
target_compile_options(schemagen PRIVATE -DUSE_BOOST_FILESYSTEM)
55+
endif()
56+
57+
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
58+
target_link_libraries(schemagen PRIVATE ${BOOST_LIBRARIES})
59+
60+
install(TARGETS schemagen
61+
EXPORT cppgraphqlgen-targets
62+
RUNTIME DESTINATION ${GRAPHQL_INSTALL_TOOLS_DIR}/${PROJECT_NAME}
63+
CONFIGURATIONS Release)
5464
endif()
5565

56-
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
57-
target_link_libraries(schemagen PRIVATE ${BOOST_LIBRARIES})
58-
59-
install(TARGETS schemagen
60-
EXPORT cppgraphqlgen-targets
61-
RUNTIME DESTINATION ${GRAPHQL_INSTALL_TOOLS_DIR}/${PROJECT_NAME}
62-
CONFIGURATIONS Release)
63-
6466
# introspection
6567
if(GRAPHQL_UPDATE_SAMPLES)
6668
add_custom_command(

0 commit comments

Comments
 (0)