CMake无法在Windows上find库

CMake无法在Windows上find库,第1张

概述CMake无法在Windows上find库

我有这个CMake脚本来find一个库:

# FANN_FOUND - system has fann # FANN_INCLUDE_Dirs - the fann include directory # FANN_liBRARIES - link these to use fann # FANN_DEFinitioNS - Compiler switches required for using fann if(FANN_liBRARIES AND FANN_INCLUDE_Dirs) set(FANN_FOUND TRUE) else() find_path(FANN_INCLUDE_DIR nameS fann.h PATHS ${CMAKE_CURRENT_SOURCE_DIR}/FANN/include) set( _librarIEs doublefann fixedfann floatfann ) foreach( _lib ${_librarIEs} ) string( toupper ${_lib} _name ) find_library(${_name}_liBRARY nameS ${_lib} PATHS "${CMAKE_CURRENT_SOURCE_DIR}/FANN/lib") endforeach() set(FANN_INCLUDE_Dirs ${FANN_INCLUDE_DIR}) message("${FANN_INCLUDE_DIR}") set(FANN_liBRARIES ${FANN_liBRARIES} ${DOUBLEFANN_liBRARY} ${FIXEDFANN_liBRARY} ${floatFANN_liBRARY} ) if( UNIX ) set( FANN_liBRARIES ${FANN_liBRARIES} m ) endif() if(FANN_INCLUDE_Dirs AND FANN_liBRARIES) set(FANN_FOUND TRUE) endif() if(FANN_FOUND) if(NOT FANN_FIND_QUIETLY) message(STATUS "Found FANN:") message(STATUS "FANN_INCLUDE_Dirs: ${FANN_INCLUDE_Dirs}") message(STATUS "FANN_liBRARIES: ${FANN_liBRARIES}") endif() else() if(FANN_FIND_required) message(FATAL_ERROR "Could not find FANN") endif() endif() mark_as_advanced(FANN_INCLUDE_Dirs FANN_liBRARIES) endif()

该脚本被称为FindFANN.cmake ,它是由我的主脚本与find_package()命令find_package() 。 现在我还打印了"${CMAKE_CURRENT_SOURCE_DIR}/FANN/lib"和"${CMAKE_CURRENT_SOURCE_DIR}/FANN/include" ,他们是正确的。 然而,图书馆没有find,我不明白为什么。 在"${CMAKE_CURRENT_SOURCE_DIR}/FANN/lib"我有:

fanndouble.dll fanndouble.lib fannfixed.dll fannfixed.lib fannfloat.dll fannfloat.lib

而在"${CMAKE_CURRENT_SOURCE_DIR}/FANN/include"我有fann.h其他头之间。

我知道这不是最好的便携式脚本,但现在我只需要它的工作…

如何configurationJenkins以检测SVN更改并执行作业?

如何在linux上打包c ++依赖关系

cmake找不到java,但是已经安装了

想用cmake制作独立的程序

未findCurses库

这是确切的输出

$ cmake . -G "CodeBlocks - Unix Makefiles" -- The C compiler IDentification is GNU 4.8.1 -- The CXX compiler IDentification is GNU 4.8.1 -- Check for working C compiler: c:/MinGW/bin/cc.exe -- Check for working C compiler: c:/MinGW/bin/cc.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: c:/MinGW/bin/c++.exe -- Check for working CXX compiler: c:/MinGW/bin/c++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at cmake/Modules/FindFANN.cmake:91 (message): Could not find FANN Call Stack (most recent call first): CMakeLists.txt:30 (find_package) -- Configuring incomplete,errors occurred! See also "C:/Users/Manuele/documents/TicTacToe/CMakefiles/CMakeOutput.log".

这是我的grep FANN CMakeCache.txt:

$ grep FANN CMakeCache.txt DOUBLEFANN.liB_liBRARY:filePATH=DOUBLEFANN.liB_liBRARY-NOTFOUND DOUBLEFANN_liBRARY:filePATH=DOUBLEFANN_liBRARY-NOTFOUND FANN_DIR:UNINITIAliZED=C:/Users/Manuele/documents/TicTacToe/FANN/ FANN_INCLUDE_DIR:PATH=c:/Users/Manuele/documents/TicTacToe/FANN/include FIXEDFANN.liB_liBRARY:filePATH=FIXEDFANN.liB_liBRARY-NOTFOUND FIXEDFANN_liBRARY:filePATH=FIXEDFANN_liBRARY-NOTFOUND floatFANN.liB_liBRARY:filePATH=floatFANN.liB_liBRARY-NOTFOUND floatFANN_liBRARY:filePATH=floatFANN_liBRARY-NOTFOUND.

检测Cmake中的底层平台/风格

如何将生成types更改为cmake中的发布模式?

CMake保存剥离的deBUGging信息

ccmake。 vs ccmake

我如何强制CMake在特定目录中查找库?

好的…它一直在那里,但是最后的message()输出给我,实际上意识到了这一点。

set( _librarIEs doublefann fixedfann floatfann )

和:

fanndouble.dll fanndouble.lib fannfixed.dll fannfixed.lib fannfloat.dll fannfloat.lib

你看到这个问题? 你正在寻找错误的库名称。 ( fanndouble与doublefann等)

总结

以上是内存溢出为你收集整理的CMake无法在Windows上find库全部内容,希望文章能够帮你解决CMake无法在Windows上find库所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1155827.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存