Cannot open mcuboot as CMake project, CLion forces it to west project and fails completely, cannot be switched to CMake

已回答

Take this fork of mcuboot from NCS - it can be built from command line as cmake/make, but CLion forbids any attempt to change it to CMake project. Since it fails to build as west project in CLion: 

Build from command line goes through:

git clone --recursive https://github.com/nrfconnect/sdk-mcuboot
cd sdk-mcuboot
git checkout v2.1.0-ncs3
cd boot/zephyr
#their toolchains have funky library path issues that can be fixed either with patchelf or LD_LIBRARY_PATH, but it builds with cmake + make

#cmake call with board definition
LD_LIBRARY_PATH=/home/ondro/ncs/toolchains/b77d8c1312/usr/local/lib cmake -DBOARD=nrf52840dk/nrf52840 ..
LD_LIBRARY_PATH=/home/ondro/ncs/toolchains/b77d8c1312/usr/local/lib make -j4
# Success!

CLion forces as “west” project fails right away, though no symbols or code completion

However, if you try to open sdk-mcuboot/boot/zephyr in CLion, it will automatically force west on you and there's no way it can be switched to CMake project. Under settings for CMake it tells you “CMake settings cannot be used for west project”, although it certainly works on command line,  just won't let you switch.

Since the configuring project fails from beginning, it does not give you symbols and defines for code completion (or even which code is ifdefed out). Also error log is completely empty, this is very short output when the west plugin tries to configure:

-- west build: generating a build system
CMake Error at CMakeLists.txt:29 (build_info):
 Unknown CMake command "build_info".

-- Configuring incomplete, errors occurred!
See also "/home/ondro/work/satoshilabs/repos/UNforked-mcuboot/v2.9.0/bootloader.orig2.testbuild/mcuboot/boot/zephyr/build/CMakeFiles/CMakeOutput.log".
 

West cannot be uninstalled or disabled as far as I know and I couldn't find how to trick CLion think it's not west, just CMake project

0

After about over month battling wih the west lasagna layer build system abomination I found randomly finally a workaround to get it properly parse in CLion - disable Zephyr builtin plugin in CLion, restart and plug the parameters for CMake.

Finally the insanely ifdefed sources are resolved correctly.

Though this is behavior is kinda unacceptable that there is no option to switch away from west and also there's no question asked about how the project should be opened as, doing it automagically. (Zephyr plugin is also buggy as hell, but that's for another time)

0

Hello!

Sorry for the silence on our part.

There is an action to convert a West project back to CMake - https://www.jetbrains.com/help/clion/zephyr.html#convert-cmake-to-west:

Right-click a CMakeLists.txt file in your project directory and select Convert to CMake Project from the context menu.

0

请先登录再写评论。