From b657569837db833b654d001379a7f8b2114bad59 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 7 Apr 2023 08:22:33 -0400 Subject: [PATCH] Have consistent compile lines between BUILD_TESTS enabled or not (#1401) This will remove 1h from our conda CI builds since we can now re-use the cached object files between `libraft` and `libraft-tests` Authors: - Robert Maynard (https://github.com/robertmaynard) Approvers: - Vyas Ramasubramani (https://github.com/vyasr) - Ben Frederickson (https://github.com/benfred) - Divye Gala (https://github.com/divyegala) URL: https://github.com/rapidsai/raft/pull/1401 --- cpp/CMakeLists.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 3d6bc0ebdc..dcc7021a3f 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -81,15 +81,12 @@ option(RAFT_COMPILE_LIBRARY "Enable building raft shared library instantiations" ${RAFT_COMPILE_LIBRARY_DEFAULT} ) -if(BUILD_TESTS - OR BUILD_PRIMS_BENCH - OR BUILD_ANN_BENCH -) - # Needed because GoogleBenchmark changes the state of FindThreads.cmake, causing subsequent runs - # to have different values for the `Threads::Threads` target. Setting this flag ensures - # `Threads::Threads` is the same value in first run and subsequent runs. - set(THREADS_PREFER_PTHREAD_FLAG ON) -endif() + +# Needed because GoogleBenchmark changes the state of FindThreads.cmake, causing subsequent runs +# to have different values for the `Threads::Threads` target. Setting this flag ensures +# `Threads::Threads` is the same value across all builds so that cache hits occur +set(THREADS_PREFER_PTHREAD_FLAG ON) + include(CMakeDependentOption) # cmake_dependent_option( RAFT_USE_FAISS_STATIC "Build and statically link the FAISS library for