问题描述
在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更改目录,库目录和库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!