mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Alexander Dahl <ada@thorsis.com>
Subject: Re: [ptxdist] [APPLIED] template: src-cmake-prog: Modernize CMake file
Date: Fri, 29 Jul 2022 08:23:44 +0200	[thread overview]
Message-ID: <20220729062344.2392798-1-m.olbrich@pengutronix.de> (raw)
In-Reply-To: <20220707091152.11519-1-ada@thorsis.com>

Thanks, applied as 7b0eaf35f9a01a047a345c3b053f663a3b838cf5.

Michael

[sent from post-receive hook]

On Fri, 29 Jul 2022 08:23:43 +0200, Alexander Dahl <ada@thorsis.com> wrote:
> Most things in that 'CMakeLists.txt' were out of date and/or
> distracting.  Rework towards a sane minimal modern version:
> 
> - bump minimum required CMake version (3.1 has most things you need for
> "Modern CMake", 3.0 lacks some useful things for that)
> - add recommended 'project' command
> - avoid source file globbing
> - throw out all comments (especially those relating to Qt4)
> 
> Additionally the source file which contained C code only, was renamed to
> .c so CMake can call a C compiler for that (instead of the heavy C++
> stuff).
> 
> Signed-off-by: Alexander Dahl <ada@thorsis.com>
> Message-Id: <20220707091152.11519-1-ada@thorsis.com>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> 
> diff --git a/rules/templates/src-cmake-prog/@name@.cpp b/rules/templates/src-cmake-prog/@name@.c
> similarity index 100%
> rename from rules/templates/src-cmake-prog/@name@.cpp
> rename to rules/templates/src-cmake-prog/@name@.c
> diff --git a/rules/templates/src-cmake-prog/CMakeLists.txt b/rules/templates/src-cmake-prog/CMakeLists.txt
> index bc81d861c721..8baf3f64ec0f 100644
> --- a/rules/templates/src-cmake-prog/CMakeLists.txt
> +++ b/rules/templates/src-cmake-prog/CMakeLists.txt
> @@ -1,34 +1,8 @@
> -
> -cmake_minimum_required(VERSION 2.6.0)
> -
> -#SET(QT_MIN_VERSION "4.5.0")
> -#FIND_PACKAGE(Qt4 REQUIRED)
> -
> -file (GLOB SRC_FILES *.cpp)
> -
> -#set (FILES_TO_TRANSLATE ${SRC_FILES})
> -#file (GLOB TRANSLATIONS_FILES *.ts)
> -#
> -#option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts
> -#files(WARNING: make clean will delete the source .ts files! Danger!)")
> -#
> -#if(UPDATE_TRANSLATIONS)
> -#  qt4_create_translation(QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES})
> -#else(UPDATE_TRANSLATIONS)
> -#  qt4_add_translation(QM_FILES ${TRANSLATIONS_FILES})
> -#endif(UPDATE_TRANSLATIONS)
> +cmake_minimum_required(VERSION 3.1)
> +project(@name@)
>  
>  add_executable(@name@
> -	${SRC_FILES}
> -#	${QM_FILES}
> +	@name@.c
>  )
>  
> -#target_link_libraries(@name@
> -#	${QT_QTCORE_LIBRARY}
> -#	${QT_QTGUI_LIBRARY}
> -#)
> -#
> -#include_directories(${QT_INCLUDE_DIR})
> -
>  install(TARGETS @name@ RUNTIME DESTINATION bin)
> -
> diff --git a/rules/templates/src-cmake-prog/wizard.sh b/rules/templates/src-cmake-prog/wizard.sh
> index 253eedca9cce..8f2903bf0f24 100644
> --- a/rules/templates/src-cmake-prog/wizard.sh
> +++ b/rules/templates/src-cmake-prog/wizard.sh
> @@ -7,11 +7,11 @@ if [ -z "$NAME" ]; then
>  fi
>  NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
>  
> -mv "@name@.cpp" "${NAME}.cpp"
> +mv "@name@.c" "${NAME}.c"
>  
>  for i in \
>  	CMakeLists.txt \
> -	"${NAME}.cpp" \
> +	"${NAME}.c" \
>  ; do
>  	sed -i -e "s/\@name\@/${NAME}/g" \
>  	       -e "s/\@NAME\@/${NAME_UP}/g" $i



      reply	other threads:[~2022-07-29  6:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07  9:11 [ptxdist] [PATCH] " Alexander Dahl
2022-07-29  6:23 ` Michael Olbrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220729062344.2392798-1-m.olbrich@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ada@thorsis.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox