CMake 查找具有不同版本的多个包的特定包(NCurses)
我目前有一个cmake文件,可以找到并将库(ncurses)链接到另一个库,
...
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIR})
add_library(myLibrary STATIC ${sources})
target_link_libraries(myLibrary ${CURSES_LIBRARIES})
target_compile_options(myLibrary PUBLIC -std=c++20 -Wall -Wconversion)
...
但不幸的是,它正在提取与我需要的不同版本(5.7而不是6.1)
#include <ncurses.h>
#include <iostream>
int main()
{
std::cout << "VERSION: " << NCURSES_VERSION;
}
输出:版本:5.7
我确实安装了所需的软件包:/usr/local/ncurses/6_1
。 但是日志似乎说它是从其他位置将其拉到的:找到诅咒:/applications/xcode-beta.app/contents/developer/developer/platforms/macosx.platform/develform/develfer/sdks/sdks/macosx11.3.sdk/ usr/lib/libncurses.tbd
如何指定我要使用哪些?
I currently have a CMake file that finds and links a library (NCurses) to another library
...
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIR})
add_library(myLibrary STATIC ${sources})
target_link_libraries(myLibrary ${CURSES_LIBRARIES})
target_compile_options(myLibrary PUBLIC -std=c++20 -Wall -Wconversion)
...
This works fine, however unfortunately it is pulling up a different version than I need (5.7 instead of 6.1)
#include <ncurses.h>
#include <iostream>
int main()
{
std::cout << "VERSION: " << NCURSES_VERSION;
}
outputs: VERSION: 5.7
I do have the desired package installed under: /usr/local/ncurses/6_1
.
But the logs seem to say it is pulling it from a different location: Found Curses: /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/lib/libncurses.tbd
How can I specify which of these I want to use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我已经弄清楚了可能遇到这个问题的任何人。
首先,我从这里安装了最新版本的Ncurses(6.3): .net/ncurses/#下载h2
(我下载了GZPAR的焦油)
然后我通过了我可以找到Ncurses的USR/Local中的所有参考。
然后,我提取焦油,然后进入新目录。
我只是在目录内(没有标志)内的Plain
./配置
。完成此操作后,我运行
制作
然后我ran
进行安装
,在删除符号链接以停止碰撞之后,使安装能够正确运行。确保CMAKE变量Curses_need_ncurses在找到软件包之前将其设置为true:
它将完美工作:)
Okay I have figured this out, to anyone else who might come across this.
First I installed the latest version of ncurses (6.3) from here: https://invisible-island.net/ncurses/#downloads-h2
(I downloaded the gzipped tar)
I then went through and deleted all references in my usr/local i could find to ncurses.
I then extracted the tar, and entered the new directory.
I ran just plain
./configure
inside the directory (with no flags).After that finished, I ran
make
Then I ran
make install
, after removing symlinks to stop collisions, make install was able to run properly.Ensure that the CMake variable CURSES_NEED_NCURSES is set to TRUE before finding the package:
and it will work perfectly :)