To open it, press Alt+7 (for the tool window) or Control+F12 (for the popup). Structure view for CMake shows variables, functions, macros, and targets used your script. Press NumPad-NumPad-/ NumPad-NumPad-+ to fold or unfold a code fragment Structure view To invoke it, use mouse hover or press Control+Q.įor example, you can view quick documentation for completion suggestions: Code foldingįolding/unfolding in CMake scripts is available for macros and functions, if-else clauses, blocks, comments, as well as arbitrary code selections (make sure to enable Custom folding regions in Settings | Editor | General | Code Folding for this to work). Quick Documentation popup helps you get more information on the elements in your CMake code. To invoke parameter info manually, press Control+P. You can change this in the Parameter Info settings. The Parameter Info popup shows signature variants for CMake commands as you type:īy default, the popup appears within 1 second (1000 milliseconds) after you type an opening bracket. For example, you can get the list of the packages bundled with CMake when writing a find_package() command: Parameter info popup You can edit it using the same variables in Settings | Editor | File and Code Templates, the Files tab: Code assistance in CMakeLists.txt Code completionĬLion provides code completion for most of the elements in your CMakeLists.txt. There is also a template for CMake scripts that you can add to an existing project via New | CMakeLists.txt in the context menu of the project view. By default, they are Core for Qt Console Executable and Core, Gui, Widgets for Qt Widgets Executable. The Qt libraries required for the selected project type. For example, if the version if 3.20, this variable corresponds to 20. The minor number of the minimum supported CMake version. For example, if the version if 3.20, this variable corresponds to 3. The major number of the minimum supported CMake version. The main.cpp/ main.c/ libary.cpp/ library.c file of the project. When editing a template text, you can use common predefined variables and the following CMake-specific variables: You can fine-tune these templates in Settings | Editor | File and Code Templates, the Other tab: When you create a CMake or CMake-based ( CUDA, Qt) project via the New Project wizard, CLion uses different templates to generate CMakeLists.txt depending on the project type and settings. Type of a target added by a subdirectory CMakeLists.txt file can differ depending on the role of the module. Automatic reload feature is disabled by default, you can turn it on by selecting the Automatically reload CMake project on editing checkbox in Settings | Build, Execution, Deployment | CMake.įor projects with complex structure, you can create subdirectory CMakeList.txt files to describe the build, contents, and target rules for a subdirectory. Make sure to reload the project after editing. You can edit CMakeLists.txt files right in the editor. # Add executable target with source files listed in SOURCE_FILES variableĪdd_executable(simple_example $) # Add main.cpp file of project root directory as source file Set(CMAKE_CXX_STANDARD 14) # Enable c++14 standard Project(simple_example) # Create project "simple_example" Cmake_minimum_required(VERSION 3.13) # CMake version check
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |