CLion: Improve project portability using "${CMAKE_CURRENT_LIST_DIR}" instead of full path

This commit is contained in:
Ivan Kravets
2018-12-13 17:30:10 +02:00
parent 9f4dde4b5e
commit 4dfa885a85
2 changed files with 27 additions and 15 deletions

View File

@ -4,6 +4,15 @@ Release Notes
PlatformIO 3.0
--------------
3.6.4 (2018-??-??)
~~~~~~~~~~~~~~~~~~
* Improved Project Generator for IDEs:
- Use full path to PlatformIO CLI when generating a project
(`issue #1674 <https://github.com/platformio/platformio-core/issues/1674>`_)
- CLion: Improved project portability using "${CMAKE_CURRENT_LIST_DIR}" instead of full path
3.6.3 (2018-12-12)
~~~~~~~~~~~~~~~~~~
@ -50,7 +59,6 @@ PlatformIO 3.0
(`issue #1873 <https://github.com/platformio/platformio-core/issues/1873>`_)
* Fixed an issue with incorrect handling of a custom package name when using `platformio lib install <http://docs.platformio.org/page/userguide/lib/cmd_install.html>`__ or `platformio platform install <http://docs.platformio.org/page/userguide/platforms/cmd_install.html>`__ commands
3.6.0 (2018-08-06)
~~~~~~~~~~~~~~~~~~

View File

@ -1,8 +1,20 @@
set(ENV{PATH} "{{env_path}}")
set(PLATFORMIO_CMD "{{platformio_path}}")
% def _normalize_path(path):
% if user_home_dir in path:
% if "windows" in systype:
% path = path.replace(user_home_dir, "$ENV{HOMEDRIVE}$ENV{HOMEPATH}")
% else:
% path = path.replace(user_home_dir, "$ENV{HOME}")
% end
% elif project_dir in path:
% path = path.replace(project_dir, "${CMAKE_CURRENT_LIST_DIR}")
% end
% return path.replace("\\", "/")
% end
SET(CMAKE_C_COMPILER "{{cc_path.replace("\\", "/")}}")
SET(CMAKE_CXX_COMPILER "{{cxx_path.replace("\\", "/")}}")
set(PLATFORMIO_CMD "{{ _normalize_path(platformio_path) }}")
SET(CMAKE_C_COMPILER "{{ _normalize_path(cc_path) }}")
SET(CMAKE_CXX_COMPILER "{{ _normalize_path(cxx_path) }}")
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "{{cxx_flags}}")
SET(CMAKE_C_FLAGS_DISTRIBUTION "{{cc_flags}}")
set(CMAKE_CXX_STANDARD 11)
@ -13,15 +25,7 @@ add_definitions(-D'{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}}')
% end
% for include in includes:
% if include.startswith(user_home_dir):
% if "windows" in systype:
include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
% else:
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
% end
% else:
include_directories("{{include.replace("\\", "/")}}")
% end
include_directories("{{ _normalize_path(include) }}")
% end
FILE(GLOB_RECURSE SRC_LIST "{{project_src_dir.replace("\\", "/")}}/*.*" "{{project_lib_dir.replace("\\", "/")}}/*.*" "{{project_libdeps_dir.replace("\\", "/")}}/*.*")
FILE(GLOB_RECURSE SRC_LIST "{{ _normalize_path(project_src_dir) }}/*.*" "{{ _normalize_path(project_lib_dir) }}/*.*" "{{ _normalize_path(project_libdeps_dir) }}/*.*")