在CLion中建造 [英] Building in CLion

查看:173
本文介绍了在CLion中建造的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在CLion中构建单个文件并查看正在使用的实际编译器命令行?



我怀疑由于各种CmakLists.txt设置,CLion设法成功加载了该项目,但该项目未能生成。但是据我所知,您只能构建一个整个项目,并且使用-j 8进行构建,因此您会得到很多输出,其中不包含所使用的命令行,因此很难知道要解决的问题。我知道CLion确实在.clion10中创建了一个临时生成目录,但我希望不必在那儿走动。



另外,作为CLion的新手,我可以似乎还没有找到如何取消Clion Windows(在Windows 7机器上)的方法。 浮动选项似乎并未让我将窗口拖到Clion主窗口之外。

解决方案

多次使用 add_executable 命令。



以下是示例:

  cmake_minimum_required(版本3.3)
项目(test_build)

set(CMAKE_CXX_FLAGS $ {CMAKE_CXX_FLAGS} -std = c ++ 11)

set(BUILD_1 main)
set(SOURCE_FILES_1 main.cc)
add_executable($ {BUILD_1} $ {SOURCE_FILES_1})

set(BUILD_2 main_2)
set(SOURCE_FILES_2 main_2.cc)
add_executable($ {BUILD_2} $ {SOURCE_FILES_2})

旧的anerser:

您可以使用 add_subdirectory(path_to_directory)来使用其他CMakeList和有倍数的建立过程。即:您的cmakelist位于项目的根目录,而其他多个位于项目的某些文件中。您只需使用add_subdirectory,您就会获得其他构建选项。



对于您的其他问题,在ubuntu上,我必须拆分视图,然后才能在另一个浮动窗口中拖动。 / p>

在下面您可以看到我的一个项目和右侧的主要CMakeLists.txt





以及具有此结构的CLion上的构建选项。





文件下的CMakeLists.txt就像完整的项目构建器。


Is it possible to build a single file in CLion and see the actual compiler command line being used?

I have a large existing project, which CLion managed to load however it fails to build, I suspect because of various CmakLists.txt setting. However as far as I can tell you can only build an entire project and it gets built using -j 8 so you get a lot of output which does not include the command line being used so it's hard to know what to fix. i know CLion does create a temporary build directory in .clion10 but I was hoping not to have to go a fish around in that.

Also as a newbie to CLion I can't seem to work out how to undock Clion Windows ( on a Windows 7 box ). The "Floating" option doesn't seem to let me drag a Window outside of the main Clion window.

解决方案

You have to use add_executable command multiple times.

Here an example :

cmake_minimum_required(VERSION 3.3)
project(test_build)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(BUILD_1 main)
set(SOURCE_FILES_1 main.cc)
add_executable(${BUILD_1} ${SOURCE_FILES_1})

set(BUILD_2 main_2)
set(SOURCE_FILES_2 main_2.cc)
add_executable(${BUILD_2} ${SOURCE_FILES_2})

Old anwser :
You can use add_subdirectory(path_to_directory) to use an other CMakeLists and have multiples building process. ie: you have your cmakelists at the root of your project and multiple other in some files of your project. You just use add_subdirectory and you get other build options.

For your other question, on ubuntu i have to split the view and after i can drag in another floating window.

Under you can see one of my projects and the main CMakeLists.txt on the right

And the build options on CLion with this structure.

The CMakeLists.txt under the files are like full project builders.

这篇关于在CLion中建造的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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