Platformio-core: [CLion] CMakeListsUser.txt is not included in CMakeLists.txt

Created on 26 Jun 2019  路  3Comments  路  Source: platformio/platformio-core

What kind of issue is this?

  • [x] PlatformIO Core.

    If you鈥檝e found a bug, please provide an information below

Configuration

Operating system : Debian 9, kernel 4.9.168-1+deb9u3 x86_64

PlatformIO Version : 4.0.0b3

Python Version : 3.7.3

CLion Version : 2019.1.4

Description of problem

CMakeListsUser.txt is not included in the CMakeLists.txt file thus preventing the use of custom CMake operations.

Steps to Reproduce

  1. Init a new paltoformio project with --ide clion
  2. Add a template main.cpp in src/
  3. Init once more (As per the documentation).
  4. Open in CLion. At this point everything should load fine and CMake will create the cmake-build-debug directory (Default in CLion)
  5. Create the CMakeListsUser.txt file containing message(${CMAKE_VERSION}) at the root of the project
  6. Reload CMake project (CMake tab, reload)

Actual Results

-- Configuring done
-- Generating done

CMakeListsUser.txt is not included.

Expected Results

3.14.3
-- Configuring done
-- Generating done

CMakeListsUser.txt is included.

Additional info

https://github.com/platformio/platformio-core/blob/54921c5dbdc68893fe45649d07d067818c36889b/platformio/ide/tpls/clion/CMakeLists.txt.tpl#L13-L15

From what I can make out, the if(EXISTS CMakeListsUser.txt) resolves relative paths from the cmake-build-debug directory but not include(CMakeListsUser.txt) , which resolves from the root of the project. In the current state, touching a "CMakeListsUser.txt" file in the cmake-build-debug directory makes it work as expected, but this should not be needed.

Proposed fix

Changing if(EXISTS CMakeListsUser.txt) to if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeListsUser.txt) looks like a clean fix to me, better than what I initially proposed in my forum post.

bug

All 3 comments

Please re-test with pio upgrade --dev.

Works perfectly, thanks for the quick fix ! I am really looking forward to the release of platformio 4.0 !

It's planned for the beginning of next week.

Was this page helpful?
0 / 5 - 0 ratings