mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Fix CMakeLists.txt add_executable has only one source file // Resolve #421
This commit is contained in:
@ -16,6 +16,8 @@ PlatformIO 2.0
|
|||||||
(`issue #422 <https://github.com/platformio/platformio/issues/422>`_)
|
(`issue #422 <https://github.com/platformio/platformio/issues/422>`_)
|
||||||
* Fixed package ``shasum`` validation on Mac OS X 10.11.2
|
* Fixed package ``shasum`` validation on Mac OS X 10.11.2
|
||||||
(`issue #429 <https://github.com/platformio/platformio/issues/429>`_)
|
(`issue #429 <https://github.com/platformio/platformio/issues/429>`_)
|
||||||
|
* Fixed CMakeLists.txt ``add_executable`` has only one source file
|
||||||
|
(`issue #421 <https://github.com/platformio/platformio/issues/421>`_)
|
||||||
|
|
||||||
2.7.0 (2015-12-30)
|
2.7.0 (2015-12-30)
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -91,14 +91,6 @@ class ProjectGenerator(object):
|
|||||||
result.append(relpath(join(root, f)))
|
result.append(relpath(join(root, f)))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_main_src_file(src_files):
|
|
||||||
for f in src_files:
|
|
||||||
for ext in ("c", "cpp"):
|
|
||||||
if f.endswith(".%s" % ext):
|
|
||||||
return f
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_tpls(self):
|
def get_tpls(self):
|
||||||
tpls = []
|
tpls = []
|
||||||
tpls_dir = join(util.get_source_dir(), "ide", "tpls", self.ide)
|
tpls_dir = join(util.get_source_dir(), "ide", "tpls", self.ide)
|
||||||
@ -132,9 +124,9 @@ class ProjectGenerator(object):
|
|||||||
|
|
||||||
def _gather_tplvars(self):
|
def _gather_tplvars(self):
|
||||||
src_files = self.get_src_files()
|
src_files = self.get_src_files()
|
||||||
main_src_file = self.get_main_src_file(src_files)
|
|
||||||
|
|
||||||
if not main_src_file and self.ide == "clion":
|
if (not any([f.endswith((".c", ".cpp")) for f in src_files]) and
|
||||||
|
self.ide == "clion"):
|
||||||
click.secho(
|
click.secho(
|
||||||
"Warning! Can not find main source file (*.c, *.cpp). So, "
|
"Warning! Can not find main source file (*.c, *.cpp). So, "
|
||||||
"code auto-completion is disabled. Please add source files "
|
"code auto-completion is disabled. Please add source files "
|
||||||
@ -147,7 +139,6 @@ class ProjectGenerator(object):
|
|||||||
self._tplvars.update({
|
self._tplvars.update({
|
||||||
"project_name": self.get_project_name(),
|
"project_name": self.get_project_name(),
|
||||||
"src_files": src_files,
|
"src_files": src_files,
|
||||||
"main_src_file": main_src_file,
|
|
||||||
"user_home_dir": abspath(expanduser("~")),
|
"user_home_dir": abspath(expanduser("~")),
|
||||||
"project_dir": self.project_dir,
|
"project_dir": self.project_dir,
|
||||||
"systype": util.get_systype(),
|
"systype": util.get_systype(),
|
||||||
|
@ -38,8 +38,14 @@ add_custom_target(
|
|||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
% if main_src_file:
|
% if src_files and any([f.endswith((".c", ".cpp")) for f in src_files]):
|
||||||
add_executable({{project_name}} {{main_src_file.replace("\\", "/")}})
|
add_executable({{project_name}}
|
||||||
|
% for f in src_files:
|
||||||
|
% if f.endswith((".c", ".cpp")):
|
||||||
|
{{f.replace("\\", "/")}}
|
||||||
|
% end
|
||||||
|
% end
|
||||||
|
)
|
||||||
% else:
|
% else:
|
||||||
#
|
#
|
||||||
# To enable code auto-completion, please specify path
|
# To enable code auto-completion, please specify path
|
||||||
|
Reference in New Issue
Block a user