Add an option to disable ccache in the CMakeLists.txt file

This commit is contained in:
Username404-59 2021-09-23 10:57:39 +02:00
parent 1ee7b8dc7c
commit 3fd04724f1
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 7 additions and 6 deletions

View File

@ -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)

2
Jenkinsfile vendored
View File

@ -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}"