"File | Import Project" is gone. How to create CMakeLists.txt for a project automatically like before?

Answered

Apparently "File | Import Project" which auto-creates CMakeLists.txt and treats the project as CMake is gone.

I have a Makefile/scons project (https://github.com/trezor/trezor-firmware/), but it doesn't work very well with code completion when it's imported as Makefile project instead of CMake project (it can't guess extra defines from Makefile/scons and so on).

Originally I let the autoimport generate the CMakeLists.txt and pasted the needed defines and include dirs so that code completion started working.

Now I have to copypaste the old file from some cloned dir from earlier and hope there isn't many differences in files.

Any other solution?

0
3 comments

Hello!

The "New CMake Project from Sources" action was often confused with the regular "Open Project" action intended for opening an existing CMake project. So we removed this action, and now projects based on unsupported build systems can be converted into CMake projects using File | Open as described in https://www.jetbrains.com/help/clion/creating-new-project-from-scratch.html#import-prj.

If the project is based on the build system supported by CLion, CLion will try to open it and won't suggest to convert into a CMake project.

So in your case you need to delete the .idea subfolder from the project folder and move the Makefile to some other location, and after that open the project in CLion.

0

Well I actually need the "New CMake Project from Sources" or some other way to describe defines and include dirs to the parser and autocomplete.

Old way (just added in the generated CMakeLists.txt) :

add_definitions(
-DFF_FS_READONLY=0
-DFF_FS_MINIMIZE=0
-DFF_USE_STRFUNC=0
-DFF_USE_FIND=0)
include_directories(vendor/micropython)
include_directories(build/firmware/genhdr/)

How to do something like that in a Makefile/scons project?

0

I need to resurrect this thread, because it seems the workaround is buggy and I have met found quite a few people who need it, including spending lot of time on it myself, like this thread:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/7800097853202-Marking-Directory-as-a-python-source-root-

Could you add the same option "New CMake Project from Sources" under "Tools" for example? Because now it can be only triggered if you have no Makefile and CMakeLists.txt - https://www.jetbrains.com/help/clion/reloading-project.html .

If you look at the linked forum thread, 11 step workaround with a bug in CLion caching is not that pleasant (where project forgets it's CMake project on next/second CLion start).

0

Please sign in to leave a comment.