From 50a61486013f82e911b75a9d325bee320b9c02d1 Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Thu, 2 Jan 2025 21:44:11 +0300 Subject: [PATCH 1/2] Added CMakeLists.txt and fixed C++17 compilation on Windows --- CMakeLists.txt | 13 +++++++++++++ include/intelhex.h | 2 -- src/intelhex.cc | 10 ++++------ 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7ae7ca8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.16) +project(intelhex VERSION 1.0.0 LANGUAGES CXX) + +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src SUB_SOURCES) + +set(SOURCE + ${SOURCE} + ${SUB_SOURCES} +) + +add_library(${PROJECT_NAME} ${SOURCE}) + +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/include/intelhex.h b/include/intelhex.h index 428a701..3251939 100644 --- a/include/intelhex.h +++ b/include/intelhex.h @@ -10,8 +10,6 @@ #include #include -#include - namespace intelhex { diff --git a/src/intelhex.cc b/src/intelhex.cc index e7d01cb..74f3907 100644 --- a/src/intelhex.cc +++ b/src/intelhex.cc @@ -3,13 +3,11 @@ Copyright 2002 Brandon Fosdick (BSD License) */ -#include - -#include -#include -#include #include "intelhex.h" +#include +#include + namespace intelhex { @@ -350,7 +348,7 @@ namespace intelhex while( (s.get() == ':') && s.good() ) { - getline(s, line); // Read the whole line + std::getline(s, line); // Read the whole line if( line.size() <= 10 ) // Ignore truncated lines break; buffer.clear(); From ca57d26ff4f4a8cbc399090db4622a11d9065c44 Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Sat, 1 Mar 2025 16:10:28 +0300 Subject: [PATCH 2/2] Headers folder added to generated project --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ae7ca8..9bd9c9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,9 @@ set(SOURCE ${SUB_SOURCES} ) -add_library(${PROJECT_NAME} ${SOURCE}) +FILE(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h*) +FILE(GLOB PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h*) + +add_library(${PROJECT_NAME} ${SOURCE} ${HEADERS} ${PRIVATE_HEADERS}) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)