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 <[email protected]> --- .../src-cmake-prog/{@[email protected] => @[email protected]} | 0 rules/templates/src-cmake-prog/CMakeLists.txt | 32 ++----------------- rules/templates/src-cmake-prog/wizard.sh | 4 +-- 3 files changed, 5 insertions(+), 31 deletions(-) rename rules/templates/src-cmake-prog/{@[email protected] => @[email protected]} (100%) diff --git a/rules/templates/src-cmake-prog/@[email protected] b/rules/templates/src-cmake-prog/@[email protected] similarity index 100% rename from rules/templates/src-cmake-prog/@[email protected] rename to rules/templates/src-cmake-prog/@[email protected] diff --git a/rules/templates/src-cmake-prog/CMakeLists.txt b/rules/templates/src-cmake-prog/CMakeLists.txt index bc81d861c..8baf3f64e 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} + @[email protected] ) -#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 253eedca9..8f2903bf0 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 "@[email protected]" "${NAME}.cpp" +mv "@[email protected]" "${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 base-commit: 7384b37919cb66e12ff15b4264325cb5eba911c3 -- 2.30.2
