Skip to content

Commit 3f8735a

Browse files
committed
Make building the ifc tool optional.
1 parent 6a73c55 commit 3f8735a

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

CMakeLists.txt

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,19 @@ target_link_libraries(ifc-dom PUBLIC ifc-reader)
6565
target_compile_features(ifc-dom PUBLIC cxx_std_23)
6666
target_include_directories(ifc-dom PUBLIC "\$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>")
6767

68-
# The `ifc` tool executable.
69-
add_executable(
70-
ifc
71-
src/tools/ifc.cxx
72-
)
73-
add_executable(Microsoft.IFC::Tool ALIAS ifc)
74-
set_property(TARGET ifc PROPERTY EXPORT_NAME Tool)
75-
target_compile_features(ifc PUBLIC cxx_std_23)
76-
target_link_libraries(ifc ifc-reader)
77-
target_include_directories(ifc PUBLIC "\$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>")
68+
option(BUILD_TOOLS "Build the ifc tool executable" ON)
69+
if(BUILD_TOOLS)
70+
# The `ifc` tool executable.
71+
add_executable(
72+
ifc
73+
src/tools/ifc.cxx
74+
)
75+
add_executable(Microsoft.IFC::Tool ALIAS ifc)
76+
set_property(TARGET ifc PROPERTY EXPORT_NAME Tool)
77+
target_compile_features(ifc PUBLIC cxx_std_23)
78+
target_link_libraries(ifc ifc-reader)
79+
target_include_directories(ifc PUBLIC "\$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>")
80+
endif()
7881

7982
# The IFC SDK comprises the `reader`, the `dom`, and the tool.
8083
add_library(SDK INTERFACE)

cmake/install-rules.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ install(
1919
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
2020
)
2121

22-
install(
23-
TARGETS ifc
24-
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
25-
)
22+
if(TARGET ifc)
23+
install(
24+
TARGETS ifc
25+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
26+
)
27+
endif()
2628

2729
install(
2830
TARGETS ifc-dom ifc-reader SDK

0 commit comments

Comments
 (0)