Skip to content

Commit 93be043

Browse files
authored
Fix use of CMAKE_INSTALL_PREFIX in tokenizers-config.cmake (#106)
Looks like we need to use a new PATH_VAR instead.
1 parent c9c4add commit 93be043

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ configure_package_config_file(
210210
${CMAKE_CURRENT_SOURCE_DIR}/cmake/tokenizers-config.cmake.in
211211
${CMAKE_CURRENT_BINARY_DIR}/tokenizers-config.cmake
212212
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/tokenizers
213-
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
213+
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR
214214
)
215215

216216
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tokenizers-config.cmake

cmake/tokenizers-config.cmake.in

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@
88

99
include(CMakeFindDependencyMacro)
1010
include(GNUInstallDirs)
11-
# Find dependencies
12-
find_dependency(re2 REQUIRED)
13-
find_dependency(absl REQUIRED)
1411
# Directly include sentencepiece library
15-
set(SENTENCEPIECE_LIBRARY "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libsentencepiece.a")
12+
set_and_check(TOKENIZERS_LIBDIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
13+
set(SENTENCEPIECE_LIBRARY "${TOKENIZERS_LIBDIR}/libsentencepiece.a")
1614
if(NOT EXISTS "${SENTENCEPIECE_LIBRARY}")
1715
message(
1816
FATAL_ERROR
1917
"Could not find sentencepiece library at ${SENTENCEPIECE_LIBRARY}"
2018
)
2119
endif()
2220

21+
find_dependency(re2 REQUIRED)
22+
find_dependency(absl REQUIRED)
23+
2324
# Include the exported targets file
2425
include("${CMAKE_CURRENT_LIST_DIR}/tokenizers-targets.cmake")
2526

0 commit comments

Comments
 (0)