android ndk toolchain Could not find a package configuration file provided by "fmt" on windows os
I try to use cmake android ndk toolchain to build spdlog, as I set CMAKE_PREFIX_PATH to path where fmt-config.cmake is located,it failed to find package of fmt.
cmakelists.txt
set(CMAKE_PREFIX_PATH "F:/packages/f/fmt/10.2.1/7def98216fe149a88a59c825d35870c7/lib/cmake/fmt")
if(SPDLOG_FMT_EXTERNAL OR SPDLOG_FMT_EXTERNAL_HO)
if(NOT TARGET fmt::fmt)
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
find_package(fmt CONFIG REQUIRED)
endif()
directory:
PS D:\Code\OtherProject\cxx\spdlog> ls F:\packages\f\fmt\10.2.1\7def98216fe149a88a59c825d35870c7\lib\cmake\fmt\
directory: F:\packages\f\fmt\10.2.1\7def98216fe149a88a59c825d35870c7\lib\cmake\fmt
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2024/3/15 20:34 1900 fmt-config-version.cmake
-a---- 2024/3/15 20:34 1030 fmt-config.cmake
-a---- 2024/3/15 20:34 826 fmt-targets-release.cmake
-a---- 2024/3/15 20:34 4493 fmt-targets.cmake
output:
[main] 正在配置项目: spdlog
[proc] 执行命令: "D:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DSPDLOG_FMT_EXTERNAL=ON -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=26 -DANDROID_STL=c++_shared -DSPDLOG_BUILD_TESTS=OFF -DSPDLOG_BUILD_SHARED=OFF -DSPDLOG_USE_STD_FORMAT=OFF -DSPDLOG_FMT_EXTERNAL_HO=OFF -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=FALSE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_TOOLCHAIN_FILE:FILEPATH=D:/android-ndk-r26b/build/cmake/android.toolchain.cmake -SD:/Code/OtherProject/cxx/spdlog -Bd:/Code/OtherProject/cxx/spdlog/cmakebuild -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Android: Targeting API '26' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
[cmake] -- Android: Selected unified Clang toolchain
[cmake] -- The CXX compiler identification is Clang 17.0.2
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: D:/android-ndk-r26b/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Build spdlog: 1.13.0
[cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
[cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
[cmake] -- Looking for pthread_create in pthreads
[cmake] -- Looking for pthread_create in pthreads - not found
[cmake] -- Looking for pthread_create in pthread
[cmake] -- Looking for pthread_create in pthread - not found
[cmake] -- Check if compiler accepts -pthread
[cmake] -- Check if compiler accepts -pthread - yes
[cmake] -- Found Threads: TRUE
[cmake] -- Build type: Debug
[cmake] -- CMAKE_PREFIX_PATH: F:/packages/f/fmt/10.2.1/7def98216fe149a88a59c825d35870c7/lib/cmake/fmt
[cmake] CMake Error at CMakeLists.txt:215 (find_package):
[cmake] Could not find a package configuration file provided by "fmt" with any of
[cmake] the following names:
[cmake]
[cmake] fmtConfig.cmake
[cmake] fmt-config.cmake
[cmake]
[cmake] Add the installation prefix of "fmt" to CMAKE_PREFIX_PATH or set "fmt_DIR"
[cmake] to a directory containing one of the above files. If "fmt" provides a
[cmake] separate development package or SDK, be sure it has been installed.
[cmake]
Edited by guijiyang