Skip to content

Commit d096c9f

Browse files
committed
fixed CMake with BUILD_CLI=OFF
1 parent 3529cd6 commit d096c9f

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ if(LIBXML2_XMLLINT_EXECUTABLE)
4747
add_dependencies(validatePlatforms validatePlatforms-${platformname})
4848
endforeach()
4949

50-
add_custom_target(errorlist-xml $<TARGET_FILE:cppcheck> --errorlist > ${CMAKE_BINARY_DIR}/errorlist.xml
51-
DEPENDS cppcheck)
50+
if (BUILD_CLI)
51+
add_custom_target(errorlist-xml $<TARGET_FILE:cppcheck> --errorlist > ${CMAKE_BINARY_DIR}/errorlist.xml
52+
DEPENDS cppcheck)
5253

53-
add_custom_target(example-xml $<TARGET_FILE:cppcheck> --xml --enable=all --inconclusive --max-configs=1 ${CMAKE_SOURCE_DIR}/samples 2> ${CMAKE_BINARY_DIR}/example.xml
54-
DEPENDS cppcheck)
54+
add_custom_target(example-xml $<TARGET_FILE:cppcheck> --xml --enable=all --inconclusive --max-configs=1 ${CMAKE_SOURCE_DIR}/samples 2> ${CMAKE_BINARY_DIR}/example.xml
55+
DEPENDS cppcheck)
56+
endif()
5557

5658
add_custom_target(createXMLExamples DEPENDS errorlist-xml example-xml)
5759

cmake/options.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ option(ENABLE_CHECK_INTERNAL "Enable internal checks"
6262
option(DISABLE_DMAKE "Disable run-dmake dependencies" OFF)
6363
option(BUILD_MANPAGE "Enable man target to build manpage" OFF)
6464

65-
option(BUILD_CLI "Build the cli application" ON)
65+
option(BUILD_CLI "Build the CLI application" ON)
66+
if(NOT BUILD_CLI AND BUILD_TESTS)
67+
message(FATAL_ERROR "Building the tests requires the CLI to be build as well")
68+
endif()
6669

6770
option(BUILD_GUI "Build the qt application" OFF)
6871
option(WITH_QCHART "Enable QtCharts usage in the GUI" OFF)

0 commit comments

Comments
 (0)