Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…727) Always add `raft::raft_nn_lib` and `raft::raft_distance_lib` aliases so adding raft as a submodule provides the same library targets as using it as a package. Here's an example of the differences between using RAFT as a submodule and using it as a package (preinstalled or otherwise): ```cmake # Build raft from source set(RAFT_COMPILE_LIBRARIES ON) add_subdirectory(/raft/cpp) if(TARGET raft_nn_lib) # FALSE if(TARGET raft_distance_lib) # FALSE if(TARGET raft::raft_nn_lib) # TRUE if(TARGET raft::raft_distance_lib) # TRUE # Find the RAFT package set(raft_ROOT /raft/cpp/build) find_package(raft) if(TARGET raft_nn_lib) # FALSE if(TARGET raft_distance_lib) # FALSE if(TARGET raft::raft_nn_lib) # TRUE if(TARGET raft::raft_distance_lib) # TRUE ``` The problem is exacerbated if we use `CPMFindPackage`, since the available raft targets will be different based on whether this is the first time we've configured or if we're re-configuring: ```cmake if(EXISTS ${CMAKE_BINARY_DIR}/_deps/raft-build) set(raft_ROOT ${CMAKE_BINARY_DIR}/_deps/raft-build) endif() # Find or build RAFT from source CPMFindPackage(NAME raft ...) if(TARGET raft_nn_lib) # initial configure=TRUE, reconfigure=FALSE if(TARGET raft_distance_lib) # initial configure=TRUE, reconfigure=FALSE if(TARGET raft::raft_nn_lib) # initial configure=FALSE, reconfigure=TRUE if(TARGET raft::raft_distance_lib) # initial configure=FALSE, reconfigure=TRUE ``` Authors: - Paul Taylor (https://github.com/trxcllnt) Approvers: - Robert Maynard (https://github.com/robertmaynard) URL: #727
- Loading branch information