如何使用CLion更改目录,库目录和库 [英] How to change include dirs, library dirs and libraries with CLion

查看:999
本文介绍了如何使用CLion更改目录,库目录和库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CLion中,如何指定C ++编译器将在其中查找头文件的包含目录?另外,如何设置要链接的库及其库目录?

In CLion, how can I specify the include directories where the C++ compiler will look for header files? Also, how do I setup the libraries to link against, and their library directories?

当前,我正在直接修改文件 CMakeLists的那些任务。 .txt

Currently I'm doing those tasks modifying directly the file CMakeLists.txt:

include_directories(/opt/netcdf/include)
link_directories(/opt/netcdf/lib)
link_libraries(netcdf)

但我想知道是否有可能

谢谢

推荐答案

在CLion中,项目的 CMakeLists.txt 文件是系统记录,用于您的构建系统和设置。 GUI中显示的内容均来自构建脚本。这类似于IntelliJ使用Maven pom.xml 文件作为Java构建的记录系统,并在IDE中基于该文件显示内容的方式。根据我过去在IntelliJ方面的经验,我希望JetBrains能够随着时间的推移提供更加双向的体验(更新GUI将编辑 CMakeLists.txt )。

In CLion, the CMakeLists.txt file(s) for your project are the system of record for your build system and settings. What's shown in the GUI is derived from the build script. This is similar to the way IntelliJ uses a Maven pom.xml file as the system of record for a Java build and shows things in the IDE based on the file. Based on my past experience with IntelliJ, I expect that JetBrains will make this a more bidirectional experience (updating the GUI will edit the CMakeLists.txt) over time.

这篇关于如何使用CLion更改目录,库目录和库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆