From 3fd04724f12bac1c1b4d5c307de7ca49bed4e956 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Thu, 23 Sep 2021 10:57:39 +0200 Subject: [PATCH] Add an option to disable ccache in the CMakeLists.txt file --- CMakeLists.txt | 11 ++++++----- Jenkinsfile | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa6e898..60c5251 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,13 +35,14 @@ set(MINIMAL_CLANG "13.0") set(IS_GNU (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)) set(IS_CLANG (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)) -if (NOT DEFINED CCACHE_PRESENT) +option(NO_CCACHE "Disables CCache") +if (NOT NO_CCACHE) find_program(CCACHE_PRESENT ccache) + if(CCACHE_PRESENT) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + endif() endif() -if(CCACHE_PRESENT) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) -endif(CCACHE_PRESENT) if (${IS_GNU} OR ${IS_CLANG}) if (NOT MINGW) diff --git a/Jenkinsfile b/Jenkinsfile index 718eaa4..715cadf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ def buildTarget(String path, String rpmArch = 'noarch', String debArch = 'noarch String packageArch = isPackageArchDeb ? debArch : rpmArch; // Note: CMake 3.20 or higher is needed cmakeBuild buildDir: "cmake-build-${packageArch}${suffix}", buildType: 'release', cleanBuild: true, installation: 'Latest', - cmakeArgs: "--no-warn-unused-cli -DCMAKE_C_COMPILER=/usr/bin/${path}-gcc -DCMAKE_CXX_COMPILER=/usr/bin/${path}-g++ -DCMAKE_LINKER=/usr/bin/${path}-ld.gold -DCMAKE_AR=/usr/bin/${path}-ar -DCMAKE_RC_COMPILER=/usr/bin/${path}-windres -DCPACK_RPM_PACKAGE_ARCHITECTURE=${rpmArch} -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=${debArch} -DCXX_TARGET=${packageArch} -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS=/usr/${path}/lib/ -DCCACHE_PRESENT=False" + cmakeArgs: "--no-warn-unused-cli -DCMAKE_C_COMPILER=/usr/bin/${path}-gcc -DCMAKE_CXX_COMPILER=/usr/bin/${path}-g++ -DCMAKE_LINKER=/usr/bin/${path}-ld.gold -DCMAKE_AR=/usr/bin/${path}-ar -DCMAKE_RC_COMPILER=/usr/bin/${path}-windres -DCPACK_RPM_PACKAGE_ARCHITECTURE=${rpmArch} -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=${debArch} -DCXX_TARGET=${packageArch} -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS=/usr/${path}/lib/ -DNO_CCACHE=ON" cmake arguments: "--build ./cmake-build-${packageArch}${suffix} --target ybcon", installation: 'Latest' sh "/usr/bin/${path}-strip ./cmake-build-${packageArch}${suffix}/ybcon*" cpack installation: 'Latest', workingDir: "cmake-build-${packageArch}${suffix}"