CLion fails to build project


#1

Hello,

I am using the latest CLion 2017.3 and platformio 3.5.0rc14. When I generate a CLion project and open the project with CLion, cmake throws tons of errors and fails to compile or even show the build targets.

To reproduce:

mkdir testproj && cd testproj
pio init -b adafruit_feather_m0 --ide=clion

Then import in CLion. Upon opening, it will try to execute CMake on it and fail with the following messages:

/home/max/Downloads/clion-2017.3/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/max/Documents/FeatherTLSClion
-- The C compiler identification is GNU 7.2.0
-- The CXX compiler identification is GNU 7.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeListsPrivate.txt:33:
  Syntax Warning in cmake code at column 32

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:47:
  Syntax Warning in cmake code at column 47

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:64:
  Syntax Warning in cmake code at column 37

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:66:
  Syntax Warning in cmake code at column 30

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:88:
  Syntax Warning in cmake code at column 31

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:114:
  Syntax Warning in cmake code at column 32

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:118:
  Syntax Warning in cmake code at column 42

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:130:
  Syntax Warning in cmake code at column 40

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:166:
  Syntax Warning in cmake code at column 40

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:184:
  Syntax Warning in cmake code at column 31

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:185:
  Syntax Warning in cmake code at column 32

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:195:
  Syntax Warning in cmake code at column 31

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:214:
  Syntax Warning in cmake code at column 33

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:295:
  Syntax Warning in cmake code at column 44

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:296:
  Syntax Warning in cmake code at column 31

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:313:
  Syntax Warning in cmake code at column 32

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeListsPrivate.txt:336:
  Syntax Warning in cmake code at column 31

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at CMakeListsPrivate.txt:387:
  Parse error.  Function missing ending ")".  End of file reached.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)


CMake Error at CMakeLists.txt:4 (include):
  include could not find load file:

    CMakeListsPrivate.txt


CMake Error at CMakeLists.txt:54 (add_executable):
  add_executable called with incorrect number of arguments


-- Configuring incomplete, errors occurred!
See also "/home/max/Documents/FeatherTLSClion/cmake-build-debug/CMakeFiles/CMakeOutput.log".

[Failed to reload]

The contents of the CmakeList.txt and CmakeListsPrivate.txt can be found here and here.

What I find interesting is that even the first lines don’t quite match up. It detects a GCC 7.2.0 compiler, but the compiler pointed to by the CMakeListsPrivate.txt file has version 6.3.1. GCC 7.2.0 is the native GCC on my computer. It also complains about a ton of white-space errors in -D .. lines and a missing closing bracket, which is definitely there. Weird.

Once the project is opened and CMake has failed, I only get the build target PLATFORMIO_UPDATE | Nothing to run on. Adding a minimal main.cpp sourcefile before or after opening the project in CLion does not change anything. I can’t build anything or edit code properly with autocomplete.

Is someone able to re-produce this problem?


#2

Thanks! Please upgrade to the latest development version via pio upgrade --dev and re-init project.

Fixed in


#3

Thank you very much, too. After upgrading platformio and re-initializing the project, CLion now imports the project, lets me edit the code and build and upload to the MCU. Successfully solved!


#4

Thanks! Had the same problem - you saved my day!