From 5219564d7180b12a09a301255ea2c73bccc85f3c Mon Sep 17 00:00:00 2001 From: paulbourelly999 <77466294+paulbourelly999@users.noreply.github.com> Date: Wed, 22 Jan 2025 10:06:19 -0500 Subject: [PATCH] Fix allow cmake build without tests (#30) * Update CMake with options to skip building testing and debian package respectively * Update --- CMakeLists.txt | 19 ++++++++++++++----- build.sh | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddc8097..23e6246 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,8 @@ project(carma-clock option(BUILD_PYTHON_BINDINGS "BUILD PYTHON BINDINGS is used to configure whether or not to including building python module bindings into the cmake build process. **NOTE** Build python bindings is currently only support for native builds (not supported for cross-compile builds) " OFF) +option(BUILD_TESTS "Build tests" OFF) +option(CREATE_DEB_PACKAGE "Create Debian Package" OFF) include(cmake/dependencies.cmake) add_library(${PROJECT_NAME} SHARED ) @@ -30,8 +32,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES ) include(CommonSource) -include(Testing) -include(CodeCoverage) +if (BUILD_TESTS) + include(Testing) + include(CodeCoverage) +endif() include(InstallingGeneral) include(InstallingConfigs) @@ -60,14 +64,19 @@ if (${BUILD_PYTHON_BINDINGS}) ) # set up test for python module binding FILE(COPY carma_clock_py/python_wrapper_test.py DESTINATION .) - add_test(NAME test_carma_clock_python_module_binding COMMAND ${PYTHON_EXECUTABLE} python_wrapper_test.py ) + if (BUILD_TESTS) + + add_test(NAME test_carma_clock_python_module_binding COMMAND ${PYTHON_EXECUTABLE} python_wrapper_test.py ) + endif() + # set cpack depedencies set(CPACK_DEBIAN_PACKAGE_DEPENDS python3-dev) # remove debug post fix for library. Required due to import naming for python module import set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "") endif() - -include(Packing) +if (CREATE_DEB_PACKAGE) + include(Packing) +endif() diff --git a/build.sh b/build.sh index 2ea2c2e..85951da 100755 --- a/build.sh +++ b/build.sh @@ -2,4 +2,4 @@ set -e -${CARMA_OPT_DIR}/scripts/build_script.sh -p $@ +${CARMA_OPT_DIR}/scripts/build_script.sh -p $@ -DBUILD_TESTS=ON -DCREATE_DEB_PACKAGE=ON